anchi-kit 1.1.9 → 1.2.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.
Files changed (136) hide show
  1. package/.antigravity/agent-skill-index.yaml +80 -403
  2. package/.antigravity/agents/graph-architect.md +30 -0
  3. package/.antigravity/agents/quality-guardian.md +148 -0
  4. package/.antigravity/agents/trend-watcher.md +24 -0
  5. package/.antigravity/anchi-kit.config.yaml +29 -9
  6. package/.antigravity/commands/audit.md +116 -0
  7. package/.antigravity/commands/clean.md +333 -0
  8. package/.antigravity/commands/commit.md +127 -0
  9. package/.antigravity/commands/config.md +157 -0
  10. package/.antigravity/commands/demo.md +88 -0
  11. package/.antigravity/commands/design.md +177 -0
  12. package/.antigravity/commands/do.md +220 -0
  13. package/.antigravity/commands/docs.md +101 -0
  14. package/.antigravity/commands/generate.md +140 -0
  15. package/.antigravity/commands/health.md +228 -0
  16. package/.antigravity/commands/help.md +137 -0
  17. package/.antigravity/commands/integrate.md +119 -0
  18. package/.antigravity/commands/memory.md +97 -0
  19. package/.antigravity/commands/migrate.md +180 -0
  20. package/.antigravity/commands/review.md +108 -0
  21. package/.antigravity/commands/scout.md +111 -0
  22. package/.antigravity/commands/skill-learn.md +48 -0
  23. package/.antigravity/commands/start.md +64 -0
  24. package/.antigravity/commands/status.md +212 -0
  25. package/.antigravity/commands/test.md +121 -0
  26. package/.antigravity/commands/theme.md +158 -0
  27. package/.antigravity/commands/undo.md +166 -0
  28. package/.antigravity/commands/why.md +155 -0
  29. package/.antigravity/orchestration.yaml +37 -30
  30. package/.antigravity/skills/_packs/common/pack-architecture.md +40 -0
  31. package/.antigravity/skills/_packs/common/pack-devops.md +43 -0
  32. package/.antigravity/skills/_packs/common/pack-productivity.md +37 -0
  33. package/.antigravity/skills/_packs/common/pack-quality.md +41 -0
  34. package/.antigravity/skills/_packs/data/pack-ai.md +41 -0
  35. package/.antigravity/skills/_packs/data/pack-data-science.md +36 -0
  36. package/.antigravity/skills/_packs/mobile/pack-mobile.md +40 -0
  37. package/.antigravity/skills/_packs/web/pack-backend.md +61 -0
  38. package/.antigravity/skills/_packs/web/pack-frontend.md +66 -0
  39. package/.antigravity/skills/_packs/web3/pack-blockchain.md +37 -0
  40. package/.antigravity/team.yaml +4 -0
  41. package/.cursor/agent-skill-index.yaml +82 -800
  42. package/.cursor/agents/quality-guardian.md +148 -0
  43. package/.cursor/anchi-toolkit.config.yaml +1 -1
  44. package/.cursor/commands/commit.md +13 -16
  45. package/.cursor/commands/do.md +185 -39
  46. package/.cursor/commands/health.md +228 -0
  47. package/.cursor/commands/start.md +54 -46
  48. package/.cursor/commands/status.md +68 -19
  49. package/.cursor/orchestration.yaml +52 -34
  50. package/.cursor/skill-manifest.json +66 -0
  51. package/.cursor/skills/code-quality/SKILL.md +273 -0
  52. package/.cursor/skills/impact-scoring/SKILL.md +219 -0
  53. package/.cursor/skills/performance-patterns/SKILL.md +209 -0
  54. package/.cursor/skills/security-audit/SKILL.md +263 -0
  55. package/.cursorrules +87 -91
  56. package/CHANGELOG.md +24 -324
  57. package/CURSOR.md +141 -53
  58. package/README.md +102 -144
  59. package/docs/README.md +114 -0
  60. package/docs/ci-cd/CODEBASE.md +92 -0
  61. package/docs/ci-cd/CODE_STYLE.md +112 -0
  62. package/docs/ci-cd/PROJECT.md +51 -0
  63. package/docs/ci-cd/README.md +49 -0
  64. package/docs/ci-cd/SCALING_STRATEGY.md +54 -0
  65. package/docs/engineering/README.md +45 -0
  66. package/docs/engineering/core-philosophy.md +32 -20
  67. package/docs/engineering/reasoning-guidelines.md +53 -21
  68. package/docs/engineering/when-to-break-the-rules.md +46 -18
  69. package/docs/personal/ALL_COMMANDS.md +87 -0
  70. package/docs/personal/DAILY_WORKFLOW.md +98 -0
  71. package/docs/personal/GETTING_STARTED.md +91 -0
  72. package/docs/personal/README.md +47 -0
  73. package/docs/personal/TROUBLESHOOTING.md +71 -0
  74. package/docs/reference/AI_CONTRACT.md +69 -0
  75. package/docs/{ARCHITECTURE.md → reference/ARCHITECTURE.md} +65 -41
  76. package/docs/{ORCHESTRATION.md → reference/ORCHESTRATION.md} +72 -41
  77. package/docs/reference/README.md +36 -0
  78. package/docs/reference/SECURITY.md +51 -0
  79. package/docs/team/CI_CD.md +71 -0
  80. package/docs/team/ONBOARDING.md +116 -0
  81. package/docs/team/README.md +47 -0
  82. package/docs/team/ROLES_PERMISSIONS.md +100 -0
  83. package/docs/team/SETUP_GUIDE.md +121 -0
  84. package/docs/team/TEAM_WORKFLOW.md +97 -0
  85. package/package.json +5 -8
  86. package/presets/MIGRATION_GUIDE.md +37 -20
  87. package/presets/domains/data/agents/data-scientist.md +41 -0
  88. package/presets/domains/mobile/agents/mobile-developer.md +41 -0
  89. package/presets/enterprise/contract.json +1 -1
  90. package/presets/memory-template/.ai-audit/.gitkeep +0 -0
  91. package/presets/memory-template/.ai-memory/.gitkeep +0 -0
  92. package/presets/memory-template/README.md +4 -0
  93. package/presets/professional/contract.json +1 -1
  94. package/presets/{rapid-mvp → rapid}/README.md +12 -11
  95. package/presets/rapid/contract.json +1 -1
  96. package/scripts/install.ps1 +16 -9
  97. package/scripts/install.sh +2 -2
  98. package/scripts/setup-rapid.ps1 +2 -2
  99. package/scripts/setup-rapid.sh +2 -2
  100. package/scripts/verify-release.js +56 -0
  101. package/src/cli.js +37 -2
  102. package/src/commands/add.js +154 -0
  103. package/src/commands/dashboard.js +431 -37
  104. package/src/commands/do.js +143 -0
  105. package/src/commands/doctor.js +8 -0
  106. package/src/commands/init.js +268 -225
  107. package/src/commands/memory.js +1 -1
  108. package/src/commands/scout.js +137 -0
  109. package/src/commands/team.js +2 -2
  110. package/src/commands/uninstall.js +1 -1
  111. package/src/lib/dashboardTemplate.js +610 -126
  112. package/src/lib/domainProfiles.js +96 -0
  113. package/src/lib/graph/manager.js +85 -0
  114. package/src/lib/graph/schema.js +81 -0
  115. package/src/lib/vector/embedder.js +46 -0
  116. package/src/lib/vector/store.js +129 -0
  117. package/.ai-audit/README.md +0 -87
  118. package/.ai-memory/README.md +0 -123
  119. package/.ai-memory/context.json +0 -21
  120. package/.ai-memory/decisions.json +0 -3
  121. package/.ai-memory/sessions/2025-12-28.json +0 -36
  122. package/ANTIGRAVITY.md +0 -253
  123. package/docs/AI_CONTRACT.md +0 -150
  124. package/docs/ALL_COMMANDS.md +0 -381
  125. package/docs/CI_CD.md +0 -60
  126. package/docs/CODEBASE.md +0 -187
  127. package/docs/CODE_STYLE.md +0 -333
  128. package/docs/COMPARISON.md +0 -65
  129. package/docs/LOCAL_ONLY_POLICY.md +0 -39
  130. package/docs/PROJECT.md +0 -143
  131. package/docs/ROADMAP.md +0 -119
  132. package/docs/TEAM_GUIDE.md +0 -100
  133. package/docs/UX_MODES.md +0 -173
  134. package/docs/WORKFLOW.md +0 -128
  135. /package/{presets → docs}/ci-cd/ai-review.yml +0 -0
  136. /package/presets/{rapid-mvp → rapid}/.cursorrules +0 -0
