# Example: Todo API

> A complete REST API built entirely with SkillFoundry — from PRD to production-ready code in two commands.

This example shows the SkillFoundry workflow end-to-end:

1. **PRD** — Define what you want (`genesis/todo-api.md`)
2. **Build** — `/forge` implements everything with quality gates

## What Gets Built

A Node.js/Express REST API with:
- CRUD endpoints for todos (`GET`, `POST`, `PUT`, `DELETE`)
- SQLite database with migrations
- Input validation
- Error handling with proper HTTP status codes
- Tests (unit + integration)
- Health check endpoint

## How to Reproduce

```bash
# 1. Create a new project
mkdir my-todo-api && cd my-todo-api
git init

# 2. Initialize SkillFoundry
npx skillfoundry init

# 3. Copy the PRD into genesis/
cp node_modules/skillfoundry/examples/todo-api/genesis/todo-api.md genesis/
# Or if using git clone install:
# cp ~/dev-tools/skillfoundry/examples/todo-api/genesis/todo-api.md genesis/

# 4. Run the pipeline (in your AI IDE)
/forge
```

That's it. The framework validates the PRD, generates implementation stories, builds the API, runs quality gates, and harvests lessons.

## Project Structure (After /forge)

```
my-todo-api/
├── src/
│   ├── index.ts              # Express app entry point
│   ├── routes/
│   │   └── todos.ts          # CRUD route handlers
│   ├── models/
│   │   └── todo.ts           # Todo model + DB queries
│   ├── middleware/
│   │   ├── validation.ts     # Input validation
│   │   └── error-handler.ts  # Centralized error handling
│   └── db/
│       ├── connection.ts     # SQLite connection
│       └── migrations/
│           └── 001-create-todos.sql
├── tests/
│   ├── routes/
│   │   └── todos.test.ts     # Integration tests
│   └── models/
│       └── todo.test.ts      # Unit tests
├── genesis/
│   └── todo-api.md           # The PRD that started it all
├── package.json
├── tsconfig.json
└── .env.example
```

## The PRD

See [genesis/todo-api.md](genesis/todo-api.md) for the full Product Requirements Document. This is the only input — everything else is generated by SkillFoundry.

## Time to Build

With a Tier 1 model (Claude Sonnet 4, GPT-4o): ~3-5 minutes for the full pipeline including quality gates.
