yaml-config
Use this skill when reading or writing YAML configuration files, loading vehicle parameters, or handling config file parsing with proper error handling.
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-03
- Stars
- ★ 127
- Forks
- 24
01 前言 Front Matter
- name
- yaml-config
- description
- Use this skill when reading or writing YAML configuration files, loading vehicle parameters, or handling config file parsing with proper error handling.
03 SKILL.md 正文
YAML Configuration Files
Reading YAML
Always use safe_load to prevent code execution vulnerabilities:
import yaml
with open('config.yaml', 'r') as f:
config = yaml.safe_load(f)
# Access nested values
value = config['section']['key']
Writing YAML
import yaml
data = {
'settings': {
'param1': 1.5,
'param2': 0.1
}
}
with open('output.yaml', 'w') as f:
yaml.dump(data, f, default_flow_style=False, sort_keys=False)
Options
default_flow_style=False: Use block style (readable)sort_keys=False: Preserve insertion orderallow_unicode=True: Support unicode characters
Error Handling
import yaml
try:
with open('config.yaml', 'r') as f:
config = yaml.safe_load(f)
except FileNotFoundError:
config = {} # Use defaults
except yaml.YAMLError as e:
print(f"YAML parse error: {e}")
config = {}
Optional Config Loading
import os
import yaml
def load_config(filepath, defaults=None):
"""Load config file, return defaults if missing."""
if defaults is None:
defaults = {}
if not os.path.exists(filepath):
return defaults
with open(filepath, 'r') as f:
loaded = yaml.safe_load(f) or {}
# Merge loaded values over defaults
result = defaults.copy()
result.update(loaded)
return result
04 同仓库更多 Skills
data-reconciliation
暂无简介
hierarchical-taxonomy-clustering
Build unified multi-level category taxonomy from hierarchical product category paths from any e-commerce companies using embedding-based recursive clustering with intelligent category naming via weighted word frequency analysis.
nlp-research-repo-package-installment
Align Python version and repo-declared dependencies (requirements.txt / environment.yml) before installing packages for NLP research code reproduction.
state-space-linearization
Linearizing nonlinear dynamics around operating points for control design.
mpc-horizon-tuning
Selecting MPC prediction horizon and cost matrices for web handling.
integral-action-design
Adding integral action to MPC for offset-free tension tracking.