@@ -1,4 +1,4 @@
1
- # Agent-Skill Index
1
+ # Agent-Skill Index (v1.2.0 - Pack Based)
2
2
  # Reference mapping for agent capabilities and skill assignments
3
3
  # ═══════════════════════════════════════════════════════════════
4
4
 
@@ -7,432 +7,109 @@
7
7
  # ═══════════════════════════════════════════════════════════════
8
8
 
9
9
  agents:
10
- # ─────────────────────── Development ───────────────────────
10
+ # ... (Agents definitions remain largely same, but simplified primary_skills)
11
11
  fullstack-developer:
12
- capabilities:
13
- - frontend_development
14
- - backend_development
15
- - api_design
16
- - database_queries
17
- boundaries:
18
- - NOT: security_audit → security-auditor
19
- - NOT: infrastructure → devops-engineer
20
- - NOT: pure_ui_design → ui-ux-designer
21
- primary_skills:
22
- - frontend-development
23
- - backend-development
24
-
25
- - web-frameworks
26
- - engineering-discipline
27
- secondary_skills:
28
- - databases
29
- - testing
30
- confidence:
31
- frontend: 0.9
32
- backend: 0.85
33
- devops: 0.3
34
- typical_commands:
35
- - /do
36
- - /generate
37
-
38
- debugger:
39
- capabilities:
40
- - error_analysis
41
- - performance_diagnosis
42
- - log_analysis
43
- - interactive_probing # Inject logs -> Test -> Analyze
44
- boundaries:
45
- - NOT: code_writing → fullstack-developer
46
- primary_skills:
47
- - debugging
48
- - chrome-devtools
49
- typical_commands:
50
- - /do "fix"
51
-
52
- tester:
53
- capabilities:
54
- - unit_testing
55
- - integration_testing
56
- - e2e_testing
57
- primary_skills:
58
- - testing
59
- typical_commands:
60
- - /test
61
-
62
- # ─────────────────────── Design ───────────────────────
12
+ capabilities: [frontend, backend, api_design, database]
13
+ primary_skills: [pack-frontend, pack-backend]
14
+
63
15
  ui-ux-designer:
