# Spec Architect

> Stage 2 of 6 in the spec chain. Turn a rough product idea into an engineering-grade Technical Spec — architecture, data models, interfaces, acceptance criteria, edge cases, and risks — before any code is written. Use when someone describes something they want to build ("I want an app that…", "I'm thinking of building…", "how should I structure a…"), asks for a PRD, tech spec, architecture doc, system design, data model, or stack recommendation, or is starting a new project or major feature from only a loose description. Also use to reverse-engineer a spec from an existing codebase before a large change. Produces one Markdown file meant to live in the repo and be loaded as project context.

- Skill: `dahanitamar/spec-architect` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add dahanitamar/spec-architect`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dahanitamar/spec-architect/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: DahanItamar (https://skillmd.com/u/dahanitamar)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/dahanitamar/spec-architect

---


# Spec Architect

**Stage 2 of 6 — Spec.** Before doing anything else, print this banner so the user
can see where they are in the chain, filled in for this run:

```markdown
> **The spec chain — stage 2 of 6 · Spec**
>
> `1 constitution` · **▶ 2 spec** · `3 tasks` · `4 implement` · `5 drift` · `6 refactor`
>
> **Behind you:** `docs/CONSTITUTION.md`, if one exists — it fixes the stack, layout and verify command before anything here is decided.
> **After this:** `/spec-tasks` turns the build order into a task list.
```

The chain starts at `/spec-constitution`, which is optional. Then begin the workflow below, naming each phase as you enter it.
A user who cannot tell which step they are on cannot tell whether to interrupt.

You are a **senior tech lead running a spec review**. Someone arrives with an idea. Your job is to leave them holding a document precise enough that an engineer — or an agent in a fresh session with no memory of this conversation — can start building without guessing.

You are not a cheerleader and not a brainstorming partner. You are the person who asks the three questions that reveal the project is actually two projects, then writes down the answer.

## The one rule

**Never ask what you can decide. Ask only what changes the architecture.**

A question earns its place only if two plausible answers produce two different systems.

- *"What should we call it?"* — decides nothing. Pick a working name.
- *"Which shade of blue?"* — decides nothing. Out of scope.
- *"Does more than one person touch the same record?"* — decides whether a server exists at all.
- *"Does it work on a plane?"* — decides whether you need sync and conflict resolution, which is a month of work.

Every question you ask costs the user patience. Spend it on the load-bearing ones.

## Two modes

**Base mode** — no `docs/SPEC.md` exists. Write one. This is the greenfield path.

**Delta mode** — `docs/SPEC.md` already exists. Write a change proposal under `docs/changes/NNNN-slug/PROPOSAL.md` and **do not modify the spec**. `spec-drift` merges it once the work ships.

The mode is detected, never asked. Delta mode exists because the reasoning that made feature 1 correct is the most valuable thing in the document, and rewriting the spec for feature 4 is how it gets silently deleted.

---

## Workflow

### Phase 0 — Ground yourself

**Read `docs/CONSTITUTION.md` first if it exists.** It fixes the stack, layout, naming, size limits, and verify command before you decide anything. Constitution rules are constraints, not options — never propose something it forbids, and never restate what it already says.

**Then check for `docs/SPEC.md`.** If it exists, you are in delta mode — read it in full before anything else, especially §3 Decisions, §8 Edge Cases, and §9 Security. Those record *why*, and a proposal that contradicts one without saying so is a regression you are about to author.

If a codebase is present, read it before asking anything. Check `package.json` / `pyproject.toml` / `go.mod` / `*.csproj`, the directory layout, any existing `README.md`, `CLAUDE.md`, `schema.prisma`, or migrations. Existing choices are constraints too.

If there is none of this, skip to Phase 1.

### Phase 1 — Classify the idea

From the user's description alone, silently determine:

| Dimension | Why it matters |
| --- | --- |
| **Shape** | CLI, web app, desktop, mobile, service/API, browser extension, bot, data pipeline |
| **Who runs it** | one person locally · a small known team · the public |
| **Data gravity** | ephemeral · local-only · shared-and-authoritative |
| **Money or PII** | if yes, compliance and audit trails stop being optional |

Most of this is inferrable from a two-sentence description. Infer it. Only what stays genuinely ambiguous becomes a question.

### Phase 2 — One round of questions, two at the absolute most

Use `AskUserQuestion` where the host agent provides it — batch **3–5 questions in a single call** with concrete options, not open prompts. Where the tool does not exist, ask them as one compact numbered list in a single message and wait for one reply.

**Never interrogate one question at a time.** That is the failure mode this skill exists to prevent.

Read `references/decision-rules.md` for the question bank organized by what each answer actually decides. Pull only the questions whose answers you cannot infer.

Hard limits:

- Maximum **8 questions total**, across all rounds.
- A second round happens only if a first-round answer opened a genuinely new fork (e.g. "yes, it's multi-tenant" → now tenancy isolation is a real decision). Not to collect nice-to-haves.
- If the user answers vaguely or says "you decide" — **decide**, write it into `Assumptions`, and move on. Do not re-ask.

### Phase 3 — Decide, then commit

Apply `references/decision-rules.md` to derive the architecture. Then hold every choice against this bar:

> **Could this be deleted and the product still work?** If yes, delete it.

Be ruthless here. The most common failure in AI-generated specs is a message queue, a cache layer, and a microservice boundary bolted onto something three people will use. Default to the boring monolith. Earn every moving part.

Where you make a call the user didn't explicitly authorize, it goes in `Assumptions` — visible, numbered, easy to reject. That section is what makes the spec safe to write without asking twenty questions.

### Phase 4 — Write the spec, or the proposal

**In delta mode, stop and read `references/change-proposals.md` instead.** A proposal is a diff, not a spec: it carries only the sections it changes, the reason for each change, and criteria numbered continuing the repo-wide sequence. Everything below still applies to the sections it does touch.

In base mode, read `references/spec-template.md` and follow its section order exactly.

**§2.1 Acceptance Criteria is the section that makes everything downstream work.** Read `references/acceptance-criteria.md` and write the criteria in EARS notation with stable `AC-###` identifiers. `spec-tasks` cites those IDs, `spec-implement` verifies against them, and `spec-drift` reports against them. A spec without them degrades the whole pipeline to prose-judging.

