agentleFS
kirkchenkirkchen/beat/skills/distill/SKILL.md

distill

Skill9 starsChanged 7 months agoMITView on GitHub

Use when extracting BDD specs from existing code — for adopting Beat in an established codebase or distilling a module into feature files

75 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use layout, shape and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • owshq-mecSkill

    layout

    Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy. Use when the user mentions layout feeling off, spacing issues, visual hierarchy, crowded UI, alignment problems, or wanting better composition.

    Also in 8 projects that use this

  • HAR5HA-7663Skill

    shape

    Plan the UX and UI for a feature before writing code. Runs a structured discovery interview, then produces a design brief that guides implementation. Use during the planning phase to establish design direction, constraints, and strategy before any code is written.

    Also in 11 projects that use this

  • klauswgSkill

    ckm:design-system

    Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing/typography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.

    Also in 3 projects that use this

  • iovisorSkill

    evolve

    Evolve uBPF through a gated spec-first workflow that propagates approved changes through requirements, design, validation, implementation, and RFC alignment artifacts.

    Also in 3 projects that use this

  • termdockSkill

    recall

    Retrieves cross-session memories about past decisions, lessons, and patterns. Use when user asks about prior work, past decisions, or mentions a feature. Triggers include check memory, what did we decide, how did we solve.

    Also in 5 projects that use this

  • bidodevSkill

    devils-advocate

    Challenges decisions, plans, and code by systematically arguing the opposing side. Surfaces risks, pokes holes in assumptions, and stress-tests thinking before committing. Supports intensity levels (gentle, balanced, ruthless, linus) and works with conversation context or a specific file reference. Trigger on requests like "challenge this", "poke holes", "what could go wrong", "play devil's advocate", "linus mode", or "/devils-advocate".

    Also in 3 projects that use this

  • Other versions75 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 75

    1. talesofai/cohub★ 585same name
    2. juxt/allium★ 506same name
    3. educlopez/ui-craft★ 441same name
    4. Michaelliv/napkin★ 428same name
    5. nexmoe/DayBee★ 424same name
    6. nexmoe/eve★ 424same name
    7. Southclaws/storyden★ 348same name
    8. 10xChengTu/Mux0★ 337same name
    9. theexperiencecompany/gaia★ 325same name
    10. AkaraChen/aghub★ 271same name

    65 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

