requirements-spec
Gather requirements and produce comprehensive implementation specifications through interactive clarification and codebase analysis. Use when: (1) User requests a new feature implementation plan (2) User wants to enrich or validate an existing sprint/implementation document (3) User asks "what do I need to build X" or "help me plan Y" (4) User provides vague requirements needing clarification (5) User wants to identify reusable code before implementing Produces structured specification documents with blocking issues, domain models, API schemas, migration strategies, deliverables, and test plans.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- requirements-spec
- description
- Gather requirements and produce comprehensive implementation specifications through interactive clarification and codebase analysis. Use when: (1) User requests a new feature implementation plan (2) User wants to enrich or validate an existing sprint/implementation document (3) User asks "what do I need to build X" or "help me plan Y" (4) User provides vague requirements needing clarification (5) User wants to identify reusable code before implementing Produces structured specification documents with blocking issues, domain models, API schemas, migration strategies, deliverables, and test plans.
02 资源文件 2
- 参考文档references/output-template.md7.7 KB
- 参考文档references/question-bank.md6.8 KB
03 SKILL.md 正文
Requirements & Specifications
Produce implementation-ready specification documents through iterative clarification and codebase validation.
Workflow
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ 1. CLARIFY │───▶│ 2. ANALYZE │───▶│ 3. SYNTHESIZE │
│ Requirements │ │ Codebase │ │ Specification │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
AskUserQuestion Semantic + Grep Markdown Document
(2-4 questions) (find reusable code) (Sprint README format)
Phase 1: Clarify Requirements
Use AskUserQuestion with 2-4 focused questions per round. Stop when sufficient clarity exists.
Question Categories
| Category | When Missing | Example |
|---|---|---|
| Scope | Feature boundaries unclear | "Backend only, full-stack, or client-only?" |
| Actors | No roles/permissions mentioned | "Who can perform this? Role restrictions?" |
| Data | Entities without relationships | "How does [A] relate to [B]?" |
| Integration | Standalone vs connected unclear | "Does this integrate with existing features?" |
| Constraints | NFRs not specified | "Performance, security, or compatibility requirements?" |
| Priority | MVP vs full feature unclear | "What's minimum viable vs nice-to-have?" |
Clarification Patterns
Ambiguous scope: Ask about boundaries and priority breakdown.
Missing actors: Ask about access control and ownership scope (user/workspace/global).
Unclear data model: Ask about relationships and lifecycle (archive/delete behavior).
Integration uncertainty: Ask about existing feature touchpoints and API contracts.
Phase 2: Analyze Codebase
Find reusable patterns, existing implementations, and integration points using parallel searches.
Search Strategy
# Semantic search (similar patterns)
find_symbol(name_path_pattern="*Service", depth=1)
find_symbol(name_path_pattern="*Repository", depth=1)
# Keyword search (specific implementations)
search_for_pattern(substring_pattern="@dataclass", paths_include_glob="**/domain/**")
# Reference search (usage patterns)
find_referencing_symbols(name_path="UnitOfWork", relative_path="domain/ports/")
What to Find
| Category | Search Target | Purpose |
|---|---|---|
| Domain | Entities, value objects | Reuse field patterns, validation |
| Services | Application services | Follow established DI, error handling |
| Repositories | Port definitions | Match existing CRUD patterns |
| API | Proto messages, RPCs | Consistent API design |
| Tests | Fixtures, parameterized tests | Reuse test infrastructure |
| Migrations | Alembic scripts | Follow migration conventions |
Validation Checklist
- [ ] No duplicate implementations exist
- [ ] Identified base classes/protocols to extend
- [ ] Found related features for integration
- [ ] Located test fixtures to reuse
- [ ] Checked for conflicting naming
Phase 3: Synthesize Specification
Generate specification following references/output-template.md. Key sections:
- Header — Sprint name, size, owner, prerequisites, phase
- Open Issues — Blocking issues, design gaps, prerequisite verification
- Validation Status — What exists vs needs implementation
- Objective — 2-3 sentence goal
- Key Decisions — Table with rationale
- What Already Exists — Reusable assets from analysis
- Scope — Task breakdown with effort (S/M/L/XL)
- Domain Model — Entity definitions with code
- API Schema — Proto/gRPC or REST additions
- Migration Strategy — Phased rollout with risks
- Deliverables — Checkbox lists by layer
- Test Strategy — Fixtures, parameterized tests, cases
- Quality Gates — Exit criteria
Effort Guide
| Size | Scope |
|---|---|
| S | Single file, straightforward (add field, simple function) |
| M | Multiple files, clear pattern (new entity, repo method) |
| L | Cross-cutting, some complexity (new service, gRPC mixin) |
| XL | Architectural, high complexity (new subsystem, major refactor) |
Tool Usage
| Tool | Phase | Purpose |
|---|---|---|
AskUserQuestion |
1 | Gather requirements |
find_symbol |
2 | Semantic code search |
search_for_pattern |
2 | Regex code search |
find_referencing_symbols |
2 | Find usage patterns |
get_symbols_overview |
2 | Understand file structure |
Write |
3 | Generate specification |
Guardrails
think_about_collected_information— After Phase 2think_about_task_adherence— Before writing specthink_about_whether_you_are_done— After document complete
References
references/output-template.md— Full specification document templatereferences/question-bank.md— Comprehensive clarification questions
04 同仓库更多 Skills
type-strictness
Enforce strict type compliance by eliminating `Any` types and `# type: ignore` comments. Use when: (1) Editing code that contains `Any` as a type annotation (2) Code has `# type: ignore` or `# pyright: ignore` comments (3) User requests type fixes or type strictness enforcement (4) Importing from untyped third-party libraries (5) User asks to "fix types", "remove Any", or "add proper typing" (6) Pyrefly or mypy reports type errors that need resolution (7) Code review reveals weak typing patterns Follows hierarchical resolution: codebase inference → type stubs → library inspection → type guards → casting (last resort).
slopgate-test-extender
Extend Python test suites with parametrization, fixture reuse, and quality enforcement. Use when asked to add tests, extend existing tests, improve test coverage, consolidate duplicate tests, fix test quality issues, or when Slopgate reports untested-production-code, missing test references, or coverage gaps. Triggers on requests like "add tests for X", "extend these tests", "parametrize tests", "consolidate tests", "fix test quality", "improve test coverage", "write tests for this function", "test this module", "behavior tests", "integration tests", "missing tests", "coverage holes", "untested code", or when a hook denies with test-related findings.
slopgate-intelligent-coding-patterns
Pattern-selection playbook for agents editing code with complex branching, stateful parsers/workflows, duplicated skeletons, policy checks, or ordered transforms. Load before refactoring if/elif dispatch chains, boolean-flag state machines, repeated validation predicates, parallel provider/language implementations, or regex/content transformation pipelines. Also load when asked to "apply a design pattern", "which pattern should I use here", "refactor this switch statement", "replace if-elif chain", "state machine pattern", "strategy pattern", "template method", "pipeline pattern", "specification pattern", "dispatch table", "guard clause refactor", "reduce cyclomatic complexity", or when Slopgate fires PY-CODE-014, PY-CODE-017, PY-CODE-018, QUALITY-LINT-001, or PY-QUALITY-010. Use with behavior-locking tests and avoid pattern theater for simple one-off code.
slopgate-hygiene-orchestrator
Orchestrate systematic elimination of linter warnings and errors across Python, TypeScript, and Rust codebases. Use when asked to "clean up lints", "fix all warnings", "run hygiene", "eliminate type errors", "orchestrate code quality fixes", "fix lint errors", "resolve quality gate failures", "pass CI checks", "reduce tech debt", "refactor to pass hooks", or when a Slopgate hook denies with QUALITY-LINT-001, PY-CODE-017, PY-CODE-018, or any collector finding. This skill coordinates multiple code-hygiene-enforcer agents working in parallel on non-conflicting file groupings, tracks progress persistently via JSON exports, and loops until all issues are resolved. CRITICAL: Never run linters directly—always use `slopgate lint check` as the primary gate, discover project-specific tools from config files, and export findings to JSON for tracking.
slopgate-code-smell-utility-locator
Autoactivate when code-smell hooks or reviews mention feature envy, thin wrappers, duplicate helpers, duplicate code, scattered helpers, builders/factories/config/constants/dataclass reuse, PY-CODE-012, PY-CODE-013, QUALITY-LINT-001, or repeated slopgate code-quality denials. Also load when asked to "find existing helpers", "consolidate utilities", "search for duplicate code", "where is this already implemented", "reuse existing logic", "don't duplicate this", "find similar functions", "utility inventory", "code smell radar", or before adding new helpers/wrappers so agents can find existing shared utilities and consolidate instead of duplicating.
slopgate-code-hygiene-refactor
Recovery playbook for Slopgate and project quality failures. Load after hook/lint denials such as PY-CODE-017 flat sibling modules, PY-CODE-018 oversized modules, QUALITY-LINT-001 post-edit quality backstops, PY-QUALITY-010 magic numbers / repeated literals, PY-CODE-012/PY-CODE-013 smell findings, type-suppression bans, duplicate helpers, or repeated hygiene retry loops. Also load when asked to "refactor this module", "split this file", "extract a class", "reduce complexity", "fix god class", "flatten module hierarchy", "move code to a package", "extract helpers", "consolidate duplicates", "replace magic numbers with constants", or when a hook blocks an edit with structural complaints. Focuses on preserving public APIs while refactoring toward packages, cohesive modules, typed seams, and focused tests.