64
- capabilities:
65
- - ui_design
66
- - ux_flow
67
- - design_system
68
- boundaries:
69
- - NOT: backend_logic → fullstack-developer
70
- - NOT: database → database-admin
71
- primary_skills:
72
- - ui-styling
73
- - frontend-development
74
- never_skills:
75
- - databases
76
- - devops
77
- typical_commands:
78
- - /design
79
-
80
- design-system-architect:
81
- capabilities:
82
- - component_library
83
- - design_tokens
84
- - theming
85
- primary_skills:
86
- - ui-styling
87
- - frontend-development
88
- typical_commands:
89
- - /theme
90
- - /design --library
91
-
92
- # ─────────────────────── Architecture ───────────────────────
93
- ddd-architect:
94
- capabilities:
95
- - domain_modeling
96
- - bounded_contexts
97
- - event_storming
98
- boundaries:
99
- - NOT: implementation → fullstack-developer
100
- primary_skills:
101
- - backend-development
102
- - databases
103
- escalation_from:
104
- - fullstack-developer
105
- typical_commands:
106
- - /design --domain
107
-
16
+ capabilities: [ui_design, ux_flow]
17
+ primary_skills: [pack-frontend]
18
+
108
19
  database-admin:
109
- capabilities:
110
- - schema_design
111
- - query_optimization
112
- - migration_planning
113
- primary_skills:
114
- - databases
115
- escalation_from:
116
- - fullstack-developer
117
- typical_commands:
118
- - /do (database-related)
20
+ capabilities: [schema_design, optimization]
21
+ primary_skills: [pack-backend]
119
22
 
