MCP HubMCP Hub
SKILL·F329FC

generative-recipe-dsl

pjt222
업데이트됨 3 days ago
26
3
26
GitHub에서 보기
메타wordtestingdesigndata

정보

이 스킬은 AI 에이전트가 코드 대신 검증된 JSON "레시피"를 출력하고, 단일 인터프리터가 이를 렌더링하는 생성형 레시피 DSL(도메인 특화 언어)을 만들기 위한 패턴을 제공합니다. 아이콘이나 배지와 같이 유사한 아티팩트가 많이 필요한 시나리오를 위해 설계되었으며, 항목별 맞춤형 코드 작성을 피하고 전체 코퍼스를 다양한 스타일로 저렴하게 재렌더링할 수 있도록 합니다. 주요 기능으로는 스타일-불가지론적 레시피, 검증 게이트, 수백 개의 생성된 항목 간 일관성을 유지하기 위한 규약이 포함됩니다.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/generative-recipe-dsl

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Build a Generative Recipe DSL

When many similar artifacts must be generated — icons, badges, diagram nodes, test fixtures — having each generator write bespoke code does not scale: N code paths to review, no uniform validation, no cheap re-render. A recipe DSL inverts this: generator agents emit small JSON documents (recipes), and ONE interpreter renders them all. The interpreter is the single audited code path; the recipes are pure data, gated by a validator before any item counts as done. The pattern is proven at corpus scale: in the originating trading-card glyph project, over a thousand agent-generated recipes render through one ~120-line interpreter in two completely different styles.

This skill is the complement of create-glyph: create-glyph hand-authors ONE glyph as R code with individual craft; generative-recipe-dsl builds the machinery for MANY agent-generated artifacts as data under one interpreter. Reach for create-glyph when a single artifact deserves bespoke attention; reach for this skill when a corpus is coming.

When to Use

  • A family of roughly 15 or more similar artifacts must be produced: icons for a skill domain, status badges for a service fleet, node pictograms for a diagram set, fixtures for a test matrix
  • Generator agents author the artifacts — small JSON documents can be machine-validated at corpus scale; N bespoke code files cannot be reviewed at corpus scale
  • The corpus must render in more than one style (print + screen, mono + color, light + dark), or a future restyle is plausible
  • Per-item bespoke code is already multiplying unreviewed code paths for artifacts that share one visual or structural grammar
  • Do NOT use for one-off or heterogeneous artifacts whose logic is genuinely unique — hand-author those (for icons, use create-glyph)

Inputs

  • Required: Artifact family and expected corpus size (what is being generated, how many now, how many later)
  • Required: At least two target render styles (e.g. mono engraving for print + flat color for screen) — two styles are what prove the role slots
  • Required: Host toolchain for interpreter and validator (e.g. R/ggplot2, Python/SVG, JavaScript/Canvas)
  • Optional: Existing bespoke implementations to mine for the primitive vocabulary
  • Optional: Batch driver for wave generation — the companion workflow batch-generate-waves

Procedure

Step 1: Decide — Recipe DSL or Bespoke Code

The DSL pays for itself only above a threshold number of artifacts. Decide explicitly before building anything.

  1. Count the artifacts: how many exist today, how many are expected over the corpus lifetime.

  2. Apply the threshold:

    Artifact countRecommendation
    1–3Bespoke code. A DSL costs more than it saves.
    ~4–15Gray zone. DSL if the artifacts share one shape grammar and more are expected; bespoke if each needs unique logic.
    15+Recipe DSL. Reviewing N code paths costs more than one ~120-line interpreter; validation and re-render become uniform.
  3. Check the override signals that favor a DSL regardless of count:

    • The generators are agents — emitted data can be gated mechanically; emitted code cannot
    • More than one render style is needed now, or a restyle is plausible later
    • The whole corpus must stay cheaply re-renderable (style tweaks touch one file, not N)
    • Shared conventions must hold corpus-wide (see Step 6)
  4. Check the counter-signals: each item genuinely needs unique logic, there is no common primitive vocabulary, or the corpus will never grow. If these dominate, stop here and write bespoke code.

Expected: A written go/no-go decision naming the artifact count, the styles, and which signals tipped it.

On failure: If the decision is unclear, prototype 2–3 artifacts both ways. If the bespoke versions share most of their structure and differ only in data-like parameters, the DSL is viable — that shared structure IS the interpreter.

Step 2: Design the Recipe Schema

