mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-08 18:33:28 +08:00
docs: enhance 5 thin commands and add Rust API example
Commands enhanced with multi-language support, error recovery strategies, and structured step-by-step workflows: - build-fix: build system detection table, fix loop, recovery strategies - test-coverage: framework detection, test generation rules, before/after report - refactor-clean: safety tiers (SAFE/CAUTION/DANGER), multi-language tools - update-codemaps: codemap format spec, diff detection, metadata headers - update-docs: source-of-truth mapping, staleness checks, generated markers New example: - rust-api-CLAUDE.md: Axum + SQLx + PostgreSQL with layered architecture, thiserror patterns, compile-time SQL verification, integration test examples
This commit is contained in:
@@ -1,17 +1,72 @@
|
||||
# Update Codemaps
|
||||
|
||||
Analyze the codebase structure and update architecture documentation:
|
||||
Analyze the codebase structure and generate token-lean architecture documentation.
|
||||
|
||||
1. Scan all source files for imports, exports, and dependencies
|
||||
2. Generate token-lean codemaps in the following format:
|
||||
- codemaps/architecture.md - Overall architecture
|
||||
- codemaps/backend.md - Backend structure
|
||||
- codemaps/frontend.md - Frontend structure
|
||||
- codemaps/data.md - Data models and schemas
|
||||
## Step 1: Scan Project Structure
|
||||
|
||||
3. Calculate diff percentage from previous version
|
||||
4. If changes > 30%, request user approval before updating
|
||||
5. Add freshness timestamp to each codemap
|
||||
6. Save reports to .reports/codemap-diff.txt
|
||||
1. Identify the project type (monorepo, single app, library, microservice)
|
||||
2. Find all source directories (src/, lib/, app/, packages/)
|
||||
3. Map entry points (main.ts, index.ts, app.py, main.go, etc.)
|
||||
|
||||
Use TypeScript/Node.js for analysis. Focus on high-level structure, not implementation details.
|
||||
## Step 2: Generate Codemaps
|
||||
|
||||
Create or update codemaps in `docs/CODEMAPS/` (or `.reports/codemaps/`):
|
||||
|
||||
| File | Contents |
|
||||
|------|----------|
|
||||
| `architecture.md` | High-level system diagram, service boundaries, data flow |
|
||||
| `backend.md` | API routes, middleware chain, service → repository mapping |
|
||||
| `frontend.md` | Page tree, component hierarchy, state management flow |
|
||||
| `data.md` | Database tables, relationships, migration history |
|
||||
| `dependencies.md` | External services, third-party integrations, shared libraries |
|
||||
|
||||
### Codemap Format
|
||||
|
||||
Each codemap should be token-lean — optimized for AI context consumption:
|
||||
|
||||
```markdown
|
||||
# Backend Architecture
|
||||
|
||||
## Routes
|
||||
POST /api/users → UserController.create → UserService.create → UserRepo.insert
|
||||
GET /api/users/:id → UserController.get → UserService.findById → UserRepo.findById
|
||||
|
||||
## Key Files
|
||||
src/services/user.ts (business logic, 120 lines)
|
||||
src/repos/user.ts (database access, 80 lines)
|
||||
|
||||
## Dependencies
|
||||
- PostgreSQL (primary data store)
|
||||
- Redis (session cache, rate limiting)
|
||||
- Stripe (payment processing)
|
||||
```
|
||||
|
||||
## Step 3: Diff Detection
|
||||
|
||||
1. If previous codemaps exist, calculate the diff percentage
|
||||
2. If changes > 30%, show the diff and request user approval before overwriting
|
||||
3. If changes <= 30%, update in place
|
||||
|
||||
## Step 4: Add Metadata
|
||||
|
||||
Add a freshness header to each codemap:
|
||||
|
||||
```markdown
|
||||
<!-- Generated: 2026-02-11 | Files scanned: 142 | Token estimate: ~800 -->
|
||||
```
|
||||
|
||||
## Step 5: Save Analysis Report
|
||||
|
||||
Write a summary to `.reports/codemap-diff.txt`:
|
||||
- Files added/removed/modified since last scan
|
||||
- New dependencies detected
|
||||
- Architecture changes (new routes, new services, etc.)
|
||||
- Staleness warnings for docs not updated in 90+ days
|
||||
|
||||
## Tips
|
||||
|
||||
- Focus on **high-level structure**, not implementation details
|
||||
- Prefer **file paths and function signatures** over full code blocks
|
||||
- Keep each codemap under **1000 tokens** for efficient context loading
|
||||
- Use ASCII diagrams for data flow instead of verbose descriptions
|
||||
- Run after major feature additions or refactoring sessions
|
||||
|
||||
Reference in New Issue
Block a user