LearnHub is a starter repository for AI-assisted Spec-Driven Development: humans write and approve the specifications, and AI coding agents (Claude Code, Codex, Copilot, Cursor and similar) implement them in Go.
LearnHub itself is a deliberately small online learning platform. The real subject is the workflow: the repository is set up so an AI agent can take a requirement ID, find its approved spec and API contract, and build exactly what is specified, with nothing invented along the way.
⚠️ Note: This repository is an SDD documentation starter. It contains baseline specifications, domain boundaries, architecture decision records (ADRs), an OpenAPI contract, database migration designs, and AI agent instructions. It does not contain the completed Go application code. Writing that code is the AI agent's job.
AI coding agents are fast, but left unguided they guess at business rules, add features nobody asked for, and drift from the API contract. This repository constrains them with specifications:
| Problem with unguided AI agents | How this repo constrains them |
|---|---|
| Invents requirements or "helpful" extras | AGENTS.md forbids unapproved features; only approved specs in docs/specs/ may be implemented |
| Guesses on ambiguous edge cases | Agents must stop and ask, or propose a spec update, before coding |
| Drifts from the API contract | api/openapi/openapi.yaml is the source of truth for every request and response |
| Produces changes that are hard to review | Every change cites stable requirement IDs (CAT-001, LES-002, PRG-003), traced in docs/TRACEABILITY.md |
| Makes architectural calls on its own | Decisions are fixed in ADRs under docs/decisions/ |
This is AI-assisted, spec-driven development, not vibe coding.
Vibe coding means prompting an AI loosely, accepting whatever it writes if it seems to work, and iterating by feel. That works for throwaway prototypes, but the AI fills every gap in the prompt with its own assumptions, and nobody can say afterwards which behaviour was intended and which was guessed.
In this repository, the AI implements decisions that humans have already made:
- Intent is written down first. Each behaviour has a requirement ID, business rules and acceptance criteria in
docs/specs/, so the agent builds what was decided rather than what it infers. - Rules are fixed, not improvised. Invariants like "unpublished tutorials return 404" and the progress-percentage formula (ADR-003) are set before any code exists. The AI cannot quietly change them.
- Scope is enforced. ADR-001 rules out user accounts. Without it, an AI might add logins or JWTs because they look like good practice. Here, that counts as a defect.
- Ambiguity stops the work. If a spec is unclear, the agent asks or proposes a spec change; it does not guess.
- Results can be verified. Every change traces back to requirement IDs and acceptance tests in
docs/TRACEABILITY.md, so reviewers check the work against the spec, not against a feeling that it works.
The AI still does most of the typing. What changes is accountability: humans own what gets built and why, the AI owns how, and the spec is the contract between them.
LearnHub enables anonymous learners to:
- Browse published tutorials.
- View ordered lessons within a tutorial.
- Read lesson contents with prev/next navigation.
- Track completed lessons and view progress percentage (stored per anonymous browser UUID via
X-Learner-ID).
- Language: Go 1.22+
- Architecture: Modular Monolith (
cmd/all) - Database: PostgreSQL
- API Contract: OpenAPI 3.1 (HTTP JSON API)
- Frontend: Single Page Application (SPA) / static frontend (separate context)
learnhub-sdd/
├── AGENTS.md # Crucial instructions for AI coding agents
├── README.md # Project overview and SDD entry point
├── go.mod # Go module definition
├── .gitignore
├── .env.example
├── cmd/all/ # Single executable composition root
├── internal/ # Domain modules (tutorials, lessons, progress)
├── pkg/ # Shared utility packages (config, database, httpserver, id)
├── api/openapi/ # OpenAPI 3.1 specification
├── migrations/ # Database SQL migration scripts baseline
├── web/ # Frontend application workspace placeholder
├── tests/ # System & integration test blueprints
└── docs/ # Core SDD specs, ADRs, engineering standards, and traceability
In this project, no application code is written, by a human or an AI, without an approved specification.
Human AI agent Human
[ Propose → Specify → Review → Approve ] → [ Implement → Test → Trace ] → [ Verify → Merge ]
- Humans own intent: product goals, specs, acceptance criteria, ADRs, and approval.
- AI agents own implementation: Go code, tests, and traceability updates that match the approved spec.
- Specs settle disputes: if code and spec disagree, the code changes, unless a spec revision is approved.
See docs/WORKFLOW.md for the full lifecycle, Definition of Ready and Definition of Done.
-
Pick a requirement ID from
docs/TRACEABILITY.md. -
Point your AI coding agent at this repository. It should read
AGENTS.mdfirst; many agents pick it up automatically. -
Give it the reusable prompt from
docs/WORKFLOW.md:You are working on the LearnHub repository following Spec-Driven Development (SDD). Task: Implement requirement PRG-001. Step 1: Read `AGENTS.md` and `docs/specs/progress/lesson-progress.md`. Step 2: Check `api/openapi/openapi.yaml` for expected request/response contracts. Step 3: Implement domain logic, handlers, and persistence layer in Go. Step 4: Write unit and integration tests verifying all acceptance criteria (AC-[ID]). Step 5: Report completion with test evidence. Do not add unapproved features. -
Review the agent's change against the spec's acceptance criteria and the traceability matrix before merging.
If you are an AI assistant tasked with writing code for this repository:
- Read
AGENTS.mdfirst. Its rules override your defaults. - Verify that the task maps to an approved feature specification in
docs/specs/. - Follow
docs/ENGINEERING_STANDARDS.mdanddocs/ARCHITECTURE.md. - Satisfy every acceptance criterion in the spec without introducing unapproved features.
- If the spec is ambiguous, ask; do not guess.
This project is licensed under the MIT License.