Spec to repo skill

Use when the user says 'build me an app', 'create a project from this spec', 'scaffold a new repo', 'generate a starter', 'turn this idea into code', 'bootstrap a project', 'I have requirements and need a codebase', or provides a natural-language project specification and expects a complete, runnable repository.

by alirezarezvani·MIT license·★ 26,349 Stars on the repo·GitHub ↗

Use now

Files of Spec to repo

alirezarezvani/main1 file shown
SKILL.md
Show the full text275 lines

Spec to Repo

Turn a natural-language project specification into a complete, runnable starter repository. Not a template filler — a spec interpreter that generates real, working code for any stack.

When to Use

  • User provides a text description of an app and wants code
  • User has a PRD, requirements doc, or feature list and needs a codebase
  • User says "build me an app that...", "scaffold this", "bootstrap a project"
  • User wants a working starter repo, not just a file tree

Not this skill when the user wants a SaaS app with Stripe + Auth specifically — use product-team/saas-scaffolder instead.

Core Workflow

Phase 1 — Parse & Interpret

Read the spec. Extract these fields silently:

Field Source Required
App name Explicit or infer from description yes
Description First sentence of spec yes
Features Bullet points or sentences describing behavior yes
Tech stack Explicit ("use FastAPI") or infer from context yes
Auth "login", "users", "accounts", "roles" if mentioned
Database "store", "save", "persist", "records", "schema" if mentioned
API surface "endpoint", "API", "REST", "GraphQL" if mentioned
Deploy target "Vercel", "Docker", "AWS", "Railway" if mentioned