A recipe is data, not code: a small JSON document an agent can emit in one shot and a validator can check mechanically. The proven shape is primitives × roles × modifier flags.

  1. Enumerate the shape primitives from your prototypes. Keep the set small — the reference implementation shipped with 7 (polygon, ngon, circle, star, arc, zigzag, rect), grew to 8 only when spiral was added centrally after launch, and covered a corpus of over a thousand recipes.
  2. Fix a local coordinate frame with a soft convention and a hard limit the validator enforces (reference: content within ±36 units, hard limit ±45, +y is up).
  3. Add cheap-leverage modifiers. The highest-value one is bilateral symmetry: a top-level "symmetry": "bilateral" flag duplicates every layer marked "mirror": true x-negated — half of a symmetric artifact's points come for free.
  4. Include a free-text _intent field the interpreter ignores: one line stating what the recipe depicts, for human audits and reviewer diffs.
{
  "_intent": "one-line human note: what this artifact depicts",
  "symmetry": "bilateral",
  "layers": [
    {"shape": "rect", "x0": -30, "y0": -20, "x1": 30, "y1": 20, "role": "ground"},
    {"shape": "circle", "cx": 22, "cy": 13, "r": 4, "role": "spark"},
    {"shape": "arc", "cx": 0, "cy": 0, "r": 31, "from": 42, "to": 78, "role": "line", "mirror": true}
  ]
}

Expected: A schema document (one page, kept next to the recipes) listing every primitive with its parameters, the coordinate frame, the modifiers, and the roles from Step 3.

On failure: If prototypes keep demanding new primitives, the family may be too heterogeneous for one DSL — split into two schemas, or return to Step 1. If one primitive is repeatedly requested by generators (the reference implementation added spiral this way), add it centrally through code review, never per-item.

Step 3: Design Roles as Style Slots

