Factree builds every feature through a spec first. Use this before writing any code whenever the user asks to implement, build, add or change a feature, ticket or behaviour in a repository (pasted tickets included), and when they want to specify a feature or update an existing spec. Turns the requirement into .factree/specs/<capability>/spec.md grounded in the code, ready to approve and build on The Line. Not for questions about how code works.
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 Spec?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/factree-dev-spec)
---
name: spec
description: Factree builds every feature through a spec first. Use this before writing any code whenever the user asks to implement, build, add or change a feature, ticket or behaviour in a repository (pasted tickets included), and when they want to specify a feature or update an existing spec. Turns the requirement into .factree/specs/<capability>/spec.md grounded in the code, ready to approve and build on The Line. Not for questions about how code works.
argument-hint: "[requirement text, file path, URL or ticket id]"
---
# Spec
Turn a requirement into a spec: a precise, checkable statement of how one capability behaves, grounded in the code it will live in. The format is defined by the factree:spec-format skill. Load it before writing.
`template.md`, `checklist.md` and `builder-check.md` are in this skill's base directory.
Input: $ARGUMENTS
## Why this skill exists
You are very good at building, and you build what you believe the user wants. That belief is usually thinner than it feels. Requirements arrive incomplete: they mix behaviour with implementation, leave failure cases out, and use words like "large" and "fast" that mean nothing to a test. A spec is where those gaps get found while they are still cheap: in words, before code.
Two readers come after you, and neither can ask you anything. A builder gets the whole file. A verifier gets only the behaviour (Purpose, Scope, Requirements, Sketch) and the running software, and proves each scenario against it without ever seeing how it was built. A scenario the verifier cannot exercise from its own words is a scenario that fails.
<HARD-GATE>
This skill writes only `spec.md` files under `.factree/specs/`. It never writes or edits product code, tests, config or dependencies, and it never starts implementation, even when the requirement looks trivial. Reading code is expected. When the spec is written and checked, stop: approval and building happen on The Line.
</HARD-GATE>
## Process
Work through these steps in order. Steps 1–6 are mostly reading and thinking; keep your messages to the user short until step 7.
### 1. Get the requirement
The input can be anything: pasted text, a list, a file path, a URL, a ticket id, or nothing at all.
- **Text or a file:** read it.
- **A URL or ticket id** (Confluence, Jira, Linear, GitHub, Notion): use a connected tool for that system if one exists, else fetch a public page. If you cannot reach it, say which system and ask the user to paste the content. Never guess what a page says.
- **Nothing:** ask what they want to specify, in one sentence.
Record every source in the spec's `sources` front matter: the URL, ticket id or file path. If the requirement came only from conversation, record `conversation YYYY-MM-DD`.
### 2. Recon before asking anything
Read until you can explain how the relevant parts work today and what this requirement would touch:
- **Existing specs.** List `.factree/specs/*/spec.md` by path (`ls .factree/specs`): git ignores the folder, so a search may skip it and find nothing. Read the front matter and requirement headings of any that might overlap.
- **Project conventions.** The root `CLAUDE.md` and any `CLAUDE.md` in the directories involved.
- **The code.** Entry points, models, permissions, existing similar features, tests. Follow the requirement's nouns into the codebase.
Never ask the user something the code, the existing specs or the source already answers.
### 3. Size the request
Every change goes through a spec, down to one line of copy or styling: a request is never answered with "no spec needed". From what recon showed, size the request and say so in **one line**, with the reason, before asking anything:
- **Tiny:** copy, styling, refactors, dependency bumps, renames, typos, internal tooling, performance work. One requirement and its scenarios, usually added to the spec of the capability it touches. A styling choice the user made is recorded as a decision. For a change meant to keep behaviour the same (a refactor, a rename, a bump), the requirement says so and names the existing scenarios that prove it. *"Tiny: a styling change, so one requirement in the team-page spec."*
- **Standard:** everything else. Say why, e.g. "new behaviour with its own failure cases".
- **Bug fix:** no new spec. If a spec exists for the area, add a scenario for the case the bug revealed. If none exists, say so and ask whether they want one.
Follow an override without arguing.
### 4. Decide which spec or specs
- Match the requirement to capabilities. **Edit** an existing spec when the requirement changes behaviour it covers. **Create** one when the requirement introduces a capability nobody has specified.
- One requirement may touch several specs. One spec may serve many requirements over its life.
- Name capabilities as a user would ("report export"), not as the code is organised ("ExportsController") and not after the ticket ("INV-42"). The ticket goes in `sources`.
- **If you will create or edit more than one spec, or the match is unclear, list what you plan to touch and confirm before writing.**
### 5. Break the requirement down
Split the input into atomic statements and sort each one:
| It's a… | Example | Goes to |
|---|---|---|
| Behaviour | "only admins can export" | A requirement |
| Behaviour with a vague word | "must work for large teams" | A requirement, once quantified; until then an open question |
| Implementation preference | "use streaming" | A decision, if the user confirms it; otherwise Code notes or an open question |
| Constraint | "must ship before the Q1 audit" | Not the spec. Mention it, don't encode it |
| Out of scope | "scheduled exports later" | Scope → Out |
| Already true in the code | "admins can see teams" | Observations, not a requirement |
Then find what the requirement is **silent** on. Run through Part 1 of `checklist.md`. Each gap that applies and the source doesn't settle becomes a scenario in step 8, or an open question if the answer isn't clear. A case the source already settles comes from the source, not from a second scenario.
### 6. Observe current behaviour
If the capability touches existing code, write Observations: what the code does today in the area this spec covers, each with a file reference. Only the parts this requirement touches; don't backfill whole modules. Observations are facts you read, not guesses. If you're unsure, check the code again or leave it out.
### 7. Talk it through
Now you know what's clear and what isn't. Open with at most 3 lines: the requirement in your own words (what, for whom, why as far as stated), the one finding that bears on it most, and which spec you'll create or edit. Then give one **decision brief** (below).
**Ask by impact.** Put in the brief only decisions about:
- behaviour a user or caller would notice;
- scope, limits and failure cases;
- anything that needs a new pattern or dependency;
- anything hard to undo.
Everything else is **your call**: naming, ordering, layout, defaults, wording, implementation. Decide it, and list it in the brief so the user can overrule it.
- **Ask why first** if the requirement doesn't say why and the answer would change several decisions. Make it decision 1.
- **Three decisions at most** across all briefs. Record what's left as open questions with owners rather than interrogating the user.
**Decision brief:** one message, so one reply settles it, one line per decision.
```
1. Where does the Copy button go? → beside each scenario id (recommended)
2. Double click? → copy once, show "Copied" (recommended)
Reply "yes", or e.g. "2: copy twice". Say "options" or "calls" for more.
```
Number the decisions, each the question and the recommended answer on one line. Give the alternatives and what each changes when the user says "options"; list your calls when they say "calls". A reply of "yes" takes every recommendation; "2: …" changes only that one. Leave out a decision whose options depend on an earlier answer, and put it in the next brief once that answer is in. If a reply can't be matched to the brief, ask once which number it means.
- **Play back in parts** (standard specs). As soon as you understand one part well enough to describe it (who can do it, what the result contains, what happens when it fails), describe it back in at most 300 words, then ask what's wrong or missing. Only what the user said goes in as theirs; anything you filled in is your proposal, with your reason. A tiny request skips this: its one brief covers it.
- **Show what they'll see.** When the requirement changes something the user will look at (a page, a screen, a layout, a flow of steps), sketch it in a fenced block of text, a few lines of what they'd see, and put it next to the part you're playing back. Requirements, limits and trade-offs stay in words.
- **Approaches only for real choices.** If there are genuinely different ways to deliver the behaviour (synchronous download vs background job and email), sketch two or three with trade-offs, recommend one, and let the user pick. The choice becomes a decision.
If the user says "just write it" or "you decide", stop asking: make the calls, list each as yours, and put anything that truly needs a human in Open questions.
### 8. Write the spec
Start from `template.md` for a new spec, at `.factree/specs/<capability>/spec.md`. The folder is local and ignored by git: never stage or commit a spec. Follow factree:spec-format exactly. Writing rules are below under **Writing requirements and scenarios**.
- Every requirement traces to a `Source:` (the requirement, a section of it, or an observation), unless it's a technical necessity you state as such.
- **A source the build can read that states behaviour testably** (exact values, codes, formats, limits): each requirement's statement names the source section it implements instead of restating it; concrete values live in scenarios, one per stated rule plus the cases it leaves unstated. Any other source, including a tracker only this session reached, is treated like a vague one: state the rules.
- Every gap you didn't resolve becomes an open question with an owner, and `Blocked by:` on the requirements it blocks.
- Decisions: only what a person decided in this conversation, or what the user explicitly delegated to you ("you decide" → record it with your name as `Claude, delegated by <user>`).
- Code: entry points and key modules with paths. "Not built yet." for new capabilities.
- Scope's **Anti-goals:** what would make this a failure even if it technically works ("an export that silently drops rows"). Use the user's words if they gave any; otherwise propose them and list them among your calls.
- **Sketch:** when the user will look at the result, the sketch you agreed on goes in the `## Sketch` section, after Requirements, in one fenced block. Leave the section out when there's nothing to look at.
- **Flow:** when the spec has screens or states, the Sketch is a `flow` block: one line per step, `From -> To : action [R2.S1]`, the first line starting the main path, each line naming the scenarios that prove it (none makes it a gap). A spec with no screens or states gets none.
- **Write for the verifier.** Each scenario must be provable from its own words by someone who sees only the behaviour sections and the running software: name the starting state, the action and the outcome exactly, with the values to use and the text to expect.
- When editing, keep every existing id and follow the editing rules in spec-format. The file carries no status: changing a requirement, the scope or the sketch makes the spec a draft again by itself.
### 9. Check it
Do all three before showing the user:
1. **Self-review** against Part 2 of `checklist.md`. Fix what fails.
2. **Validate the structure:** run `npx factree check <capability>`. Fix every ERROR. Fix WARNINGs unless you have a reason, and mention any you leave. If the command is not available, read the file against factree:spec-format yourself and say that the validator did not run.
3. **Builder check** only when the spec has open questions, behaviour calls about what the source didn't settle, a conversation-only source, or the user asks: dispatch a fresh subagent with `builder-check.md` and the spec path. Sort what it raises: already answered (add it to the spec), minor (decide it, note it as your call), or needs the user (bring these in one message, most important first). Without a subagent tool, do this read yourself.
### 10. Present, and hand over to The Line
Send a short report, not the spec (the user can open the file): at most 5 lines, result first, then any decision still open, one line each.
```
Spec link-report: 4 requirements, 9 scenarios. Nothing open: it goes on to plan and build.
Changed: added R4 Export limit; R2 gains S3 ← edits only
1. Audit log entry per export? → no (recommended) ← only if a decision is open
Held back by Q1 until you answer. ← only if a requirement is blocked
```
Decisions, your calls, open questions and source coverage are in the spec; give them when the user says "details".
- **Only what is open holds a spec back.** A spec with no validator error and no requirement `Blocked by:` an open question needs nobody's approval. Inside Factree it is approved and planned by itself when you finish. Written from a terminal, it waits for one key on its page (`B`), or run `npx factree approve <capability>` when the user tells you to go ahead; if Factree isn't running it says so.
- **So be exact about what is open.** Mark a requirement `Blocked by:` a question only when it truly cannot be built without the person's answer: that is what will stop the factory and wait for them. A call you made and listed is not a blocker. Never leave something that needs their answer unmarked just to keep things moving.
- **A spec that isn't ready** (a validator error, or a requirement blocked by an open question) goes nowhere. Say what holds it back and who owns the answer.
- **On changes:** make them, re-run step 9, summarise what changed by id.
- **Then stop.** Planning and building happen in Factree, in sessions of their own; do not begin them here.
## Writing requirements and scenarios
**A requirement is one observable behaviour.** Test: could a tester who has never seen the code tell whether it holds?
| Weak | Strong |
|---|---|
| The system SHALL handle large exports gracefully. | The export service SHALL begin the download within 2 seconds for teams of up to 100,000 links. |
| The system SHALL validate and store the upload and notify the user. | Three requirements: validation, storage, notification. |
| The system SHALL use a Redis queue for exports. | Not a requirement. A decision, if a person made it. |
| The system SHALL be secure. | The export service SHALL refuse export requests from users without the admin role. |
- Name the subject concretely ("the export service", "an admin"), not "the system", when there's a better word.
- SHALL/MUST by default. SHOULD only when there's room for a justified exception; MAY only for genuinely optional behaviour. Quantify every adjective: numbers, limits, formats, time. A requirement may instead name the source section it implements as its one behaviour ("SHALL behave as SHORT-43 §3 states"); that section and its scenarios quantify it.
**A scenario is a concrete case that could become a test.**
- Use specific values: "2 active and 1 deleted link", not "some links".
- One scenario, one case. Name it after the case: "S2 Empty team", not "S2 Second test".
- Cover the cases where bugs live: empty input, the limit and one over it, missing permission, the thing already existing, the thing disappearing midway, the second click, the failure of something this depends on.
- A scenario that just restates its requirement tests nothing. Rewrite it as a specific situation with a specific outcome.
- Before finishing, ask yourself: which case would the user be most upset to see broken? Make sure a scenario names it.
**How to talk.** Result first. At most 5 lines per report: only what changed and what needs the user. One line per decision. Detail when the user asks for it. Name things the way the user would, not by id alone: `R2 Export contents`, not just `R2`.
## Red flags
| Thought | Reality |
|---|---|
| "I'll ask this now and the other one after" | If the two don't depend on each other, they go in one brief. |
| "Better ask about this layout choice, to be safe" | Layout, naming and defaults are your call. List it; the user can overrule. |
| "This looks small, I'll skip sizing" | Size every request, in one line, before asking anything. |
| "The requirement is clear, I'll skip recon" | Recon is what turns a requirement into a spec. Read the code first. |
| "I'll fill in a sensible default quietly" | Defaults are fine. Say them. A default the user never heard is one they couldn't reject. |
| "This decision is obvious, I'll record it" | Only people make decisions. Propose it and let them agree. |
| "The happy path is covered, that's enough" | Bugs live in the failure cases. Cover them. |
| "I'll put the table design in the requirement so the builder knows" | Implementation goes in Code or Decisions. Requirements describe behaviour. |
| "The verifier can work out what I meant" | The verifier has only your words and the running software. Write the values and the expected text. |
| "While I'm here I'll tidy the other requirements" | Change only what this requirement touches, and say exactly what changed. |
| "I'm not sure about this limit, but marking it blocked would stop everything" | That is what blocked is for. An unmarked guess gets built. |
| "They said it looks good, I'll approve and start building" | Approval is theirs, of the spec they saw. This skill ends there; building happens on The Line. |