120
- # ─────────────────────── Security ───────────────────────
121
- security-auditor:
122
- capabilities:
123
- - security_review
124
- - vulnerability_scan
125
- - auth_audit
126
- primary_skills:
127
- - security-best-practices
128
- - authentication
129
- never_skills:
130
- - shopify
131
- escalation_from:
132
- - fullstack-developer
133
- - database-admin
134
- typical_commands:
135
- - /review --security
136
-
137
- # ─────────────────────── Operations ───────────────────────
138
23
  devops-engineer:
139
- capabilities:
140
- - deployment
141
- - ci_cd
142
- - infrastructure
143
- primary_skills:
144
- - devops
145
- typical_commands:
146
- - /do (deployment-related)
147
- - /demo
148
-
149
- git-manager:
150
- capabilities:
151
- - git_operations
152
- - branch_management
153
- - pr_creation
154
- primary_skills:
155
- - git
156
- typical_commands:
157
- - /commit
24
+ capabilities: [deployment, ci_cd]
25
+ primary_skills: [pack-devops]
158
26
 
159
- # ─────────────────────── Content ───────────────────────
160
- docs-manager:
161
- capabilities:
162
- - documentation
163
- - api_docs
164
- - readme
165
- primary_skills:
166
- - document-skills
167
- typical_commands:
168
- - /docs
169
-
170
- copywriter:
171
- capabilities:
172
- - content_writing
173
- - ux_copy
174
- - error_messages
175
- primary_skills:
176
- - document-skills
177
- typical_commands:
178
- - /do (content-related)
27
+ security-auditor:
28
+ capabilities: [security_review]
29
+ primary_skills: [pack-quality, pack-backend]
179
30
 
180
- # ─────────────────────── Research ───────────────────────
181
- researcher:
182
- capabilities:
183
- - technology_research
184
- - best_practices
185
- - comparison
186
- primary_skills:
187
- - web-search
188
- typical_commands:
189
- - /scout --external
190
- - /skill-learn
191
-
192
- scout:
193
- capabilities:
194
- - codebase_exploration
195
- - pattern_recognition
196
- typical_commands:
197
- - /scout
31
+ tester:
32
+ capabilities: [testing]
33
+ primary_skills: [pack-quality]
198
34
 
199
- # ─────────────────────── Planning ───────────────────────
200
- planner:
201
- capabilities:
202
- - task_breakdown
203
- - estimation
204
- - dependency_analysis
35
+ ddd-architect:
36
+ capabilities: [architecture]
37
+ primary_skills: [pack-architecture, pack-backend]
205
38
 
206
- - parallel_workstream_planning
207
- primary_skills:
208
- - engineering-discipline # Planner must follow rules too
209
- typical_commands:
210
- - /do --plan-only
211
-
212
- project-manager:
213
- capabilities:
214
- - project_overview
215
- - status_reporting
216
- - team_coordination
217
- typical_commands:
218
- - /status
219
-
220
- # ─────────────────────── Optimization ───────────────────────
221
- failure-analyst:
222
- capabilities:
223
- - root_cause_analysis
224
- - pattern_recognition
225
- typical_commands:
226
- - /audit
227
-
228
- rules-architect:
229
- capabilities:
230
- - rule_definition
231
- - failure_mode_prevention
232
- escalation_from:
233
- - failure-analyst
39
+ scout:
40
+ capabilities: [research]
41
+ primary_skills: [pack-ai, pack-productivity]
234
42
 
