doc-driven-dev
npx skills add https://github.com/zigcc/skills --skill doc-driven-dev
Agent 安装分布
Skill 文档
Document-Driven Development Guide
Core Principle: Documentation first, code follows, tests verify, documentation closes. All features must follow the documentation-driven development cycle.
This skill ensures proper documentation workflow, preventing common mistakes like code without Story updates or incomplete feature tracking.
Project Documentation Structure:
- Stories:
stories/(version-based feature tracking) - Design Docs:
docs/design/(architecture and decisions) - API Docs:
docs/(user-facing documentation) - Changelog:
CHANGELOG.md(session-based updates) - Roadmap:
ROADMAP.md(version planning)
Related Skills:
solana-sdk-zig: Rust source references and test compatibilityzig-0.15: Zig API usagezig-memory: Memory management patterns
References
Detailed templates and examples:
| Document | Path | Content |
|---|---|---|
| CHANGELOG Template | references/changelog-template.md |
Session entry format, version release format |
Development Cycle (Required)
Every feature/change MUST follow this workflow:
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â 1. Documentation Preparation â
â âââ Update/create design docs (docs/design/) â
â âââ Update ROADMAP.md (if new feature) â
â âââ Create/Update Story file (stories/) â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¤
â 2. Coding Phase â
â âââ Implement feature code â
â âââ Add code comments with Rust source references â
â âââ Sync update docs/ (REQUIRED!) â
â âââ Update Story checkboxes as features complete â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¤
â 3. Testing Phase â
â âââ Unit tests (zig test src/xxx.zig) â
â âââ Integration tests (zig build test) â
â âââ All tests MUST pass before proceeding â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¤
â 4. Documentation Finalization â
â âââ Update CHANGELOG.md with session entry â
â âââ Update Story status (â³ â â
) if ALL complete â
â âââ Update README.md (if user-visible changes) â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Story File Format
Directory Structure
stories/
âââ v0.1.0-core-types.md
âââ v0.2.0-serialization.md
âââ v0.29.0-program-sdk-completion.md
âââ v1.0.0-sdk-restructure.md
âââ v2.0.0-spl-token.md
âââ v2.2.0-stake-program.md
Story Template
# Story: vX.Y.Z Feature Name
> Brief description (one sentence)
## Goals
- Goal 1
- Goal 2
## Acceptance Criteria
### module_name.zig
- [ ] Feature 1
- [ ] Feature 2
- [ ] Unit tests
### Integration
- [ ] root.zig exports
- [ ] Documentation update
- [ ] Tests passing
## Completion Status
- Start date: YYYY-MM-DD
- Completion date: YYYY-MM-DD
- Status: â³ In Progress / â
Completed
Status Markers
| Marker | Location | Meaning | When to Use |
|---|---|---|---|
â³ |
ROADMAP, stories, docs | Pending/In Progress | Feature started but not complete |
ð¨ |
ROADMAP, stories | Currently Working | Active development this session |
â
|
ROADMAP, stories | Completed | ALL checkboxes are [x] |
[ ] |
stories, docs | Unchecked task | Task not yet done |
[x] |
stories, docs | Completed task | Task finished and verified |
TODO |
Code comments | To implement | Future work |
FIXME |
Code comments | To fix | Known issue |
XXX |
Code comments | Attention needed | Needs review |
Story Sync Rules (Critical)
| Timing | Required Action |
|---|---|
| Start new version | Create Story file, list ALL acceptance criteria |
| Complete single feature | Change [ ] to [x] for that feature |
| Complete entire version | ONLY update status to â
when ALL [ ] are [x] |
| Add new feature | Add acceptance criteria to Story |
| Before version release | Ensure all [ ] are [x] |
Common Mistakes
# â WRONG - Marking complete with unchecked items
## Completion Status
- Status: â
Completed
## Acceptance Criteria
- [x] Feature 1
- [ ] Feature 2 â Still unchecked!
# â
CORRECT - All items checked before marking complete
## Completion Status
- Status: â
Completed
## Acceptance Criteria
- [x] Feature 1
- [x] Feature 2
Validation Commands
# Check uncompleted tasks in stories/
grep -rn "\[ \]" stories/
# Check story status markers
grep -rn "Status:" stories/
# Check ROADMAP status
grep -n "â³\|â
" ROADMAP.md
# Full scan (one command)
echo "=== ROADMAP.md ===" && grep -n "â³" ROADMAP.md && \
echo "=== stories/ ===" && grep -rn "\[ \]\|â³" stories/ && \
echo "=== docs/ ===" && grep -rn "TODO\|FIXME\|â³\|\[ \]" docs/ && \
echo "=== src/ ===" && grep -rn "TODO\|FIXME\|XXX" src/ --include="*.zig"
# Verify Story-ROADMAP consistency
echo "=== ROADMAP ===" && grep -n "â
\|â³" ROADMAP.md
echo "=== Stories ===" && grep -rn "Status:" stories/
Completion Criteria
A version can ONLY be marked as “completed” when ALL conditions are met:
| Criterion | Verification |
|---|---|
| Core functionality 100% | All [ ] are [x] in Story |
| All tests passing | zig build test shows 0 failures |
| No memory leaks | Testing allocator reports no leaks |
| Documentation synced | CHANGELOG updated, Story status correct |
| Issues documented | Any deferred items noted |
Refactoring Rules
When doing architecture changes, follow this strict order:
Phase 1: Refactor Existing Code
âââ Move/reorganize file structure
âââ Update import paths and dependencies
âââ Run tests: zig build test
âââ Ensure all existing tests 100% pass
âââ Commit: "refactor: reorganize project structure"
Phase 2: Verify Refactoring Complete
âââ Compilation passes, no errors
âââ All original tests pass
âââ Functionality unchanged from before
âââ DO NOT proceed until 100% verified
Phase 3: Add New Features (ONLY after Phase 2)
âââ Add new modules/files
âââ Implement new features
âââ Add tests for new features
âââ Commit: "feat: add new feature"
Prohibited Refactoring Behaviors
| Behavior | Status |
|---|---|
| Mix refactoring + new features in one commit | â PROHIBITED |
| Start new features before refactoring tests pass | â PROHIBITED |
| Skip test verification between phases | â PROHIBITED |
| Combine Phase 1 and Phase 3 in same commit | â PROHIBITED |
CHANGELOG Format
See:
references/changelog-template.mdfor complete templates.
Session Entry (Daily Work)
### Session YYYY-MM-DD-NNN
**Date**: YYYY-MM-DD
**Goal**: Brief description of session goal
#### Completed Work
1. Implemented feature X
2. Fixed bug in Y
3. Added tests for Z
#### Test Results
- Unit tests: 305 tests passed
- Integration tests: 53 vectors verified
#### Next Steps
- [ ] Task for next session
Version Release Entry
## [vX.Y.Z] - YYYY-MM-DD
### Added
- New feature 1
- New feature 2
### Changed
- Modified behavior 1
### Fixed
- Bug fix 1
Test Requirements
All code changes MUST pass tests before commit:
# Run full test suite
./solana-zig/zig build test --summary all
# Or run SDK tests
cd sdk && ../solana-zig/zig build test --summary all
On Test Failure
| Situation | Action |
|---|---|
| Test fails | Fix immediately, do NOT commit |
| Cannot fix quickly | Revert changes, investigate |
| Need help | Ask before committing broken code |
Critical: zig build test must 100% pass before git commit.
Common Error Scenarios
| Error | Cause | Fix |
|---|---|---|
Story says â
but has [ ] |
Premature completion | Uncheck â , complete remaining items |
| ROADMAP and Story disagree | Sync issue | Run validation commands, align status |
| Code complete, Story unchanged | Forgot to update | Update Story checkboxes immediately |
| Tests fail after “complete” | Incomplete verification | Never mark complete without test pass |
Verification Checklist
Before marking any version complete:
-
grep -rn "\[ \]" stories/vX.Y.Z-*.mdreturns nothing -
zig build testshows 100% pass - CHANGELOG.md has session entry
- Story status updated (â³ â â )
- ROADMAP.md version marked â
Prohibited Actions
- â Code complete but Story not updated
- â Story marked â but code not implemented
- â Skip Story and develop directly
- â Release version with
[ ]remaining - â Mark Story â when partial features complete
- â Commit code that fails tests
- â Mix refactoring and new features in one commit