implement-spec
Orchestrate disciplined implementation from requirements documents or user prompts. Use when: (1) User provides a sprint README, requirements doc, or implementation plan to execute (2) User asks to "implement", "build", or "develop" a feature with detailed requirements (3) User wants to break down a large effort into testable, verifiable tasks (4) User asks to execute work described in @docs/sprints/ or similar planning documents Enforces: task breakdown, search-before-edit, quality compliance, test coverage, type safety, and documentation reconciliation.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- implement-spec
- description
- Orchestrate disciplined implementation from requirements documents or user prompts. Use when: (1) User provides a sprint README, requirements doc, or implementation plan to execute (2) User asks to "implement", "build", or "develop" a feature with detailed requirements (3) User wants to break down a large effort into testable, verifiable tasks (4) User asks to execute work described in @docs/sprints/ or similar planning documents Enforces: task breakdown, search-before-edit, quality compliance, test coverage, type safety, and documentation reconciliation.
02 资源文件 2
- 参考文档references/search-patterns.md7.4 KB
- 参考文档references/task-breakdown.md5.1 KB
03 SKILL.md 正文
Implementation Orchestrator
Execute implementation work through disciplined task breakdown, mandatory code search, and quality enforcement.
Core Principles
| Principle | Enforcement |
|---|---|
| Small, testable tasks | Break all work into single-responsibility units |
| Search before edit | Every code edit preceded by codebase search |
| No new files without permission | Ask user before creating new modules |
| Quality compliance | All changes must pass make quality |
| Type safety | Use type-strictness skill for typing issues |
| Test coverage | Use test-extender skill for all tests |
| Issue tracking | Never ignore issues; document or create tasks |
| Doc reconciliation | Update related sprint/roadmap docs on completion |
Workflow
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ 1. PARSE │───▶│ 2. CLARIFY │───▶│ 3. BREAKDOWN │───▶│ 4. IMPLEMENT │
│ Requirements │ │ (if unclear) │ │ Into Tasks │ │ Each Task │
└─────────────────┘ └──────────────────┘ └─────────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
requirements-spec TodoWrite Search → Edit
skill small units → Test → Quality
│
▼
┌──────────────────┐
│ 5. RECONCILE │
│ Documentation │
└──────────────────┘
Phase 1: Parse Requirements
Accept input from:
- Sprint README:
@docs/sprints/phase-X/sprint-N/README.md - Requirements doc: Any structured implementation plan
- User prompt: Direct description of work to be done
Extract from document:
- Objective and scope
- Deliverables list (checkbox items)
- Domain model definitions
- API/Proto schema additions
- Migration requirements
- Test strategy
- Quality gates
Phase 2: Clarify Requirements
If requirements are unclear, incomplete, or ambiguous, invoke the requirements-spec skill:
Use requirements-spec skill to:
1. Ask clarifying questions (2-4 per round)
2. Analyze codebase for existing patterns
3. Produce enriched specification
Clarity checklist:
- [ ] Scope boundaries defined (backend/fullstack/client)
- [ ] Entities and relationships clear
- [ ] API contracts specified
- [ ] Migration strategy defined
- [ ] Test cases identified
- [ ] Quality gates explicit
Phase 3: Break Down Into Tasks
Convert requirements into small, testable, verifiable tasks using TodoWrite.
Task Sizing Rules
| Size | Characteristics |
|---|---|
| Atomic | Single function, single test, single file (preferred) |
| Small | 2-3 related functions, same module |
| Medium | Single entity + repository + tests |
| Large | Split into smaller tasks |
Task Ordering
- Domain layer first — Entities, value objects, errors
- Infrastructure adapters — Repositories, converters
- Application services — Business logic orchestration
- API layer — Proto, mixins, handlers
- Tests in parallel — Write tests alongside implementation
- Client last — Frontend changes after backend stable
Task Template
Task: [ACTION] [COMPONENT] for [PURPOSE]
Verify: [HOW TO TEST]
Depends: [PREREQUISITE TASKS]
Example:
Task: Create ProjectRole enum with permission methods
Verify: pytest tests/domain/test_project_role.py
Depends: None
Task: Add ProjectModel with FK to WorkspaceModel
Verify: alembic upgrade head (no errors)
Depends: ProjectRole enum
Task: Implement ProjectRepository with CRUD operations
Verify: pytest tests/infrastructure/test_project_repository.py
Depends: ProjectModel
Phase 4: Implement Each Task
4.1 Search Before Edit (MANDATORY)
Before ANY code edit, search the codebase to find:
# Find similar implementations
find_symbol(name_path_pattern="*Service", depth=1, include_body=False)
find_symbol(name_path_pattern="*Repository", depth=1)
# Find specific patterns
search_for_pattern(substring_pattern="@dataclass", paths_include_glob="**/domain/**")
# Find usage patterns for reuse
find_referencing_symbols(name_path="UnitOfWork", relative_path="domain/ports/")
# Keyword search for signatures
search_for_pattern(substring_pattern="def create_", paths_include_glob="**/*service*.py")
Search requirements:
- [ ] Find existing similar implementations
- [ ] Identify base classes/protocols to extend
- [ ] Locate imports and their signatures
- [ ] Check for conflicting names
- [ ] Find related test fixtures
4.2 Ask Permission for New Files
If search yields no satisfactory match:
Before creating [new_file.py]:
- Purpose: [why needed]
- Location: [proposed path]
- Alternatives considered: [what was searched]
Proceed with file creation? (Ask user)
4.3 Implement with Quality
Write code following patterns found in search:
# Match existing conventions
# - Import style from same package
# - Error handling patterns
# - Docstring format
# - Type annotation style
4.4 Write Tests (test-extender skill)
For every implementation, use test-extender skill:
Invoke test-extender to:
1. Find existing test fixtures to reuse
2. Check for parametrization opportunities
3. Follow quality rules (no loops, no conditionals in tests)
4. Use proper assertion messages
4.5 Fix Type Issues (type-strictness skill)
For any typing errors or Any usage, invoke type-strictness skill:
Invoke type-strictness to:
1. Infer types from codebase
2. Find type stubs if needed
3. Inspect library signatures
4. Apply type guards/narrowing
5. Document casts (last resort)
4.6 Run Quality Checks
make quality
Quality gates:
- All tests pass
- No type errors
- No lint violations
- No test anti-patterns
Phase 5: Reconcile Documentation
After implementation complete:
5.1 Update Sprint/Task Documents
# Find related docs
rg -l "Sprint 18" docs/
rg -l "[Feature Name]" docs/sprints/
Update:
- [ ] Mark deliverables as complete
- [ ] Update validation status
- [ ] Resolve blocking issues
- [ ] Add discovered issues to "Open Issues"
5.2 Update Roadmap
If implementation changes affect future sprints:
- Update prerequisite status
- Note downstream impacts
- Add discovered work to backlog
5.3 Document Issues
Never ignore issues. For each issue encountered:
| Action | When |
|---|---|
| Fix immediately | Small, in-scope issue |
| Create task | Medium issue, related to current work |
| Add to doc | Larger issue, out of scope |
| Open issue | Cross-cutting, needs discussion |
Issue Handling
Preexisting Issues
When encountering preexisting issues:
- Acknowledge — Note the issue in your response
- Assess impact — Does it block current task?
- Document — Add to sprint doc or create task
- Decide action:
- Fix if small and in-scope
- Create explicit task if medium
- Escalate to user if large
Implementation Issues
When hitting problems during implementation:
Issue: [Description]
Impact: [How it affects current work]
Options:
1. [Option with trade-offs]
2. [Option with trade-offs]
Recommendation: [Your suggestion]
Ask user before proceeding with workarounds.
Tool Integration
| Tool/Skill | Phase | Purpose |
|---|---|---|
TodoWrite |
3 | Track task breakdown and progress |
find_symbol |
4.1 | Semantic code search |
search_for_pattern |
4.1 | Keyword/regex search |
find_referencing_symbols |
4.1 | Find usage patterns |
AskUserQuestion |
4.2 | Permission for new files |
| test-extender | 4.4 | Test creation and quality |
| type-strictness | 4.5 | Type safety enforcement |
| requirements-spec | 2 | Clarification if needed |
Guardrails
Call these before major actions:
| Tool | When |
|---|---|
think_about_collected_information |
After search, before edit |
think_about_task_adherence |
Before implementing each task |
think_about_whether_you_are_done |
After completing all tasks |
Quick Reference
Before Every Edit
- Search codebase (semantic + keyword)
- Find imports and signatures
- Check for existing patterns
- Confirm no new files without permission
After Every Task
- Run tests for that component
- Check types (
pyrefly check) - Run quality checks
- Mark task complete in TodoWrite
On Completion
- Run full quality suite (
make quality) - Update sprint documentation
- Document any new issues
- Reconcile with roadmap
References
references/task-breakdown.md— Task sizing and ordering patternsreferences/search-patterns.md— Code search strategies and examples
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.