@iamnishankhan/opencode-kit-grok 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +46 -0
- package/kit/.opencode/AGENTS.md +392 -0
- package/kit/.opencode/README.md +71 -0
- package/kit/.opencode/USAGE.md +405 -0
- package/kit/.opencode/agents/backend-specialist.md +278 -0
- package/kit/.opencode/agents/code-archaeologist.md +114 -0
- package/kit/.opencode/agents/database-architect.md +233 -0
- package/kit/.opencode/agents/debugger.md +234 -0
- package/kit/.opencode/agents/devops-engineer.md +252 -0
- package/kit/.opencode/agents/documentation-writer.md +111 -0
- package/kit/.opencode/agents/explorer-agent.md +83 -0
- package/kit/.opencode/agents/frontend-specialist.md +606 -0
- package/kit/.opencode/agents/game-developer.md +169 -0
- package/kit/.opencode/agents/mobile-developer.md +385 -0
- package/kit/.opencode/agents/orchestrator.md +213 -0
- package/kit/.opencode/agents/penetration-tester.md +197 -0
- package/kit/.opencode/agents/performance-optimizer.md +194 -0
- package/kit/.opencode/agents/product-manager.md +120 -0
- package/kit/.opencode/agents/product-owner.md +103 -0
- package/kit/.opencode/agents/project-planner.md +418 -0
- package/kit/.opencode/agents/qa-automation-engineer.md +113 -0
- package/kit/.opencode/agents/security-auditor.md +179 -0
- package/kit/.opencode/agents/seo-specialist.md +119 -0
- package/kit/.opencode/agents/test-engineer.md +169 -0
- package/kit/.opencode/commands/brainstorm.md +113 -0
- package/kit/.opencode/commands/coordinate.md +72 -0
- package/kit/.opencode/commands/create.md +63 -0
- package/kit/.opencode/commands/debug.md +102 -0
- package/kit/.opencode/commands/deploy.md +175 -0
- package/kit/.opencode/commands/enhance.md +62 -0
- package/kit/.opencode/commands/orchestrate.md +241 -0
- package/kit/.opencode/commands/plan.md +89 -0
- package/kit/.opencode/commands/preview.md +80 -0
- package/kit/.opencode/commands/remember.md +67 -0
- package/kit/.opencode/commands/status.md +86 -0
- package/kit/.opencode/commands/test.md +143 -0
- package/kit/.opencode/commands/verify.md +71 -0
- package/kit/.opencode/memory/MEMORY.md +6 -0
- package/kit/.opencode/memory/feedback-history.md +9 -0
- package/kit/.opencode/memory/project-conventions.md +16 -0
- package/kit/.opencode/memory/tech-decisions.md +10 -0
- package/kit/.opencode/memory/user-preferences.md +9 -0
- package/kit/.opencode/opencode.json +15 -0
- package/kit/.opencode/scripts/README.md +95 -0
- package/kit/.opencode/scripts/auto_preview.py +149 -0
- package/kit/.opencode/scripts/checklist.py +75 -0
- package/kit/.opencode/scripts/component_registry.py +238 -0
- package/kit/.opencode/scripts/dependency_graph.py +73 -0
- package/kit/.opencode/scripts/generate_manifest.py +44 -0
- package/kit/.opencode/scripts/session_manager.py +120 -0
- package/kit/.opencode/scripts/tests/test_toolkit.py +238 -0
- package/kit/.opencode/scripts/validate_kit.py +397 -0
- package/kit/.opencode/scripts/validation_runner.py +216 -0
- package/kit/.opencode/scripts/verify_all.py +85 -0
- package/kit/.opencode/skills/api-patterns/SKILL.md +83 -0
- package/kit/.opencode/skills/api-patterns/api-style.md +42 -0
- package/kit/.opencode/skills/api-patterns/auth.md +24 -0
- package/kit/.opencode/skills/api-patterns/documentation.md +26 -0
- package/kit/.opencode/skills/api-patterns/graphql.md +41 -0
- package/kit/.opencode/skills/api-patterns/rate-limiting.md +31 -0
- package/kit/.opencode/skills/api-patterns/response.md +37 -0
- package/kit/.opencode/skills/api-patterns/rest.md +40 -0
- package/kit/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
- package/kit/.opencode/skills/api-patterns/security-testing.md +122 -0
- package/kit/.opencode/skills/api-patterns/trpc.md +41 -0
- package/kit/.opencode/skills/api-patterns/versioning.md +22 -0
- package/kit/.opencode/skills/app-builder/SKILL.md +78 -0
- package/kit/.opencode/skills/app-builder/agent-coordination.md +71 -0
- package/kit/.opencode/skills/app-builder/feature-building.md +53 -0
- package/kit/.opencode/skills/app-builder/project-detection.md +45 -0
- package/kit/.opencode/skills/app-builder/scaffolding.md +110 -0
- package/kit/.opencode/skills/app-builder/tech-stack.md +41 -0
- package/kit/.opencode/skills/app-builder/templates/SKILL.md +39 -0
- package/kit/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +78 -0
- package/kit/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +96 -0
- package/kit/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/kit/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +97 -0
- package/kit/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +89 -0
- package/kit/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +93 -0
- package/kit/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +97 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +125 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +174 -0
- package/kit/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +127 -0
- package/kit/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +94 -0
- package/kit/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +121 -0
- package/kit/.opencode/skills/architecture/SKILL.md +57 -0
- package/kit/.opencode/skills/architecture/context-discovery.md +43 -0
- package/kit/.opencode/skills/architecture/examples.md +94 -0
- package/kit/.opencode/skills/architecture/pattern-selection.md +68 -0
- package/kit/.opencode/skills/architecture/patterns-reference.md +50 -0
- package/kit/.opencode/skills/architecture/trade-off-analysis.md +77 -0
- package/kit/.opencode/skills/bash-linux/SKILL.md +201 -0
- package/kit/.opencode/skills/batch-operations/SKILL.md +105 -0
- package/kit/.opencode/skills/behavioral-modes/SKILL.md +253 -0
- package/kit/.opencode/skills/brainstorming/SKILL.md +178 -0
- package/kit/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
- package/kit/.opencode/skills/clean-code/SKILL.md +201 -0
- package/kit/.opencode/skills/code-review-checklist/SKILL.md +111 -0
- package/kit/.opencode/skills/code-review-graph/SKILL.md +305 -0
- package/kit/.opencode/skills/context-compression/SKILL.md +145 -0
- package/kit/.opencode/skills/coordinator-mode/SKILL.md +208 -0
- package/kit/.opencode/skills/database-design/SKILL.md +54 -0
- package/kit/.opencode/skills/database-design/database-selection.md +43 -0
- package/kit/.opencode/skills/database-design/indexing.md +39 -0
- package/kit/.opencode/skills/database-design/migrations.md +48 -0
- package/kit/.opencode/skills/database-design/optimization.md +36 -0
- package/kit/.opencode/skills/database-design/orm-selection.md +30 -0
- package/kit/.opencode/skills/database-design/schema-design.md +56 -0
- package/kit/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
- package/kit/.opencode/skills/deployment-procedures/SKILL.md +243 -0
- package/kit/.opencode/skills/design-spec/SKILL.md +185 -0
- package/kit/.opencode/skills/design-spec/collection.md +106 -0
- package/kit/.opencode/skills/documentation-templates/SKILL.md +196 -0
- package/kit/.opencode/skills/frontend-architecture/SKILL.md +245 -0
- package/kit/.opencode/skills/frontend-design/SKILL.md +1222 -0
- package/kit/.opencode/skills/frontend-design/redesign.md +178 -0
- package/kit/.opencode/skills/frontend-design/scripts/accessibility_checker.py +145 -0
- package/kit/.opencode/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/kit/.opencode/skills/frontend-design/style-brutalist.md +92 -0
- package/kit/.opencode/skills/frontend-design/style-minimalist.md +85 -0
- package/kit/.opencode/skills/game-development/2d-games/SKILL.md +118 -0
- package/kit/.opencode/skills/game-development/3d-games/SKILL.md +134 -0
- package/kit/.opencode/skills/game-development/SKILL.md +169 -0
- package/kit/.opencode/skills/game-development/game-art/SKILL.md +184 -0
- package/kit/.opencode/skills/game-development/game-audio/SKILL.md +189 -0
- package/kit/.opencode/skills/game-development/game-design/SKILL.md +128 -0
- package/kit/.opencode/skills/game-development/mobile-games/SKILL.md +107 -0
- package/kit/.opencode/skills/game-development/multiplayer/SKILL.md +131 -0
- package/kit/.opencode/skills/game-development/pc-games/SKILL.md +143 -0
- package/kit/.opencode/skills/game-development/vr-ar/SKILL.md +122 -0
- package/kit/.opencode/skills/game-development/web-games/SKILL.md +149 -0
- package/kit/.opencode/skills/geo-fundamentals/SKILL.md +158 -0
- package/kit/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +273 -0
- package/kit/.opencode/skills/i18n-localization/SKILL.md +156 -0
- package/kit/.opencode/skills/i18n-localization/scripts/i18n_checker.py +223 -0
- package/kit/.opencode/skills/intelligent-routing/SKILL.md +337 -0
- package/kit/.opencode/skills/lint-and-validate/SKILL.md +47 -0
- package/kit/.opencode/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/kit/.opencode/skills/lint-and-validate/scripts/type_coverage.py +245 -0
- package/kit/.opencode/skills/mcp-builder/SKILL.md +205 -0
- package/kit/.opencode/skills/memory-system/SKILL.md +181 -0
- package/kit/.opencode/skills/mobile-design/SKILL.md +396 -0
- package/kit/.opencode/skills/mobile-design/decision-trees.md +516 -0
- package/kit/.opencode/skills/mobile-design/mobile-backend.md +491 -0
- package/kit/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
- package/kit/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
- package/kit/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/kit/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
- package/kit/.opencode/skills/mobile-design/mobile-performance.md +767 -0
- package/kit/.opencode/skills/mobile-design/mobile-testing.md +356 -0
- package/kit/.opencode/skills/mobile-design/mobile-typography.md +433 -0
- package/kit/.opencode/skills/mobile-design/platform-android.md +666 -0
- package/kit/.opencode/skills/mobile-design/platform-ios.md +561 -0
- package/kit/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/kit/.opencode/skills/mobile-design/touch-psychology.md +537 -0
- package/kit/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/kit/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/kit/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/kit/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/kit/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/kit/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/kit/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/kit/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/kit/.opencode/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/kit/.opencode/skills/nextjs-react-expert/SKILL.md +293 -0
- package/kit/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/kit/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +281 -0
- package/kit/.opencode/skills/nodejs-best-practices/SKILL.md +336 -0
- package/kit/.opencode/skills/parallel-agents/SKILL.md +192 -0
- package/kit/.opencode/skills/performance-profiling/SKILL.md +145 -0
- package/kit/.opencode/skills/performance-profiling/scripts/bundle_analyzer.py +120 -0
- package/kit/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +108 -0
- package/kit/.opencode/skills/plan-writing/SKILL.md +153 -0
- package/kit/.opencode/skills/powershell-windows/SKILL.md +169 -0
- package/kit/.opencode/skills/python-patterns/SKILL.md +443 -0
- package/kit/.opencode/skills/red-team-tactics/SKILL.md +201 -0
- package/kit/.opencode/skills/rust-pro/SKILL.md +177 -0
- package/kit/.opencode/skills/seo-fundamentals/SKILL.md +131 -0
- package/kit/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/kit/.opencode/skills/server-management/SKILL.md +163 -0
- package/kit/.opencode/skills/simplify-code/SKILL.md +131 -0
- package/kit/.opencode/skills/skillify/SKILL.md +115 -0
- package/kit/.opencode/skills/systematic-debugging/SKILL.md +111 -0
- package/kit/.opencode/skills/tailwind-patterns/SKILL.md +271 -0
- package/kit/.opencode/skills/tdd-workflow/SKILL.md +151 -0
- package/kit/.opencode/skills/testing-patterns/SKILL.md +180 -0
- package/kit/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kit/.opencode/skills/verify-changes/SKILL.md +127 -0
- package/kit/.opencode/skills/vulnerability-scanner/SKILL.md +278 -0
- package/kit/.opencode/skills/vulnerability-scanner/checklists.md +124 -0
- package/kit/.opencode/skills/vulnerability-scanner/scripts/dependency_analyzer.py +144 -0
- package/kit/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +410 -0
- package/kit/.opencode/skills/web-design-guidelines/SKILL.md +56 -0
- package/kit/.opencode/skills/webapp-testing/SKILL.md +189 -0
- package/kit/.opencode/skills/webapp-testing/scripts/playwright_runner.py +123 -0
- package/lib/init.js +61 -0
- package/package.json +21 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clean-code
|
|
3
|
+
description: Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
|
|
4
|
+
compatibility: opencode
|
|
5
|
+
metadata:
|
|
6
|
+
when_to_use: "\"Always active for ALL code writing. Enforces concise, direct coding standards, testing pyramid, and performance best practices.\""
|
|
7
|
+
version: "2.0.0"
|
|
8
|
+
---
|
|
9
|
+
# Clean Code - Pragmatic AI Coding Standards
|
|
10
|
+
|
|
11
|
+
> **CRITICAL SKILL** - Be **concise, direct, and solution-focused**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Core Principles
|
|
16
|
+
|
|
17
|
+
| Principle | Rule |
|
|
18
|
+
|-----------|------|
|
|
19
|
+
| **SRP** | Single Responsibility - each function/class does ONE thing |
|
|
20
|
+
| **DRY** | Don't Repeat Yourself - extract duplicates, reuse |
|
|
21
|
+
| **KISS** | Keep It Simple - simplest solution that works |
|
|
22
|
+
| **YAGNI** | You Aren't Gonna Need It - don't build unused features |
|
|
23
|
+
| **Boy Scout** | Leave code cleaner than you found it |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Naming Rules
|
|
28
|
+
|
|
29
|
+
| Element | Convention |
|
|
30
|
+
|---------|------------|
|
|
31
|
+
| **Variables** | Reveal intent: `userCount` not `n` |
|
|
32
|
+
| **Functions** | Verb + noun: `getUserById()` not `user()` |
|
|
33
|
+
| **Booleans** | Question form: `isActive`, `hasPermission`, `canEdit` |
|
|
34
|
+
| **Constants** | SCREAMING_SNAKE: `MAX_RETRY_COUNT` |
|
|
35
|
+
|
|
36
|
+
> **Rule:** If you need a comment to explain a name, rename it.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Function Rules
|
|
41
|
+
|
|
42
|
+
| Rule | Description |
|
|
43
|
+
|------|-------------|
|
|
44
|
+
| **Small** | Max 20 lines, ideally 5-10 |
|
|
45
|
+
| **One Thing** | Does one thing, does it well |
|
|
46
|
+
| **One Level** | One level of abstraction per function |
|
|
47
|
+
| **Few Args** | Max 3 arguments, prefer 0-2 |
|
|
48
|
+
| **No Side Effects** | Don't mutate inputs unexpectedly |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Code Structure
|
|
53
|
+
|
|
54
|
+
| Pattern | Apply |
|
|
55
|
+
|---------|-------|
|
|
56
|
+
| **Guard Clauses** | Early returns for edge cases |
|
|
57
|
+
| **Flat > Nested** | Avoid deep nesting (max 2 levels) |
|
|
58
|
+
| **Composition** | Small functions composed together |
|
|
59
|
+
| **Colocation** | Keep related code close |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## AI Coding Style
|
|
64
|
+
|
|
65
|
+
| Situation | Action |
|
|
66
|
+
|-----------|--------|
|
|
67
|
+
| User asks for feature | Write it directly |
|
|
68
|
+
| User reports bug | Fix it, don't explain |
|
|
69
|
+
| No clear requirement | Ask, don't assume |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Anti-Patterns (DON'T)
|
|
74
|
+
|
|
75
|
+
| ❌ Pattern | ✅ Fix |
|
|
76
|
+
|-----------|-------|
|
|
77
|
+
| Comment every line | Delete obvious comments |
|
|
78
|
+
| Helper for one-liner | Inline the code |
|
|
79
|
+
| Factory for 2 objects | Direct instantiation |
|
|
80
|
+
| utils.ts with 1 function | Put code where used |
|
|
81
|
+
| "First we import..." | Just write code |
|
|
82
|
+
| Deep nesting | Guard clauses |
|
|
83
|
+
| Magic numbers | Named constants |
|
|
84
|
+
| God functions | Split by responsibility |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🔴 Before Editing ANY File (THINK FIRST!)
|
|
89
|
+
|
|
90
|
+
**Before changing a file, ask yourself:**
|
|
91
|
+
|
|
92
|
+
| Question | Why |
|
|
93
|
+
|----------|-----|
|
|
94
|
+
| **What imports this file?** | They might break |
|
|
95
|
+
| **What does this file import?** | Interface changes |
|
|
96
|
+
| **What tests cover this?** | Tests might fail |
|
|
97
|
+
| **Is this a shared component?** | Multiple places affected |
|
|
98
|
+
|
|
99
|
+
**Quick Check:**
|
|
100
|
+
```
|
|
101
|
+
File to edit: UserService.ts
|
|
102
|
+
└── Who imports this? → UserController.ts, AuthController.ts
|
|
103
|
+
└── Do they need changes too? → Check function signatures
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
> 🔴 **Rule:** Edit the file + all dependent files in the SAME task.
|
|
107
|
+
> 🔴 **Never leave broken imports or missing updates.**
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Summary
|
|
112
|
+
|
|
113
|
+
| Do | Don't |
|
|
114
|
+
|----|-------|
|
|
115
|
+
| Write code directly | Write tutorials |
|
|
116
|
+
| Let code self-document | Add obvious comments |
|
|
117
|
+
| Fix bugs immediately | Explain the fix first |
|
|
118
|
+
| Inline small things | Create unnecessary files |
|
|
119
|
+
| Name things clearly | Use abbreviations |
|
|
120
|
+
| Keep functions small | Write 100+ line functions |
|
|
121
|
+
|
|
122
|
+
> **Remember: The user wants working code, not a programming lesson.**
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🔴 Self-Check Before Completing (MANDATORY)
|
|
127
|
+
|
|
128
|
+
**Before saying "task complete", verify:**
|
|
129
|
+
|
|
130
|
+
| Check | Question |
|
|
131
|
+
|-------|----------|
|
|
132
|
+
| ✅ **Goal met?** | Did I do exactly what user asked? |
|
|
133
|
+
| ✅ **Files edited?** | Did I modify all necessary files? |
|
|
134
|
+
| ✅ **Code works?** | Did I test/verify the change? |
|
|
135
|
+
| ✅ **No errors?** | Lint and TypeScript pass? |
|
|
136
|
+
| ✅ **Nothing forgotten?** | Any edge cases missed? |
|
|
137
|
+
|
|
138
|
+
> 🔴 **Rule:** If ANY check fails, fix it before completing.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Verification Scripts (MANDATORY)
|
|
143
|
+
|
|
144
|
+
> 🔴 **CRITICAL:** Each agent runs ONLY their own skill's scripts after completing work.
|
|
145
|
+
|
|
146
|
+
### Agent → Script Mapping
|
|
147
|
+
|
|
148
|
+
| Agent | Script | Command |
|
|
149
|
+
|-------|--------|---------|
|
|
150
|
+
| **frontend-specialist** | UX Audit | `python .opencode/skills/frontend-design/scripts/ux_audit.py .` |
|
|
151
|
+
| **frontend-specialist** | A11y Check | `python .opencode/skills/frontend-design/scripts/accessibility_checker.py .` |
|
|
152
|
+
| **backend-specialist** | API Validator | `python .opencode/skills/api-patterns/scripts/api_validator.py .` |
|
|
153
|
+
| **mobile-developer** | Mobile Audit | `python .opencode/skills/mobile-design/scripts/mobile_audit.py .` |
|
|
154
|
+
| **database-architect** | Schema Validate | `python .opencode/skills/database-design/scripts/schema_validator.py .` |
|
|
155
|
+
| **security-auditor** | Security Scan | `python .opencode/skills/vulnerability-scanner/scripts/security_scan.py .` |
|
|
156
|
+
| **seo-specialist** | SEO Check | `python .opencode/skills/seo-fundamentals/scripts/seo_checker.py .` |
|
|
157
|
+
| **seo-specialist** | GEO Check | `python .opencode/skills/geo-fundamentals/scripts/geo_checker.py .` |
|
|
158
|
+
| **performance-optimizer** | Lighthouse | `python .opencode/skills/performance-profiling/scripts/lighthouse_audit.py <url>` |
|
|
159
|
+
| **test-engineer** | Test Runner | `python .opencode/skills/testing-patterns/scripts/test_runner.py .` |
|
|
160
|
+
| **test-engineer** | Playwright | `python .opencode/skills/webapp-testing/scripts/playwright_runner.py <url>` |
|
|
161
|
+
| **Any agent** | Lint Check | `python .opencode/skills/lint-and-validate/scripts/lint_runner.py .` |
|
|
162
|
+
| **Any agent** | Type Coverage | `python .opencode/skills/lint-and-validate/scripts/type_coverage.py .` |
|
|
163
|
+
| **Any agent** | i18n Check | `python .opencode/skills/i18n-localization/scripts/i18n_checker.py .` |
|
|
164
|
+
|
|
165
|
+
> ❌ **WRONG:** `test-engineer` running `ux_audit.py`
|
|
166
|
+
> ✅ **CORRECT:** `frontend-specialist` running `ux_audit.py`
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### 🔴 Script Output Handling (READ → SUMMARIZE → ASK)
|
|
171
|
+
|
|
172
|
+
**When running a validation script, you MUST:**
|
|
173
|
+
|
|
174
|
+
1. **Run the script** and capture ALL output
|
|
175
|
+
2. **Parse the output** - identify errors, warnings, and passes
|
|
176
|
+
3. **Summarize to user** in this format:
|
|
177
|
+
|
|
178
|
+
```markdown
|
|
179
|
+
## Script Results: [script_name.py]
|
|
180
|
+
|
|
181
|
+
### ❌ Errors Found (X items)
|
|
182
|
+
- [File:Line] Error description 1
|
|
183
|
+
- [File:Line] Error description 2
|
|
184
|
+
|
|
185
|
+
### ⚠️ Warnings (Y items)
|
|
186
|
+
- [File:Line] Warning description
|
|
187
|
+
|
|
188
|
+
### ✅ Passed (Z items)
|
|
189
|
+
- Check 1 passed
|
|
190
|
+
- Check 2 passed
|
|
191
|
+
|
|
192
|
+
**Should I fix the X errors?**
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
4. **Wait for user confirmation** before fixing
|
|
196
|
+
5. **After fixing** → Re-run script to confirm
|
|
197
|
+
|
|
198
|
+
> 🔴 **VIOLATION:** Running script and ignoring output = FAILED task.
|
|
199
|
+
> 🔴 **VIOLATION:** Auto-fixing without asking = Not allowed.
|
|
200
|
+
> 🔴 **Rule:** Always READ output → SUMMARIZE → ASK → then fix.
|
|
201
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-checklist
|
|
3
|
+
description: Code review guidelines covering code quality, security, and best practices.
|
|
4
|
+
compatibility: opencode
|
|
5
|
+
metadata:
|
|
6
|
+
when_to_use: "\"When reviewing code for quality, security, and best practices. When the user says 'review my code' or 'check this PR'.\""
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
# Code Review Checklist
|
|
10
|
+
|
|
11
|
+
## Quick Review Checklist
|
|
12
|
+
|
|
13
|
+
### Correctness
|
|
14
|
+
- [ ] Code does what it's supposed to do
|
|
15
|
+
- [ ] Edge cases handled
|
|
16
|
+
- [ ] Error handling in place
|
|
17
|
+
- [ ] No obvious bugs
|
|
18
|
+
|
|
19
|
+
### Security
|
|
20
|
+
- [ ] Input validated and sanitized
|
|
21
|
+
- [ ] No SQL/NoSQL injection vulnerabilities
|
|
22
|
+
- [ ] No XSS or CSRF vulnerabilities
|
|
23
|
+
- [ ] No hardcoded secrets or sensitive credentials
|
|
24
|
+
- [ ] **AI-Specific:** Protection against Prompt Injection (if applicable)
|
|
25
|
+
- [ ] **AI-Specific:** Outputs are sanitized before being used in critical sinks
|
|
26
|
+
|
|
27
|
+
### Performance
|
|
28
|
+
- [ ] No N+1 queries
|
|
29
|
+
- [ ] No unnecessary loops
|
|
30
|
+
- [ ] Appropriate caching
|
|
31
|
+
- [ ] Bundle size impact considered
|
|
32
|
+
|
|
33
|
+
### Code Quality
|
|
34
|
+
- [ ] Clear naming
|
|
35
|
+
- [ ] DRY - no duplicate code
|
|
36
|
+
- [ ] SOLID principles followed
|
|
37
|
+
- [ ] Appropriate abstraction level
|
|
38
|
+
|
|
39
|
+
### Testing
|
|
40
|
+
- [ ] Unit tests for new code
|
|
41
|
+
- [ ] Edge cases tested
|
|
42
|
+
- [ ] Tests readable and maintainable
|
|
43
|
+
|
|
44
|
+
### Documentation
|
|
45
|
+
- [ ] Complex logic commented
|
|
46
|
+
- [ ] Public APIs documented
|
|
47
|
+
- [ ] README updated if needed
|
|
48
|
+
|
|
49
|
+
## AI & LLM Review Patterns
|
|
50
|
+
|
|
51
|
+
### Logic & Hallucinations
|
|
52
|
+
- [ ] **Chain of Thought:** Does the logic follow a verifiable path?
|
|
53
|
+
- [ ] **Edge Cases:** Did the AI account for empty states, timeouts, and partial failures?
|
|
54
|
+
- [ ] **External State:** Is the code making safe assumptions about file systems or networks?
|
|
55
|
+
|
|
56
|
+
### Prompt Engineering Review
|
|
57
|
+
```markdown
|
|
58
|
+
// ❌ Vague prompt in code
|
|
59
|
+
const response = await ai.generate(userInput);
|
|
60
|
+
|
|
61
|
+
// ✅ Structured & Safe prompt
|
|
62
|
+
const response = await ai.generate({
|
|
63
|
+
system: "You are a specialized parser...",
|
|
64
|
+
input: sanitize(userInput),
|
|
65
|
+
schema: ResponseSchema
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Anti-Patterns to Flag
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// ❌ Magic numbers
|
|
73
|
+
if (status === 3) { ... }
|
|
74
|
+
|
|
75
|
+
// ✅ Named constants
|
|
76
|
+
if (status === Status.ACTIVE) { ... }
|
|
77
|
+
|
|
78
|
+
// ❌ Deep nesting
|
|
79
|
+
if (a) { if (b) { if (c) { ... } } }
|
|
80
|
+
|
|
81
|
+
// ✅ Early returns
|
|
82
|
+
if (!a) return;
|
|
83
|
+
if (!b) return;
|
|
84
|
+
if (!c) return;
|
|
85
|
+
// do work
|
|
86
|
+
|
|
87
|
+
// ❌ Long functions (100+ lines)
|
|
88
|
+
// ✅ Small, focused functions
|
|
89
|
+
|
|
90
|
+
// ❌ any type
|
|
91
|
+
const data: any = ...
|
|
92
|
+
|
|
93
|
+
// ✅ Proper types
|
|
94
|
+
const data: UserData = ...
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Review Comments Guide
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
// Blocking issues use 🔴
|
|
101
|
+
🔴 BLOCKING: SQL injection vulnerability here
|
|
102
|
+
|
|
103
|
+
// Important suggestions use 🟡
|
|
104
|
+
🟡 SUGGESTION: Consider using useMemo for performance
|
|
105
|
+
|
|
106
|
+
// Minor nits use 🟢
|
|
107
|
+
🟢 NIT: Prefer const over let for immutable variable
|
|
108
|
+
|
|
109
|
+
// Questions use ❓
|
|
110
|
+
❓ QUESTION: What happens if user is null here?
|
|
111
|
+
```
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-graph
|
|
3
|
+
description: Token-efficient code review using Tree-sitter AST graphs and MCP. Cuts AI token usage on large codebases by computing the blast radius of changes instead of reading entire codebases. Uses a SQLite graph database for structural analysis.
|
|
4
|
+
compatibility: opencode
|
|
5
|
+
metadata:
|
|
6
|
+
when_to_use: "\"When reviewing code in large codebases (500+ files), when token costs are high, when making multi-file changes with cross-module dependencies, or when working with monorepos. Also for dead code detec"
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
# Code Review Graph — Token-Efficient Codebase Context via MCP
|
|
10
|
+
|
|
11
|
+
> Cut AI token usage substantially on large codebases by giving the AI a structural map instead of letting it read everything. Savings scale with codebase size — marginal on small projects, large on monorepos.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`code-review-graph` is an MCP server that uses **Tree-sitter** to parse your codebase into an AST graph stored in **SQLite**. When your AI assistant needs context for a task, it queries the graph first — getting only the files in the **blast radius** of your change — instead of reading every file in the directory.
|
|
16
|
+
|
|
17
|
+
**Token Impact (illustrative — varies by codebase):**
|
|
18
|
+
|
|
19
|
+
| Codebase Type | Pattern |
|
|
20
|
+
|---------------|---------|
|
|
21
|
+
| Large monorepo (10K+ files) | Biggest savings — graph reads a small fraction of files |
|
|
22
|
+
| Mid-size app (1-5K files) | Meaningful reduction on multi-file changes |
|
|
23
|
+
| Small project (<200 files) | Little benefit — graph overhead can exceed savings |
|
|
24
|
+
|
|
25
|
+
> **Quality angle:** scoping the AI to the blast radius reduces noise, which tends to improve review focus. Measure on your own repo rather than relying on a fixed multiplier.
|
|
26
|
+
|
|
27
|
+
## Bootstrap Protocol (opt-in)
|
|
28
|
+
|
|
29
|
+
When invoked during `/plan` or standard usage on a mid-to-large project, check whether graph analysis is available before relying on it:
|
|
30
|
+
1. **Step 1:** Check if the tool is installed: `Get-Command code-review-graph` (Windows) or `which code-review-graph` (macOS/Linux).
|
|
31
|
+
2. **Step 2:** Check if a `.code-review-graph/` directory exists in the workspace.
|
|
32
|
+
3. **Step 3:** If installed but the index is missing, ask the user before running `code-review-graph build` (it scans the whole project).
|
|
33
|
+
4. **Step 4:** If not installed and the project is large, ask the user: "Would you like to `pip install code-review-graph` and build a local map to cut token usage for this project?" Never install or run build without confirmation.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## When to Use vs When to Skip
|
|
38
|
+
|
|
39
|
+
### ✅ Install it if:
|
|
40
|
+
- Codebase is **500+ files**
|
|
41
|
+
- You make **multi-file changes** with cross-module dependencies
|
|
42
|
+
- You spend **$20+/month** on AI assistant tokens
|
|
43
|
+
- You work with **monorepos**, microservices, or cross-package TypeScript
|
|
44
|
+
- You want **better review quality** in addition to cost savings
|
|
45
|
+
|
|
46
|
+
### ❌ Skip it if:
|
|
47
|
+
- Codebase is **under ~200 files** with isolated single-file changes
|
|
48
|
+
- Heavy use of **dynamic patterns** (reflection, runtime code gen, dynamic imports)
|
|
49
|
+
- You want **zero-maintenance** — the graph needs to stay in sync
|
|
50
|
+
- Team hasn't standardized on an AI coding tool yet
|
|
51
|
+
|
|
52
|
+
### ⚠️ Evaluate first if:
|
|
53
|
+
- Codebase is **200–500 files** — benchmark before committing
|
|
54
|
+
- Mix of **static and dynamic patterns** — test on representative commits
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## How It Works (4 Layers)
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Layer 1: PARSE → Tree-sitter builds ASTs from 19 languages
|
|
62
|
+
Layer 2: STORE → Nodes + edges saved in SQLite graph
|
|
63
|
+
Layer 3: TRACE → BFS computes blast radius of changes
|
|
64
|
+
Layer 4: SERVE → MCP exposes graph to AI assistants
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### What the Graph Contains
|
|
68
|
+
- **Nodes:** Files, functions, methods, classes, imports, tests
|
|
69
|
+
- **Edges:** "A calls B", "X imports Y", "TestZ covers FunctionW", "ClassA extends ClassB"
|
|
70
|
+
- **Metadata:** Name, type, file path, line range per node
|
|
71
|
+
- **Privacy:** Structural metadata only — NO source code content in the graph
|
|
72
|
+
|
|
73
|
+
### Supported Languages (19)
|
|
74
|
+
Python, TypeScript, JavaScript, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, C/C++, Vue SFC, Solidity, Dart, R, Perl, Lua, Jupyter/Databricks notebooks.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
### Prerequisites
|
|
81
|
+
- Python 3.9+ (`python3 --version`)
|
|
82
|
+
- pip or pipx installed
|
|
83
|
+
- An MCP-compatible AI client (OpenCode kit, Claude Code, Cursor, Windsurf, Zed)
|
|
84
|
+
- Git-tracked codebase (for incremental updates)
|
|
85
|
+
|
|
86
|
+
### Step 1: Install the Package
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Recommended: isolated environment
|
|
90
|
+
pipx install code-review-graph
|
|
91
|
+
|
|
92
|
+
# Alternative: fastest, no permanent install
|
|
93
|
+
uvx code-review-graph install
|
|
94
|
+
|
|
95
|
+
# Alternative: global pip
|
|
96
|
+
pip install code-review-graph
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Step 2: Configure MCP Client
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Auto-detect all supported tools
|
|
103
|
+
code-review-graph install
|
|
104
|
+
|
|
105
|
+
# Or target a specific platform
|
|
106
|
+
code-review-graph install --platform claude-code
|
|
107
|
+
code-review-graph install --platform cursor
|
|
108
|
+
code-review-graph install --platform windsurf
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> **Restart your editor** after this step. The MCP server activates on restart.
|
|
112
|
+
|
|
113
|
+
### Step 3: Build the Initial Graph
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cd /your/project
|
|
117
|
+
code-review-graph build
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Codebase Size | Expected Build Time |
|
|
121
|
+
|---------------|---------------------|
|
|
122
|
+
| 500 files | 10–30 seconds |
|
|
123
|
+
| 5,000 files | 2–5 minutes |
|
|
124
|
+
| 27,000 files | 5–10 minutes |
|
|
125
|
+
|
|
126
|
+
### Step 4: Enable Watch Mode (Recommended)
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Keep graph current as you work
|
|
130
|
+
code-review-graph watch
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Incremental updates complete in **under 2 seconds**. If you prefer manual updates:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
code-review-graph update
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Step 5: Verify Integration
|
|
140
|
+
|
|
141
|
+
Open your AI client and check MCP connection. For Claude Code: run `/mcp` and confirm `code-review-graph` appears.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
### Ignore File
|
|
148
|
+
|
|
149
|
+
Create `.code-review-graphignore` at project root (uses `.gitignore` syntax):
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
# Build artifacts
|
|
153
|
+
dist/**
|
|
154
|
+
.next/**
|
|
155
|
+
build/**
|
|
156
|
+
|
|
157
|
+
# Dependencies
|
|
158
|
+
node_modules/**
|
|
159
|
+
vendor/**
|
|
160
|
+
|
|
161
|
+
# Generated files
|
|
162
|
+
generated/**
|
|
163
|
+
*.generated.ts
|
|
164
|
+
*.min.js
|
|
165
|
+
|
|
166
|
+
# Test fixtures (if large)
|
|
167
|
+
__fixtures__/**
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
> Excluding generated files and build artifacts is critical — they inflate the graph with meaningless nodes.
|
|
171
|
+
|
|
172
|
+
### Multi-Repo Setup
|
|
173
|
+
|
|
174
|
+
For microservice architectures:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Register additional repos
|
|
178
|
+
code-review-graph register /path/to/other/repo
|
|
179
|
+
|
|
180
|
+
# List all registered repos
|
|
181
|
+
code-review-graph repos
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The MCP server serves context across all registered repositories.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Core Workflows
|
|
189
|
+
|
|
190
|
+
### 1. Blast Radius Analysis (Primary Use)
|
|
191
|
+
|
|
192
|
+
This is automatic when the MCP server is active. Your AI assistant queries the graph before reading files, getting only the impacted files instead of everything.
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Without graph: Changed auth/middleware.py → AI reads 200+ files → 8,200 tokens
|
|
196
|
+
With graph: Changed auth/middleware.py → Graph returns 12 impacted files → 1,000 tokens
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 2. Risk-Scored Change Analysis
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
code-review-graph detect-changes
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Scores each uncommitted change by risk level:
|
|
206
|
+
- Number of dependents
|
|
207
|
+
- Test coverage gaps
|
|
208
|
+
- Whether changed functions are on critical paths
|
|
209
|
+
- High-risk changes flagged **before** you ask for review
|
|
210
|
+
|
|
211
|
+
### 3. Dead Code Detection
|
|
212
|
+
|
|
213
|
+
The graph finds nodes with **no incoming edges** — no callers, no importers, no test coverage:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Surfaces functions/classes that are candidates for removal
|
|
217
|
+
# Useful on mature codebases to reduce cruft
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 4. Refactoring Preview
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
code-review-graph rename preview --from OldClassName --to NewClassName
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Shows every file affected by a rename, and flags edge cases (dynamic string references that static analysis can't catch).
|
|
227
|
+
|
|
228
|
+
### 5. Architecture Visualization
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
code-review-graph visualize
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Generates interactive visualization showing module clusters using community detection (Leiden algorithm). Useful for:
|
|
235
|
+
- Onboarding new contributors
|
|
236
|
+
- Identifying architectural drift
|
|
237
|
+
- Spotting overly-coupled modules
|
|
238
|
+
|
|
239
|
+
### 6. Wiki Generation
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
code-review-graph wiki
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Generates markdown wiki of codebase structure — every module, its public API, dependencies, and test coverage.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Known Limitations
|
|
250
|
+
|
|
251
|
+
| Limitation | Impact | Mitigation |
|
|
252
|
+
|-----------|--------|------------|
|
|
253
|
+
| **Dynamic imports** (`require(variable)`, `import(buildPath())`) | Dependencies invisible to parser | Manually note in `.code-review-graphignore` or accept over-prediction |
|
|
254
|
+
| **Reflection-based calls** (Django signals, `getattr()`, Java reflection) | Missed edges in graph | Serena (LSP-based) is better for these codebases |
|
|
255
|
+
| **Runtime-generated code** (`eval`, template engines) | Not parseable at static time | Accept limitation or exclude from graph |
|
|
256
|
+
| **Cross-language boundaries** (Python calling TypeScript API) | No edges between language runtimes | Use multi-repo registration as partial workaround |
|
|
257
|
+
| **Stale graph** (without watch mode) | Claude queries outdated relationships | Always run `code-review-graph update` before tasks, or use watch mode |
|
|
258
|
+
| **TypeScript path aliases** (`@/components/...`) | May require tsconfig resolution config | Check `tsconfig_resolver.py` handles your setup |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Alternatives Comparison
|
|
263
|
+
|
|
264
|
+
| Tool | Approach | Pros | Cons | Best For |
|
|
265
|
+
|------|----------|------|------|----------|
|
|
266
|
+
| **code-review-graph** | Tree-sitter + SQLite | Fast, 19 languages, local, no deps | Static analysis only | General use, large codebases |
|
|
267
|
+
| **Claudette** | Go rewrite | Single binary, no Python | Fewer languages, simpler | Python-averse teams |
|
|
268
|
+
| **Serena** | LSP-based | Deep semantic precision, type resolution | Heavy setup, slower | Polymorphism-heavy codebases |
|
|
269
|
+
| **code-graph-rag** | RAG + vector search | Natural language queries | Complex setup | Codebase exploration |
|
|
270
|
+
| **Native IDE context** | Editor built-in | Zero setup | No explicit blast radius | Simple projects |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Integration with OpenCode kit
|
|
275
|
+
|
|
276
|
+
### Complementary Skills
|
|
277
|
+
|
|
278
|
+
| OpenCode kit Skill | How It Complements |
|
|
279
|
+
|-------------------|--------------------|
|
|
280
|
+
| `context-compression` | Graph reduces input context; compression reduces output verbosity |
|
|
281
|
+
| `coordinator-mode` | Graph-aware workers can be dispatched with precise file lists |
|
|
282
|
+
| `verify-changes` | After graph-informed review, verify changes via execution |
|
|
283
|
+
| `batch-operations` | Graph's blast radius informs which files need batch updates |
|
|
284
|
+
|
|
285
|
+
### Recommended Session Architecture
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
1. Start fresh session for each distinct task
|
|
289
|
+
2. Graph pre-filters context → AI reads only blast radius
|
|
290
|
+
3. Context compression summarizes completed phases
|
|
291
|
+
4. Memory system saves key decisions for next session
|
|
292
|
+
5. Result: minimum tokens, maximum quality
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Best Practices
|
|
298
|
+
|
|
299
|
+
1. **Always run watch mode** in development — stale graphs produce stale context
|
|
300
|
+
2. **Exclude generated files** — they inflate the graph with noise
|
|
301
|
+
3. **Benchmark first** — measure token usage for 1 week without, 1 week with
|
|
302
|
+
4. **Combine with output constraints** — graph reduces input, prompt engineering reduces output
|
|
303
|
+
5. **Use `.code-review-graphignore`** for build artifacts, `node_modules`, `dist/`
|
|
304
|
+
6. **Keep sessions short** — fresh sessions + graph = optimal token efficiency
|
|
305
|
+
7. **Multi-repo registration** for microservice architectures
|