agentleFS
sowadalmughnisowadalmughni/spec-driven-dev/SKILL.md

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

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
  1. Distinctive:

    Before anything else, use file-reading tools to search the workspace for:

    line 51
  2. Distinctive:

    If a spec exists: read it, summarize the current scope, confirm with the user whether the implementation request fits within the approved …

    line 61
  3. Distinctive:

    If no spec exists: go to Phase 0.5.

    line 63
  4. Distinctive:

    Before drafting anything, determine whether this is a greenfield project or an existing codebase, and adapt accordingly:

    line 67
  5. Very specific:

    Check for package.json, requirements.txt, Gemfile, go.mod, Cargo.toml, or equivalent to identify the language, framework, and ORM/DB client …

    line 69
  6. Very specific:

    Check the existing folder structure (src/, app/, lib/, etc.) and naming conventions already present in the codebase.

    line 70
  7. Distinctive:

    Check for an existing CLAUDE.md, linter config, or style guide.

    line 71
  8. Distinctive:

    Ask: "Does this PRD accurately capture what you want to build?

    line 88
  9. Distinctive:

    Wait for explicit approval before Phase 2.

    line 90
  10. Distinctive:

    Ask: "Feature scope confirmed?

    line 100
  11. Distinctive:

    Ask: "Architecture approved?

    line 123
  12. Distinctive:

    Do not combine multiple responsibilities into one prompt.

    line 140
  13. Distinctive:

    No code before an approved architecture: Not even "just the schema" or "just the route stub."

    line 146
  14. Distinctive:

    No assumptions about integration: If the architecture does not specify how Module A connects to Module B, stop and ask.

    line 148
  15. Distinctive:

    Audit before remediation: If reviewing an existing codebase, produce a finding register first.

    line 154

“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.

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

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:

  1. A request for any missing context (target users, success metrics, out-of-scope boundaries).
  2. A completed PRD using ./templates/prd-template.md as 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.

  1. No code before an approved architecture. Not even "just the schema" or "just the route stub."
  2. No assumptions about integration. If the architecture does not specify how Module A connects to Module B, stop and ask. Do not guess.
  3. 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.
  4. 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.
  5. 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.
  6. 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

Download now (ZIP)

Does it work?

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

No reviews yet

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

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

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

Your trail

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

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

Now do this for your own.

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