afc-spec
Generate feature specification โ write requirements, acceptance criteria, scope
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Generate feature specification โ write requirements, acceptance criteria, scope
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Code and component analysis โ analyze code, trace flows, audit consistency, inspect components
Architecture analysis and design review
Full auto pipeline โ run spec-to-clean cycle automatically for new features
Save session state for later resumption
Resolve spec ambiguities with clarifying questions
Pipeline artifact cleanup and codebase hygiene
Based on SOC occupation classification
| name | afc:spec |
| description | Generate feature specification โ write requirements, acceptance criteria, scope |
| argument-hint | [feature description in natural language] |
| allowed-tools | ["Read","Glob","Grep","Write","WebSearch","WebFetch"] |
| model | sonnet |
Converts a natural language feature description into a structured specification (spec.md). Validates completeness with convergence-based Critic Loop. Operates on pure prompts without external scripts.
$ARGUMENTS โ (required) Feature description in natural language!cat .claude/afc.config.md 2>/dev/null || echo "[CONFIG NOT FOUND] .claude/afc.config.md not found. Create it with /afc:init."
Always read .claude/afc.config.md first (read manually if not auto-loaded above).
If config file is missing:
.claude/afc.config.md not found. Run /afc:init to set up the project?"/afc:init, then restart this command with the original $ARGUMENTSBRANCH_NAME$ARGUMENTSuser-auth)YYYY-MM-DD format (e.g., 2026-03-13-user-auth).claude/afc/specs/{YYYY-MM-DD}-{feature-name}/ (create parent .claude/afc/specs/ directory if it does not exist)Before writing the spec, understand the current project structure:
{config.architecture} layer$ARGUMENTS implies multiple unrelated concerns or changes that span different architectural boundaries, warn and suggest splitting. Judge by the diversity and independence of concerns, not by file count โ a well-organized feature touching many files in one module is fine, while a small change spanning security, database, and UI layers may be over-scoped."No spec generated โ {reason}." and suggest the appropriate alternative.Detect whether $ARGUMENTS references external libraries, APIs, or technologies not already present in the codebase:
$ARGUMENTS"{library/API name} latest stable version usage guide {current year}"mcp__context7__resolve-library-id โ mcp__context7__query-docs) for library-specific documentation.claude/afc/specs/{YYYY-MM-DD}-{feature-name}/research-notes.md (lightweight spec-scoped notes; distinct from plan phase's research.md which covers deep technical research)[RESEARCHED] for traceabilityResearch here is lightweight and spec-scoped โ just enough to write accurate requirements. Deep technical research (alternatives comparison, migration paths) belongs in
/afc:planPhase 0.
Create .claude/afc/specs/{YYYY-MM-DD}-{feature-name}/spec.md following the template in ${CLAUDE_SKILL_DIR}/spec-template.md. Read it first, then generate the spec using that structure.
After writing the spec, check for [NEEDS CLARIFICATION] items:
[NEEDS CLARIFICATION] items exist: skip, proceed to Step 4/afc:spec directly):
[NEEDS CLARIFICATION] with resolved text)[NEEDS CLARIFICATION] and note in final output/afc:auto: skip this step entirely (auto.md handles auto-resolution in Phase 1)This replaces the previous pattern of always deferring to
/afc:clarify. Standalone spec now resolves ambiguities immediately when the user is present./afc:clarifyremains available for revisiting specs later.
If .claude/afc/memory/retrospectives/ directory exists, load the most recent 10 files (sorted by filename descending) and check:
[AUTO-RESOLVED] items that turned out wrong? Flag similar patterns.Always read
${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.mdfirst and follow it.
Run the critic loop until convergence. Safety cap: 5 passes.
| Criterion | Validation |
|---|---|
| COMPLETENESS | Does every User Story have acceptance scenarios? Are any requirements missing? |
| MEASURABILITY | Are the success criteria measurable, not subjective? |
| INDEPENDENCE | Are implementation details (code, library names) absent from the spec? |
| EDGE_CASES | Are at least 2 edge cases identified? Any missing boundary conditions? |
| TESTABILITY | Does every System Requirement follow one of the 5 EARS patterns (WHEN/WHILE/IF/WHERE/SHALL)? Does each EARS requirement have a mapped TC (โ TC: should_...)? If not โ FAIL and auto-fix: rewrite to EARS + generate TC mapping. |
Follow verdict handling and output format per docs/critic-loop-rules.md.
When not running inside /afc:auto, save progress for /afc:resume:
.claude/afc/memory/ directory if it does not exist (mkdir -p .claude/afc/memory/).claude/afc/memory/checkpoint.md with: branch, last commit (or "none" if empty repo), feature name, current phase (spec complete), next step (/afc:plan)Spec generated
โโ .claude/afc/specs/{YYYY-MM-DD}-{feature-name}/spec.md
โโ User Stories: {count}
โโ Requirements: FR {count}, NFR {count}
โโ Research: {N} external references researched / skipped (all internal)
โโ Clarified: {N} items resolved inline / {M} deferred
โโ Unresolved: {[NEEDS CLARIFICATION] count}
โโ Next step: /afc:plan (unresolved items will be flagged at plan start)
$ARGUMENTS is empty, ask user for a feature description./afc:auto, [AUTO-SUGGESTED] NFRs are included automatically. Review after completion is recommended.