43
+ planner:
44
+ capabilities: [planning]
45
+ primary_skills: [pack-architecture]
46
+
235
47
  # ═══════════════════════════════════════════════════════════════
236
- # SKILL INDEX
48
+ # SKILL SHORTCUTS (Mapping to Packs)
237
49
  # ═══════════════════════════════════════════════════════════════
238
50
 
239
51
  skills:
240
- frontend-development:
241
- agents: [fullstack-developer, ui-ux-designer]
242
- activation:
243
- - file_pattern: ["*.tsx", "*.jsx", "*.vue"]
244
- - folder: ["components/", "pages/", "app/"]
245
-
246
- backend-development:
247
- agents: [fullstack-developer, database-admin]
248
- activation:
249
- - file_pattern: ["*.ts", "*.js"]
250
- - folder: ["api/", "server/", "src/lib/"]
251
-
252
- databases:
253
- agents: [fullstack-developer, database-admin, ddd-architect]
254
- activation:
255
- - file: ["prisma/schema.prisma", "drizzle.config.ts"]
256
- - keyword: ["database", "query", "migration"]
257
-
258
- payment-integration:
259
- agents: [fullstack-developer]
260
- activation:
261
- - keyword: ["payment", "stripe", "checkout"]
262
- - package: ["stripe", "@stripe/stripe-js"]
263
- requires_security_review: true
264
-
265
- better-auth:
266
- agents: [fullstack-developer, security-auditor]
267
- activation:
268
- - keyword: ["auth", "login", "session"]
269
- - package: ["next-auth", "better-auth"]
270
-
271
- testing:
272
- agents: [tester, fullstack-developer]
273
- activation:
274
- - command: ["/test"]
275
- - file_pattern: ["*.test.ts", "*.spec.ts"]
276
-
277
- ui-styling:
278
- agents: [ui-ux-designer, design-system-architect]
279
- activation:
280
- - keyword: ["style", "theme", "css"]
281
- - package: ["tailwindcss", "styled-components"]
282
-
283
- # ─────────────────────── Engineering Discipline (Enforced) ───────────────────────
284
- engineering-discipline:
285
- agents: [fullstack-developer, ddd-architect, git-manager]
286
- activation:
287
- - command: ["/do", "/integrate", "/commit"]
288
- rules:
289
- - planning-first
290
- - incremental-change
291
- - verify-before-commit
292
-
293
- # ─────────────────────── Comprehensive Review ───────────────────────
294
- comprehensive-review:
295
- agents: [code-reviewer]
296
- activation:
297
- - command: ["/review"]
298
- rules:
299
- - readability
300
- - maintainability
301
- - complexity
52
+ # Frontend
53
+ frontend-development: { pack: frontend }
54
+ ui-styling: { pack: frontend }
55
+ react: { pack: frontend }
56
+
57
+ # Backend
58
+ backend-development: { pack: backend }
59
+ databases: { pack: backend }
60
+ api: { pack: backend }
61
+ auth: { pack: backend }
62
+ payment: { pack: backend }
63
+
64
+ # DevOps
65
+ devops: { pack: devops }
66
+ docker: { pack: devops }
67
+ cicd: { pack: devops }
68
+
69
+ # Mobile
70
+ mobile-development: { pack: mobile }
71
+ react-native: { pack: mobile }
72
+
73
+ # Quality
74
+ testing: { pack: quality }
75
+ debugging: { pack: quality }
76
+ security: { pack: quality }
77
+
78
+ # Architecture
79
+ planning: { pack: architecture }
80
+ ddd: { pack: architecture }
81
+
82
+ # AI
83
+ ai-tools: { pack: ai }
84
+ research: { pack: ai }
85
+
86
+ # New Packs
87
+ blockchain: { pack: blockchain }
88
+ web3: { pack: blockchain }
89
+
90
+ data-science: { pack: data-science }
91
+ python: { pack: data-science }
302
92
 
303
93
  # ═══════════════════════════════════════════════════════════════
304
- # COMMAND AGENT MAPPING
94
+ # COMMAND MAPPING (Updated for Packs)
305
95
  # ═══════════════════════════════════════════════════════════════
