원클릭으로
yaml
YAML & JSON Schema Conventions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
YAML & JSON Schema Conventions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| 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()