Stack inference rules (when user doesn't specify):

Signal Inferred stack
"web app", "dashboard", "SaaS" Next.js + TypeScript
"API", "backend", "microservice" FastAPI (Python) or Express (Node)
"mobile app" Flutter or React Native
"CLI tool" Go or Python
"data pipeline" Python
"high performance", "systems" Rust or Go

After parsing, present a structured interpretation back to the user:

## Spec Interpretation

**App:** [name]
**Stack:** [framework + language]
**Features:**
1. [feature]
2. [feature]

**Database:** [yes/no — engine]
**Auth:** [yes/no — method]
**Deploy:** [target]

Does this match your intent? Any corrections before I generate?

Flag ambiguities. Ask at most 3 clarifying questions. If the user says "just build it", proceed with best-guess defaults.

Phase 2 — Architecture

Design the project before writing any files:

  1. Select template — Match to a stack template from references/stack-templates.md
  2. Define file tree — List every file that will be created
  3. Map features to files — Each feature gets at minimum one file/component
  4. Design database schema — If applicable, define tables/collections with fields and types
  5. Identify dependencies — List every package with version constraints
  6. Plan API routes — If applicable, list every endpoint with method, path, request/response shape

Present the file tree to the user before generating:

project-name/
├── README.md
├── .env.example
├── .gitignore
├── .github/workflows/ci.yml
├── package.json / requirements.txt / go.mod
├── src/
│   ├── ...
├── tests/
│   ├── ...
└── ...
Phase 3 — Generate

Write every file. Rules:

  • Real code, not stubs. Every function has a real implementation. No // TODO: implement or pass placeholders.
  • Syntactically valid. Every file must parse without errors in its language.
  • Imports match dependencies. Every import must correspond to a package in the manifest (package.json, requirements.txt, go.mod, etc.).
  • Types included. TypeScript projects use types. Python projects use type hints. Go projects use typed structs.
  • Environment variables. Generate .env.example with every required variable, commented with purpose.
  • README.md. Include: project description, prerequisites, setup steps (clone, install, configure env, run), and available scripts/commands.
  • CI config. Generate .github/workflows/ci.yml with: install, lint (if linter in deps), test, build.
  • .gitignore. Stack-appropriate ignores (node_modules, pycache, .env, build artifacts).

File generation order:

  1. Manifest (package.json / requirements.txt / go.mod)
  2. Config files (.env.example, .gitignore, CI)
  3. Database schema / migrations
  4. Core business logic
  5. API routes / endpoints
  6. UI components (if applicable)
  7. Tests
  8. README.md
Phase 4 — Validate

After generation, run through this checklist:

  • Every imported package exists in the manifest
  • Every file referenced by an import exists in the tree
  • .env.example lists every env var used in code
  • .gitignore covers build artifacts and secrets
  • README has setup instructions that actually work
  • No hardcoded secrets, API keys, or passwords
  • At least one test file exists
  • Build/start command is documented and would work

Run scripts/validate_project.py against the generated directory to catch common issues.

Examples

Example 1: Task Management API

Input spec:

"Build me a task management API. Users can create, list, update, and delete tasks. Tasks have a title, description, status (todo/in-progress/done), and due date. Use FastAPI with SQLite. Add basic auth with API keys."

Output file tree:

task-api/
├── README.md
├── .env.example              # API_KEY, DATABASE_URL
├── .gitignore
├── .github/workflows/ci.yml
├── requirements.txt          # fastapi, uvicorn, sqlalchemy, pytest
├── main.py                   # FastAPI app, CORS, lifespan
├── models.py                 # SQLAlchemy Task model
├── schemas.py                # Pydantic request/response schemas
├── database.py               # SQLite engine + session
├── auth.py                   # API key middleware
├── routers/
│   └── tasks.py              # CRUD endpoints
└── tests/
    └── test_tasks.py         # Smoke tests for each endpoint
Example 2: Recipe Sharing Web App

Input spec:

"I want a recipe sharing website. Users sign up, post recipes with ingredients and steps, browse other recipes, and save favorites. Use Next.js with Tailwind. Store data in PostgreSQL."

Output file tree:

recipe-share/
├── README.md
├── .env.example              # DATABASE_URL, NEXTAUTH_SECRET, NEXTAUTH_URL
├── .gitignore
├── .github/workflows/ci.yml
├── package.json              # next, react, tailwindcss, prisma, next-auth
├── tailwind.config.ts
├── tsconfig.json
├── next.config.ts
├── prisma/
│   └── schema.prisma         # User, Recipe, Ingredient, Favorite models
├── src/
│   ├── app/
│   │   ├── layout.tsx
│   │   ├── page.tsx          # Homepage — recipe feed
│   │   ├── recipes/
│   │   │   ├── page.tsx      # Browse recipes
│   │   │   ├── [id]/page.tsx # Recipe detail
│   │   │   └── new/page.tsx  # Create recipe form
│   │   └── api/
│   │       ├── auth/[...nextauth]/route.ts
│   │       └── recipes/route.ts
│   ├── components/
│   │   ├── RecipeCard.tsx
│   │   ├── RecipeForm.tsx
│   │   └── Navbar.tsx
│   └── lib/
│       ├── prisma.ts
│       └── auth.ts
└── tests/
    └── recipes.test.ts
Example 3: CLI Expense Tracker

Input spec:

"Python CLI tool for tracking expenses. Commands: add, list, summary, export-csv. Store in a local SQLite file. No external API."

Output file tree:

expense-tracker/
├── README.md
├── .gitignore
├── .github/workflows/ci.yml
├── pyproject.toml
├── src/
│   └── expense_tracker/
│       ├── __init__.py
│       ├── cli.py            # argparse commands
│       ├── database.py       # SQLite operations
│       ├── models.py         # Expense dataclass
│       └── formatters.py     # Table + CSV output
└── tests/
    └── test_cli.py

Anti-Patterns

Anti-pattern Fix
Placeholder code — // TODO: implement, pass, empty function bodies Every function has a real implementation. If complex, implement a working simplified version.
Stack override — picking Next.js when the user said Flask Always honor explicit tech preferences. Only infer when the user doesn't specify.
Missing .gitignore — committing node_modules or .env Generate stack-appropriate .gitignore as one of the first files.
Phantom imports — importing packages not in the manifest Cross-check every import against package.json / requirements.txt before finishing.
Over-engineering MVP — adding Redis caching, rate limiting, WebSockets to a v1 Build the minimum that works. The user can iterate.
Ignoring stated preferences — user says "PostgreSQL" and you generate MongoDB Parse the spec carefully. Explicit preferences are non-negotiable.
Missing env vars — code reads process.env.X but .env.example doesn't list it Every env var used in code must appear in .env.example with a comment.
No tests — shipping a repo with zero test files At minimum: one smoke test per API endpoint or one test per core function.
Hallucinated APIs — generating code that calls library methods that don't exist Stick to well-documented, stable APIs. When unsure, use the simplest approach.

Validation Script

scripts/validate_project.py

Checks a generated project directory for common issues:

# Validate a generated project
python3 scripts/validate_project.py /path/to/generated-project

# JSON output
python3 scripts/validate_project.py /path/to/generated-project --format json

Checks performed:

  • README.md exists and is non-empty
  • .gitignore exists
  • .env.example exists (if code references env vars)
  • Package manifest exists (package.json, requirements.txt, go.mod, Cargo.toml, pubspec.yaml)
  • No .env file committed (secrets leak)
  • At least one test file exists
  • No TODO/FIXME placeholders in generated code

Progressive Enhancement

For complex specs, generate in stages:

  1. MVP — Core feature only, working end-to-end
  2. Auth — Add authentication if requested
  3. Polish — Error handling, validation, loading states
  4. Deploy — Docker, CI, deploy config

Ask the user after MVP: "Core is working. Want me to add auth/polish/deploy next, or iterate on what's here?"

Cross-References

  • Related: product-team/saas-scaffolder — SaaS-specific scaffolding (Next.js + Stripe + Auth)
  • Related: engineering/spec-driven-workflow — spec-first development methodology
  • Related: engineering/database-designer — database schema design patterns
  • Related: engineering-team/senior-fullstack — full-stack implementation patterns
1---
2name: spec-to-repo
3description: "Use when the user says 'build me an app', 'create a project from this spec', 'scaffold a new repo', 'generate a starter', 'turn this idea into code', 'bootstrap a project', 'I have requirements and need a codebase', or provides a natural-language project specification and expects a complete, runnable repository. Stack-agnostic: Next.js, FastAPI, Rails, Go, Rust, Flutter, and more."
4---
5 
6# Spec to Repo
7 
8Turn a natural-language project specification into a complete, runnable starter repository. Not a template filler — a spec interpreter that generates real, working code for any stack.
9 
10## When to Use
11 
12- User provides a text description of an app and wants code
13- User has a PRD, requirements doc, or feature list and needs a codebase
14- User says "build me an app that...", "scaffold this", "bootstrap a project"
15- User wants a working starter repo, not just a file tree
16 
17**Not this skill** when the user wants a SaaS app with Stripe + Auth specifically — use `product-team/saas-scaffolder` instead.
18 
19## Core Workflow
20 
21### Phase 1 — Parse & Interpret
22 
23Read the spec. Extract these fields silently:
24 
25| Field | Source | Required |
26|-------|--------|----------|
27| App name | Explicit or infer from description | yes |
28| Description | First sentence of spec | yes |
29| Features | Bullet points or sentences describing behavior | yes |
30| Tech stack | Explicit ("use FastAPI") or infer from context | yes |
31| Auth | "login", "users", "accounts", "roles" | if mentioned |
32| Database | "store", "save", "persist", "records", "schema" | if mentioned |
33| API surface | "endpoint", "API", "REST", "GraphQL" | if mentioned |
34| Deploy target | "Vercel", "Docker", "AWS", "Railway" | if mentioned |
35 
36**Stack inference rules** (when user doesn't specify):
37 
38| Signal | Inferred stack |
39|--------|---------------|
40| "web app", "dashboard", "SaaS" | Next.js + TypeScript |
41| "API", "backend", "microservice" | FastAPI (Python) or Express (Node) |
42| "mobile app" | Flutter or React Native |
43| "CLI tool" | Go or Python |
44| "data pipeline" | Python |
45| "high performance", "systems" | Rust or Go |
46 
47After parsing, present a structured interpretation back to the user:
48 
49```
50## Spec Interpretation
51 
52**App:** [name]
53**Stack:** [framework + language]
54**Features:**
551. [feature]
562. [feature]
57 
58**Database:** [yes/no — engine]
59**Auth:** [yes/no — method]
60**Deploy:** [target]
61 
62Does this match your intent? Any corrections before I generate?
63```
64 
65Flag ambiguities. Ask **at most 3** clarifying questions. If the user says "just build it", proceed with best-guess defaults.
66 
67### Phase 2 — Architecture
68 
69Design the project before writing any files:
70 
711. **Select template** — Match to a stack template from `references/stack-templates.md`
722. **Define file tree** — List every file that will be created
733. **Map features to files** — Each feature gets at minimum one file/component
744. **Design database schema** — If applicable, define tables/collections with fields and types
755. **Identify dependencies** — List every package with version constraints
766. **Plan API routes** — If applicable, list every endpoint with method, path, request/response shape
77 
78Present the file tree to the user before generating:
79 
80```
81project-name/
82├── README.md
83├── .env.example
84├── .gitignore
85├── .github/workflows/ci.yml
86├── package.json / requirements.txt / go.mod
87├── src/
88│ ├── ...
89├── tests/
90│ ├── ...
91└── ...
92```
93 
94### Phase 3 — Generate
95 
96Write every file. Rules:
97 
98- **Real code, not stubs.** Every function has a real implementation. No `// TODO: implement` or `pass` placeholders.
99- **Syntactically valid.** Every file must parse without errors in its language.
100- **Imports match dependencies.** Every import must correspond to a package in the manifest (package.json, requirements.txt, go.mod, etc.).
101- **Types included.** TypeScript projects use types. Python projects use type hints. Go projects use typed structs.
102- **Environment variables.** Generate `.env.example` with every required variable, commented with purpose.
103- **README.md.** Include: project description, prerequisites, setup steps (clone, install, configure env, run), and available scripts/commands.
104- **CI config.** Generate `.github/workflows/ci.yml` with: install, lint (if linter in deps), test, build.
105- **.gitignore.** Stack-appropriate ignores (node_modules, __pycache__, .env, build artifacts).
106 
107**File generation order:**
1081. Manifest (package.json / requirements.txt / go.mod)
1092. Config files (.env.example, .gitignore, CI)
1103. Database schema / migrations
1114. Core business logic
1125. API routes / endpoints
1136. UI components (if applicable)
1147. Tests
1158. README.md
116 
117### Phase 4 — Validate
118 
119After generation, run through this checklist:
120 
121- [ ] Every imported package exists in the manifest
122- [ ] Every file referenced by an import exists in the tree
123- [ ] `.env.example` lists every env var used in code
124- [ ] `.gitignore` covers build artifacts and secrets
125- [ ] README has setup instructions that actually work
126- [ ] No hardcoded secrets, API keys, or passwords
127- [ ] At least one test file exists
128- [ ] Build/start command is documented and would work
129 
130Run `scripts/validate_project.py` against the generated directory to catch common issues.
131 
132## Examples
133 
134### Example 1: Task Management API
135 
136**Input spec:**
137> "Build me a task management API. Users can create, list, update, and delete tasks. Tasks have a title, description, status (todo/in-progress/done), and due date. Use FastAPI with SQLite. Add basic auth with API keys."
138 
139**Output file tree:**
140```
141task-api/
142├── README.md
143├── .env.example # API_KEY, DATABASE_URL
144├── .gitignore
145├── .github/workflows/ci.yml
146├── requirements.txt # fastapi, uvicorn, sqlalchemy, pytest
147├── main.py # FastAPI app, CORS, lifespan
148├── models.py # SQLAlchemy Task model
149├── schemas.py # Pydantic request/response schemas
150├── database.py # SQLite engine + session
151├── auth.py # API key middleware
152├── routers/
153│ └── tasks.py # CRUD endpoints
154└── tests/
155 └── test_tasks.py # Smoke tests for each endpoint
156```
157 
158### Example 2: Recipe Sharing Web App
159 
160**Input spec:**
161> "I want a recipe sharing website. Users sign up, post recipes with ingredients and steps, browse other recipes, and save favorites. Use Next.js with Tailwind. Store data in PostgreSQL."
162 
163**Output file tree:**
164```
165recipe-share/
166├── README.md
167├── .env.example # DATABASE_URL, NEXTAUTH_SECRET, NEXTAUTH_URL
168├── .gitignore
169├── .github/workflows/ci.yml
170├── package.json # next, react, tailwindcss, prisma, next-auth
171├── tailwind.config.ts
172├── tsconfig.json
173├── next.config.ts
174├── prisma/
175│ └── schema.prisma # User, Recipe, Ingredient, Favorite models
176├── src/
177│ ├── app/
178│ │ ├── layout.tsx
179│ │ ├── page.tsx # Homepage — recipe feed
180│ │ ├── recipes/
181│ │ │ ├── page.tsx # Browse recipes
182│ │ │ ├── [id]/page.tsx # Recipe detail
183│ │ │ └── new/page.tsx # Create recipe form
184│ │ └── api/
185│ │ ├── auth/[...nextauth]/route.ts
186│ │ └── recipes/route.ts
187│ ├── components/
188│ │ ├── RecipeCard.tsx
189│ │ ├── RecipeForm.tsx
190│ │ └── Navbar.tsx
191│ └── lib/
192│ ├── prisma.ts
193│ └── auth.ts
194└── tests/
195 └── recipes.test.ts
196```
197 
198### Example 3: CLI Expense Tracker
199 
200**Input spec:**
201> "Python CLI tool for tracking expenses. Commands: add, list, summary, export-csv. Store in a local SQLite file. No external API."
202 
203**Output file tree:**
204```
205expense-tracker/
206├── README.md
207├── .gitignore
208├── .github/workflows/ci.yml
209├── pyproject.toml
210├── src/
211│ └── expense_tracker/
212│ ├── __init__.py
213│ ├── cli.py # argparse commands
214│ ├── database.py # SQLite operations
215│ ├── models.py # Expense dataclass
216│ └── formatters.py # Table + CSV output
217└── tests/
218 └── test_cli.py
219```
220 
221## Anti-Patterns
222 
223| Anti-pattern | Fix |
224|---|---|
225| **Placeholder code** — `// TODO: implement`, `pass`, empty function bodies | Every function has a real implementation. If complex, implement a working simplified version. |
226| **Stack override** — picking Next.js when the user said Flask | Always honor explicit tech preferences. Only infer when the user doesn't specify. |
227| **Missing .gitignore** — committing node_modules or .env | Generate stack-appropriate .gitignore as one of the first files. |
228| **Phantom imports** — importing packages not in the manifest | Cross-check every import against package.json / requirements.txt before finishing. |
229| **Over-engineering MVP** — adding Redis caching, rate limiting, WebSockets to a v1 | Build the minimum that works. The user can iterate. |
230| **Ignoring stated preferences** — user says "PostgreSQL" and you generate MongoDB | Parse the spec carefully. Explicit preferences are non-negotiable. |
231| **Missing env vars** — code reads `process.env.X` but `.env.example` doesn't list it | Every env var used in code must appear in `.env.example` with a comment. |
232| **No tests** — shipping a repo with zero test files | At minimum: one smoke test per API endpoint or one test per core function. |
233| **Hallucinated APIs** — generating code that calls library methods that don't exist | Stick to well-documented, stable APIs. When unsure, use the simplest approach. |
234 
235## Validation Script
236 
237### `scripts/validate_project.py`
238 
239Checks a generated project directory for common issues:
240 
241```bash
242# Validate a generated project
243python3 scripts/validate_project.py /path/to/generated-project
244 
245# JSON output
246python3 scripts/validate_project.py /path/to/generated-project --format json
247```
248 
249Checks performed:
250- README.md exists and is non-empty
251- .gitignore exists
252- .env.example exists (if code references env vars)
253- Package manifest exists (package.json, requirements.txt, go.mod, Cargo.toml, pubspec.yaml)
254- No .env file committed (secrets leak)
255- At least one test file exists
256- No TODO/FIXME placeholders in generated code
257 
258## Progressive Enhancement
259 
260For complex specs, generate in stages:
261 
2621. **MVP** — Core feature only, working end-to-end
2632. **Auth** — Add authentication if requested
2643. **Polish** — Error handling, validation, loading states
2654. **Deploy** — Docker, CI, deploy config
266 
267Ask the user after MVP: "Core is working. Want me to add auth/polish/deploy next, or iterate on what's here?"
268 
269## Cross-References
270 
271- Related: `product-team/saas-scaffolder` — SaaS-specific scaffolding (Next.js + Stripe + Auth)
272- Related: `engineering/spec-driven-workflow` — spec-first development methodology
273- Related: `engineering/database-designer` — database schema design patterns
274- Related: `engineering-team/senior-fullstack` — full-stack implementation patterns
275 

Discussion

Alternatives

Academy guideStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Business & ops · Apache-2.0Analyze feature requestsAnalyze and prioritize a list of feature requests by theme, strategic alignment, impact, effort, and risk. Use when reviewing customer feature requests, triaging a backlog, or making prioritization decisions. · MITAdvocacy program designerUse when the user asks to "design an employee advocacy program", "set up founder-led sharing", or "build a share kit for the team"; produces an advocacy program blueprint in two modes — participation-driven opt-in (default) or top-down assigned with its coercion and authenticity risks flagged — with a voluntary opt-in roster spec submitted as channel-registry proposal events, share kits with mandatory per-person variation, staggered human posting windows plus anti-pod guardrails (no coordinated identical reshares, no engagement rings), per-person material-connection disclosure lines per FTC and 《互联网广告管理办法》, and a Slack/Teams distribution spec. Not for paid creator campaigns — use campaign-planner. 员工倡导/创始人IP分享/内部分享计划/披露合规Business & ops · Apache-2.0Act as a product managerGuides the AI to act as a product manager, assisting in writing product requirement documents and addressing product-related queries.Business & ops · CC0-1.0