Agent skill
yaml-configuration-loading-yaml-in-python
Sub-skill of yaml-configuration: Loading YAML in Python (+3).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/data/scientific/yaml-configuration/loading-yaml-in-python
SKILL.md
Loading YAML in Python (+3)
Loading YAML in Python
import yaml
from pathlib import Path
def load_config(config_file: str) -> dict:
"""Load YAML configuration file."""
with open(config_file, 'r') as f:
config = yaml.safe_load(f)
return config
*See sub-skills for full details.*
## Writing YAML from Python
```python
import yaml
def save_config(config: dict, output_file: str):
"""Save configuration to YAML file."""
with open(output_file, 'w') as f:
yaml.dump(config, f, default_flow_style=False, sort_keys=False)
# Create configuration
config = {
*See sub-skills for full details.*
## Validation
```python
import yaml
from jsonschema import validate, ValidationError
def validate_config(config_file: str, schema_file: str) -> bool:
"""Validate YAML against JSON schema."""
with open(config_file) as f:
config = yaml.safe_load(f)
with open(schema_file) as f:
*See sub-skills for full details.*
## Merging Configs
```python
def merge_configs(base_config: dict, override_config: dict) -> dict:
"""Deep merge two configuration dictionaries."""
import copy
result = copy.deepcopy(base_config)
for key, value in override_config.items():
if key in result and isinstance(result[key], dict) and isinstance(value, dict):
result[key] = merge_configs(result[key], value)
*See sub-skills for full details.*
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?