spec — research and write spec
Caution
Skipping spec means rewriting later. Without a specification, parallel agents and reviewers have no shared ground truth — they duplicate work, contradict each other, and miss edge cases. The fix costs more than the spec would have.
Tip
-n / --noask for CI and scripts. Pass the flag to suppress all AskUserQuestion calls — spec is generated and reviewed automatically, no human in the loop. Useful when piping requirements from a file or external tool.
Quick reference
| Field | Value |
|---|---|
| Command | /brewcode:spec |
| Arguments | [-n] <description> | <path-to-requirements> |
| Flag | -n, --noask — skip all clarifying questions |
| Model | opus |
| Context | session |
| Tools | Read, Write, Glob, Grep, Bash, Task, AskUserQuestion |
When to use
- New feature or task — turn a description or requirements file into a structured SPEC.md
- Ambiguous requirements — clarifying questions surface scope, constraints, and edge cases before research begins
- Large scope — the skill detects when requirements span more than 3 independent areas and suggests splitting
- Automated pipelines —
--noaskskips interaction; pipe a requirements doc path as the argument
Examples
# From a plain description
/brewcode:spec "add JWT refresh token rotation to auth service"
# From an existing requirements file
/brewcode:spec path/to/requirements.md
# No interaction — auto-approve all defaults
/brewcode:spec -n "migrate database layer to async repositories"
Expected output after a successful run:
# Spec Created
Files Created:
SPEC: .claude/tasks/20260417_143052_auth_feature_task/SPEC.md
Task Dir: .claude/tasks/20260417_143052_auth_feature_task/
Flow
- Check adapted templates
Verifies
.claude/tasks/templates/SPEC.md.templateexists. Missing template means the project structure is not initialized — the skill stops here rather than writing a spec into the wrong structure. - Parse input and ask clarifying questions
Reads
$ARGUMENTS: plain text becomes the task description; a path is read as requirements; empty args fall back to.claude/TASK.md. Then (unless—noask) fires up to 3 batches of questions — scope, constraints, edge cases. If requirements span more than 3 independent areas, proposes splitting into separate tasks. - Partition research areas
Divides the codebase into 5–10 logical zones: controllers, services, repositories, tests, config, docs, domain-specific paths. Each zone gets an assigned agent type. Team agents from
.claude/teams/take priority over plugin agents. - Parallel codebase research
Spawns 5–10 subagents in a single message — Plan, developer, tester, reviewer, Explore — each scoped to one research zone. Agents return findings as bullet lists and file:line references, never large code blocks.
- Consolidate into SPEC.md
Creates the task directory (
.claude/tasks/{TIMESTAMP}_{NAME}_task/), merges and deduplicates agent findings, fills all SPEC sections per the project-adapted template, and writes the file. A research table records which agent covered which area. - Validate findings with user
Unless
—noask, presents key architectural decisions, risk assessment, and assumptions viaAskUserQuestion. User feedback is incorporated into SPEC before the review pass. - Reviewer loop
A reviewer agent checks the SPEC for completeness, consistency, feasibility, and risks. All critical and major remarks are fixed and re-reviewed — up to 3 iterations. Remaining remarks after 3 rounds are surfaced to the user.
Phase details — input handling, agent prompt template, output format
Input detection (after flag stripping)
$ARGUMENTS | Action |
|---|---|
| Empty | Read .claude/TASK.md — first line = path — derive task dir |
| Plain text | Use as task description |
| File path | Read file contents as task description |
Naming convention
- Timestamp:
YYYYMMDD_HHMMSS(e.g.,20260417_143052) - Name slug: lowercase, underscores (e.g.,
auth_feature) - Task directory:
.claude/tasks/{TIMESTAMP}_{NAME}_task/
Agent prompt template (research phase)
Each parallel subagent receives a prompt in this shape:
Analyze {AREA} for task: "{TASK_DESCRIPTION}"
Focus: patterns, reusable code, risks, constraints
Context files: {FILES_IN_AREA}
Output: findings (bullets), assets (table), risks, recommendations
NO large code blocks — use file:line referencesDynamic agent resolution order
- Team agent from
.claude/teams/team.mdmatching the domain - Project agent from
.claude/agents/ - Plugin agent (developer, tester, reviewer, Explore, Plan)
Reviewer iteration loop
WHILE remarks.critical > 0 OR remarks.major > 0:
Fix all critical/major remarks in SPEC.md
Re-run reviewer agent
MAX 3 iterations — then surface remaining remarks via AskUserQuestionTemplate source: always from .claude/tasks/templates/ (project-adapted), never from plugin base templates directly.
Semantic Search
Search the codebase semantically to ground the spec in real code patterns and dependencies.
All Brewcode Skills
Browse every skill available in the brewcode plugin.
GitHub source
SKILL.md, references, and SPEC-creation.md consolidation rules.
Brewcode overview
Full brewcode pipeline — setup, spec, plan, start, review, and more.
Updating plugins
/brewtools:plugin-update to check and update the brewcode plugin suite in one command.
See the FAQ for details.