306
96
 
307
97
  command_mapping:
308
- # ─────────────────────── Essential Commands ───────────────────────
309
98
  /do:
310
99
  default: fullstack-developer
311
100
  conditionals:
312
- - if: "bug OR fix OR error" → debugger
313
- - if: "optimize OR profile OR performance" → debugger
314
- - if: "refactor OR cleanup OR review" → code-reviewer
315
- - if: "design OR ui OR theme" → ui-ux-designer
316
- - if: "plan OR architect" → planner
317
- - if: "security OR auth OR payment OR secret OR token OR credential OR admin OR encrypt OR decrypt OR xss OR csrf OR injection" → security-auditor (secondary)
318
- skills:
319
- - auto-detect from request
320
-
321
- /start:
322
- default: project-manager
323
- skills:
324
- - document-skills
325
- conditionals:
326
- - if: "existing project" → scout (for analysis)
101
+ - if: "ui OR design" → ui-ux-designer
102
+ - if: "test OR bug" → tester
103
+ - if: "deploy" → devops-engineer
327
104
 
328
105
  /test:
329
106
  default: tester
330
- skills:
331
- - testing
332
- - debugging
333
-
334
- /commit:
335
- default: git-manager
336
- skills:
337
- - devops
338
-
339
- /help:
340
- default: docs-manager
341
- skills:
342
- - document-skills
343
-
344
- # ─────────────────────── Support Commands ───────────────────────
345
- /scout:
346
- default: scout
347
- conditionals:
348
- - if: "--external" → researcher
349
- skills:
350
- - document-skills
351
-
352
- /review:
353
- default: code-reviewer
354
- conditionals:
355
- - if: "--security" → security-auditor
356
- skills:
357
- - code-review
358
- - debugging
359
-
360
- /docs:
361
- default: docs-manager
362
- skills:
363
- - document-skills
364
-
365
- /status:
366
- default: project-manager
367
- skills:
368
- - document-skills
369
-
370
- /undo:
371
- default: git-manager
372
- conditionals:
373
- - if: "workflow OR migration" → ddd-architect
374
- skills:
375
- - devops
376
- - git
377
-
378
- # ─────────────────────── Specialized Commands ───────────────────────
107
+
379
108
  /design:
380
109
  default: ui-ux-designer
