Codex compatibility note:
- Invoke repository skills with
$skill-name in Codex; this mirrored copy rewrites legacy Claude /skill-name references.
- Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
- User-question prompts mean to ask the user directly in Codex.
- Ignore Claude-specific mode-switch instructions when they appear.
- Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
- Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required
spawn_agent subagent(s) for that task.
- Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
- For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
- If a required step/tool cannot run in this environment, stop and ask the user before adapting.
Codex Project-Reference Loading (No Hooks)
Codex uses static project-reference loading instead of runtime-injected project docs.
When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
Always read:
docs/project-config.json (project-specific paths, commands, modules, and workflow/test settings)
docs/project-reference/docs-index-reference.md (routes to the full docs/project-reference/* catalog)
docs/project-reference/lessons.md (always-on guardrails and anti-patterns)
Missing/stale context route: If docs/project-config.json, the docs index, lessons.md, CLAUDE.md, AGENTS.md, or any task-required reference doc is missing or stale, auto-run $project-init or the narrow setup route ($project-config, $docs-init, $scan-all, $scan --target=<key>, $claude-md-init) before ordinary project-specific work. If Codex mirrors or AGENTS.md are missing/stale, ask the user to run $sync-codex; do not auto-run it.
Situation-based docs:
- Project structure/architecture/tech-stack/deployment/setup (any layer — backend, frontend, or infra):
project-structure-reference.md
- Backend/CQRS/API/domain/entity changes:
backend-patterns-reference.md, domain-entities-reference.md
- Frontend/UI/styling/design-system:
frontend-patterns-reference.md, scss-styling-guide.md, design-system/README.md
- Spec authoring,
docs/specs/ pathing, or TC format: feature-spec-reference.md, spec-system-reference.md, spec-principles.md
- Behavior/public-contract changes or spec-test-code sync:
workflow-spec-test-code-cycle-reference.md plus the spec docs above
- Derived spec indexes/ERDs/reimplementation guides:
spec-system-reference.md and source Feature Specs under docs/specs/
- Integration test implementation/review:
integration-test-reference.md
- E2E test implementation/review:
e2e-test-reference.md
- Code review/audit work:
code-review-rules.md plus domain docs above based on changed files
Do not read all docs blindly. Start from docs-index-reference.md, then open only relevant files for the task.
[BLOCKING] Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
[BLOCKING] Before each step or sub-skill call, update task tracking: set in_progress when step starts, set completed when step ends.
[BLOCKING] Every completed/skipped step MUST include brief evidence or explicit skip reason.
[BLOCKING] If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
Quick Summary
Goal: UNDERSTAND the feature first, then script it — investigate the capability end-to-end until you can answer the comprehension bar with file:line, and only then produce a stakeholder-ready demo guide that lists every main user story with its REAL test-case IDs, gives a step-by-step demo flow per case, explains how the domain stores/changes the data and how that solves the feature, and places every case on the proof ladder — so the presenter can show the behaviour, explain the data behind it, and never claim proof that was not earned.
Summary — read this if nothing else. A demo guide written from names and guesses stages a demo that breaks in the room. So: investigate first, prove every claim, then write. Main steps, in order:
- RESOLVE scope — prompt → current working context → ask the user directly. NEVER invent the feature silently.
- LOAD the contract (
references/demo-guide-template.md) and SIZE the target into a tier S0–S4; announce both in one line.
- DECOMPOSE into story groups (≥2 from tier S2) and BREAK THE WORK INTO TASKS before the first deep read — the current task list first; a group task completes only when its block is on disk.
- [BLOCKING GATE] UNDERSTAND the feature — clear the 6-question comprehension bar with
file:line each, delegating to read-only investigation skills ($scout, $investigate, $debug-investigate, $graph-trace, $spec-index) when a direct read cannot answer one. No demo step is written before this gate clears.
- GATHER the five inventories — stories + REAL IDs · domain storage/solution · demo path & setup · proof · discriminator — each on its own degradation ladder ending in a stated blocker, never in invention.
- MAP story → cases and persist the map before writing.
- TRACE domain storage & solution per case — read the entity/migration/handler; never infer persistence from names.
- OPEN the guide + ledger before case one, ACCUMULATE story by story on disk; announce anything deferred or dropped.
- PROVE & VALIDATE — place every case on the proof ladder, write the transparency note, run the validation gate.
Flags: feature-or-scope arg · --context · --output · --lang · --html · --stories.
Workflow:
- Resolve Scope, Load Contract, Size & Task — scope precedence prompt → context → ASK; read the template contract; size into a tier; decompose into story groups; create the task list BEFORE the first deep read.
- Understand the Feature FIRST [BLOCKING] — clear the comprehension bar; delegate gathering to read-only skills; write the Understanding Brief to disk.
- Gather the Five Inventories — portable discovery via
docs/project-config.json; every inventory walks its ladder and records the rung it landed on.
- Map Stories → Cases — main stories, REAL
TC-* / test IDs, coverage gaps named.
- Trace Domain Storage & Solution — per case: what is persisted/changed, by which entity/migration/handler, and which rule consumes it (
file:line each).
- Open the Guide + Ledger, Accumulate — spine first, one block per story group, ledger updated as each lands.
- Write Each Case — setup → numbered demo flow → expected result as the discriminator → domain storage/solution.
- Prove — proof ladder per case + test-execution transparency note.
- Validate — the gate below; nothing declared done before it passes.
Key Rules (the contract):
- UNDERSTAND BEFORE YOU SCRIPT. The Step 1 comprehension bar is a [BLOCKING] gate: until you can answer all six questions with
file:line, you have no demo to write. — why: a demo step invented from a screen name is a demo that fails live, in front of the people it was written for.
- Scope precedence is prompt → current context → ASK. An explicit feature in the prompt wins; else derive from current work; else ask the user directly — NEVER invent a feature.
- Every case carries four parts: setup/preconditions · numbered step-by-step demo flow · expected result phrased as the discriminator vs the old behaviour · how the domain stores/changes data & solves the feature. A case missing the storage/solution part is incomplete.
- PROOF IS EARNED, NEVER ASSERTED. Every case sits on one of the four proof rungs (Step 7), and
✅ ran is licensed only by a test executed this session with its command and result recorded. There is no fifth rung: a case you cannot place is a stated blocker.
- REAL IDs ONLY — NEVER invent a test case ID. A story with no case says "no test covers this" and is recorded as a coverage gap. — why: a fabricated ID retires a risk that is still live.
- Cite
file:line for every storage/behaviour claim — read the entity, the mapping, and the migration. NEVER infer persistence from a field name.
- A demo step is traced to a real user path, or it is a stated blocker — NEVER an invented click, endpoint, or screen, and never state faked by a path a user could not reach.
- DELEGATE THE GATHERING, NEVER THE SCRIPTING. Read-only delegates only; their output is INPUT, re-verified at
file:line before it becomes a claim. NEVER delegate to a mutating or findings-emitting skill ($fix, $changes-review, $code-review, $plan-execute).
- ACCUMULATE ON DISK, NEVER IN CONTEXT. Open the guide before case one; append per case and per story group; synthesize the guide-level sections from the written blocks. — why: partial results on disk beat complete results that never got written.
- NO SECRET VALUES, ANYWHERE. Setup steps, run commands, and seed instructions name the setting, the file, and the account role — never a credential, token, key, connection string, or customer identifier. Secrets render
<redacted:…> from the moment they would enter context.
- NO SILENT TRUNCATION. Anything deferred, sampled, or dropped is named in the guide header AND the chat summary — bounded coverage must never read as complete coverage.
- Portable — discover, don't hardcode. Resolve source roots, spec/test locations, run commands, and output dir from
docs/project-config.json; degrade gracefully and say which rung you landed on.
- Scale buys MORE STORY GROUPS, never FEWER PARTS per case. "Too big to demo properly" is a conclusion this skill may never reach.
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Demo Guide — Investigate-First, Proof-Carrying Demo Script
You are an investigator first, a presenter's coach second — in that order, and the order is the whole point.
- As an investigator you learn the feature before you script it: which capability it delivers, which entity owns the state it changes, how the data flows from the user's click to the persisted row and back to the pixel that proves it, and which rule makes the outcome correct. You read the code; you never infer persistence from a name.
- As a presenter's coach you hand a human a script they can run live in front of stakeholders: staged through real user paths, phrased as the discriminator that would have been WRONG under the old behaviour, and backed by an honest statement of what was actually proven versus merely traced.
The bar: a presenter who reads this guide could (a) stage the preconditions without asking anyone, (b) run every case live without improvising a step, (c) answer "where is that stored and what makes it correct?" for any case a stakeholder challenges, and (d) state exactly which cases are backed by a green test and which are being shown by trace alone. Anything less is a wish-list, not a demo guide.
Instructions, not documentation: this skill teaches HOW to build the guide from real project evidence, adapting to whatever the project actually has (specs, tests, PBIs, or just a diff).
Invocation
$demo-guide [feature-or-scope] [--context] [--output path] [--lang xx] [--html] [--stories "A,B"]
| Flag / arg |
Meaning |
feature-or-scope |
Named feature, spec title, PBI/story id, path, or free-text scope. Highest precedence. |
--context |
Force "derive scope from current working context" (branch diff / staged + unstaged / active work). |
--output path |
Where to write the guide. Default: project demo-guide dir (see Configuration), else a temp file. |
--lang xx |
Also emit a translated copy in the given language (keep code identifiers/paths/IDs in English). |
--html |
After the markdown, offer/produce a self-contained HTML runbook (via the Artifact flow). |
--stories "A,B" |
Restrict to the named stories instead of all main stories. |
Step 0 — Resolve Scope, Load the Contract, Size & Task (cheap — costs seconds)
0.1 Resolve scope (prompt → context → ASK). Apply the precedence strictly — the skill's defining behaviour:
- Prompt names a feature/scope → use it. Normalise to a concrete target: a spec file, a PBI/story id, a set of changed files, or a keyword set. Confirm it resolves to real artifacts before proceeding.
- Prompt empty / only "generate demo guide" → derive from the current working context, in this order until one yields signal: active task list / workflow goal →
git status + git diff (staged and unstaged) + branch name → recent commits vs the main branch → any in-progress plan/spec/release-note.
- No usable signal → STOP and ask the user directly: "Which feature should I generate the demo guide for?" Offer the best 2-4 candidates you did find plus free-text. NEVER pick one silently.
State the resolved scope and its source in one line (e.g. Scope: <feature> — derived from branch diff (7 changed files)).
0.2 Load the output contract BEFORE gathering. Read references/demo-guide-template.md — the document structure, the per-case block, the proof rungs, the storage-block field map, and the translation/HTML rules. The shape of the guide decides what you must collect; improvising it from memory guarantees a thin case block. If the file is missing (partial distribution, vendored copy, incomplete mirror sync), degrade out loud, never silently: say which file is absent in one line and run on the inline contract in this file (Step 6's four mandatory parts, Step 7's proof ladder). The guide is still owed in full; only the elaboration is lost.
0.3 Size the target into a tier (count, do not estimate). In-scope files, distinct user-facing capabilities/flows, distinct modules/bounded contexts (docs/project-config.json → modules), and changed lines where a diff exists. First row whose trigger matches, top-down. Announce it: Scope: S2 · Multi — 14 files, 3 capabilities → 3 story groups.
| Tier |
Trigger (first match wins) |
Story groups |
How the work runs |
| S0 · Point |
One case, one bug fix, one screen |
1 |
Inline, case by case |
| S1 · Small |
< 10 in-scope files, one capability |
1 |
Inline, case by case |
| S2 · Multi |
≥ 10 files OR ≥ 2 capabilities/flows/contexts |
2–6 |
Inline, story group by story group |
| S3 · Large |
> 40 files OR > 6 story groups |
6–12 |
One sub-agent per group, front-loaded writes |
| S4 · Program |
Whole product · multi-service · "demo the whole thing" |
Grouped per context |
Group agents → context synthesis → spine |
Thresholds are the framework's existing map-reduce ladder (SYNC:systematic-review-batching: < 10 sequential · ≥ 10 batch · > 6 categories or > 40 files hierarchical) and match $understand's tiers deliberately. — why: a feature that gets understood and then demoed must be partitioned the same way twice, not by two competing maps.
Tier is a SHAPE dial, not a depth dial. It changes how many story groups exist and how the work is dispatched. It NEVER removes a case part, a proof rung, or the storage explanation.
0.4 Decompose into story groups, then task the work — BEFORE any deep read.
- A story group is a demoable unit — one user-facing capability whose cases can be staged in one sitting, ≤ 8 files or ≤ 2000 diff-lines. Decomposition axis, first rung yielding ≥2 cohesive groups: capability / user story → end-to-end flow → module / bounded context → screen or endpoint cluster (last resort, labelled "structural grouping — not a story boundary"). Record which rung you landed on. Tier S0/S1 → exactly one group.
- [BLOCKING] Create the task list BEFORE gathering. the current task list FIRST — an interrupted or compacted run resumes its tasks, never duplicates them. Then one task per story group plus the fixed tasks: size & decompose · understand-gate · scope-wide gather · open guide + ledger · {one per group} · proof & transparency · validate. Exactly one
in_progress. A group task completes ONLY when that group's block is on disk — evidence is the path plus the cases it carries, never a summary in context. — why: a run that dies mid-guide must show exactly where it stopped.
Step 1 — Understand the Feature FIRST [BLOCKING GATE]
No demo step, no expected result, and no storage claim is written before this gate clears. Investigation is not a preamble to the guide — it is the thing that makes the guide true.
The comprehension bar — answer all six with file:line, for each story group:
- What capability does this deliver, and what did the system do before it? The before → after in behaviour terms — this is what the demo's expected result must discriminate against.
- Which entity/aggregate owns the state the feature changes, and which field/column/table holds it? Read the entity, the mapping/configuration, and the migration — not the property name.
- What is the end-to-end flow? Entry point (screen/endpoint/job) → validation → handler/domain rule → persistence → the read path that renders the outcome the presenter will point at.
- Which business rule or invariant makes the expected result correct, and where is it enforced? This is what a stakeholder's "but what if…" attacks.
- What preconditions must exist, and which REAL user path stages each? Roles, configuration, seed data, prior state — every one reachable through actions a user could actually perform.
- What proves it? The REAL
TC-* / test IDs covering each case, which of them are runnable in this environment, and which cases have none.
Cannot answer one? Keep investigating — or delegate. NEVER paper over the gap with a plausible-looking step.
| The gate needs… |
Invoke |
Feeds |
| Where the feature's files even are, across a large or unfamiliar repo |
$scout |
Step 0.4 group decomposition + file lists |
| How the existing feature actually works, beyond what one read shows |
$investigate |
Bar Q1 · Q3 · Q4 → the storage/solution block |
| Why a fixed defect now behaves differently (bug-fix demo) |
$debug-investigate |
Bar Q1's before → after discriminator |
| The call/flow chain and which read path renders the outcome |
$graph-trace · $graph-blast-radius |
Bar Q3 · the "where to look" demo step |
| Which spec owns the capability, when finding it is itself the problem |
$spec-index · $spec |
Bar Q6 → REAL TC-* IDs |
- Read-only delegates ONLY. NEVER invoke a skill that mutates files or issues findings/verdicts (
$fix, $changes-review, $code-review, $why-review, $plan-execute) — this skill emits a script, not a verdict, and mutates nothing but its own output.
- MUST ATTENTION delegate on evidence of need — NEVER by reflex. Try read + grep + trace first, within the group's budget. Announce each delegation in one line and record it in the guide header:
Delegated: $investigate — Story B mechanics. — why: the reader calibrates on the provenance chain exactly as on a grep-derived claim.
- A delegate's output is INPUT, never a finished block. Re-verify every claim at
file:line before it enters the guide; a TC-* ID that arrives through a delegate is still one you must have read yourself. The anti-hallucination bar does not relax by passing through another skill.
- At tier S3+, delegation happens INSIDE the group's sub-agent, never in the orchestrator. — why: delegating from the orchestrator pulls a whole investigation transcript into the one context the grouping exists to protect.
Gate exit — write the Understanding Brief to disk before Step 2 ends: per story group, the six answers with their file:line anchors, the delegations used, and any question you could NOT answer (named as a blocker, never left blank). This brief is what Steps 4, 6 and 7 are written from — never memory.
Step 2 — Gather the Five Inventories (portable discovery)
Read docs/project-config.json (and the project-reference docs it points to) to locate — do NOT hardcode: source roots (entities, handlers, migrations, models), spec / feature-doc location (canonical stories, ACs, TC-* IDs), test locations (integration/unit/e2e — the ground truth of "what is proven"), release-notes / changelog / PBI-story dirs, and run/test commands. This skill runs on repos it has never seen; a hardcoded framework path is a guess wearing a citation.
Each inventory walks its ladder top-down and records the rung it landed on — the reader calibrates on it. Every ladder ends in a stated blocker; none has a rung of invention.
- Story & test-case inventory (feeds the story map, §Quick-reference). The main user-facing capabilities in scope, each as As a … I want … so that …, plus the REAL cases proving each — spec
TC-* IDs and/or the integration/unit/e2e it / [Fact] / scenario names. Reconcile the union of spec TCs and test-code cases. Ladder: specs → tests → PBIs/release notes/commit messages → the diff itself → state that no story source exists.
- Domain storage & solution inventory (feeds each case's fourth part). Per case: the persisted field/column/table, the owning entity/value object, the migration that added or altered it, the value actually written (anchored/computed), and the rule/method/invariant that consumes it. Ladder: entity + mapping + migration read → graph trace of the writer/reader → schema dump → state the blocker.
- Demo path & setup inventory (feeds setup/preconditions and the numbered steps). The real user path to each precondition: roles/permissions, configuration flags, seed or fixture entry points, which app/screen/endpoint, and what input. Ladder: existing seeders/fixtures → e2e test setup → manual path traced through the UI/API code → state that the precondition cannot be staged.
- Proof inventory (feeds the proof rung per case). Which suites/cases exist, which are runnable here (resolve the command — never guess it), and what a run actually returned this session. Ladder:
project-config.json commands → the CI workflow's own commands → the test-runner manifest (package.json scripts, *.csproj, Makefile) → state that no command could be resolved.
- Discriminator inventory (feeds every expected result). Per case, the value/state that would have been WRONG under the old behaviour — from the diff, the fixed defect, the spec's AC, or the test's assertion. Ladder: the test assertion → the diff's before/after → the spec AC → state that the discriminator is unknown rather than writing "it succeeds".
[SECURITY] Record every command, credential, and account in placeholder form at the moment of collection — not at write time. Environment variables, connection strings, tokens, keys, passwords, and customer identifiers are referenced by NAME and rendered <redacted:…>; demo accounts are named by role (<demo user: approver>), never by real login. This is the point where a secret would first enter context, so it is the point that must refuse it.
When .code-graph/graph.db exists, run python .claude/scripts/code_graph trace <entity-or-handler> --direction both --json to map how a stored field flows to the reader that solves the case — this is how the "how the domain solves the feature" claim is backed by structure instead of guesswork.
Step 3 — Map Stories → Cases (persist the map)
- Main user story = a user-facing capability/outcome the feature delivers. Prefer the spec's stories; else synthesise one per distinct capability from ACs/tests. Keep to the main stories — group minor variants under the case list, don't inflate the count.
- Cases per story = the real cases that prove it. Use the ACTUAL IDs — NEVER invent case numbers. A story with no case is a coverage gap to report, never a gap to fill with a plausible ID.
Write the story → case map to disk before writing any case block, and cross-check it against the full changed-file list so no main area is missed. — why: the map is the coverage contract; held only in context it is one cutoff from gone.
Step 4 — Trace Domain Storage & Solution (the distinctive step)
For each main case, open the owning code and answer both questions with file:line evidence:
- How is the domain data stored or changed? The persisted field(s)/column(s)/table, the value object or entity that owns it, the migration that added/altered it, the anchored/computed value actually written, and whether the change is additive/nullable/backfilled. Read the entity, the DTO mapping, and the migration — NEVER infer persistence from names.
- How does the domain solve the feature? The rule/method/invariant that consumes that stored data to produce the demoed outcome (resolver/derivation/gate), and why storing it this way makes the case correct — edge cases, legacy fallback, cross-tier parity.
A display-only case with no persistence change says so explicitly and describes the representation that solves it instead (what value/shape is computed and why it is correct). "No storage change" is a valid and important answer for a demo — an empty block is not.
Step 5 — Open the Guide + Ledger, Accumulate Story by Story
Create the guide file BEFORE writing case one, then append as you produce it. Never hold the whole guide in context and write once at the end.
Write order is fixed: header FIRST — scope + source, sources used, delegations, tier + group count, and the group ledger with every row pending → then group by group (trace → write that group's cases → update its ledger row to written with its case count → complete that task) → then the guide-level sections (storage summary, quick-reference table, transparency note) from the written blocks → then the chat summary. NEVER hold more than the current group in context; read a finished block back from disk when you need it again.
After a cutoff, compaction, or resume: the current task list → read the ledger → verify every written row against the filesystem (the file exists AND carries its cases; an absent or truncated block resets to pending) → re-read the contract and the Understanding Brief → continue at the first unfinished group. NEVER restart a finished group and never re-derive a written block from memory.
[NO SILENT TRUNCATION] If any cap, budget, or interruption leaves part of the resolved scope uncovered, name what was deferred or dropped in the guide header AND in the chat summary — "Story D (bulk import, 9 cases) deferred — not covered by this guide." — why: bounded coverage that reads as complete coverage sends a presenter into a room unprepared for the question nobody examined.
Write location — the demo guide is a DELIVERABLE, not a working artifact. It is written to the project's demo-guide dir (Configuration below) and is meant to be shared and version-controlled. This is a deliberate divergence from $understand, whose report is a git-ignored working artifact — do NOT copy that skill's git-ignored-only rule here. — why: a demo script the team cannot find in the repo is a demo script nobody uses.
Step 6 — Write Each Case (four mandatory parts)
Follow references/demo-guide-template.md. Per main case the guide MUST contain:
- Setup / preconditions — the exact state to stage before demoing (roles, configuration, seed data, which app/screen), staged through real user paths — never by faking state a user could not reach. Secrets as
<redacted:…>, accounts by role.
- Step-by-step demo flow — numbered, concrete, click-/action-level steps a presenter follows live: who acts, on which screen/endpoint, with what input, and where to look. A step you cannot trace to a real user path is a stated blocker, never an invented click.
- Expected result — the observable outcome phrased as the discriminator: the value that would have been WRONG under the old behaviour, not a generic "it succeeds".
- How the domain stores/changes data + solves it — the Step-4 explanation in plain team language, keeping the
file:line anchors for credibility.
Also include: the scope/source header, per-story grouping, the main test-case quick-reference table (ID · what it proves · proof rung), the domain storage summary per story, and the test-execution transparency note. Keep prose tight (output-quality principles).
--lang given → emit a translated copy (prose translated; code identifiers, file:line, TC-* IDs, and numeric values kept verbatim). --html given → follow the Artifact flow to render a self-contained runbook after the markdown is approved.
Step 7 — Prove (the proof ladder)
Every case sits on exactly one rung. State it per case AND in the quick-reference table.
| Rung |
Means |
Licence |
✅ ran |
The test was executed this session |
The ONLY rung that may claim green. Record the command + pass/fail. |
⚠️ trace-verified |
Code read end-to-end, the file:line chain is complete, not executed |
Demo it live; say it was not run. |
📄 spec-only |
Asserted by a spec/TC; the code path was not traced |
Weakest rung — say so explicitly. |
❌ no coverage |
No test exists for this case |
A reported gap. NEVER filled with a plausible ID. |
There is no fifth rung. A case you cannot place on one of these four is a stated blocker, not a case you quietly promote.
Proof chain per case — the file:line links a challenger can walk: where the value is written → where it is read → where the presenter sees it. A case whose chain has a missing link cannot sit above 📄 spec-only.
Transparency note (mandatory, at the end of the guide): what was proven this session (suites/cases executed + pass/fail counts), what was not and why (runner blocker, environment, no coverage), and which cases are therefore being shown live rather than via a green run. NEVER imply a run that did not happen.
Step 8 — Validate
Before declaring done, verify each — evidence, not assertion:
- MUST ATTENTION the resolved scope and its source (prompt / context / user-confirmed) are recorded in the guide header.
- MUST ATTENTION the Step 1 comprehension bar was cleared per story group, with
file:line per answer, and the Understanding Brief is on disk.
- MUST ATTENTION every main user story is present, each with its REAL test-case IDs — no invented numbers — and every story with no case is named as a coverage gap.
- MUST ATTENTION every case has all four parts: setup · numbered demo flow · expected result as the discriminator · domain storage/solution.
- MUST ATTENTION every storage/behaviour claim cites
file:line from a read entity/migration/handler — nothing inferred from a name.
- MUST ATTENTION every case carries a proof rung and a proof chain;
✅ ran appears only where a command was executed and recorded.
- MUST ATTENTION no secret value appears anywhere — settings, files, and account roles named; credentials rendered
<redacted:…>.
- MUST ATTENTION anything deferred, sampled, or dropped is named in the guide header AND the chat summary.
- MUST ATTENTION the ledger's
written rows are verified against the filesystem, and the output landed at the resolved path; translation/HTML produced only if requested.
Configuration
Resolve everything project-specific from docs/project-config.json; an optional block overrides demo-guide defaults:
{
"demoGuide": {
"outputDir": "docs/demo-guides",
"specDir": "docs/specs",
"translateDefaultLang": null,
"storyGranularity": "main"
}
}
Block or file absent → degrade gracefully: default outputDir to the project's docs/demo dir if one exists, else a temp file; discover spec/test/source locations from the project-reference docs; and state the fallbacks you used.
Integration with Other Skills
$understand — reuse its Purpose→How→Why framing for the "how the domain solves the feature" explanation. ⚠️ Boundary — decide by audience, not by overlap: $understand §11 Test & Demo is reviewer-facing — how to run and see the change you are about to review, scoped to that change. This skill is presenter-facing — a standalone, stakeholder-ready script that walks a room through a whole feature. The per-case block is deliberately the same shape in both so they converge instead of drifting; showing finished work to people → here, preparing to review it → $understand.
$investigate / $scout / $debug-investigate / $graph-trace — the Step 1 gate's read-only gather delegates. Their output is INPUT, re-verified at file:line; they never author a case block.
$spec — the canonical source of user stories + TC-* IDs when the project maintains feature specs. A business TC-* and a demo case are the SAME event for two audiences — the spec states it as intent, this guide stages it for a room. So they converge by construction: reuse the TC's demo flow and expected result rather than re-deriving them, and cite the TC-* ID per case so the two cannot drift apart. ⚠️ A TC-* you cannot stage as a live demo is a finding, not a formatting problem — it means a non-demoable (technical) case reached the business spec, which violates M7. Report it; do NOT invent a demo to cover for it.
$release-doc / $changelog — sibling generators; demo-guide is presenter-facing (how to show it), they are change-facing (what changed).
$commit — commit the generated guide when the user wants it version-controlled.
[IMPORTANT] Use task tracking to break ALL work into small tasks BEFORE starting — one per story group (understand → trace → write) so a long feature can't overflow context. Persist the Understanding Brief and the story→case map early; NEVER hold them only in memory.
IMPORTANT MANDATORY Steps: resolve-scope-load-contract-size-and-task-first -> understand-the-feature-blocking-gate-six-question-bar -> gather-five-inventories-with-ladders -> map-stories-to-real-case-ids -> trace-domain-storage-and-solution -> open-guide-and-ledger-accumulate-story-by-story -> write-each-case-four-parts -> place-every-case-on-the-proof-ladder -> validate
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Understand Code First — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
- Search 3+ similar patterns (
grep/glob) — cite file:line evidence
- Read existing files in target area — understand structure, base classes, conventions
- Run
python .claude/scripts/code_graph trace <file> --direction both --json when .code-graph/graph.db exists
- Map dependencies via
connections or callers_of — know what depends on your target
- Write investigation to
.ai/workspace/analysis/ for non-trivial tasks (3+ files)
- Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth
- NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader
BLOCKED until: - [ ] Read target files - [ ] Grep 3+ patterns - [ ] Graph trace (if graph.db exists) - [ ] Assumptions verified with evidence
Evidence-Based Reasoning — Speculation is FORBIDDEN. Every claim needs proof.
- Cite
file:line, grep results, or framework docs for EVERY claim
- Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend
- Cross-service validation required for architectural changes
- "I don't have enough evidence" is valid and expected output
BLOCKED until: - [ ] Evidence file path (file:line) - [ ] Grep search performed - [ ] 3+ similar patterns found - [ ] Confidence level stated
Forbidden without proof: "obviously", "I think", "should be", "probably", "this is because"
If incomplete → output: "Insufficient evidence. Verified: [...]. Not verified: [...]."
Graph-Assisted Investigation — MANDATORY when .code-graph/graph.db exists.
HARD-GATE: MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
Pattern: Grep finds files → trace --direction both reveals full system flow → Grep verifies details
| Task |
Minimum Graph Action |
| Investigation/Scout |
trace --direction both on 2-3 entry files |
| Fix/Debug |
callers_of on buggy function + tests_for |
| Feature/Enhancement |
connections on files to be modified |
| Code Review |
tests_for on changed functions |
| Blast Radius |
trace --direction downstream |
CLI: python .claude/scripts/code_graph {command} --json. Use --node-mode file first (10-30x less noise), then --node-mode function for detail.
Incremental Result Persistence — MANDATORY for all sub-agents or heavy inline steps processing >3 f
…(truncated)
1---2name: demo-guide3description: [Documentation] Use when you need to generate a step-by-step demo guide (demo script / walkthrough) covering all main user stories and their test cases — scope from a named feature, else the current working context, else confirm with the user — explaining for each case how the domain data is stored/changed and how the domain solves the feature. Triggers: demo guide, generate demo guide, demo script, demo walkthrough, how to demo, prepare demo, sprint demo, user story demo.4---5
6> Codex compatibility note:
7>
8> - Invoke repository skills with `$skill-name` in Codex; this mirrored copy rewrites legacy Claude `/skill-name` references.
9> - Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
10> - User-question prompts mean to ask the user directly in Codex.
11> - Ignore Claude-specific mode-switch instructions when they appear.
12> - Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
13> - Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required `spawn_agent` subagent(s) for that task.
14> - Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
15> - For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
16> - If a required step/tool cannot run in this environment, stop and ask the user before adapting.
17
18<!-- CODEX:PROJECT-REFERENCE-LOADING:START -->
19
20## Codex Project-Reference Loading (No Hooks)
21
22Codex uses static project-reference loading instead of runtime-injected project docs.
23When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
24
25**Always read:**
26
27- `docs/project-config.json` (project-specific paths, commands, modules, and workflow/test settings)
28- `docs/project-reference/docs-index-reference.md` (routes to the full `docs/project-reference/*` catalog)
29- `docs/project-reference/lessons.md` (always-on guardrails and anti-patterns)
30
31**Missing/stale context route:** If `docs/project-config.json`, the docs index, `lessons.md`, `CLAUDE.md`, `AGENTS.md`, or any task-required reference doc is missing or stale, auto-run `$project-init` or the narrow setup route (`$project-config`, `$docs-init`, `$scan-all`, `$scan --target=<key>`, `$claude-md-init`) before ordinary project-specific work. If Codex mirrors or `AGENTS.md` are missing/stale, ask the user to run `$sync-codex`; do not auto-run it.
32
33**Situation-based docs:**
34
35- Project structure/architecture/tech-stack/deployment/setup (any layer — backend, frontend, or infra): `project-structure-reference.md`
36- Backend/CQRS/API/domain/entity changes: `backend-patterns-reference.md`, `domain-entities-reference.md`
37- Frontend/UI/styling/design-system: `frontend-patterns-reference.md`, `scss-styling-guide.md`, `design-system/README.md`
38- Spec authoring, `docs/specs/` pathing, or TC format: `feature-spec-reference.md`, `spec-system-reference.md`, `spec-principles.md`
39- Behavior/public-contract changes or spec-test-code sync: `workflow-spec-test-code-cycle-reference.md` plus the spec docs above
40- Derived spec indexes/ERDs/reimplementation guides: `spec-system-reference.md` and source Feature Specs under `docs/specs/`
41- Integration test implementation/review: `integration-test-reference.md`
42- E2E test implementation/review: `e2e-test-reference.md`
43- Code review/audit work: `code-review-rules.md` plus domain docs above based on changed files
44
45Do not read all docs blindly. Start from `docs-index-reference.md`, then open only relevant files for the task.
46
47<!-- CODEX:PROJECT-REFERENCE-LOADING:END -->
48
49<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:START -->
50
51> **[BLOCKING]** Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
52> **[BLOCKING]** Before each step or sub-skill call, update task tracking: set `in_progress` when step starts, set `completed` when step ends.
53> **[BLOCKING]** Every completed/skipped step MUST include brief evidence or explicit skip reason.
54> **[BLOCKING]** If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
55
56<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:END -->
57
58## Quick Summary
59
60**Goal:** **UNDERSTAND the feature first, then script it** — investigate the capability end-to-end until you can answer the comprehension bar with `file:line`, and only then produce a stakeholder-ready demo guide that lists every **main user story** with its **REAL test-case IDs**, gives a **step-by-step demo flow** per case, explains **how the domain stores/changes the data and how that solves the feature**, and places every case on the **proof ladder** — so the presenter can show the behaviour, explain the data behind it, and never claim proof that was not earned.
61
62**Summary — read this if nothing else.** A demo guide written from names and guesses stages a demo that breaks in the room. So: investigate first, prove every claim, then write. Main steps, in order:
63
641. **RESOLVE scope** — prompt → current working context → ask the user directly. NEVER invent the feature silently.
652. **LOAD the contract** (`references/demo-guide-template.md`) and **SIZE the target into a tier S0–S4**; announce both in one line.
663. **DECOMPOSE into story groups** (≥2 from tier S2) and **BREAK THE WORK INTO TASKS before the first deep read** — the current task list first; a group task completes only when its block is **on disk**.
674. **[BLOCKING GATE] UNDERSTAND the feature** — clear the 6-question comprehension bar with `file:line` each, **delegating to read-only investigation skills** (`$scout`, `$investigate`, `$debug-investigate`, `$graph-trace`, `$spec-index`) when a direct read cannot answer one. No demo step is written before this gate clears.
685. **GATHER the five inventories** — stories + REAL IDs · domain storage/solution · demo path & setup · proof · discriminator — each on its own degradation **ladder** ending in a **stated blocker**, never in invention.
696. **MAP story → cases** and persist the map before writing.
707. **TRACE domain storage & solution per case** — read the entity/migration/handler; never infer persistence from names.
718. **OPEN the guide + ledger before case one, ACCUMULATE story by story** on disk; announce anything deferred or dropped.
729. **PROVE & VALIDATE** — place every case on the proof ladder, write the transparency note, run the validation gate.
73
74**Flags:** `feature-or-scope` arg · `--context` · `--output` · `--lang` · `--html` · `--stories`.
75
76**Workflow:**
77
780. **Resolve Scope, Load Contract, Size & Task** — scope precedence prompt → context → ASK; read the template contract; size into a tier; decompose into story groups; create the task list BEFORE the first deep read.
791. **Understand the Feature FIRST [BLOCKING]** — clear the comprehension bar; delegate gathering to read-only skills; write the Understanding Brief to disk.
802. **Gather the Five Inventories** — portable discovery via `docs/project-config.json`; every inventory walks its ladder and records the rung it landed on.
813. **Map Stories → Cases** — main stories, REAL `TC-*` / test IDs, coverage gaps named.
824. **Trace Domain Storage & Solution** — per case: what is persisted/changed, by which entity/migration/handler, and which rule consumes it (`file:line` each).
835. **Open the Guide + Ledger, Accumulate** — spine first, one block per story group, ledger updated as each lands.
846. **Write Each Case** — setup → numbered demo flow → expected result as the discriminator → domain storage/solution.
857. **Prove** — proof ladder per case + test-execution transparency note.
868. **Validate** — the gate below; nothing declared done before it passes.
87
88**Key Rules (the contract):**
89
90- **UNDERSTAND BEFORE YOU SCRIPT.** The Step 1 comprehension bar is a **[BLOCKING] gate**: until you can answer all six questions with `file:line`, you have no demo to write. — why: a demo step invented from a screen name is a demo that fails live, in front of the people it was written for.
91- **Scope precedence is prompt → current context → ASK.** An explicit feature in the prompt wins; else derive from current work; else ask the user directly — NEVER invent a feature.
92- **Every case carries four parts:** setup/preconditions · numbered **step-by-step demo flow** · **expected result phrased as the discriminator** vs the old behaviour · **how the domain stores/changes data & solves the feature**. A case missing the storage/solution part is incomplete.
93- **PROOF IS EARNED, NEVER ASSERTED.** Every case sits on one of the four proof rungs (Step 7), and `✅ ran` is licensed **only** by a test executed this session with its command and result recorded. There is no fifth rung: a case you cannot place is a **stated blocker**.
94- **REAL IDs ONLY — NEVER invent a test case ID.** A story with no case says _"no test covers this"_ and is recorded as a coverage gap. — why: a fabricated ID retires a risk that is still live.
95- **Cite `file:line` for every storage/behaviour claim** — read the entity, the mapping, and the migration. NEVER infer persistence from a field name.
96- **A demo step is traced to a real user path, or it is a stated blocker** — NEVER an invented click, endpoint, or screen, and never state faked by a path a user could not reach.
97- **DELEGATE THE GATHERING, NEVER THE SCRIPTING.** Read-only delegates only; their output is INPUT, re-verified at `file:line` before it becomes a claim. NEVER delegate to a mutating or findings-emitting skill (`$fix`, `$changes-review`, `$code-review`, `$plan-execute`).
98- **ACCUMULATE ON DISK, NEVER IN CONTEXT.** Open the guide before case one; append per case and per story group; synthesize the guide-level sections **from the written blocks**. — why: partial results on disk beat complete results that never got written.
99- **NO SECRET VALUES, ANYWHERE.** Setup steps, run commands, and seed instructions name the setting, the file, and the account **role** — never a credential, token, key, connection string, or customer identifier. Secrets render `<redacted:…>` from the moment they would enter context.
100- **NO SILENT TRUNCATION.** Anything deferred, sampled, or dropped is named in the guide header AND the chat summary — bounded coverage must never read as complete coverage.
101- **Portable — discover, don't hardcode.** Resolve source roots, spec/test locations, run commands, and output dir from `docs/project-config.json`; degrade gracefully and say which rung you landed on.
102- **Scale buys MORE STORY GROUPS, never FEWER PARTS per case.** _"Too big to demo properly"_ is a conclusion this skill may never reach.
103
104**Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.**
105
106---
107
108# Demo Guide — Investigate-First, Proof-Carrying Demo Script
109
110You are an **investigator first, a presenter's coach second** — in that order, and the order is the whole point.
111
112- **As an investigator** you learn the feature before you script it: which capability it delivers, which entity owns the state it changes, how the data flows from the user's click to the persisted row and back to the pixel that proves it, and which rule makes the outcome correct. You read the code; you never infer persistence from a name.
113- **As a presenter's coach** you hand a human a script they can run live in front of stakeholders: staged through real user paths, phrased as the discriminator that would have been WRONG under the old behaviour, and backed by an honest statement of what was actually proven versus merely traced.
114
115> **The bar:** a presenter who reads this guide could (a) stage the preconditions without asking anyone, (b) run every case live without improvising a step, (c) answer _"where is that stored and what makes it correct?"_ for any case a stakeholder challenges, and (d) state exactly which cases are backed by a green test and which are being shown by trace alone. Anything less is a wish-list, not a demo guide.
116
117Instructions, not documentation: this skill teaches HOW to build the guide from real project evidence, adapting to whatever the project actually has (specs, tests, PBIs, or just a diff).
118
119## Invocation
120
121```
122$demo-guide [feature-or-scope] [--context] [--output path] [--lang xx] [--html] [--stories "A,B"]
123```
124
125| Flag / arg | Meaning |
126| ------------------ | -------------------------------------------------------------------------------------------------- |
127| `feature-or-scope` | Named feature, spec title, PBI/story id, path, or free-text scope. Highest precedence. |
128| `--context` | Force "derive scope from current working context" (branch diff / staged + unstaged / active work). |
129| `--output path` | Where to write the guide. Default: project demo-guide dir (see Configuration), else a temp file. |
130| `--lang xx` | Also emit a translated copy in the given language (keep code identifiers/paths/IDs in English). |
131| `--html` | After the markdown, offer/produce a self-contained HTML runbook (via the Artifact flow). |
132| `--stories "A,B"` | Restrict to the named stories instead of all main stories. |
133
134## Step 0 — Resolve Scope, Load the Contract, Size & Task (cheap — costs seconds)
135
136**0.1 Resolve scope (prompt → context → ASK).** Apply the precedence strictly — the skill's defining behaviour:
137
1381. **Prompt names a feature/scope** → use it. Normalise to a concrete target: a spec file, a PBI/story id, a set of changed files, or a keyword set. Confirm it resolves to real artifacts before proceeding.
1392. **Prompt empty / only "generate demo guide"** → derive from the **current working context**, in this order until one yields signal: active task list / workflow goal → `git status` + `git diff` (staged and unstaged) + branch name → recent commits vs the main branch → any in-progress plan/spec/release-note.
1403. **No usable signal** → **STOP and ask the user directly**: _"Which feature should I generate the demo guide for?"_ Offer the best 2-4 candidates you did find plus free-text. NEVER pick one silently.
141
142State the resolved scope and its source in one line (e.g. `Scope: <feature> — derived from branch diff (7 changed files)`).
143
144**0.2 Load the output contract BEFORE gathering.** Read `references/demo-guide-template.md` — the document structure, the per-case block, the proof rungs, the storage-block field map, and the translation/HTML rules. The shape of the guide decides what you must collect; improvising it from memory guarantees a thin case block. **If the file is missing** (partial distribution, vendored copy, incomplete mirror sync), degrade **out loud, never silently**: say which file is absent in one line and run on the inline contract in this file (Step 6's four mandatory parts, Step 7's proof ladder). The guide is still owed in full; only the elaboration is lost.
145
146**0.3 Size the target into a tier (count, do not estimate).** In-scope **files**, distinct user-facing **capabilities/flows**, distinct **modules/bounded contexts** (`docs/project-config.json` → modules), and **changed lines** where a diff exists. First row whose trigger matches, top-down. Announce it: `Scope: S2 · Multi — 14 files, 3 capabilities → 3 story groups`.
147
148| Tier | Trigger (first match wins) | Story groups | How the work runs |
149| ---------------- | ------------------------------------------------------ | ------------------- | -------------------------------------------- |
150| **S0 · Point** | One case, one bug fix, one screen | 1 | Inline, case by case |
151| **S1 · Small** | < 10 in-scope files, one capability | 1 | Inline, case by case |
152| **S2 · Multi** | ≥ 10 files **OR** ≥ 2 capabilities/flows/contexts | 2–6 | Inline, story group by story group |
153| **S3 · Large** | > 40 files **OR** > 6 story groups | 6–12 | One sub-agent per group, front-loaded writes |
154| **S4 · Program** | Whole product · multi-service · "demo the whole thing" | Grouped per context | Group agents → context synthesis → spine |
155
156> Thresholds are the framework's existing map-reduce ladder (`SYNC:systematic-review-batching`: < 10 sequential · ≥ 10 batch · > 6 categories or > 40 files hierarchical) and match `$understand`'s tiers deliberately. — why: a feature that gets understood and then demoed must be partitioned the same way twice, not by two competing maps.
157
158**Tier is a SHAPE dial, not a depth dial.** It changes how many story groups exist and how the work is dispatched. It NEVER removes a case part, a proof rung, or the storage explanation.
159
160**0.4 Decompose into story groups, then task the work — BEFORE any deep read.**
161
162- **A story group is a demoable unit** — one user-facing capability whose cases can be staged in one sitting, ≤ 8 files or ≤ 2000 diff-lines. Decomposition axis, first rung yielding ≥2 cohesive groups: **capability / user story** → **end-to-end flow** → **module / bounded context** → **screen or endpoint cluster** (last resort, labelled _"structural grouping — not a story boundary"_). Record which rung you landed on. Tier S0/S1 → exactly one group.
163- **[BLOCKING] Create the task list BEFORE gathering.** the current task list FIRST — an interrupted or compacted run **resumes its tasks, never duplicates them**. Then one task per story group plus the fixed tasks: _size & decompose · understand-gate · scope-wide gather · open guide + ledger · {one per group} · proof & transparency · validate_. Exactly one `in_progress`. **A group task completes ONLY when that group's block is on disk** — evidence is the path plus the cases it carries, never a summary in context. — why: a run that dies mid-guide must show exactly where it stopped.
164
165## Step 1 — Understand the Feature FIRST **[BLOCKING GATE]**
166
167**No demo step, no expected result, and no storage claim is written before this gate clears.** Investigation is not a preamble to the guide — it is the thing that makes the guide true.
168
169**The comprehension bar — answer all six with `file:line`, for each story group:**
170
1711. **What capability does this deliver, and what did the system do before it?** The before → after in _behaviour_ terms — this is what the demo's expected result must discriminate against.
1722. **Which entity/aggregate owns the state the feature changes, and which field/column/table holds it?** Read the entity, the mapping/configuration, and the migration — not the property name.
1733. **What is the end-to-end flow?** Entry point (screen/endpoint/job) → validation → handler/domain rule → persistence → the read path that renders the outcome the presenter will point at.
1744. **Which business rule or invariant makes the expected result correct, and where is it enforced?** This is what a stakeholder's _"but what if…"_ attacks.
1755. **What preconditions must exist, and which REAL user path stages each?** Roles, configuration, seed data, prior state — every one reachable through actions a user could actually perform.
1766. **What proves it?** The REAL `TC-*` / test IDs covering each case, which of them are runnable in this environment, and which cases have none.
177
178**Cannot answer one? Keep investigating — or delegate. NEVER paper over the gap with a plausible-looking step.**
179
180| The gate needs… | Invoke | Feeds |
181| --------------------------------------------------------------------- | -------------------------------------- | --------------------------------------------- |
182| Where the feature's files even are, across a large or unfamiliar repo | `$scout` | Step 0.4 group decomposition + file lists |
183| How the existing feature actually works, beyond what one read shows | `$investigate` | Bar Q1 · Q3 · Q4 → the storage/solution block |
184| Why a fixed defect now behaves differently (bug-fix demo) | `$debug-investigate` | Bar Q1's before → after discriminator |
185| The call/flow chain and which read path renders the outcome | `$graph-trace` · `$graph-blast-radius` | Bar Q3 · the "where to look" demo step |
186| Which spec owns the capability, when finding it is itself the problem | `$spec-index` · `$spec` | Bar Q6 → REAL `TC-*` IDs |
187
1881. **Read-only delegates ONLY.** NEVER invoke a skill that mutates files or issues findings/verdicts (`$fix`, `$changes-review`, `$code-review`, `$why-review`, `$plan-execute`) — this skill emits a script, not a verdict, and mutates nothing but its own output.
1892. **MUST ATTENTION delegate on evidence of need — NEVER by reflex.** Try read + grep + trace first, within the group's budget. Announce each delegation in one line and record it in the guide header: `Delegated: $investigate — Story B mechanics`. — why: the reader calibrates on the provenance chain exactly as on a grep-derived claim.
1903. **A delegate's output is INPUT, never a finished block.** Re-verify every claim at `file:line` before it enters the guide; a `TC-*` ID that arrives through a delegate is still one you must have read yourself. The anti-hallucination bar does not relax by passing through another skill.
1914. **At tier S3+, delegation happens INSIDE the group's sub-agent**, never in the orchestrator. — why: delegating from the orchestrator pulls a whole investigation transcript into the one context the grouping exists to protect.
192
193**Gate exit — write the Understanding Brief to disk before Step 2 ends:** per story group, the six answers with their `file:line` anchors, the delegations used, and any question you could NOT answer (named as a blocker, never left blank). This brief is what Steps 4, 6 and 7 are written from — never memory.
194
195## Step 2 — Gather the Five Inventories (portable discovery)
196
197Read `docs/project-config.json` (and the project-reference docs it points to) to locate — do NOT hardcode: **source roots** (entities, handlers, migrations, models), **spec / feature-doc location** (canonical stories, ACs, `TC-*` IDs), **test locations** (integration/unit/e2e — the ground truth of "what is proven"), **release-notes / changelog / PBI-story** dirs, and **run/test commands**. This skill runs on repos it has never seen; a hardcoded framework path is a guess wearing a citation.
198
199Each inventory walks its ladder top-down and **records the rung it landed on** — the reader calibrates on it. **Every ladder ends in a stated blocker; none has a rung of invention.**
200
2011. **Story & test-case inventory** (feeds the story map, §Quick-reference). The main user-facing capabilities in scope, each as _As a … I want … so that …_, plus the REAL cases proving each — spec `TC-*` IDs and/or the integration/unit/e2e `it` / `[Fact]` / scenario names. Reconcile the union of spec TCs and test-code cases. _Ladder:_ specs → tests → PBIs/release notes/commit messages → the diff itself → **state that no story source exists**.
2022. **Domain storage & solution inventory** (feeds each case's fourth part). Per case: the persisted field/column/table, the owning entity/value object, the migration that added or altered it, the value actually written (anchored/computed), and the rule/method/invariant that consumes it. _Ladder:_ entity + mapping + migration read → graph trace of the writer/reader → schema dump → **state the blocker**.
2033. **Demo path & setup inventory** (feeds setup/preconditions and the numbered steps). The real user path to each precondition: roles/permissions, configuration flags, seed or fixture entry points, which app/screen/endpoint, and what input. _Ladder:_ existing seeders/fixtures → e2e test setup → manual path traced through the UI/API code → **state that the precondition cannot be staged**.
2044. **Proof inventory** (feeds the proof rung per case). Which suites/cases exist, which are runnable here (resolve the command — never guess it), and what a run actually returned this session. _Ladder:_ `project-config.json` commands → the CI workflow's own commands → the test-runner manifest (`package.json` scripts, `*.csproj`, `Makefile`) → **state that no command could be resolved**.
2055. **Discriminator inventory** (feeds every expected result). Per case, the value/state that would have been WRONG under the old behaviour — from the diff, the fixed defect, the spec's AC, or the test's assertion. _Ladder:_ the test assertion → the diff's before/after → the spec AC → **state that the discriminator is unknown** rather than writing "it succeeds".
206
207> **[SECURITY]** Record every command, credential, and account in **placeholder form** at the moment of collection — not at write time. Environment variables, connection strings, tokens, keys, passwords, and customer identifiers are referenced by NAME and rendered `<redacted:…>`; demo accounts are named by **role** (`<demo user: approver>`), never by real login. This is the point where a secret would first enter context, so it is the point that must refuse it.
208
209> When `.code-graph/graph.db` exists, run `python .claude/scripts/code_graph trace <entity-or-handler> --direction both --json` to map how a stored field flows to the reader that solves the case — this is how the "how the domain solves the feature" claim is backed by structure instead of guesswork.
210
211## Step 3 — Map Stories → Cases (persist the map)
212
213- **Main user story** = a user-facing capability/outcome the feature delivers. Prefer the spec's stories; else synthesise one per distinct capability from ACs/tests. Keep to the _main_ stories — group minor variants under the case list, don't inflate the count.
214- **Cases per story** = the real cases that prove it. Use the **ACTUAL IDs** — NEVER invent case numbers. A story with no case is a **coverage gap to report**, never a gap to fill with a plausible ID.
215
216Write the story → case map to disk before writing any case block, and cross-check it against the full changed-file list so no main area is missed. — why: the map is the coverage contract; held only in context it is one cutoff from gone.
217
218## Step 4 — Trace Domain Storage & Solution (the distinctive step)
219
220For **each main case**, open the owning code and answer both questions with `file:line` evidence:
221
222- **How is the domain data stored or changed?** The persisted field(s)/column(s)/table, the value object or entity that owns it, the migration that added/altered it, the anchored/computed value actually written, and whether the change is additive/nullable/backfilled. Read the entity, the DTO mapping, and the migration — NEVER infer persistence from names.
223- **How does the domain solve the feature?** The rule/method/invariant that consumes that stored data to produce the demoed outcome (resolver/derivation/gate), and why storing it this way makes the case correct — edge cases, legacy fallback, cross-tier parity.
224
225A display-only case with no persistence change says so **explicitly** and describes the **representation** that solves it instead (what value/shape is computed and why it is correct). _"No storage change"_ is a valid and important answer for a demo — an empty block is not.
226
227## Step 5 — Open the Guide + Ledger, Accumulate Story by Story
228
229**Create the guide file BEFORE writing case one**, then append as you produce it. Never hold the whole guide in context and write once at the end.
230
231**Write order is fixed:** header FIRST — scope + source, sources used, delegations, tier + group count, and the **group ledger** with every row `pending` → then group by group (trace → write that group's cases → update its ledger row to `written` with its case count → complete that task) → then the guide-level sections (storage summary, quick-reference table, transparency note) **from the written blocks** → then the chat summary. NEVER hold more than the current group in context; read a finished block back from disk when you need it again.
232
233**After a cutoff, compaction, or resume:** the current task list → read the ledger → **verify every `written` row against the filesystem** (the file exists AND carries its cases; an absent or truncated block resets to `pending`) → re-read the contract and the Understanding Brief → continue at the first unfinished group. NEVER restart a finished group and never re-derive a written block from memory.
234
235> **[NO SILENT TRUNCATION]** If any cap, budget, or interruption leaves part of the resolved scope uncovered, name what was deferred or dropped **in the guide header AND in the chat summary** — _"Story D (bulk import, 9 cases) deferred — not covered by this guide."_ — why: bounded coverage that reads as complete coverage sends a presenter into a room unprepared for the question nobody examined.
236
237**Write location — the demo guide is a DELIVERABLE, not a working artifact.** It is written to the project's demo-guide dir (Configuration below) and is meant to be shared and version-controlled. **This is a deliberate divergence from `$understand`, whose report is a git-ignored working artifact** — do NOT copy that skill's git-ignored-only rule here. — why: a demo script the team cannot find in the repo is a demo script nobody uses.
238
239## Step 6 — Write Each Case (four mandatory parts)
240
241Follow `references/demo-guide-template.md`. Per **main case** the guide MUST contain:
242
2431. **Setup / preconditions** — the exact state to stage before demoing (roles, configuration, seed data, which app/screen), staged through **real user paths** — never by faking state a user could not reach. Secrets as `<redacted:…>`, accounts by role.
2442. **Step-by-step demo flow** — numbered, concrete, click-/action-level steps a presenter follows live: who acts, on which screen/endpoint, with what input, and where to look. A step you cannot trace to a real user path is a **stated blocker**, never an invented click.
2453. **Expected result** — the observable outcome phrased as **the discriminator**: the value that would have been WRONG under the old behaviour, not a generic "it succeeds".
2464. **How the domain stores/changes data + solves it** — the Step-4 explanation in plain team language, keeping the `file:line` anchors for credibility.
247
248Also include: the scope/source header, per-story grouping, the **main test-case quick-reference table** (ID · what it proves · proof rung), the **domain storage summary** per story, and the **test-execution transparency note**. Keep prose tight (output-quality principles).
249
250`--lang` given → emit a translated copy (prose translated; code identifiers, `file:line`, `TC-*` IDs, and numeric values kept verbatim). `--html` given → follow the Artifact flow to render a self-contained runbook **after** the markdown is approved.
251
252## Step 7 — Prove (the proof ladder)
253
254Every case sits on exactly one rung. State it per case AND in the quick-reference table.
255
256| Rung | Means | Licence |
257| ------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------- |
258| `✅ ran` | The test was **executed this session** | The ONLY rung that may claim green. Record the command + pass/fail. |
259| `⚠️ trace-verified` | Code read end-to-end, the `file:line` chain is complete, not executed | Demo it live; say it was not run. |
260| `📄 spec-only` | Asserted by a spec/TC; the code path was not traced | Weakest rung — say so explicitly. |
261| `❌ no coverage` | No test exists for this case | A reported gap. NEVER filled with a plausible ID. |
262
263**There is no fifth rung.** A case you cannot place on one of these four is a **stated blocker**, not a case you quietly promote.
264
265**Proof chain per case** — the `file:line` links a challenger can walk: **where the value is written** → **where it is read** → **where the presenter sees it**. A case whose chain has a missing link cannot sit above `📄 spec-only`.
266
267**Transparency note (mandatory, at the end of the guide):** what was proven this session (suites/cases executed + pass/fail counts), what was not and why (runner blocker, environment, no coverage), and which cases are therefore being shown live rather than via a green run. NEVER imply a run that did not happen.
268
269## Step 8 — Validate
270
271Before declaring done, verify each — evidence, not assertion:
272
273- **MUST ATTENTION** the resolved scope and its source (prompt / context / user-confirmed) are recorded in the guide header.
274- **MUST ATTENTION** the Step 1 comprehension bar was cleared per story group, with `file:line` per answer, and the Understanding Brief is on disk.
275- **MUST ATTENTION** every main user story is present, each with its REAL test-case IDs — **no invented numbers** — and every story with no case is named as a coverage gap.
276- **MUST ATTENTION** every case has all four parts: setup · numbered demo flow · expected result as the discriminator · domain storage/solution.
277- **MUST ATTENTION** every storage/behaviour claim cites `file:line` from a read entity/migration/handler — nothing inferred from a name.
278- **MUST ATTENTION** every case carries a proof rung and a proof chain; `✅ ran` appears only where a command was executed and recorded.
279- **MUST ATTENTION** no secret value appears anywhere — settings, files, and account roles named; credentials rendered `<redacted:…>`.
280- **MUST ATTENTION** anything deferred, sampled, or dropped is named in the guide header AND the chat summary.
281- **MUST ATTENTION** the ledger's `written` rows are verified against the filesystem, and the output landed at the resolved path; translation/HTML produced only if requested.
282
283## Configuration
284
285Resolve everything project-specific from `docs/project-config.json`; an optional block overrides demo-guide defaults:
286
287```json
288{
289 "demoGuide": {
290 "outputDir": "docs/demo-guides",
291 "specDir": "docs/specs",
292 "translateDefaultLang": null,
293 "storyGranularity": "main"
294 }
295}
296```
297
298Block or file absent → degrade gracefully: default `outputDir` to the project's docs/demo dir if one exists, else a temp file; discover spec/test/source locations from the project-reference docs; and **state the fallbacks you used**.
299
300## Integration with Other Skills
301
302- **`$understand`** — reuse its Purpose→How→Why framing for the "how the domain solves the feature" explanation. ⚠️ **Boundary — decide by audience, not by overlap:** `$understand` §11 _Test & Demo_ is **reviewer-facing** — how to run and see the change you are about to review, scoped to that change. This skill is **presenter-facing** — a standalone, stakeholder-ready script that walks a room through a whole feature. The per-case block is deliberately the same shape in both so they converge instead of drifting; showing finished work to people → here, preparing to review it → `$understand`.
303- **`$investigate`** / **`$scout`** / **`$debug-investigate`** / **`$graph-trace`** — the Step 1 gate's read-only gather delegates. Their output is INPUT, re-verified at `file:line`; they never author a case block.
304- **`$spec`** — the canonical source of user stories + `TC-*` IDs when the project maintains feature specs. **A business `TC-*` and a demo case are the SAME event for two audiences** — the spec states it as intent, this guide stages it for a room. So they converge by construction: reuse the TC's demo flow and expected result rather than re-deriving them, and **cite the `TC-*` ID per case** so the two cannot drift apart. ⚠️ **A `TC-*` you cannot stage as a live demo is a finding, not a formatting problem** — it means a non-demoable (technical) case reached the business spec, which violates **M7**. Report it; do NOT invent a demo to cover for it.
305- **`$release-doc`** / **`$changelog`** — sibling generators; `demo-guide` is presenter-facing (how to show it), they are change-facing (what changed).
306- **`$commit`** — commit the generated guide when the user wants it version-controlled.
307
308---
309
310> **[IMPORTANT]** Use task tracking to break ALL work into small tasks BEFORE starting — one per story group (understand → trace → write) so a long feature can't overflow context. Persist the Understanding Brief and the story→case map early; NEVER hold them only in memory.
311
312**IMPORTANT MANDATORY Steps:** resolve-scope-load-contract-size-and-task-first -> understand-the-feature-blocking-gate-six-question-bar -> gather-five-inventories-with-ladders -> map-stories-to-real-case-ids -> trace-domain-storage-and-solution -> open-guide-and-ledger-accumulate-story-by-story -> write-each-case-four-parts -> place-every-case-on-the-proof-ladder -> validate
313
314**Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.**
315
316<!-- SYNC:understand-code-first -->
317
318> **Understand Code First** — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
319>
320> 1. Search 3+ similar patterns (`grep`/`glob`) — cite `file:line` evidence
321> 2. Read existing files in target area — understand structure, base classes, conventions
322> 3. Run `python .claude/scripts/code_graph trace <file> --direction both --json` when `.code-graph/graph.db` exists
323> 4. Map dependencies via `connections` or `callers_of` — know what depends on your target
324> 5. Write investigation to `.ai/workspace/analysis/` for non-trivial tasks (3+ files)
325> 6. Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth
326> 7. NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader
327>
328> **BLOCKED until:** `- [ ]` Read target files `- [ ]` Grep 3+ patterns `- [ ]` Graph trace (if graph.db exists) `- [ ]` Assumptions verified with evidence
329
330<!-- /SYNC:understand-code-first -->
331
332<!-- SYNC:evidence-based-reasoning -->
333
334> **Evidence-Based Reasoning** — Speculation is FORBIDDEN. Every claim needs proof.
335>
336> 1. Cite `file:line`, grep results, or framework docs for EVERY claim
337> 2. Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend
338> 3. Cross-service validation required for architectural changes
339> 4. "I don't have enough evidence" is valid and expected output
340>
341> **BLOCKED until:** `- [ ]` Evidence file path (`file:line`) `- [ ]` Grep search performed `- [ ]` 3+ similar patterns found `- [ ]` Confidence level stated
342>
343> **Forbidden without proof:** "obviously", "I think", "should be", "probably", "this is because"
344> **If incomplete →** output: `"Insufficient evidence. Verified: [...]. Not verified: [...]."`
345
346<!-- /SYNC:evidence-based-reasoning -->
347
348<!-- SYNC:graph-assisted-investigation -->
349
350> **Graph-Assisted Investigation** — MANDATORY when `.code-graph/graph.db` exists.
351>
352> **HARD-GATE:** MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
353>
354> **Pattern:** Grep finds files → `trace --direction both` reveals full system flow → Grep verifies details
355>
356> | Task | Minimum Graph Action |
357> | ------------------- | -------------------------------------------- |
358> | Investigation/Scout | `trace --direction both` on 2-3 entry files |
359> | Fix/Debug | `callers_of` on buggy function + `tests_for` |
360> | Feature/Enhancement | `connections` on files to be modified |
361> | Code Review | `tests_for` on changed functions |
362> | Blast Radius | `trace --direction downstream` |
363>
364> **CLI:** `python .claude/scripts/code_graph {command} --json`. Use `--node-mode file` first (10-30x less noise), then `--node-mode function` for detail.
365
366<!-- /SYNC:graph-assisted-investigation -->
367
368<!-- SYNC:incremental-persistence -->
369
370> **Incremental Result Persistence** — MANDATORY for all sub-agents or heavy inline steps processing >3 f
371
372…(truncated)