30 rules. 0 are common, 16 are distinctive, and 14 are very specific to this project.

  • 0

    Common

    Most of the 71 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this to bring existing codebases into the Beat workflow.

    line 8
  2. Distinctive:

    Should NOT trigger: "design a new feature" / "write specs for something we want to build" / "explore this idea"

    line 25
  3. Distinctive:

    Before writing any artifact files: you MUST invoke superpowers:using-git-worktrees.

    line 30
  4. Very specific:

    Before writing feature files: you MUST run the glossary check (see step 6) and ensure every project-specific term used in scenarios is …

    line 34
  5. Distinctive:

    Create the glossary lazily — only when the first term is added.

    line 37
  6. Distinctive:

    After writing each artifact: you MUST run the four-check spec self-review (placeholder / consistency / scope / ambiguity).

    line 39
  7. Distinctive:

    If a prerequisite skill is unavailable (not installed), continue with fallback — but NEVER skip because you judged it unnecessary.

    line 48
  8. Distinctive:

    If a superpower is unavailable (skill not installed), skip and continue.

    line 60
  9. Distinctive:

    If not specified, use AskUserQuestion tool:

    line 133
  10. Distinctive:

    Read the specified code. Map out:

    line 142
  11. Very specific:

    Read Feature: and Scenario: lines to map existing coverage

    line 151
  12. Distinctive:

    If the scope is entirely covered: inform user and STOP

    line 154
  13. Very specific:

    Create beat/changes/distill-<scope-name>/ with status.yaml (schema: references/status-schema.md):

    line 158
  14. Very specific:

    Read beat/config.yaml if it exists (schema: references/config-schema.md).

    line 177
  15. Very specific:

    Read GLOSSARY.md if it exists (schema: references/context-format.md).

    line 181
  16. Very specific:

    Every project-specific term used in scenarios MUST exist in GLOSSARY.md before the scenario is written.

    line 190
  17. Very specific:

    Read references/feature-writing.md for conventions on description blocks, scenario organization, and review checklist

    line 193
  18. Distinctive:

    Write feature files describing CURRENT behavior (not desired behavior)

    line 194
  19. Very specific:

    Use tags: @distilled (always), plus @happy-path, @error-handling, @edge-case

    line 196
  20. Very specific:

    Every scenario MUST have a testing layer tag (@e2e or @behavior, default @behavior)

    line 197
  21. Distinctive:

    If behavior is ambiguous, note it as uncertain rather than guessing

    line 198
  22. Distinctive:

    If the purpose is clear from code/docs: write a brief "why this exists" proposal

    line 201
  23. Very specific:

    If you choose not to write it: set proposal: { status: skipped } in status.yaml — never leave it pending (archive warns on pending …

    line 203
  24. Distinctive:

    Document the current technical architecture and key decisions visible in the code

    line 206
  25. Very specific:

    If you choose not to write design.md: set design: { status: skipped } in status.yaml — never leave it pending

    line 214
  26. Very specific:

    Update status.yaml for each artifact created, and mark optional artifacts you chose not to create as skipped.

    line 227
  27. Very specific:

    Run node <skill-dir>/scripts/lint-features.mjs beat/changes/<name>/features/*.feature and node <skill-dir>/scripts/validate-beat.mjs --file …

    line 235
  28. Distinctive:

    Commit the change directory and every living-documentation file this run wrote or modified — they are one unit of work:

    line 237
  29. Distinctive:

    Use a descriptive message: "distill(<scope>): extract BDD specs from existing code"

    line 251
  30. Distinctive:

    All generated feature files (summary of scenarios per feature)

    line 256

“Common” is measured: kept by at least 6 in 10 of the 71 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Distill — reverse-engineer Gherkin feature files from existing code.

Use this to bring existing codebases into the Beat workflow. The output is draft .feature files that describe current behavior (not aspirational), verified independently by /beat:verify.

<decision_boundary>

Use for:

  • Extracting BDD specs from an existing codebase that doesn't have feature files yet
  • Bringing a module, directory, or functionality into the Beat workflow retroactively
  • Generating draft .feature files that describe what the code currently does

NOT for:

  • Designing new behavior or features (use /beat:design)
  • Writing aspirational specs for code that doesn't exist yet (use /beat:design)
  • Greenfield projects with no existing code to distill
  • Exploring ideas or thinking through a problem (use /beat:explore)

Trigger examples:

  • "Distill the auth module into feature files" / "Extract specs from existing code" / "Bring this codebase into Beat"
  • Should NOT trigger: "design a new feature" / "write specs for something we want to build" / "explore this idea"

</decision_boundary>

<HARD-GATE> Before writing any artifact files: you MUST invoke superpowers:using-git-worktrees. Distilled artifacts live in a change container that flows through verify → archive. Worktree isolation ensures they don't contaminate the main workspace.

Before writing feature files: you MUST run the glossary check (see step 6) and ensure every project-specific term used in scenarios is defined in GLOSSARY.md at the project root (path: references/project-layout.md). Create the glossary lazily — only when the first term is added.

After writing each artifact: you MUST run the four-check spec self-review (placeholder / consistency / scope / ambiguity). Fix issues inline.

While writing design.md: you MUST run the three-condition ADR gate (hard-to-reverse + surprising + real trade-off — see references/adr-format.md) on each Key Decision recovered from the code. When all three hold, offer to lift it into docs/adr/. The user may decline. NEVER invent rationale the code doesn't show — mark it unverified or ask the user.

If a prerequisite skill is unavailable (not installed), continue with fallback — but NEVER skip because you judged it unnecessary. If the user explicitly asks to skip the worktree, say that the change container will be written and committed on the current branch, confirm once, then proceed there — never imply an isolation you don't have. </HARD-GATE>

Prerequisites (invoke before proceeding)

SuperpowerWhenPriority
using-git-worktreesBefore first file writeMUST

If a superpower is unavailable (skill not installed), skip and continue.

Rationalization Prevention

ThoughtReality
"I don't need a worktree for just writing feature files"Distilled artifacts flow through verify and archive. Without isolation, they won't carry forward correctly.
"The user said no worktree, so I'll just not mention it"Honour it — after saying where the files land and that the commit goes on the current branch. The failure is the silent skip, not the skip.
"The code is simple, I can verify the scenarios myself"Self-verification of distilled specs is explicitly forbidden. Always use /beat:verify for independent accuracy checking.
"I'll skip scanning existing features, this is a new area"Existing features may already cover this behavior. Distilling duplicates creates maintenance burden.
"These scenarios are obviously correct, verification is overkill"Distill extracts specs from code — the most likely error is describing aspirational behavior instead of current behavior. Verification catches this.
"I'll commit later, let me just generate the files first"Uncommitted artifacts can be lost. Commit before presenting to the user, matching design's behavior.
"The terms are already in the code, no need for a glossary"Code shows usage, not meaning. Distill is the moment an established codebase gets its glossary — entries are two lines, add them inline.
"I can't know why this decision was made, so no ADR"You can't invent the why, but you can record the what and ask. Run the gate; mark unverified rationale as unverified instead of skipping.
"Spec self-review is overkill, the scenarios came straight from code"Reading code ≠ describing it accurately. The four checks catch placeholders, contradictions, and ambiguities in 30 seconds.

Red Flags — STOP if you catch yourself:

  • Writing any file before invoking using-git-worktrees
  • Writing scenarios that describe desired behavior instead of current behavior
  • Skipping the existing feature scan
  • Claiming verification passed without running /beat:verify
  • Finishing without committing artifacts
  • Writing Gherkin scenarios that contain internal method names, numeric thresholds, or implementation constants
  • Writing scenarios that use project-specific domain terms not defined in GLOSSARY.md
  • Writing a Key Decision in design.md without running the three-condition ADR gate
  • Inventing rationale for a recovered decision instead of marking it unverified or asking
  • Skipping the spec self-review because the scenarios "came straight from the code"
  • Telling the user to run /beat:plan or /beat:apply on the distill change itself (there is nothing to implement)
  • Thinking "I know the code well enough to skip verification"

Process Flow

digraph distill {
    "Ask for scope" [shape=box];
    "Invoke using-git-worktrees" [shape=box, style=bold];
    "Read and understand code" [shape=box];
    "Scan existing features" [shape=box];
    "Scope already covered?" [shape=diamond];
    "STOP: inform user" [shape=box, style=dashed];
    "Create change container" [shape=box];
    "Glossary check\n(terms → GLOSSARY.md)" [shape=box, style=bold];
    "Generate draft artifacts\n(self-review each)" [shape=box];
    "design.md included?" [shape=diamond];
    "ADR gate\n(design.md Key Decisions)" [shape=box, style=bold];
    "Offer module README\n(Layer 3, optional)" [shape=box];
    "Commit artifacts" [shape=box];
    "Present to user" [shape=doublecircle];

    "Ask for scope" -> "Invoke using-git-worktrees";
    "Invoke using-git-worktrees" -> "Read and understand code";
    "Read and understand code" -> "Scan existing features";
    "Scan existing features" -> "Scope already covered?";
    "Scope already covered?" -> "STOP: inform user" [label="yes"];
    "Scope already covered?" -> "Create change container" [label="no"];
    "Create change container" -> "Glossary check\n(terms → GLOSSARY.md)";
    "Glossary check\n(terms → GLOSSARY.md)" -> "Generate draft artifacts\n(self-review each)";
    "Generate draft artifacts\n(self-review each)" -> "design.md included?";
    "design.md included?" -> "ADR gate\n(design.md Key Decisions)" [label="yes"];
    "design.md included?" -> "Offer module README\n(Layer 3, optional)" [label="no"];
    "ADR gate\n(design.md Key Decisions)" -> "Offer module README\n(Layer 3, optional)";
    "Offer module README\n(Layer 3, optional)" -> "Commit artifacts";
    "Commit artifacts" -> "Present to user";
}

Input: User specifies the code scope to distill (module, directory, or functionality).

Steps

  1. Ask for scope

    If not specified, use AskUserQuestion tool:

    "What code do you want to distill into BDD specs? Specify a module, directory, or describe the functionality."

  2. Ensure worktree isolation

    Invoke using-git-worktrees before reading or writing any files.

  3. Read and understand the code

    Read the specified code. Map out:

    • User-visible behaviors (functionality)
    • Edge cases handled
    • Error conditions
    • Existing tests (if any) that reveal behavior
  4. Scan existing features

    Scan beat/features/**/*.feature and beat/changes/*/features/*.feature (excluding archive):

    • Read Feature: and Scenario: lines to map existing coverage
    • Deep-read only features that overlap with the distill scope
    • Note which behaviors are already covered — do NOT distill duplicates
    • If the scope is entirely covered: inform user and STOP
  5. Create a change container

    Create beat/changes/distill-<scope-name>/ with status.yaml (schema: references/status-schema.md):

    name: distill-<scope-name>
    created: YYYY-MM-DD
    phase: new
    source: distill
    pipeline:
      proposal: { status: pending }
      gherkin: { status: pending }
      design: { status: pending }
      tasks: { status: skipped }

    tasks is skipped because a distill change describes current behavior — there is nothing to implement. Future changes to this area get their own change containers via the normal /beat:design → /beat:plan → /beat:apply flow.

  6. Generate draft artifacts

    Read beat/config.yaml if it exists (schema: references/config-schema.md). Use language for artifact output language, inject context as project background, and apply matching rules per artifact type (e.g., rules.gherkin, rules.proposal, rules.design).

    Glossary check (Layer 1) — before writing feature files:

    Read GLOSSARY.md if it exists (schema: references/context-format.md). Create it lazily when the first term is added — never preemptively.

    Distill is often the first time an established codebase builds its glossary, and the code itself is the source. For each project-specific term that will appear in scenarios, adapt the four challenges from references/context-format.md and update GLOSSARY.md inline as terms resolve (never batch). Insert each entry where "Where a new entry goes" in references/context-format.md says — inside its ## <group> section (or ## Language), never appended after ## Flagged ambiguities; when creating the file, write the full skeleton first:

    1. Against the glossary — the term conflicts with an existing entry? Surface, resolve, update.
    2. Sharpen fuzzy — the code uses synonyms for one concept (e.g. user/account/member for the same entity)? Pick the canonical word, list the others as _Avoid_.
    3. Stress-test against code — probe term boundaries with the edge cases the code actually handles; name the boundary.
    4. Cross-reference docs — README/comments/docs use a term differently from the code? Surface it and ask the user which is canonical.

    Every project-specific term used in scenarios MUST exist in GLOSSARY.md before the scenario is written. Bold terms in scenarios are the canonical form (see references/feature-writing.md). If a term's meaning is genuinely uncertain from code alone, ask the user rather than guessing.

    features/*.feature (mandatory):

    • Read references/feature-writing.md for conventions on description blocks, scenario organization, and review checklist
    • Write feature files describing CURRENT behavior (not desired behavior)
    • Each scenario must accurately reflect what the code actually does
    • Use tags: @distilled (always), plus @happy-path, @error-handling, @edge-case
    • Every scenario MUST have a testing layer tag (@e2e or @behavior, default @behavior)
    • If behavior is ambiguous, note it as uncertain rather than guessing

    proposal.md (optional):

    • If the purpose is clear from code/docs: write a brief "why this exists" proposal
    • Sections: ## Why, ## What Changes, ## Impact
    • If you choose not to write it: set proposal: { status: skipped } in status.yaml — never leave it pending (archive warns on pending artifacts)

    design.md (optional):

    • Document the current technical architecture and key decisions visible in the code
    • Sections: ## Approach, ## Key Decisions, ## Components
    • ADR gate — for each Key Decision recovered from the code, run the three-condition check from references/adr-format.md:
      1. Hard to reverse?
      2. Surprising without context?
      3. Result of a real trade-off? Recovered decisions are prime candidates — "surprising without context" is exactly what code archaeology surfaces. Caveat: the code shows what was decided, not why. Take rationale from evidence (commit history, comments, docs) or from the user; if neither is available, record the decision with rationale marked unverified (e.g. "Rationale unconfirmed — recovered from code"). Never invent a why. If all three hold, use AskUserQuestion tool: "This recovered decision meets the ADR gate. Lift it into docs/adr/?" On Yes, follow "Before writing an ADR" in references/adr-format.md (apply config rules.adr; use the project's docs/adr/TEMPLATE.md if it exists, otherwise Beat's front-matter template with source: beat/changes/distill-<scope-name>), write the 1-3 sentence ADR, incrementing the highest existing number. On No, continue. Create docs/adr/ lazily — only on first ADR. Step 7 commits the ADR with the change.
    • If you choose not to write design.md: set design: { status: skipped } in status.yaml — never leave it pending

    Spec self-review (after writing each artifact):

    Re-read the artifact with fresh eyes and check:

    1. Placeholder scan — any TBD, TODO, incomplete sections, vague descriptions?
    2. Internal consistency — do sections contradict each other? Do scenarios contradict the proposal/design?
    3. Scope check — does the artifact stay within the distill scope, or did it drift into adjacent behavior?
    4. Ambiguity check — could any scenario be read two different ways? If so, pick the reading the code supports and make it explicit.

    Fix issues inline. No need to re-review the fix — just fix and move on.

    Update status.yaml for each artifact created, and mark optional artifacts you chose not to create as skipped. Set phase to the latest completed spec artifact.

    Module README offer (Layer 3, optional):

    If the distilled scope is a module (its own directory with a public interface) and it has no README.md, offer once to scaffold one per references/architecture-format.md. If beat/ARCHITECTURE.md exists and is missing this module's row, offer to add it. Advisory — the user may decline; never block.

  7. Lint and commit artifacts

    Run node <skill-dir>/scripts/lint-features.mjs beat/changes/<name>/features/*.feature and node <skill-dir>/scripts/validate-beat.mjs --file beat/changes/<name>/status.yaml (see references/lint-tools.md); fix every error before committing. Distilled scenarios have no tests yet, so @covered-by warnings are expected here.

    Commit the change directory and every living-documentation file this run wrote or modified — they are one unit of work:

    git add beat/changes/distill-<scope-name>/
    git add docs/adr/NNNN-<slug>.md   # each ADR from the ADR gate, by file name
    git add docs/adr/<index-file>     # only if the project keeps an ADR index there and this run updated it
    git add GLOSSARY.md           # glossary entries from the glossary check
    git add beat/ARCHITECTURE.md      # if the hub row was added
    git add <module>/README.md        # if the module README scaffold was accepted
    git commit

    Stage files by name, never docs/adr/ as a directory: a path is staged when git status shows it and this run wrote it; a path that is absent, unchanged, or was modified by the user outside this run stays unstaged.

    Use a descriptive message: "distill(<scope>): extract BDD specs from existing code"

  8. Present to user for review

    Show:

    • All generated feature files (summary of scenarios per feature)
    • Any remaining uncertainties about behavior
    • Existing features that overlap (from step 4 scan)
    ## Distill Complete: distill-<scope-name>
    
    Created:
    - features/*.feature (N scenarios across M files)
    - proposal.md (or skipped)
    - design.md (or skipped)
    
    Glossary: N terms added to GLOSSARY.md (or "no new terms")
    ADRs: N written to docs/adr/ (or "none qualified")
    
    Uncertainties: [list any ambiguous behaviors]
    
    Next steps:
    - Review the draft feature files for accuracy
    - Run `/beat:verify` to independently verify scenarios match code behavior (accuracy mode)
    - Run `/beat:archive` to sync verified features into `beat/features/` living documentation
    - Future changes to this area use the normal flow: `/beat:design` → `/beat:plan` → `/beat:apply`

    Then end with the handoff block from references/handoff-report.md (next: /beat:verify <name>).

Distill vs Normal Flow

Normal:  Spec -> Code   (write spec first, then implement)
Distill: Code -> Spec   (extract spec from existing code)
              |
         /beat:verify confirms accuracy (source: distill → accuracy mode)
              |
         /beat:archive syncs features into living documentation
              |
         Future changes use normal BDD flow (new change container)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.