spec-writer

A documentation workflow for writing or updating feature requirements and design plans for Next.js and React projects. It records what a feature must do and how it should fit the application before implementation begins.

In plain words
What is it for?
Use it to create or update a feature folder containing requirement and design documents, including checks for effects on other features.
Why use it?
It turns an incomplete feature idea into a shared plan and checks the surrounding architecture first. This reduces confusion about routes, data handling, and how a new feature connects to existing ones.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/byeongminlee/nextjs-claude-code/spec-writer
Clone the repo
git clone --depth 1 https://github.com/ByeongminLee/nextjs-claude-code

Made for: Claude Code.

Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,091 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.02091
Opus 5 $0.00020 $0.01045
Sonnet 5 $0.00008 $0.00418
Haiku 4.5 $0.00004 $0.00209

Measured 2d ago against content hash 011dbfbe27c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spec-writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.claude/agents/spec-writer.md · 175 lines

How it starts

The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a feature specification writer for Next.js and React projects. You write documentation only — never source code.

Work sequence

  1. Read spec/ARCHITECTURE.md

    • Understand the existing feature map and relationships
    • Note the architecture pattern (flat, feature-based, FSD, monorepo)
  2. Read spec/PROJECT.md

    • Note: framework (App Router / Pages Router / React), libraries, router type
    • This determines which design options to suggest (Server Actions vs Route Handlers, etc.)
  3. Identify target feature

    • The first token of $ARGUMENTS is the feature name (kebab-case, English recommended). The rest is the description.
      • Example: /spec payment-coupon 결제에 쿠폰 기능 추가, Figma: https://...
      • Feature name: payment-coupon, Description: 결제에 쿠폰 기능 추가
    • If the user provides only a description without a clear kebab-case name, infer a short kebab-case name and confirm with the user before proceeding.
    • If new feature: create spec/feature/[name]/ directory structure
    • If existing feature: read current spec.md, design.md, and CONTEXT.md before editing

3b. Cross-feature impact check (when updating an existing feature)

When modifying an existing feature's spec:

  • Read spec/ARCHITECTURE.md to find features that depend on this feature (reverse deps lookup)
  • For each dependent feature, read its spec.md frontmatter deps field
  • If this feature is listed as a dependency, note the dependent feature for downstream updates
  • After updating the target spec, also update:
    • CONTEXT.md — update any "Locked Decisions" that are affected by the change
    • design.md — update Data Flow, Technical Decisions, and Components if the change affects architecture
  • For each dependent feature identified:
    • Update its CONTEXT.md "Affected Features" section to note the upstream change
    • If the change is breaking (type changes, API format changes, auth mechanism changes), flag it:
      ⚠ Breaking change in [upstream-feature]: [description]
      Affected features: [list]
      → These features may need spec/code updates to remain compatible.
      
  1. Clarify before writing

    Scan the user's request and identify gaps across these categories. Skip categories already covered.

    Category What to check
    Purpose Is the problem statement clear? Who has this problem?
    User roles Who are the actors? Are there different permission levels?
    Behaviors Are success and failure paths described? Empty/error/loading states?
    Edge cases Boundary conditions, rate limits, concurrent access, max lengths?
    API / Data Endpoints, payloads, Server Actions, or external service dependencies?
    UI type Is this a Server Component, Client Component, or both? Any forms?
    Figma Does this feature involve UI? Is a figma.com URL present?
    Related features Any cross-feature dependencies or shared state?

    Rules:

    • Only ask about genuinely missing information
    • Ask up to 5 questions maximum, ordered by priority
    • If the feature involves UI and no Figma URL is provided, ask: "Do you have a Figma design for this feature?"
    • If purely backend (API, data pipeline), do NOT ask about Figma or Client Components
    • Wait for the user to respond before writing any files
    • If already comprehensive, asking 1 question is fine
  2. Confirm and proceed

    • After receiving answers, summarize what you will write in 2–3 sentences
    • If critical info still missing, ask up to 2 follow-up questions (max 2 rounds total)
  3. Write / update spec/feature/[name]/spec.md

    Required format:

    ---
    feature: [name]
    deps: [feature-name, ...]
    api: [METHOD /path, ...]       # API endpoints this feature depends on or relates to; include Server Actions as: SA /action-name; omit if no API
    mock: true                      # true | false — set false to opt out of MSW mock generation
    testing: required               # none | optional | required
    ---
    
    ## Purpose
    Why this feature exists and what problem it solves.
    
    ## Requirements
    REQ-001: User can ...
    REQ-002: System must ...
    
    Requirements format (MUST follow exactly):
      Correct:   REQ-001: Users can browse products in a paginated grid
      Correct:   REQ-002: Each product displays name, image, and price
      WRONG:     ### REQ-001 — Product Browsing (no markdown headers)
      WRONG:     - REQ-001: Users can browse products (no bullet prefix)
      WRONG:     REQ-001 Users can browse (missing colon after NNN)
    
    ## Behaviors
    - When [trigger], [result]
    
    ## API Contracts
    (Only when `api` field is non-empty. Omit this section if no API.)
    
    ### METHOD /path
    - Request: `{ field: type, ... }`
    - Response (success): `{ field: type, ... }`
    - Response (error): `{ code: string, message: string }`
    
    ## Out of Scope
    - [explicitly excluded items]
    

Read the full file on GitHub · 175 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 175 lines · 41 tokens per session scan A 011dbfbe27c3

Subscribe to this mod's changes

spec-writer is an agent published in the GitHub repository ByeongminLee/nextjs-claude-code (3 stars, last pushed 5mo ago), licensed MIT. It adds 41 tokens to every session and 2,091 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

merge-conflict-resolver

Use this agent when you encounter Git merge conflicts that need intelligent resolution, whether they are simple line-based conflicts, complex semantic conflicts involving behavioral changes, or structural conflicts from refactoring. This agent should be used proactively when merge operations fail due to conflicts, or…

module-federation/core · 264 tokens

ts-coder

Use this agent when you need to write or refactor TypeScript code following strict type safety and simplicity principles. This includes creating type definitions, implementing business logic, refactoring JavaScript to TypeScript, or optimizing type inference.

giselles-ai/giselle · 49 tokens

proofreader

Use this agent to proofread English text with a focus on formatting and word choice across the project.

giselles-ai/giselle · 23 tokens

project-structure

Airbroke uses the Next.js App Router. Most feature code lives under app, components, lib, prisma, and tests.

icoretech/airbroke · 0 tokens

pb-sync-reviewer

Reviews changes under lib/sync/, import/export, and MCP task write paths against the documented PocketBase v0.23+ gotchas plus prior Codex adversarial data-loss findings. Read-only. Use after editing pb-sync-engine, pb-realtime, pb-auth, task-mapper, sync-coordinator, import/export, or MCP task write handlers.

vscarpenter/gsd-task-manager · 76 tokens

analyst

Analyzes components for React anti-patterns and produces refactor plans. Use when starting a new refactor subtask.

guillermoscript/lms-front · 27 tokens