بنقرة واحدة
spec
Decompose BRD into epics, stories, dependency graph, and feature list for agent team execution.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Decompose BRD into epics, stories, dependency graph, and feature list for agent team execution.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | spec |
| description | Decompose BRD into epics, stories, dependency graph, and feature list for agent team execution. |
| argument-hint | [path-to-BRD] |
| context | fork |
| agent | planner |
Ultracode tip: Decomposition benefits from broad parallel exploration of stories and dependency edges, so
/effort ultracodeis a good fit here. Drop back to/effort highbefore the execution phases (/auto,/implement).
/spec specs/brd/brd.md
Pass the path to the approved BRD as the argument. Produces epics, stories, a dependency graph, and a features.json for session chaining.
This is the second gate in the SDLC pipeline. The planner agent reads an approved BRD, or an existing set of user stories, and normalizes them into structured, independently executable units of work. Every implementation-ready story gets testable acceptance criteria, a layer assignment, a dependency group, and a readiness marker. A machine-readable root features.json is generated from those criteria so the evaluator can track pass/fail state across sessions.
Read the file at the path provided as the argument. Confirm the document exists and is an approved BRD. If the file is missing, halt and ask the human to run /brd first.
Invoke .claude/skills/clarify/SKILL.md only if the BRD or existing stories contain uncertainty that affects story readiness, dependencies, acceptance criteria, layer assignment, or whether a story must be split.
Use the clarification budget:
needs_breakdown over extending the interview.Notes.Group related functionality into epics. Rules:
E1, E2, E3 ...specs/stories/epics.md.For each story:
Story ID: E{n}-S{n} (e.g., E1-S2)
Required fields per story:
title: Short imperative phrase (e.g., "User can register with email and password")description: 2-4 sentences of context and motivationuser_story: "As a , I want so that ."acceptance_criteria: 3-6 items. Each criterion must be:
layer: One of Types | Config | Repository | Service | API | UIgroup: Dependency group letter (A, B, C ...) — see Step 4depends_on: List of story IDs this story depends on (empty list if group A)readiness: ready | needs_breakdownbreakdown_reason: Required when readiness is needs_breakdown; otherwise nullReadiness rule: A story is ready only when it can be implemented by one teammate without further product decomposition and has 3-6 concrete acceptance criteria. Mark it needs_breakdown when it combines unrelated workflows, has multiple independent user goals, lacks verifiable criteria, requires unresolved product decisions, or would force multiple teammates to own the same broad scope.
Do not assign needs_breakdown stories to an implementation group. Either break them into smaller ready stories before writing the dependency graph, or place them in specs/stories/backlog-needs-breakdown.md for human review.
Write specs/stories/dependency-graph.md with:
Format each group as a table showing Story ID, Title, Layer, and Dependencies.
Rules:
Write each story to: specs/stories/E{n}-S{n}.md
Each file includes: ID, title, description, user_story, acceptance criteria, layer, group, depends_on, readiness, and breakdown_reason.
Use this shape:
# E1-S1 — User can register with email and password
## Metadata
- Epic: E1 — User Authentication
- Layer: API
- Group: A
- Depends On: []
- Readiness: ready
- Breakdown Reason: null
## User Story
As a visitor, I want to create an account with email and password so that I can access protected features.
## Description
...
## Acceptance Criteria
- ...
features.jsonTransform every acceptance criterion into one or more testable features.
Mapping rule: Each acceptance criterion produces 1-3 feature entries. The feature description must be a specific, observable behavior. Each feature has executable steps describing how to verify it.
Output file: features.json at the project root.
Do not write specs/features.json. features.json is root-level because /auto, /evaluate, and session chaining read it from the project root.
Schema for each feature entry:
{
"id": "F001",
"category": "functional",
"story": "E1-S1",
"group": "A",
"description": "User registration endpoint returns 201 with user ID on valid input",
"steps": [
"POST /api/auth/register with valid email and password",
"Assert response status is 201",
"Assert response body contains a non-null userId field"
],
"passes": false,
"last_evaluated": null,
"failure_reason": null,
"failure_layer": null
}
Field rules:
id: Sequential, zero-padded to 3 digits (F001, F002 ...)category: functional | integration | ui | security | performancestory: Story ID this feature belongs togroup: Inherited from the story's dependency groupdescription: Single sentence, specific and observablesteps: Ordered list of verification steps (at least 2)passes: Always false at generation timelast_evaluated: Always null at generation timefailure_reason: Always null at generation timefailure_layer: Always null at generation timeEvery acceptance criterion must map to at least one feature. No criteria may be omitted.
specs/stories/story-traces.jsonWrite the machine-readable spine that grounds the stories to the BRD requirements and seeds the test layer. One entry per story, each with a stable id, its BRD-requirement traces, and the stable ids of its acceptance criteria:
[
{ "id": "E1-S1", "text": "User registration endpoint", "traces": ["BR-1"],
"acs": ["E1-S1-AC1", "E1-S1-AC2"] },
{ "id": "E1-S2", "text": "Login endpoint", "traces": ["BR-1", "BR-3"],
"acs": ["E1-S2-AC1"] }
]
Every story must carry at least one BR-n trace (the ids in specs/brd/brd-requirements.json). A story that traces to no BRD requirement is scope the BRD never authorized — either remove it, or escalate to the human and add the requirement to the BRD first (re-run /brd). Give each acceptance criterion a stable {story}-AC{n} id; /test traces its test cases to these.
specs/brd/brd-requirements.json exists]If the BRD was produced with a machine-readable spine (FRD-grounded /brd), prove mechanically — not by judgement — that the stories invented and dropped nothing relative to it:
node .claude/scripts/trace-check.js \
--required specs/brd/brd-requirements.json \
--downstream specs/stories/story-traces.json \
--layer spec \
--out specs/reviews/spec-grounding.json
The verdict (specs/reviews/spec-grounding.json — { pass, required_covered, net_new[], dropped[] }) is a hard gate, independent of the rubric score:
net_new non-empty → a story introduces scope tracing to no BRD requirement. Remove it, or get the requirement into the BRD first.dropped non-empty → a BRD requirement that no story realizes. Add a story covering it (or, if intentionally deferred, record the deferral and re-run /brd so the BRD reflects it).Only proceed to Step 6.5 when spec-grounding.json#pass === true. (Skip this step if brd-requirements.json does not exist — an older or interview-only BRD; fall back to the LLM traceability check in Step 6.5 alone.)
Spawn the evaluator agent (artifact mode) to validate the spec against the BRD.
Agent invocation:
Spawn Agent with subagent_type="evaluator" and prompt:
Ratchet loop (max 3 iterations):
Traceability report shown to human:
Display:
/design, or provide corrections."| File | Purpose |
|---|---|
specs/stories/epics.md | Epic index with story membership and readiness summary |
specs/stories/dependency-graph.md | Parallel execution groups with dependency mapping |
specs/stories/E{n}-S{n}.md | One file per story |
specs/stories/backlog-needs-breakdown.md | Optional list of oversized or ambiguous stories that cannot enter implementation |
features.json | Machine-readable feature list for evaluator |
specs/stories/story-traces.json | Trace spine: each story's BR-n traces + stable AC ids (grounds spec to BRD, seeds /test) |
specs/reviews/spec-grounding.json | (FRD-grounded BRD) deterministic spec-vs-BRD verdict (pass, net_new[], dropped[]) |
Grounding gate (FRD-grounded BRD) — hard block. trace-check.js proves mechanically that no story invented scope (net_new) and no BRD requirement was dropped (dropped) — see Step 6.45. Any violation blocks before the rubric runs, independent of quality score.
Phase evaluation gate runs before human review. The evaluator agent (artifact mode) validates:
spec-grounding.json when present, else every story traces to a BRD goal)Human review is still required before proceeding to /design. The evaluator validates structure and traceability; the human validates product intent.
Pre-approval checklist (verified by evaluator, confirmed by human):
readiness: ready before it appears in dependency-graph.mdfeatures.jsonpasses fields are falseDo not auto-advance. Wait for explicit approval or correction.
needs_breakdown, it must not appear in a dependency group or features.json. Break it down first.Discover and map an existing codebase before planning or changing it.
Change the behavior of existing code — story-driven by default, or --issue N for a GitHub bug fix. Test-first, full verification, code review.
Use when a planned change touches persisted data shape — ORM models, migration files, schema definitions, serialized formats, or message contracts — in /change, /refactor, or /implement on an existing codebase. Routes schema changes through expand-contract and proves reversibility before any deploy.
Generate production code and tests for a story group using agent teams for parallel execution.
Refactor existing code for quality, performance, or maintainability. Enforces core quality principles with ratchet gate.
Generate test plan, test cases, test data fixtures, and Playwright E2E tests mapped to acceptance criteria.