一键导入
draft-requirements
Draft structured requirements documents with goals and guards from discussion docs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Draft structured requirements documents with goals and guards from discussion docs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Apply approved review findings to a document — reads the review file and makes targeted edits
Systematically review design documents for bugs, inconsistencies, and missing cases
Systematically review requirements documents for completeness, testability, and consistency
Systematically review task breakdowns for completeness, dependency correctness, and implementability
Incremental write pattern for long documents (design, requirements, specs, postmortems, RFCs, ADRs, any structured markdown)
Track, manage, and fix issues across all projects (full lifecycle, strict format)
| name | draft-requirements |
| description | Draft structured requirements documents with goals and guards from discussion docs |
| version | 2.0.0 |
| author | potato |
| triggers | {"patterns":["write requirements","写需求","requirements for","需求文档"],"regex":["(?i)requirements?\\.md"]} |
| tags | ["development","planning"] |
| priority | 60 |
| always_load | false |
| max_body_size | 4096 |
| subagent_preamble | You are a sub-agent writing a requirements document. Key rules: - All input context (discussions, existing docs, ideas) is ALREADY pre-loaded. Do NOT call read_file for them. - START WRITING the requirements file within your first 3 tool calls. - Write incrementally: overview + structure first, then fill GOALs section by section. - Budget: max 20% reading, 80% writing. |
Transform project ideas into structured, verifiable requirements documents.
This is Phase 2 of the GID pipeline: Idea → Requirements → Design → Graph → Execute.
Requirements documents define WHAT the system must do (not HOW). Every criterion must be verifiable — if you can't test it, it's not a criterion.
⚠️ The #1 failure mode is writing implementation details disguised as requirements. This is especially common for infrastructure/framework features where WHAT and HOW feel intertwined. See "The WHAT/HOW Boundary" section below — read it before writing any GOAL.
A single requirements document MUST NOT exceed ~15 GOALs. If it does, split into feature-level documents.
Why: Review agents run 27+ checks across all GOALs. At 30+ GOALs, review quality degrades (context pressure, missed cross-references). Splitting at the source is the root fix — no need for complex multi-agent review architectures.
Structure for large projects:
.gid/
├── docs/
│ └── requirements.md ← Master: overview + feature index + GUARDs only
└── features/
├── auth/requirements.md ← 10-15 GOALs for auth
├── pipeline/requirements.md ← 10-15 GOALs for pipeline
└── cli/requirements.md ← 10-15 GOALs for CLI
.gid/docs/) contains:Each feature requirements.md contains:
When to split:
GOAL numbering across features:
GOAL-auth.1, GOAL-pipe.1, etc.GOAL-1.1 (module 1), GOAL-2.1 (module 2) — each feature doc owns a module number rangeDepends on project structure:
.gid/features/{feature-name}/requirements.md.gid/docs/requirements.md (GUARDs + index) + features at .gid/features/{feature-name}/requirements.mdThe .gid/ location is canonical — assemble_task_context() resolves requirements from there via the feature node's design_doc metadata. Task nodes' satisfies references (e.g., GOAL-1.1) are resolved against their parent feature's requirements.md.
ONLY use these names. No aliases, no alternatives:
❌ NEVER use: CR, INV, AC, CP, REQ, FR, NFR, or any other abbreviation. Even if the task prompt uses different names, always use GOAL/GUARD.
# Requirements: {Project Name}
## Overview
{One paragraph: what this project does and why it exists. No implementation details.
Include the core user problem being solved.}
## Priority Levels
- **P0**: Core — required for the system to function at all
- **P1**: Important — needed for production-quality operation
- **P2**: Enhancement — improves efficiency, UX, or observability
## Guard Severity
- **hard**: Violation = system is broken, execution must stop
- **soft**: Violation = degraded quality, should warn but can continue
## Goals
{Verifiable completion conditions. Each must be testable by a human or automated check.
Group by feature area. Use GOAL-{module}.{number} format.
Numbers must be sequential within each module — no gaps.}
### {Feature Area 1}
- **GOAL-1.1** [P0]: {Specific, verifiable condition} *(ref: {source})*
- **GOAL-1.2** [P1]: {Specific, verifiable condition} *(ref: {source})*
### {Feature Area 2}
- **GOAL-2.1** [P0]: {Specific, verifiable condition} *(ref: {source})*
- **GOAL-2.2** [P2]: {Specific, verifiable condition} *(ref: {source})*
## Guards
{System-level properties that must ALWAYS hold, regardless of feature.
These are cross-cutting constraints, not feature-specific.
Think: security, data integrity, performance, reliability.
Numbers must be sequential — GUARD-1, GUARD-2, etc.}
- **GUARD-1** [hard]: {Property that must never be violated} *(ref: {source})*
- **GUARD-2** [soft]: {Property that should hold} *(ref: {source})*
## Out of Scope
- {Thing explicitly not included}
## Dependencies
- {Dependency and why it's needed}
{Summary line: **N GOALs** (X P0 / Y P1 / Z P2) + **M GUARDs** (A hard / B soft)}
P0 — "System doesn't work without this":
P1 — "System works but isn't production-ready":
P2 — "Nice to have":
When unsure: P1. Better to over-prioritize than under — P0 items gate implementation.
This is the #1 source of requirements bugs. Three rounds of review can't fix a document that mixes requirements with design decisions — the contradictions are structural, not editorial.
Requirements describe observable behavior from outside the system. Design describes how the system achieves that behavior internally.
If you could achieve the same observable result with a completely different implementation, the requirement is valid. If the requirement specifies the implementation itself, it belongs in DESIGN.md.
Ask: "Could someone satisfy this GOAL using a different internal approach?" If yes → good requirement. If the GOAL dictates the approach → it's a design decision.
BAD: "Detects cycles using Kahn's algorithm"
→ Specifies the algorithm. Requirement = detect cycles. How = design.
BAD: "Code nodes use `node_type = "code"` and `node_kind` for precise type"
→ Specifies field names and schema layout. Requirement = code nodes are distinguishable from task nodes. How fields are named = design.
BAD: "Layer is derived from `source == "extract"`, not from `node_type`"
→ Specifies the derivation mechanism. Requirement = layers are deterministic. Which field drives it = design.
BAD: "Bridge edges use `edge.metadata["source"] = "extract"`"
→ Specifies schema. Requirement = code-to-feature connections are queryable. What the edge looks like internally = design.
BAD: "Uses SQLite for persistence"
→ Specifies technology. Requirement = state persists across crashes. Storage backend = design.
BAD: "Implements retry with exponential backoff"
→ Specifies algorithm. Requirement = failed operations are retried before giving up. Retry strategy = design.
BAD: "Merges are serialized via mutex/lock"
→ Specifies concurrency mechanism. Requirement = concurrent merges don't corrupt data. How = design.
GOOD: "Detects dependency cycles and rejects cyclic graphs with cycle path in error message"
GOOD: "Code nodes are distinguishable from project nodes in all query and display operations"
GOOD: "Node layer classification is deterministic — same input always produces same layer"
GOOD: "Code-to-feature connections are queryable in both directions (feature→code, code→feature)"
GOOD: "Execution state persists across process crashes — no data loss on restart"
GOOD: "Failed tasks are retried with enhanced context before marking as blocked"
GOOD: "Concurrent graph modifications never corrupt data or lose writes"
Infrastructure and framework features are where this boundary is hardest. When the "product" is a schema, an API, or a data pipeline, it feels like the schema IS the requirement. It's not.
Examples from a graph engine:
| ❌ Disguised design decision | ✅ Actual requirement |
|---|---|
"Node struct has source, node_type, node_kind fields" | "Each node carries enough metadata to determine its origin (extract vs manual) and category (code vs task)" |
"ready_tasks() filters by status == Todo && source != extract" | "Task readiness queries never return code-only nodes" |
"Edge relations include BelongsTo, TestsFor, Implements" | "The graph supports structural (containment), testing, and implementation relationships between nodes" |
"FTS5 index covers title and description columns" | "Full-text search covers node titles and descriptions" |
The pattern: Strip field names, function signatures, enum variants, and schema details. What's left is the requirement. The stripped parts go to DESIGN.md.
Some statements look like requirements but aren't verifiable functional behaviors:
| Not a requirement | What it actually is | Where it belongs |
|---|---|---|
| "Task descriptions must be self-contained" | Writing guideline for graph creation | Skill template / gid_design prompt |
| "gidterm's backend is not used" | Architecture decision | DESIGN.md |
| "Use Opus for complex tasks" | Configuration preference | execution.yml |
| "Follow the 7-phase pipeline" | Process description | DESIGN.md overview |
"node_type is for coarse layer, node_kind for precise type" | Field-level schema design | DESIGN.md |
"deprecated code_node_to_task_id() is not called" | Implementation cleanup detail | Task description |
Test: Can a test or human verify this by observing system output/behavior (not by reading source code)? If you'd need to read the struct definition to verify it → it's not a requirement.
Every GOAL and GUARD must have a *(ref: ...)* pointing to its source:
Good refs — specific enough to find:
*(ref: DESIGN, Architecture/Topology Analyzer)*
*(ref: DESIGN, Context Assembly/Strategy 2)*
*(ref: DESIGN, Module 6/Failure Escalation)*
*(ref: conversation, 2026-04-01)*
Bad refs — too vague to be useful:
*(ref: DESIGN §2)* — §2 is 60% of the doc
*(ref: DESIGN, Architecture)* — too broad
*(ref: discussion)* — when? about what?
For extraction from design docs: use the subsection heading, not the top-level section number.
When requirements.md is written AFTER a design doc exists:
After writing, verify against design doc:
Before submitting, verify ALL of these:
Good goals are:
Examples:
✅ GOAL-1.1 [P0]: Running `agentctl auth list` displays all profiles with name, status (active/cooldown), and token prefix (first 8 chars)
✅ GOAL-1.2 [P0]: Running `agentctl auth use <name>` switches the active profile and confirms with "Switched to <name>"
✅ GOAL-2.1 [P1]: Config file is written atomically so partial writes never corrupt state
❌ "Auth module works correctly" — not specific
❌ "Good performance" — not verifiable
❌ "Handle errors properly" — not specific or verifiable
❌ "Uses Kahn's algorithm for cycle detection" — implementation detail
Guards are system-wide, not feature-specific:
If it only applies to one feature, it's a goal, not a guard.
Be explicit. Sub-agents will read this. If something is ambiguous, an agent might waste turns implementing it.
✅ "GUI interface — CLI only for v1"
✅ "Multi-user support — single user only"
✅ "Cloud sync — local storage only"
engram recall "{project topic} requirements decisions" for past contextrequirements.md in project rootengram add --type factual --importance 0.7 "Requirements written for {project}: {GOAL count} goals, {GUARD count} guards"After this document is written, the next phases reference it:
satisfies: ["GOAL-1.1", "GOAL-1.2"] metadataWhen the Graph phase generates feature nodes, each feature node MUST include metadata linking to its documents:
- id: feat-auth
title: Authentication
type: feature
metadata:
requirements_doc: ".gid/features/auth/requirements.md"
design_doc: ".gid/features/auth/design.md"
goal_prefix: "GOAL-1" # namespace for this feature's GOALs
Task nodes under a feature MUST reference their parent and the GOALs they satisfy:
- id: task-auth-profile-list
title: "Implement auth profile listing"
type: task
metadata:
parent_feature: "feat-auth"
satisfies: ["GOAL-1.1", "GOAL-1.2"]
This chain ensures nothing is implemented without a reason, and nothing is required without being implemented.