ag-generate-spec
Create or update a product-discovery SPEC (requirements doc) for user review. Use when turning RESEARCH findings plus user intent into a reviewable requirements artifact before INNOVATE/PLAN.
- License 许可
- MIT
- 最近更新
- 2026-08-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- ag-generate-spec
- layer
- contract
- description
- Create or update a product-discovery SPEC (requirements doc) for user review. Use when turning RESEARCH findings plus user intent into a reviewable requirements artifact before INNOVATE/PLAN.
- trigger_keywords
- spec, requirements doc, product discovery, what and why, requirements artifact
02 资源文件 2
- 参考文档references/spec-contract.md6.5 KB
- 参考文档templates/program-spec-template.md2.9 KB
03 SKILL.md 正文
Generate SPEC
When to Apply
Use this skill when working with ag-generate-spec workflows, tasks, or system specifications.
How to Use
Refer to the workflow instructions and command references detailed below.
Output style: Follow
process/development-protocols/communication-standards.md— answer-first, plain language, no unexplained jargon, TL;DR on long responses.
Use this skill to produce the authoritative product-discovery SPEC artifact for a task — a plain-language requirements document written for user review, not for an engineer.
A SPEC captures what the user wants and why so the user can read it, recognize their own intent, and confirm "yes, build that" before any approach or code is chosen. It is the bridge between RESEARCH (the facts) and INNOVATE (the how). PLAN cannot start until a SPEC exists for non-trivial work.
SPEC consumes: RESEARCH findings + the user's stated intent/brainstorm. It does NOT consume a chosen approach or a Decision Summary — no approach exists yet at SPEC time.
Normal output is one SPEC file: {slug}_SPEC_{dd-mm-yy}.md.
For a phase program, the program-level (umbrella) SPEC is written once during the outer loop and governs every inner phase. Use templates/program-spec-template.md for that case. The inner loop never writes a SPEC.
Workflow
- Read
references/spec-contract.mdfor the full section-by-section writing rules. - Run
date +%d-%m-%ybefore choosing the filename. - Confirm the inputs are present: RESEARCH findings + the user's stated intent. If neither is present, emit
SPEC_INTENT_BLOCKEDinstead of writing. - Read
process/context/all-context.mdfirst, then load the relevant context group. When the work touches testing/verification, readprocess/context/tests/all-tests.mdso acceptance-criteria scenarios are grounded in the real test-context chain. - Save the SPEC inside the task folder alongside the plan:
process/features/{feature}/active/{slug}_{date}/{slug}_SPEC_{date}.md(orprocess/general-plans/active/{slug}_{date}/{slug}_SPEC_{date}.md). For a phase program, the umbrella task folder holds{program-slug}_SPEC_{date}.md. Per task-folder artefact colocation, never write to the deprecated siblingreports/orreferences/dirs. - Write the SPEC sections in canonical order (see
references/spec-contract.md):## Summary## User Stories / Jobs To Be Done## What The User Wants (Behavioral Outcomes)## Flow / State Diagram(ASCII)## Acceptance Criteria (Testable Outcomes)— each criterion carriesproven by:+strategy:## Out Of Scope## Constraints## Open Questions## Background / Research Findings
- Keep the document oriented for user review: plain language, no file paths, no library names, no schema or code. Anything engineer-only moves to Background or a later phase.
- Each acceptance criterion MUST be provable by comprehensive tests, with a fully-automated E2E/integration gate wherever the behavior is automatable. Agent-Probe / Known-Gap stand only as an explicitly-justified residual. Vacuous-green is banned.
- If
## Open Questionsis non-empty at finalize (interactive session): emitSPEC_INTENT_BLOCKEDand stop. Under /goal: record each as a backlog note and continue. - Once Open Questions is empty/"None" (or backlogged under /goal): save the file and the agent emits
PHASE_COMPLETE: SPEC.
Important Rules
- The SPEC is written for a human reviewer. If a sentence only makes sense to an engineer, rewrite it or move it to Background.
- Do NOT choose an implementation approach (INNOVATE's job, downstream), write implementation steps (PLAN), make schema decisions, or include code/library references.
- Do NOT modify any file except the SPEC file being created.
- Acceptance-criteria scenarios must be grounded in the RESEARCH test-context-discovery, not invented here.
- Once INNOVATE/PLAN begins the SPEC is frozen — later scope gaps go to the phase report
## SPEC Gapsheading and a backlog note, never an edit to the SPEC. - For a phase program, write the umbrella SPEC once; the inner loop reads it and never writes a per-phase SPEC.
Required SPEC Sections
Every SPEC file must include all of the following, in this order:
## Summary— one plain-language paragraph: what changes for the user and why## User Stories / Jobs To Be Done— the heart of the doc; "As a [user], I want [X], so that [Y]" or JTBD## What The User Wants (Behavioral Outcomes)— observable behavior only, no implementation## Flow / State Diagram— at least one ASCII flow/state diagram## Acceptance Criteria (Testable Outcomes)— observable outcomes, each withproven by:+strategy:; max 20## Out Of Scope— at least one item## Constraints— user-stated, system/process, and technical limits from research## Open Questions— each with an owner; empty/"None" required to finalize (interactive)## Background / Research Findings— key facts from RESEARCH that shaped the requirements
Use Markdown-structured sections, not a second machine-only schema. Markdown sections are stable across all agents (Claude, Codex, future systems) without requiring a parser.
References
04 同仓库更多 Skills
zustand
Rules and standards for state management using Zustand in React and Next.js. Use when implementing client-side stores, persistence with localStorage, or preventing SSR hydration mismatch.
zod
Zod v4 schema validation best practices. Use when defining schemas, utilizing safeParse, or customizing error messages.
upstash-ratelimit
Rules, standards, and references for rate limiting in serverless environments using Upstash Ratelimit. Use when implementing rate limiting, configuring Upstash Redis, or handling request blocking.
ui-design
UI/UX and frontend design best practices guidelines (formerly frontend-design). This skill should be used when writing, reviewing, or designing frontend code to ensure accessibility, performance, and usability. Triggers on tasks involving HTML structure, CSS styling, responsive layouts, form design, animations, or accessibility improvements.
typescript
TypeScript performance, tsconfig, type errors, async patterns — triggered when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.
typescript-refactor
TypeScript and TSX refactoring and modernization guidelines from a principal specialist perspective, current to TypeScript 6.0 and React 19. This skill should be used when refactoring, reviewing, or modernizing TypeScript or React/TSX code for type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving type architecture, narrowing, generics, discriminated unions, error handling, React component and hook typing, or migration to modern TypeScript features (satisfies, using, const type parameters, inferred type predicates, isolatedDeclarations, erasable syntax, import attributes).