mit einem Klick
yaml
YAML & JSON Schema Conventions
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Menü
YAML & JSON Schema Conventions
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Basierend auf der SOC-Berufsklassifikation
| name | yaml |
| description | YAML & JSON Schema Conventions |
Generic skill — This skill is project-agnostic. Do not add project-specific references, paths, or terminology here.
Consult this when reading, writing, or modifying any YAML or JSON files in a project.
Never use raw yaml.safe_load() / yaml.dump() directly in application code. Instead:
BaseModel that matches the YAML structuremodel.model_validate(yaml.safe_load(path)) — gives type-safe attribute access and catches schema violations immediatelyyaml.dump(model.model_dump(exclude_none=True), ...) — produces clean YAML without None clutterWrap these in load_* / save_* helper functions so callers never touch raw dicts.
When saving YAML, prepend a schema tag so VS Code (with the YAML extension) provides autocompletion and validation:
# yaml-language-server: $schema=../../schemas/my_format.json
Use a relative path from the YAML file to the JSON Schema file. Save helpers should add this automatically.
Another approach is to publish schemas as GitHub Release artifacts and reference via absolute URL. (TODO: add details for ibek projects)
Generate JSON Schema files from Pydantic models using model.model_json_schema():
import json
schema = MyModel.model_json_schema()
Path("schemas/my_format.json").write_text(json.dumps(schema, indent=2) + "\n")
Commit generated schemas to the repo so VS Code picks them up without running code. Add a test that compares committed schemas against model_json_schema() output to catch staleness.
Literal["a", "b"] for enum-like string fields — catches typos at validation timemodel_config = ConfigDict(extra="allow") only for formats with user-defined fields; keep all others strictexclude_none=True when dumping so optional fields don't clutter YAML with null entriesbool | None flags, use None as the default (not False) so absent flags are omitted from output@dataclass for structures that are serialized to/from YAMLload_* / save_* helpers (with schema tag injection)model_json_schema()