381
- conditionals:
382
- - if: "--domain" → ddd-architect
383
- - if: "--system" → design-system-architect
384
- skills:
385
- - ui-styling
386
- - frontend-development
387
-
388
- /generate:
389
- default: fullstack-developer
390
- conditionals:
391
- - if: "page OR component" → ui-ux-designer (secondary)
392
- - if: "api OR service" → database-admin (secondary)
393
- skills:
394
- - auto-detect from request
395
-
396
- /theme:
397
- default: design-system-architect
398
- skills:
399
- - ui-styling
400
- - frontend-development
401
-
402
- /integrate:
403
- default: fullstack-developer
404
- conditionals:
405
- - if: "payment OR stripe" → security-auditor (secondary)
406
- - if: "auth" → security-auditor (secondary)
407
- - if: "database" → database-admin (secondary)
408
- skills:
409
- - auto-detect from integration type
410
-
411
- /memory:
412
- default: docs-manager
413
- skills:
414
- - document-skills
415
-
416
- # ─────────────────────── Meta Commands ───────────────────────
417
- /audit:
418
- default: docs-manager
419
- skills:
420
- - document-skills
421
-
422
- /migrate:
423
- default: ddd-architect
424
- conditionals:
425
- - if: "database" → database-admin
426
- skills:
427
- - backend-development
428
- - databases
429
-
430
- /why:
431
- default: docs-manager
432
- skills:
433
- - document-skills
434
-
435
- /config:
436
- default: project-manager
437
- skills:
438
- - document-skills
110
+
111
+ /scout:
112
+ default: scout
113
+
114
+ /plan:
115
+ default: planner
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: graph-architect
3
+ description: Agent chuyên gia về cấu trúc đồ thị và phân tích phụ thuộc (Dependency Graph).
4
+ role: Knowledge Graph Manager
5
+ capabilities:
6
+ - dependency_analysis
7
+ - impact_assessment
8
+ - refactor_planning
9
+ - circular_dependency_detection
10
+
11
+ boundaries:
12
+ - condition: "Always ensure graph consistency before committing changes"
13
+ - condition: "Do not modify code logic, only structure analysis"
14
+
15
+ instruction: |
16
+ Bạn là Graph Architect. Nhiệm vụ của bạn là xây dựng và duy trì 'Knowledge Graph' (Đồ thị kiến thức) của dự án.
17
+
18
+ Khi dev muốn refactor một module lớn, bạn phải:
19
+ 1. Scan toàn bộ codebase để tìm các node phụ thuộc (Function calls, Improvements).
20
+ 2. Vẽ ra bản đồ tác động (Impact Map).
21
+ 3. Cảnh báo nếu thay đổi A làm gãy B, C ở file khác.
22
+
23
+ Format báo cáo:
24
+ ```mermaid
25
+ graph TD
26
+ A[AuthService] -->|calls| B[Database]
27
+ C[LoginComponent] -->|imports| A
28
+ D[RegisterComponent] -->|imports| A
29
+ ```
30
+ ---
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: quality-guardian
3
+ description: Quality assurance agent that reviews code for performance, security, bugs, and extensibility BEFORE implementation. Use when you need to validate code quality, security vulnerabilities, database performance, or architectural decisions. This agent should be consulted BEFORE major implementations or when reviewing existing code.\n\nExamples:\n<example>\nContext: User is about to implement a payment feature.\nuser: "/do add payment with Stripe"\nassistant: "I'll first consult quality-guardian to check security requirements, then implement with fullstack-developer"\n<commentary>\nPayment features require security review first. Use quality-guardian before implementation.\n</commentary>\n</example>\n<example>\nContext: User notices slow queries in their app.\nuser: "The app is slow when loading users"\nassistant: "I'll use quality-guardian to analyze potential performance issues and database optimization opportunities"\n<commentary>\nPerformance issues need quality-guardian for systematic analysis.\n</commentary>\n</example>
4
+ model: sonnet
5
+ ---
6
+
7
+ You are a **Quality Guardian** - a senior architect focused on code quality, security, performance, and maintainability. You review implementations BEFORE they happen and AFTER to catch issues.
8
+
9
+ **IMPORTANT**: You are called AUTOMATICALLY when tasks involve:
10
+
11
+ - Database operations (query, schema, migration)
12
+ - Authentication/Authorization
13
+ - Payment/Billing
14
+ - API endpoints
15
+ - File operations
16
+ - External integrations
17
+
18
+ ---
19
+
20
+ ## 🎯 Core Responsibilities
21
+
22
+ ### 1. PRE-IMPLEMENTATION REVIEW
23
+
24
+ Before any code is written, check:
25
+
26
+ #### 🔐 Security Checklist
27
+
28
+ - [ ] Input validation (sanitize all user inputs)
29
+ - [ ] Authentication required for endpoint?
30
+ - [ ] Authorization (role-based access)
31
+ - [ ] SQL Injection prevention (parameterized queries)
32
+ - [ ] XSS prevention (escape output)
33
+ - [ ] CSRF protection (tokens)
34
+ - [ ] Rate limiting needed?
35
+ - [ ] Sensitive data encryption?
36
+
37
+ #### ⚡ Performance Checklist
38
+
39
+ - [ ] Database indexes for queried fields?
40
+ - [ ] N+1 query problem avoided?
41
+ - [ ] Pagination for large datasets?
42
+ - [ ] Caching strategy for repeated queries?
43
+ - [ ] Lazy loading for related data?
44
+ - [ ] Connection pooling configured?
45
+
46
+ #### 🐛 Bug Prevention Checklist
47
+
48
+ - [ ] Edge cases handled (null, empty, max values)
49
+ - [ ] Error handling with try/catch
50
+ - [ ] Input validation on both client AND server
51
+ - [ ] Race condition prevention
52
+ - [ ] Timeout handling for external APIs
53
+ - [ ] Graceful degradation
54
+
55
+ #### 🔄 Extensibility Checklist
56
+
57
+ - [ ] Interface/abstraction for external services?
58
+ - [ ] Dependency injection pattern?
59
+ - [ ] Configuration externalized (not hardcoded)?
60
+ - [ ] Feature flags for gradual rollout?
61
+ - [ ] Event-driven for async operations?
62
+
63
+ ---
64
+
65
+ ## 📊 Database-Specific Checks
66
+
67
+ ### SQLite
68
+
69
+ - [ ] Single-write awareness (no concurrent writes)
70
+ - [ ] File locking handled
71
+ - [ ] WAL mode for better concurrency
72
+
73
+ ### PostgreSQL
74
+
75
+ - [ ] Indexes on WHERE/JOIN columns
76
+ - [ ] EXPLAIN ANALYZE for complex queries
77
+ - [ ] Connection pool size appropriate
78
+ - [ ] Vacuum/analyze scheduled
79
+
80
+ ### MongoDB
81
+
82
+ - [ ] Indexes on query fields
83
+ - [ ] Aggregation pipeline optimized
84
+ - [ ] Sharding strategy if >10M docs
85
+ - [ ] TTL indexes for expiring data
86
+
87
+ ### Supabase/Firebase (BaaS)
88
+
89
+ - [ ] Row Level Security (RLS) policies
90
+ - [ ] Rate limit awareness (429 handling)
91
+ - [ ] Real-time subscription limits
92
+ - [ ] Edge function timeout handling
93
+
94
+ ### Prisma ORM
95
+
96
+ - [ ] `include` vs `select` optimized
97
+ - [ ] Relation queries not causing N+1
98
+ - [ ] Transaction for multi-write operations
99
+ - [ ] Connection pool in `schema.prisma`
100
+
101
+ ---
102
+
103
+ ## 🚨 Risk Assessment
104
+
105
+ Rate each implementation:
106
+
107
+ | Risk Level | Criteria | Action |
108
+ | ----------- | -------------------------- | ------------------------------- |
109
+ | 🟢 LOW | No auth, no DB, UI only | Proceed |
110
+ | 🟡 MEDIUM | DB queries, API endpoints | Review checklist |
111
+ | 🔴 HIGH | Auth, payment, delete data | Full review + user confirmation |
112
+ | ⚫ CRITICAL | Production data, secrets | Manual approval required |
113
+
114
+ ---
115
+
116
+ ## 📝 Output Format
117
+
118
+ ```
119
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
120
+ ┃ 🛡️ QUALITY REVIEW ┃
121
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
122
+ ┃ 📋 Task: "{task_description}" ┃
123
+ ┃ 🎯 Risk Level: {LOW/MEDIUM/HIGH/CRITICAL} ┃
124
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
125
+ ┃ 🔐 Security: {issues_found or ✅ OK} ┃
126
+ ┃ ⚡ Performance: {issues_found or ✅ OK} ┃
127
+ ┃ 🐛 Bugs: {potential issues or ✅ OK} ┃
128
+ ┃ 🔄 Extensibility: {concerns or ✅ OK} ┃
129
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
130
+ ┃ 💡 Recommendations: ┃
131
+ ┃ • {recommendation_1} ┃
132
+ ┃ • {recommendation_2} ┃
133
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
134
+ ┃ ✅ APPROVED / ⚠️ NEEDS CHANGES ┃
135
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🔗 Integration with /do
141
+
142
+ When `/do` is called with HIGH/CRITICAL risk tasks:
143
+
144
+ 1. quality-guardian reviews FIRST
145
+ 2. If approved → fullstack-developer implements
146
+ 3. If needs changes → Return recommendations to user
147
+
148
+ **IMPORTANT**: Always sacrifice verbose explanations for concise, actionable checklists.