Standard workflow for implementing features in doc-agent.
Before writing any code, ensure a ticket exists for the work.
- Small Changes: A simple Issue is sufficient.
- Large Features: Create an Epic and break it down into Implementation Tasks.
- No Ticket?: Create one using the templates below.
# Epic: [Name]
## 🎯 Overview
High-level goal and key insights. "Why are we doing this?"
## 🏗️ Architecture
Core components and user flow.
## 📋 Sub-Issues
Breakdown of work into implementation tasks.
- Task 1: Foundation
- Task 2: Feature
- Task 3: Integration
*(Note: Use `scripts/gh-issue-add-subs.sh` to link child tasks to the Epic)*
## ✅ Success Criteria
- [ ] Checklist of deliverables## Title: [Task/Feature] Name
**Context**
Why is this specific piece needed?
**Architecture Decisions**
- Package: e.g., `packages/storage`
- Tech: e.g., `better-sqlite3`
- Patterns: e.g., Repository Pattern, Lazy Init
**Requirements**
- [ ] Requirement 1
- [ ] Requirement 2
**References**
- Epic: #1# Update main branch
git checkout main
git pull origin main
# Use GitHub Context to find what to work on next
# (Coming soon: doc-agent issue search)# Create feature branch (use feat/, fix/, docs/, etc.)
git checkout -b feat/feature-name
# Update TODOs (mark as in_progress)
# Done via todo_write tool# Read the issue requirements
# Break down the work into specific tasks
# Suggest implementation orderImplementation Checklist:
- Define types/interfaces
- Implement core functionality
- Write comprehensive tests
- Add usage examples
- Create README if new module
- Update related documentation
# Design interfaces first (in comments or types)
# Implement with test-driven development
# Document with examples as you go# Build all packages
pnpm build
# Run all tests
pnpm test
# Check specific package coverage
npx vitest run packages/<package>/src/<module> --coverage
# Lint and format
pnpm lint
pnpm format
# Type check
pnpm typecheckQuality Standards:
- ✅ All tests passing
- ✅ 85%+ statement coverage (aim for 90%+)
- ✅ 100% function coverage
- ✅ No linter errors
- ✅ No TypeScript errors
- ✅ Documentation with examples
# Stage all changes
git add -A
# Commit with conventional commit format
git commit -m "feat(<scope>): <description>
<detailed description>
Features:
- Feature 1
- Feature 2
Testing:
- X tests, all passing
- Y% coverage
<additional sections>
Issue: #<issue-number>"
# Push to remote
git push -u origin feat/feature-name
# Create PR with comprehensive description
gh pr create \
--title "feat(<scope>): <title>" \
--body "<detailed PR description>" \
--base main<type>(<scope>): <short description>
<detailed description>
<body sections>
Issue: #<number>
feat: New featurefix: Bug fixdocs: Documentation onlytest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementchore: Maintenance tasks
cli: Command-line interfacecore: Core functionalityextract: Extraction logicstorage: Database & Persistencevector: Vector storagemcp: MCP Server integration
Always include:
- Implementation: What was built
- Features: Key features added
- Testing: Test count, coverage
- Issue: Reference to GitHub issue
Optional but recommended:
- Performance: Performance metrics
- Documentation: What was documented
- Architecture: Design decisions
- Breaking Changes: API changes
- Known Limitations: What doesn't work yet
Every commit should be atomic:
- ✅ Complete logical unit of work
- ✅ Can be reviewed independently
- ✅ Can be reverted without breaking things
- ✅ Tests pass at each commit
- ✅ Working state maintained
Commit frequently, but keep commits atomic.
For cohesive features, use a single atomic commit:
feat(scope): implement feature with tests
- Implementation details
- Tests included
- All related changes together
When to use:
- ✅ New features/modules (e.g., new package)
- ✅ Cohesive changes (< 1000 lines)
- ✅ Implementation + tests belong together
- ✅ Single logical unit of work
Rationale:
- Easier to review as one unit
- Tests validate implementation immediately
- Cleaner git history
- Simpler to revert if needed
Split into multiple atomic commits when:
- 🔀 Multiple unrelated concerns (e.g., DB + API + UI)
- 🔀 Large features (1000+ lines) that benefit from incremental review
- 🔀 Risky changes needing staged rollout
- 🔀 Tests require significant refactoring separate from implementation
Example split:
feat(module): implement core functionality
feat(module): add comprehensive test suite
Avoid splitting for:
- ❌ Small cohesive features
- ❌ Implementation + tests (they belong together)
- ❌ Artificial separation (e.g., "code" vs "tests")
Key Principle: Atomic ≠ Small. Atomic = Complete logical unit. A cohesive feature is one atomic unit.
- Statement Coverage: 85%+ (aim for 90%+)
- Branch Coverage: 60%+ (aim for 80%+)
- Function Coverage: 100%
- Line Coverage: 85%+
Must Test:
- ✅ Happy paths (normal usage)
- ✅ Edge cases (empty, null, boundaries)
- ✅ Error handling
- ✅ Public API methods
- ✅ Integration points
Don't Need to Test:
- ❌ Type definitions (TypeScript handles this)
- ❌ External library behavior
- ❌ Private implementation details (test through public API)