Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Architecture Spec?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sayeed1999-architecture-spec)
---
name: architecture-spec
description: Template and checklist for docs/architecture.md and the project skeleton. Used by the architect only.
---
# architecture-spec
Output: `docs/architecture.md` and the skeleton. Keep the document under 150 lines.
Engineers read only `docs/architecture.md`, so copy into it everything they need from `skills/stack-defaults`.
## Steps
### 1. Fill the template
- Fill every section. Write `none` or `n/a` instead of leaving one empty.
### 2. Copy from stack-defaults
- Section 3: the repo layout mode from `skills/stack-defaults`, Repo layout, and the tree of each root you use, including a `Dockerfile` in every backend and web app root.
- Section 4: the commands of each root you use, including the seed command when storage is level 4.
- Section 11: the services of the target from `skills/stack-defaults`, Containers.
### 3. Check the list
- One stack choice per layer.
- Data model lists entities, relations, and R-IDs only. Columns belong to `docs/schema.md`.
- Section 11 names every service with its port, env vars, healthcheck, and start command.
- Auth, error format, logging format, config rule are written.
- How to run locally is written.
### 4. Build the skeleton (first design only)
- Create folders, config stubs, `.env.example`.
- Create each root's dependency manifest with the stack's base packages from `skills/stack-defaults`, plus the database driver, ORM or query tool, migration tool, and UUIDv7 package when storage is level 4.
- Backend: the config and logging stubs of the stack (`fastapi`: `api/config.py`, `api/logger.py`; `go`: `api/config.go`, `api/logger.go`; several services: `internal/config/`, `internal/logging/`) that load and log correctly.
- External services: `external-services/<name>/contract.md` per third-party API, and an empty folder for the code.
- No Dockerfile or `docker-compose.yml`. devops-engineer writes them in the Compose task.
- `AGENTS.md` in every backend service root, `web/`, `mobile/`, each `external-services/<name>/`, `mcp-client/`, and `mcp-server/` in use: write it per Format, Project AGENTS.md.
- Root `README.md`: write it per Format, README. Update it on later designs when a core flow changes.
- Later designs add only what new requirements need.
## Format
```
# Architecture: <product>
## 1. Decisions
- Target: <prototype | mvp | production>
- Storage level: <1-5> and why not lower
- User answers: <question: answer>
- Assumptions: <list>
## 2. Stack
- Backend: <choice> - <reason>
- Web:
- Mobile:
- Database:
- Auth:
- AI provider: <name and model, or none>
- AI runtime: <direct | langgraph | langgraph+langchain, or none> - <R-IDs if not direct>
- Containers and hosting:
## 3. Repo layout
- Mode: <one service | several services, same language | several services, mixed languages> - <R-ID if not one service>
- Backend root: <folder, or one folder per service>
- Shared code: <internal/, or none>
- External services: <external-services/<name> per R-ID, or none>
- MCP: <mcp-client/, mcp-server/ with R-IDs, or none>
- Web root: <folder, or none>
- Mobile root: <folder, or none>
- Dockerfiles: <one per backend and web app root, written by devops-engineer, or none>
<tree and layout rules>
## 4. Commands
- <install, run, test, lint, build for each root>
## 5. Data model
- Storage level 4 only. Columns, keys, and indexes: `docs/schema.md` (database-engineer).
- <Entity>: <one-line meaning> - R-IDs - relations (<Entity> has many <Entity>)
- Owner of user data: <which entity holds user_id, or none>
## 6. Auth
- Sign-in:
- Accounts created by:
- Roles, and who may do each restricted action:
- Sessions: token lifetime, where stored on each client
- Recovery:
- (prototype: "None")
## 7. API conventions
- Base path and version:
- Error format (one shape):
- Pagination (only if needed):
- Contract file: contracts/api.md, or none
- AI contract file: contracts/ai.md, or none
## 8. Data flow
- Per shared or calculated value: writer, storage, calculator, visibility, sync, reset.
- One worked example with edge cases per calculation.
## 9. Logging
- Structured JSON, one line per entry.
- Levels: debug, info, warn, error.
- Every request log has: request_id, method, path, status, duration_ms.
- Never log passwords, tokens, secrets, or full PII.
## 10. Config
- Source: environment variables, loaded and validated once at startup. Fail fast if a required one is missing.
- Required variables: listed in each root's `.env.example`.
- Secrets are never committed.
## 11. Runtime services
- One `docker-compose.yml` at the repo root starts every service below. Every target.
- <service>: <image or build root> - port <n> - env: <VARS> - health: <check> - start: <command>
- db (mvp, production): postgres:18 - no published port - health: pg_isready
- api: build api/ - port 8000 - env: DATABASE_URL, SECRET_KEY, CORS_ORIGINS, SEED_MODE - health: GET /health - start: migrate, seed, serve
- web: build web/ - port 3000 - env: NEXT_PUBLIC_API_URL - health: GET /
- Prototype SQLite: a named volume holds the database file.
- Local: `docker compose up --build`
- Host: <answer from the user, or local only for prototype>
- Steps: `docs/deploy.md` (devops-engineer, Deploy task)
## 12. Limits
- What is faked, lost, or breaks. In the client's language.
## 13. Upgrade path
- What must change for a higher target. No tasks. Omit for production.
```
## README
- Audience: a human new to the project. Plain language.
- Sections: what the product does (2 to 3 lines), how to run it (`docker compose up --build`), core flows, notes.
- Core flows: the 2 to 4 flows that carry the product's value (for example sign-up, the main create action, the AI answer). Not every flow.
- Per core flow: one Mermaid `flowchart` (steps and decisions) and one Mermaid `sequenceDiagram` (client, api, database, external services, AI) in fenced `mermaid` blocks. Add the R-IDs.
- Flows that are a single step get no diagram.
- Notes: 3 to 6 short points a human needs: why the stack was chosen, where data lives, auth in one line, known limits (from section 12).
- Names in diagrams match `docs/architecture.md` and `contracts/api.md`. Keep each diagram under 15 nodes or messages.
## Project AGENTS.md
- Audience: any agent or human who works inside that one root. Under 60 lines. Plain language.
- Sections:
- Purpose: what this root does, in 1 to 2 lines.
- Stack: language, framework, package manager (names only).
- Structure: the folder tree from `docs/architecture.md`, section 3, with one line per folder. Mark data-layer paths and generated code as not hand-edited.
- Run: install, run, test, lint, build, seed, and migrate commands, run from this root. Skip test commands for target `prototype`.
- Config: where env is read, and the path of `.env.example`.
- Conventions: the rules that must stay here, such as the one place that reads env, the one place that logs, the error format, and where data access lives.
- Contracts: the files to read first (`contracts/api.md`, `contracts/ai.md`, `docs/schema.md`) and the task spec path.
- Link to `docs/architecture.md` and the root `AGENTS.md`. Do not copy their rules.
- Several services: one `AGENTS.md` per service root. Add shared code rules to the `internal/` one.
- The owner of the root (`AGENTS.md`, Files and owners) may update Structure, Run, Config, and Conventions when a task changes them. Nobody else edits it. A change to Purpose or Stack goes to the architect by handoff.
## MUST
- Name which requirement forces any extra service (cache, queue, worker).
- Default to one backend service and one database.
- Prefer boring, well-known tools.
- Keep the root `README.md` flow diagrams in step with the design.
- Keep each project `AGENTS.md` in step with section 3 and 4 of `docs/architecture.md`.
## NEVER
- Add infrastructure "for later".
- Leave two options open in the Stack section.
- Put tasks in the upgrade path.