Main Site ↗

yaml-config

by benchflow-ai890173GitHub

Use this skill when reading or writing YAML configuration files, loading vehicle parameters, or handling config file parsing with proper error handling.

Unlock Deep Analysis

Use AI to visualize the workflow and generate a realistic output preview for this skill.

Powered by Fastest LLM

Development
Compatible Agents
Claude Code
Claude Code
~/.claude/skills/
Codex CLI
Codex CLI
~/.codex/skills/
Gemini CLI
Gemini CLI
~/.gemini/skills/
O
OpenCode
~/.opencode/skills/
O
OpenClaw
~/.openclaw/skills/
GitHub Copilot
GitHub Copilot
~/.copilot/skills/
Cursor
Cursor
~/.cursor/skills/
W
Windsurf
~/.codeium/windsurf/skills/
C
Cline
~/.cline/skills/
R
Roo Code
~/.roo/skills/
K
Kiro
~/.kiro/skills/
J
Junie
~/.junie/skills/
A
Augment Code
~/.augment/skills/
W
Warp
~/.warp/skills/
G
Goose
~/.config/goose/skills/
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 order
  • allow_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

Source: https://github.com/benchflow-ai/SkillsBench#tasks-adaptive-cruise-control-environment-skills-yaml-config

Content curated from original sources, copyright belongs to authors

Grade B
-AI Score
Best Practices
Checking...
Try this Skill

User Rating

USER RATING

0UP
0DOWN
Loading files...

WORKS WITH

Claude Code
Claude
Codex CLI
Codex
Gemini CLI
Gemini
O
OpenCode
O
OpenClaw
GitHub Copilot
Copilot
Cursor
Cursor
W
Windsurf
C
Cline
R
Roo
K
Kiro
J
Junie
A
Augment
W
Warp
G
Goose