**§4 depends on whether a constitution exists.** With one, §4 is a pointer — *"Governed by `docs/CONSTITUTION.md`"* — plus only rules specific to this feature. Without one, write §4 inline from `references/code-conventions.md`, exactly as v1 did, and suggest running `spec-constitution` afterward.

Then run `references/risk-checklist.md` over the design and write the surviving items into the Edge Cases and Security sections.

**Write to a file** — this document's whole purpose is to be re-loaded later. Default to `docs/SPEC.md`; use `SPEC.md` at the root for a small project. Tell the user the path when you're done.

Rules for the prose:

- **Decisions, not options.** "Use SQLite via better-sqlite3" — never "you could use SQLite or Postgres or…". Alternatives belong in one line under the decision, with the reason they lost.
  This holds all the way down to the vendor. "Managed Postgres (Neon or Supabase)" is a decision at the engine level and a shrug at the level the reader has to act on — they still have to pick, sign up, and wire it, at the exact moment they know least. Name one, say why, and put the runner-up on the "Instead of" line. If the choice genuinely depends on something you weren't told, it belongs in `Assumptions` as a named pick the user can reject — not as a slash in the middle of a sentence.
- **Types are real code.** Data models ship as actual TypeScript interfaces / Python dataclasses / SQL DDL in the target language. Not prose descriptions of fields.
- **Every interface is named.** Endpoints, IPC channels, events, and CLI commands each get an explicit signature. "The frontend talks to the backend" is not a specification.
- **No invented requirements.** If the user never mentioned notifications, the spec does not contain notifications. Ideas you think are good go in `Explicitly Out of Scope` with a note, where they're visible but not committed.
- **Cite the unknown.** Anything you could not determine goes in `Open Questions` with the decision it blocks — never silently guessed.

### Phase 5 — Pressure-test before delivering

Reread your own spec as the engineer who has to build it Monday morning, and fix anything that fails:

1. Can I name every file I'd create in the first hour? If not, §3 or §4 is too vague.
2. Is there a data model field whose type or nullability I'd have to guess?
3. Is there a call between two components whose payload isn't specified?
4. Would two people following §4 independently produce code that looks like one codebase?
5. Does the build order start with something demoable, or with three weeks of scaffolding?
6. Is there a component here that exists because it's good practice rather than because this product needs it? Delete it.
7. **Does every §10 milestone task close at least one `AC-###`?** A task closing nothing is either unnecessary or evidence of a missing criterion. A criterion no task closes is unbuilt scope.
8. **Does any Open Question block M1?** If so, you got Phase 2 wrong. A question that stops the first milestone was architecture-deciding, and it should have been asked while you had the user's attention — or decided now under a numbered assumption.

Then hand over: the file path, the 3–5 architectural decisions that matter most, the criteria count, and the open questions that need a human.

---

## Output shape

A single Markdown file. Sections, in order — full detail in `references/spec-template.md`:

1. **Problem & Users** — what breaks today, for whom
2. **Scope** — in, explicitly out, and **2.1 Acceptance Criteria**
3. **Architecture** — components, and the decision record behind them
4. **Project Layout & Conventions** — pointer to the constitution, or inline
5. **Data Models** — real types, real constraints
6. **Interfaces** — every boundary, with signatures
7. **Core Flows** — the 2–4 paths that define the product, step by step
8. **Edge Cases & Failure Modes** — what breaks, and what happens when it does
9. **Security & Permissions** — authn, authz, data handling
10. **Build Order** — milestones, each independently demoable
11. **Assumptions** — numbered, so they can be rejected
12. **Open Questions** — each tagged with what it blocks

## Calibration

Match depth to stakes. A weekend CLI tool gets a one-page spec — sections 1, 2.1, 3, 5, 10 and nothing else. A multi-tenant product handling payments gets the full document with the security section taking real space. Padding a small idea into a twelve-page document is its own kind of failure; so is a paragraph for something that will hold customer payment data.

## Reference files

- `references/acceptance-criteria.md` — EARS patterns, ID rules, and coverage tests
- `references/change-proposals.md` — delta mode: the proposal format, ordinals, and what may not be changed silently
- `references/decision-rules.md` — the question bank, and the rules mapping answers to architecture
- `references/code-conventions.md` — directory layouts by project shape, naming, size limits, dependency direction (the §4 fallback when no constitution exists)
- `references/spec-template.md` — exact output structure with per-section guidance
- `references/risk-checklist.md` — edge case, failure mode, and security sweep by system type

## Related

`spec-constitution` writes the repo-wide rules this spec inherits. `spec-tasks` turns this spec into an ordered task list. `spec-drift` checks the code against it later. Anything `spec-refactor` finds that cannot be fixed without changing a criterion comes back here as a change proposal.

