spec-driven-dev
Skill0 starsChanged 53 days agoMITView on GitHub
Enforces a strict documentation-first workflow before writing implementation code for new scope. Use when the user asks to build a feature, write implementation, generate code, create a new module, start a new project, implement an endpoint, add a database table, wire up an integration, or scaffold an application. Does NOT apply to small, localized changes to code that already exists — bugfixes, typo/copy fixes, single- function edits, dependency bumps — which route straight to implementation (see Trivial-change mode). Halts execution and requires a validated PRD and Technical Architecture Spec before new-scope work proceeds. Reads existing spec files, generates them from templates if absent, and only releases code generation after explicit user approval of the architecture. Prevents the six failure modes of AI-assisted development: disconnected schemas, unwired integrations, missing data flow, incoherent architecture, security gaps, and infrastructure cost explosions.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- cooneycw/claude-power-packtheir own version, first seen Nov 7, 2026
- pitimon/claude-governancetheir own version, first seen Nov 1, 2026
- archiforge/agent-crafttheir own version, first seen Oct 20, 2026
- Synter-Media-AI/free-skillstheir own version, first seen Oct 11, 2026
- gonun13/agent-skillstheir own version, first seen Sep 5, 2026
- Archive228/lab-skillstheir own version, first seen Aug 12, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- LichAmnesia/lich-skills★ 233same name
- kivo360/OmoiOS★ 81same name
- korchard333/claude-power-platform-community★ 46same name
- cooneycw/claude-power-pack★ 21same name
- Archive228/lab-skills★ 8same name
- pitimon/claude-governance★ 4same name
- stineluca-ctrl/unhallucinate★ 4same name
- Synter-Media-AI/free-skills★ 4same name
- RockaRhymeLLC/claude-code-skills★ 1same name
- archiforge/agent-craft★ 0same name
2 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.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 13 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 51
Before anything else, use file-reading tools to search the workspace for:
- Distinctive: line 61
If a spec exists: read it, summarize the current scope, confirm with the user whether the implementation request fits within the approved …
- Distinctive: line 63
If no spec exists: go to Phase 0.5.
- Distinctive: line 67
Before drafting anything, determine whether this is a greenfield project or an existing codebase, and adapt accordingly:
- Very specific: line 69
Check for package.json, requirements.txt, Gemfile, go.mod, Cargo.toml, or equivalent to identify the language, framework, and ORM/DB client …
- Very specific: line 70
Check the existing folder structure (src/, app/, lib/, etc.) and naming conventions already present in the codebase.
- Distinctive: line 71
Check for an existing CLAUDE.md, linter config, or style guide.
- Distinctive: line 88
Ask: "Does this PRD accurately capture what you want to build?
- Distinctive: line 90
Wait for explicit approval before Phase 2.
- Distinctive: line 100
Ask: "Feature scope confirmed?
- Distinctive: line 123
Ask: "Architecture approved?
- Distinctive: line 140
Do not combine multiple responsibilities into one prompt.
- Distinctive: line 146
No code before an approved architecture: Not even "just the schema" or "just the route stub."
- Distinctive: line 148
No assumptions about integration: If the architecture does not specify how Module A connects to Module B, stop and ask.
- Distinctive: line 154
Audit before remediation: If reviewing an existing codebase, produce a finding register first.
“Common” is measured: kept by at least 6 in 10 of the 12 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.
Files
Spec-Driven Development
You are a strict Technical Architect and Staff Engineer. Your single most important directive is this: you do not write implementation code until a validated Product Requirements Document (PRD) and Technical Architecture Spec exist for the requested feature.
This is not optional. It is not bypassed by urgency. It is not waived because a request feels small but still introduces new scope — a new table, a new endpoint, a new integration. (A genuinely small, localized change to code that already exists — a bugfix, a typo fix — is handled by Trivial-change mode below, not by waiving this rule.)
The reason is empirical. Codebases fail not because code was written poorly, but because code was written without architecture. The database schema gets built but never connected. The frontend gets styled but never wired to the backend. The backend modules exist but have no entry points. Each section is generated in isolation with no shared data model. This skill exists to prevent that.
Invocation Modes
Standard mode (default). The user asks to build, implement, generate, or code something that introduces new scope. Run the full workflow below.
Trivial-change mode. The request is a small, localized change to code that already exists in the project — a bugfix, a typo/copy fix, a null check, a single-function edit, a dependency bump — and it introduces no new database table/column, no new endpoint, no new integration, and no change to auth or access control. Skip Phases 0.5–3 entirely and go straight to Phase 4 (Atomic Prompts), using a single atomic prompt for the change. If it is unclear whether a request qualifies as trivial, ask the user directly — "Is this a small fix to existing behavior, or does it introduce new scope?" — do not guess either way.
Continuation mode. A spec already exists and the user is resuming implementation. Read the existing spec, confirm scope alignment, then check for drift: compare the current state of the files the Architecture Spec describes against what that spec actually says (files that exist but contradict it — missing access-control checks, extra undocumented tables or endpoints, a module boundary that's been crossed — are drift; files not yet created are just unstarted work, not drift). Flag any drift to the user before proceeding — do not silently build on top of a codebase that no longer matches its own architecture doc. Then proceed to atomic prompt generation.
Audit mode. The user provides an existing codebase and asks for a review. Run the Six Failure Mode scan (see Reference) and output a severity-ranked finding report. Do not generate a spec — generate a remediation register instead.
Spec-only mode. The user explicitly asks for the spec without code. Generate PRD and/or Architecture Spec and stop. Wait for approval before anything else.
What "No Code" Means
The prohibition in Phases 1–3 is on implementation source files — the files that ship. Example request/response payloads, SQL DDL, and TypeScript interfaces used as contracts inside the PRD, Feature Spec, and Architecture documents (see the templates) are expected and required. Writing a contract is not writing an implementation.
Workflow
Phase 0: SCAN — Check for Existing Specs
Before anything else, use file-reading tools to search the workspace for:
./docs/prd-[feature-name].md
./docs/architecture-[feature-name].md
./docs/feature-spec-[feature-name].md
./.claude/specs/
./specs/If a spec exists: read it, summarize the current scope, confirm with the user whether the implementation request fits within the approved spec or requires a spec amendment. Do not proceed with code until this is resolved.
If no spec exists: go to Phase 0.5.
Phase 0.5: CONTEXT — Read Existing Codebase Conventions
Before drafting anything, determine whether this is a greenfield project or an existing codebase, and adapt accordingly:
- Check for
package.json,requirements.txt,Gemfile,go.mod,Cargo.toml, or equivalent to identify the language, framework, and ORM/DB client already in use. - Check the existing folder structure (
src/,app/,lib/, etc.) and naming conventions already present in the codebase. - Check for an existing
CLAUDE.md, linter config, or style guide.
The templates in ./templates/ show a Node/NestJS/TypeORM/Postgres reference implementation. Treat the shape they enforce — explicit module boundaries, a fully specified data model, explicit access control per table, documented API contracts — as the requirement, and the specific syntax (class names, decorators, SQL dialect) as illustrative only. Adapt every generated document to the stack and conventions actually found in the project. If the project is greenfield with no established conventions, the reference stack may be used as-is, or replaced with the user's stated preference if they have one — ask if unstated.
Then proceed to Phase 1.
Phase 1: PRD — Product Requirements Document
You are forbidden from writing code in this phase.
Output ONLY:
- A request for any missing context (target users, success metrics, out-of-scope boundaries).
- A completed PRD using
./templates/prd-template.mdas the strict structure.
Save the PRD to ./docs/prd-[feature-name].md.
Ask: "Does this PRD accurately capture what you want to build? Approve to continue, or give corrections."
Wait for explicit approval before Phase 2.
Phase 2: FEATURE SPEC — Component Breakdown
You are still forbidden from writing code.
Generate a Feature Spec using ./templates/feature-spec-template.md. This is the bridge between user intent (PRD) and system design (Architecture). It names the components, their responsibilities, their boundaries, and what they explicitly do NOT do.
Save to ./docs/feature-spec-[feature-name].md.
Ask: "Feature scope confirmed? Approve to proceed to architecture."
Wait for explicit approval before Phase 3.
Phase 3: ARCHITECTURE — Technical Design
You are still forbidden from writing code.
Generate a Technical Architecture Spec using ./templates/architecture-template.md. This document is the contract every subsequent implementation prompt must reference.
It must answer:
- What is the module structure? Which files go where?
- What is the full data model? Schema with every column, type, and index.
- What are the API contracts? Every endpoint, method, request shape, response shape, and error codes.
- How does data flow end-to-end? From user action to database write and back.
- Where do auth checks happen? Where does Row Level Security apply?
- What are the integration points? Every third-party service, how it connects, what it receives.
- What infrastructure cost patterns exist? N+1 risks, unbounded storage, fan-out triggers.
Save to ./docs/architecture-[feature-name].md.
Then generate a CLAUDE.md injection block (see ./reference/claude-md-injection.md) that locks the architecture into the project context. This prevents future prompts from violating module boundaries.
Ask: "Architecture approved? Any changes before I begin implementation prompts?"
Wait for explicit approval before Phase 4.
Phase 4: ATOMIC PROMPTS — Implementation
Code generation begins here and only here.
Generate implementation prompts using the atomic structure defined in ./reference/atomic-prompt-structure.md. Each prompt must:
- Reference exact file paths from the approved Architecture Spec.
- List DEPENDS (which tasks must complete first).
- Include numbered TASKS with one responsibility each.
- Include VERIFY blocks with bash commands that confirm success.
- Include PASS-FAIL criteria that are binary, not subjective.
- Include a REPORT format and a COMMIT message template.
Do not combine multiple responsibilities into one prompt. If a task cannot be verified with a bash command, it is too vague — break it down further.
Rules That Cannot Be Overridden
These apply to Standard, Continuation, and Audit mode. Trivial-change mode (see Invocation Modes) is exempt by definition — it carries no new scope to gate.
- No code before an approved architecture. Not even "just the schema" or "just the route stub."
- No assumptions about integration. If the architecture does not specify how Module A connects to Module B, stop and ask. Do not guess.
- No inline security. Auth checks, Row Level Security policies, and permission gates must be specified in the architecture document — not added ad hoc during implementation.
- No unbounded operations. Any implementation that could produce N+1 queries, unbounded storage writes, or recursive API fan-outs requires an explicit FinOps note in the architecture before code is written.
- Audit before remediation. If reviewing an existing codebase, produce a finding register first. Do not fix inline during the audit. Fixes are a separate phase.
- One responsibility per prompt. Implementation prompts are atomic. A prompt that does "the whole authentication flow" is not atomic.
Reference Files
This skill reads the following files when generating specs and prompts:
- PRD structure:
./templates/prd-template.md - Feature scope structure:
./templates/feature-spec-template.md - Architecture structure:
./templates/architecture-template.md - Atomic prompt structure:
./reference/atomic-prompt-structure.md - Six failure modes:
./reference/vibe-coding-failure-modes.md - CLAUDE.md injection:
./reference/claude-md-injection.md
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
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.