Roles are the load-bearing design decision. A role names the layer's FUNCTION in the composition — never its appearance. Each output style then maps every role to concrete aesthetics, so one recipe renders in every style unchanged. The reference implementation renders the same JSON as a mono engraving (ink, paper, hatching) and as flat 8-bit color from exactly this indirection.

  1. Define roles by compositional function. The proven six-slot vocabulary:

    RoleFunction in the compositionMono engraving styleColor style
    groundlarge backdrop masspaper fill + ink outline + 45° hatchbase fill + frame outline
    massprimary solid bodysolid inkbody fill + frame outline
    accentsecondary textured regionpaper fill + ink outline + 135° hatchhighlight fill + frame outline
    sparksmall highlight markssolid inksignal fill, no outline
    detailcutout on a solid (eyes, keyholes)solid papersignal fill, no outline
    linestroked path, no fillsoft ink pathhighlight path

    How a style separates two roles is the style's choice, not the schema's: the mono column shows the reference mapping (accent hatches at 135° vs ground's 45°), while the worked badge example in references/EXAMPLES.md separates accent from ground by tighter hatch spacing at the same angle. Both are valid slot mappings — the distinction lives in the style, never in a recipe.

  2. Apply the litmus test: propose a hypothetical third style (say, blueprint linework). If every role maps cleanly to new aesthetics without touching any recipe, the slots are functional. If a role only makes sense in one style, it is an appearance name in disguise — rename it by function.

  3. Encode substrate interactions as conventions, not new roles: e.g. spark marks read on hatched/ground bodies; detail cutouts read on solid mass bodies. Pick the mark's role for the body under it.

Expected: A role table mapping each role to concrete aesthetics in EVERY target style; the third-style litmus test passes on paper.

On failure: If two roles map identically in all styles, merge them. If a needed look has no role, first try composing existing roles (outline + hatch = two layers) before adding a seventh slot.

Step 4: Write the Interpreter — One Audited Code Path

The interpreter compiles a recipe into render layers. It is the ONLY code that turns recipes into artifacts — audit it once, and every generated item inherits the audit.

  1. Structure it as three small functions plus a loader (the verified reference is ~120 lines total):
# geometry: layer spec -> points; unknown shape is a HARD error, never skipped
badge_layer_geometry <- function(layer) {
  if (layer$shape == "circle") return(poly_regular(layer$cx, layer$cy, layer$r, 48))
  # ... one branch per primitive ...
  stop("dsl: unknown shape '", layer$shape, "'", call. = FALSE)
}

# style slots: (geometry, role, style) -> drawable layers; unknown role is a HARD error
badge_role_layers <- function(geometry, layer, style) { ... }

# compile: recipe -> function(cx, cy, s, style), applying symmetry + placement
badge_from_spec <- function(recipe) { ... }
  1. Enforce vocabulary hard: unknown shape or role must stop(), never fall through to a default — silent fallbacks let malformed recipes pass the gate.
  2. Keep it deterministic: no RNG, no time dependence. The same recipe must render byte-identically on every run, or corpus-wide re-renders produce untrackable diffs.
  3. Freeze the contract: generator agents may never edit the interpreter. Primitive additions go through normal code review as central changes.

See references/EXAMPLES.md for a complete, empirically verified ~170-line interpreter in a non-icon domain (service status badges).

Expected: The interpreter compiles hand-written test recipes into layers in every style; a recipe with an unknown shape or role raises a hard error.

On failure: If the interpreter is growing past ~250 lines, per-item logic is leaking in — push variation back into recipe data or drop a primitive. If styles disagree on layer counts, a role branch is emitting different structure per style; roles must vary aesthetics only.

Step 5: Write the Validator Gate

The validator is what makes agent-authored data trustworthy: no recipe counts as done until it passes. It must end in a REAL render — compile-only checks pass recipes that crash the renderer.

  1. Implement the checks in order, per recipe × per style:
    1. Parses — strict JSON, no recovery
    2. Structural floor — e.g. at least 2 layers
    3. Compiles — the interpreter accepts every layer (this catches unknown shapes/roles)
    4. Bounds — all geometry within the hard coordinate limit
    5. Real render — write an actual output file in EVERY style; assert plausible file size
  2. Exit nonzero on any failure and print one PASS/FAIL line per recipe — the gate must be usable by agents and CI alike.
  3. Add a --fast mode that runs checks 1–4 and skips the render. Rendering is the slow O(N) step: in the reference implementation --fast sweeps a ~1,200-recipe corpus in ~100 seconds where per-item rendering would time out.
  4. Fix the usage pattern: full mode gates every new batch; --fast is for corpus-wide sweeps (completion checks, CI on the whole tree) — never the only gate a new recipe sees.
Rscript validate_badges.R message-queue auth-gateway   # named recipes, full gate
Rscript validate_badges.R                              # all recipes, full gate
Rscript validate_badges.R --fast                       # whole corpus: compile + bounds only

Expected: Valid recipes print PASS in both modes; a deliberately broken recipe (unknown role, out-of-bounds point) prints FAIL and the process exits 1.

On failure: If the full gate is too slow even per-batch, render to a throwaway raster at reduced size — but keep a real render. If the validator and interpreter disagree (validator passes what the renderer rejects), the validator is re-implementing rules instead of calling the interpreter; make it call the same compile path.

Step 6: Hand-Author Seed Recipes and Name the Conventions

Seed recipes are the corpus's style anchor. Once the interpreter plus a few seeds exist, conventions hold across hundreds of generated items without per-item steering — the DSL constrains agents into consistency.

  1. Hand-author 3–8 seed recipes that together exercise every primitive and every role, and pass the full gate.
  2. Start a conventions document next to the recipes. Conventions observed to emerge and hold corpus-wide in the reference implementation:
    • Family motifs: related items share ONE motif elaborated across variants (an evolution line elaborating the same shape; a service family sharing an envelope motif)
    • Owner/variant marks: variants of a base item carry a small shared spark mark and dodge the base item's gesture, so variant ≠ base at a glance
    • Substrate rules: which mark role reads on which body role (Step 3.3)
    • Orientation rules: +y is up; a recipe built y-down still validates but renders upside down — the gate cannot catch it
  3. Feed the schema doc, the seeds, and the conventions into every generator prompt.

Expected: All seeds pass the full gate; the conventions document exists and is referenced by the generator prompt.

On failure: If seeds look inconsistent with each other, fix that before generating — agents amplify whatever the seeds do, including their inconsistencies.

Step 7: Generate at Scale

Generator agents emit one recipe per item and gate themselves before returning.

  1. Fix the agent contract: read the schema doc + seeds + conventions; emit recipes/<slug>.json per assigned item; run the FULL validator on your own batch; only validated recipes count as done.
  2. Derive filenames from one canonical slug function (a single source of truth shared by generators and coverage checks) — ad-hoc slugging orphans items silently.
  3. For corpus-scale runs, drive waves with the companion workflow batch-generate-waves (scout the remaining pool → generate a wave, validator-gated → audit). Because recipes land on disk before a wave returns, an interrupted wave loses nothing: validate, commit the survivors, and the next scout pass skips them.
  4. Keep the bespoke escape hatch: individually crafted artifacts remain allowed alongside recipes, with a fixed precedence rule (reference: bespoke wins over a recipe of the same name).

Expected: Waves of validated recipes accumulating in recipes/, each wave passing the full gate before merge.

On failure: If an agent's recipes fail the gate repeatedly, its prompt is missing the schema doc or conventions — do not patch the interpreter to accept them. If the scout under-enumerates the remaining pool (observed at low remaining counts), pre-compute the missing list with the slug function and pass it to the wave explicitly.

Step 8: Audit the Corpus

The validator proves renderable, not recognizable. Close the loop with human/agent judgment over real renders.

  1. Render proof sheets (paged contact sheets of the whole corpus) in each style.
  2. Judge recognizability against each item's _intent and the conventions (orientation, family motifs, variant marks).
  3. Track weak items in a backlog file (validates + renders but reads generic) rather than blocking the corpus; schedule a redraw pass.
  4. Run a coverage/drift check whenever the item pool changes: every pool item's canonical slug must resolve to exactly one recipe or bespoke artifact; report misses and orphans.

Expected: Proof sheets reviewed in every style; coverage check reports zero missing and zero orphaned items; weak-item backlog exists.

On failure: If many items read generic, the primitive set or seed diversity is too thin — improve the seeds and conventions, then redraw the weak tail; do not hand-tune the interpreter for single items.

Validation

  • Go/no-go decision from Step 1 is recorded, with artifact count and style targets
  • Schema document exists next to the recipes: primitives + parameters, coordinate frame, modifiers, roles
  • Every role maps to concrete aesthetics in EVERY target style; the third-style litmus test passes
  • One interpreter is the only render path; unknown shape or role raises a hard error (test with a deliberately broken recipe)
  • Validator gate runs compile + bounds + real render in all styles and exits nonzero on any failure
  • --fast mode (compile + bounds only) sweeps the full corpus within CI-tolerable time
  • 3+ hand-authored seed recipes pass the full gate and exercise every role
  • Conventions document exists and is included in generator prompts
  • Coverage check: every pool item resolves to exactly one recipe or bespoke artifact

Common Pitfalls

  • Roles named by appearance: red_fill or hatched instead of spark or accent breaks every recipe the moment a second style arrives. Name roles by compositional function; let each style map function to look.
  • Validator without a real render: compile + bounds proves a recipe is well-formed, not that it renders — device errors, degenerate geometry, and style-mapping bugs only surface in a real render. Keep --fast for corpus sweeps; gate every new batch in full mode.
  • Trusting PASS for recognizability: an upside-down or unrecognizable recipe validates fine. The gate checks mechanics; proof-sheet audits check meaning. Budget for both.
  • Interpreter creep: generator agents "helpfully" extending the interpreter destroys the single-audited-code-path property. Freeze it; route primitive requests through central code review (the reference added exactly one primitive this way, after it became the most-requested shape across waves).
  • One-off schema extensions: a per-item parameter added for one recipe becomes unvalidated dead weight. Express the need with existing primitives, or extend the schema centrally with validator support.
  • ID/filename drift: recipes named by ad-hoc slugging silently orphan items from their pool entries. Use one canonical slug function as the single source of truth and run the coverage check after any pool change.

Related Skills

  • create-glyph — the complement: ONE hand-authored glyph with individual craft, where this skill generates MANY recipes under one interpreter
  • enhance-glyph — the polish pass for individual items flagged weak in the Step 8 audit
  • dream — the generative front end: unconstrained exploration produces the concept a recipe then encodes (a dream becomes a recipe becomes a picture)
  • stale-proof-rendered-numbers — the sibling data-not-code pattern for rendered figures: numbers substituted from measured data, with the build failing on missing keys
  • Companion workflow: batch-generate-waves — the resumable scout → generate → audit batch driver for which this skill defines the canonical per-item generator

GitHub 저장소

pjt222/agent-almanac
경로: i18n/ja/skills/generative-recipe-dsl
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams
FAQ

Frequently asked questions

What is the generative-recipe-dsl skill?

generative-recipe-dsl is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform generative-recipe-dsl-related tasks without extra prompting.

How do I install generative-recipe-dsl?

Use the install commands on this page: add generative-recipe-dsl to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.

What category does generative-recipe-dsl belong to?

generative-recipe-dsl is in the Meta category, tagged word, testing, design and data.

Is generative-recipe-dsl free to use?

Yes. generative-recipe-dsl is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.

연관 스킬

content-collections
메타

이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.

스킬 보기
polymarket
메타

이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.

스킬 보기
creating-opencode-plugins
메타

이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.

스킬 보기
sglang
메타

SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.

스킬 보기