5.3 KiB
Implementation Plan: [FEATURE]
Branch: [###-feature-name] | Date: [DATE] | Spec: [link]
Input: Feature specification from /specs/[###-feature-name]/spec.md
Note: This template is filled in by the /speckit.plan command. See .specify/templates/commands/plan.md for the execution workflow.
Summary
[Extract from feature spec: primary requirement + technical approach from research]
Technical Context
Language/Version: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION]
Primary Dependencies: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION]
Storage: [if applicable, e.g., PostgreSQL, CoreData, files or N/A]
Testing: [e.g., pytest, XCTest, cargo test or NEEDS CLARIFICATION]
Target Platform: [e.g., Linux server, iOS 15+, WASM or NEEDS CLARIFICATION]
Project Type: [single/web/mobile - determines source structure]
Performance Goals: [domain-specific, e.g., 1000 req/s, 10k lines/sec, 60 fps or NEEDS CLARIFICATION]
Constraints: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
Scale/Scope: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
Constitution Check
GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.
Tech Stack Adherence:
- Feature uses Fiber + GORM + Viper + Zap + Lumberjack.v2 + Validator + sonic JSON + Asynq + PostgreSQL
- No native calls bypass framework (no
database/sql,net/http,encoding/jsondirect use) - All HTTP operations use Fiber framework
- All database operations use GORM
- All async tasks use Asynq
Code Quality Standards:
- Follows Handler → Service → Store → Model architecture
- Handler layer only handles HTTP, no business logic
- Service layer contains business logic with cross-module support
- Store layer manages all data access with transaction support
- Uses dependency injection via Service/Store structs
- Unified error codes in
pkg/errors/ - Unified API responses via
pkg/response/
Testing Standards:
- Unit tests for all core business logic (Service layer)
- Integration tests for all API endpoints
- Tests use Go standard testing framework
- Tests are independent (no external service dependencies)
- Target coverage: 70%+ overall, 90%+ for core business
User Experience Consistency:
- All APIs use unified JSON response format
- Error responses include clear error codes and bilingual messages
- RESTful design principles followed
- Unified pagination parameters (page, page_size, total)
- Time fields use ISO 8601 format (RFC3339)
- Currency amounts use integers (cents) to avoid float precision issues
Performance Requirements:
- API response time (P95) < 200ms, (P99) < 500ms
- Batch operations use bulk queries/inserts
- All database queries have appropriate indexes
- List queries implement pagination (default 20, max 100)
- Non-realtime operations use async tasks
- Database and Redis connection pools properly configured
Project Structure
Documentation (this feature)
specs/[###-feature]/
├── plan.md # This file (/speckit.plan command output)
├── research.md # Phase 0 output (/speckit.plan command)
├── data-model.md # Phase 1 output (/speckit.plan command)
├── quickstart.md # Phase 1 output (/speckit.plan command)
├── contracts/ # Phase 1 output (/speckit.plan command)
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
Source Code (repository root)
# [REMOVE IF UNUSED] Option 1: Single project (DEFAULT)
src/
├── models/
├── services/
├── cli/
└── lib/
tests/
├── contract/
├── integration/
└── unit/
# [REMOVE IF UNUSED] Option 2: Web application (when "frontend" + "backend" detected)
backend/
├── src/
│ ├── models/
│ ├── services/
│ └── api/
└── tests/
frontend/
├── src/
│ ├── components/
│ ├── pages/
│ └── services/
└── tests/
# [REMOVE IF UNUSED] Option 3: Mobile + API (when "iOS/Android" detected)
api/
└── [same as backend above]
ios/ or android/
└── [platform-specific structure: feature modules, UI flows, platform tests]
Structure Decision: [Document the selected structure and reference the real directories captured above]
Complexity Tracking
Fill ONLY if Constitution Check has violations that must be justified
| Violation | Why Needed | Simpler Alternative Rejected Because |
|---|---|---|
| [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
| [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |