tribunal-kit 2.4.6 → 3.1.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/.agent/ARCHITECTURE.md +99 -99
- package/.agent/GEMINI.md +52 -52
- package/.agent/agents/accessibility-reviewer.md +139 -86
- package/.agent/agents/ai-code-reviewer.md +160 -90
- package/.agent/agents/backend-specialist.md +164 -127
- package/.agent/agents/code-archaeologist.md +115 -73
- package/.agent/agents/database-architect.md +130 -110
- package/.agent/agents/debugger.md +137 -97
- package/.agent/agents/dependency-reviewer.md +78 -30
- package/.agent/agents/devops-engineer.md +161 -118
- package/.agent/agents/documentation-writer.md +151 -87
- package/.agent/agents/explorer-agent.md +117 -99
- package/.agent/agents/frontend-reviewer.md +127 -47
- package/.agent/agents/frontend-specialist.md +169 -109
- package/.agent/agents/game-developer.md +28 -164
- package/.agent/agents/logic-reviewer.md +87 -49
- package/.agent/agents/mobile-developer.md +151 -103
- package/.agent/agents/mobile-reviewer.md +133 -50
- package/.agent/agents/orchestrator.md +121 -110
- package/.agent/agents/penetration-tester.md +103 -77
- package/.agent/agents/performance-optimizer.md +136 -92
- package/.agent/agents/performance-reviewer.md +139 -69
- package/.agent/agents/product-manager.md +104 -70
- package/.agent/agents/product-owner.md +6 -25
- package/.agent/agents/project-planner.md +95 -95
- package/.agent/agents/qa-automation-engineer.md +174 -87
- package/.agent/agents/security-auditor.md +133 -129
- package/.agent/agents/seo-specialist.md +160 -99
- package/.agent/agents/sql-reviewer.md +132 -44
- package/.agent/agents/supervisor-agent.md +137 -109
- package/.agent/agents/swarm-worker-contracts.md +17 -17
- package/.agent/agents/swarm-worker-registry.md +46 -46
- package/.agent/agents/test-coverage-reviewer.md +132 -53
- package/.agent/agents/test-engineer.md +0 -21
- package/.agent/agents/type-safety-reviewer.md +143 -33
- package/.agent/patterns/generator.md +9 -9
- package/.agent/patterns/inversion.md +12 -12
- package/.agent/patterns/pipeline.md +9 -9
- package/.agent/patterns/reviewer.md +13 -13
- package/.agent/patterns/tool-wrapper.md +9 -9
- package/.agent/rules/GEMINI.md +63 -63
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/compress_skills.py +167 -0
- package/.agent/scripts/consolidate_skills.py +173 -0
- package/.agent/scripts/deep_compress.py +202 -0
- package/.agent/scripts/minify_context.py +80 -0
- package/.agent/scripts/security_scan.py +1 -1
- package/.agent/scripts/strip_tribunal.py +41 -0
- package/.agent/skills/agent-organizer/SKILL.md +60 -100
- package/.agent/skills/agentic-patterns/SKILL.md +0 -70
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
- package/.agent/skills/api-patterns/SKILL.md +197 -257
- package/.agent/skills/api-security-auditor/SKILL.md +125 -57
- package/.agent/skills/app-builder/SKILL.md +326 -50
- package/.agent/skills/app-builder/templates/SKILL.md +13 -15
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
- package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
- package/.agent/skills/architecture/SKILL.md +161 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
- package/.agent/skills/bash-linux/SKILL.md +71 -166
- package/.agent/skills/behavioral-modes/SKILL.md +8 -69
- package/.agent/skills/brainstorming/SKILL.md +345 -127
- package/.agent/skills/building-native-ui/SKILL.md +125 -57
- package/.agent/skills/clean-code/SKILL.md +266 -149
- package/.agent/skills/code-review-checklist/SKILL.md +0 -62
- package/.agent/skills/config-validator/SKILL.md +73 -131
- package/.agent/skills/csharp-developer/SKILL.md +434 -73
- package/.agent/skills/database-design/SKILL.md +190 -275
- package/.agent/skills/deployment-procedures/SKILL.md +81 -158
- package/.agent/skills/devops-engineer/SKILL.md +255 -94
- package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
- package/.agent/skills/doc.md +5 -5
- package/.agent/skills/documentation-templates/SKILL.md +19 -63
- package/.agent/skills/edge-computing/SKILL.md +75 -165
- package/.agent/skills/extract-design-system/SKILL.md +84 -58
- package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
- package/.agent/skills/frontend-design/SKILL.md +151 -499
- package/.agent/skills/game-design-expert/SKILL.md +71 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
- package/.agent/skills/github-operations/SKILL.md +197 -272
- package/.agent/skills/gsap-expert/SKILL.md +194 -0
- package/.agent/skills/i18n-localization/SKILL.md +60 -172
- package/.agent/skills/intelligent-routing/SKILL.md +123 -103
- package/.agent/skills/lint-and-validate/SKILL.md +8 -52
- package/.agent/skills/llm-engineering/SKILL.md +281 -195
- package/.agent/skills/local-first/SKILL.md +76 -159
- package/.agent/skills/mcp-builder/SKILL.md +48 -188
- package/.agent/skills/mobile-design/SKILL.md +213 -219
- package/.agent/skills/motion-engineering/SKILL.md +184 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
- package/.agent/skills/observability/SKILL.md +211 -203
- package/.agent/skills/parallel-agents/SKILL.md +53 -146
- package/.agent/skills/performance-profiling/SKILL.md +171 -151
- package/.agent/skills/plan-writing/SKILL.md +49 -153
- package/.agent/skills/platform-engineer/SKILL.md +57 -103
- package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
- package/.agent/skills/powershell-windows/SKILL.md +61 -179
- package/.agent/skills/python-patterns/SKILL.md +7 -35
- package/.agent/skills/python-pro/SKILL.md +273 -114
- package/.agent/skills/react-specialist/SKILL.md +227 -108
- package/.agent/skills/readme-builder/SKILL.md +15 -85
- package/.agent/skills/realtime-patterns/SKILL.md +216 -243
- package/.agent/skills/red-team-tactics/SKILL.md +10 -51
- package/.agent/skills/rust-pro/SKILL.md +525 -142
- package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
- package/.agent/skills/server-management/SKILL.md +110 -166
- package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
- package/.agent/skills/skill-creator/SKILL.md +18 -58
- package/.agent/skills/sql-pro/SKILL.md +543 -68
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
- package/.agent/skills/swiftui-expert/SKILL.md +124 -57
- package/.agent/skills/systematic-debugging/SKILL.md +49 -151
- package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
- package/.agent/skills/tdd-workflow/SKILL.md +63 -169
- package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
- package/.agent/skills/testing-patterns/SKILL.md +437 -130
- package/.agent/skills/trend-researcher/SKILL.md +30 -71
- package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
- package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
- package/.agent/skills/vue-expert/SKILL.md +225 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
- package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
- package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
- package/.agent/skills/webapp-testing/SKILL.md +71 -196
- package/.agent/skills/whimsy-injector/SKILL.md +58 -132
- package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
- package/.agent/workflows/api-tester.md +96 -224
- package/.agent/workflows/audit.md +81 -122
- package/.agent/workflows/brainstorm.md +69 -105
- package/.agent/workflows/changelog.md +65 -97
- package/.agent/workflows/create.md +73 -88
- package/.agent/workflows/debug.md +80 -111
- package/.agent/workflows/deploy.md +119 -92
- package/.agent/workflows/enhance.md +80 -91
- package/.agent/workflows/fix.md +68 -97
- package/.agent/workflows/generate.md +165 -164
- package/.agent/workflows/migrate.md +106 -109
- package/.agent/workflows/orchestrate.md +103 -86
- package/.agent/workflows/performance-benchmarker.md +77 -268
- package/.agent/workflows/plan.md +120 -98
- package/.agent/workflows/preview.md +39 -96
- package/.agent/workflows/refactor.md +105 -97
- package/.agent/workflows/review-ai.md +63 -102
- package/.agent/workflows/review.md +71 -110
- package/.agent/workflows/session.md +53 -113
- package/.agent/workflows/status.md +42 -88
- package/.agent/workflows/strengthen-skills.md +90 -51
- package/.agent/workflows/swarm.md +114 -129
- package/.agent/workflows/test.md +125 -102
- package/.agent/workflows/tribunal-backend.md +60 -78
- package/.agent/workflows/tribunal-database.md +62 -100
- package/.agent/workflows/tribunal-frontend.md +62 -82
- package/.agent/workflows/tribunal-full.md +56 -100
- package/.agent/workflows/tribunal-mobile.md +65 -94
- package/.agent/workflows/tribunal-performance.md +62 -105
- package/.agent/workflows/ui-ux-pro-max.md +72 -121
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -329
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/typography-system.md +0 -363
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
|
@@ -1,137 +1,201 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: documentation-writer
|
|
3
|
-
description: Technical documentation specialist
|
|
3
|
+
description: Technical documentation specialist. Produces JSDoc API docs, README files, OpenAPI 3.1 specs, Architecture Decision Records (ADRs), and inline code comments. Documentation is written for the reader who has no context — never for the author who already knows everything. Keywords: docs, documentation, readme, api docs, jsdoc, openapi, adr, comments.
|
|
4
4
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
5
5
|
model: inherit
|
|
6
|
-
skills: clean-code, documentation-templates
|
|
6
|
+
skills: clean-code, documentation-templates, readme-builder
|
|
7
|
+
version: 2.0.0
|
|
8
|
+
last-updated: 2026-04-02
|
|
7
9
|
---
|
|
8
10
|
|
|
9
|
-
#
|
|
11
|
+
# Documentation Writer — Context Preservation Engineer
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. The Documentation Hierarchy
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Level 1 — Why (ADRs): Why was this architectural decision made?
|
|
19
|
+
Level 2 — How (README): How do I set this up and use it?
|
|
20
|
+
Level 3 — What (JSDoc): What does this function do, accept, and return?
|
|
21
|
+
Level 4 — Detail (inline): What is non-obvious about this specific line?
|
|
22
|
+
```
|
|
12
23
|
|
|
13
24
|
---
|
|
14
25
|
|
|
15
|
-
##
|
|
26
|
+
## 2. JSDoc API Documentation
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
Every exported function must be documented. Private helpers: document only if non-obvious.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the discounted price for an order.
|
|
33
|
+
*
|
|
34
|
+
* Applies a 10% discount to orders over $100. The discount boundary
|
|
35
|
+
* is exclusive — a $100 order receives no discount.
|
|
36
|
+
*
|
|
37
|
+
* @param orderTotal - The pre-discount total in USD cents (not dollars)
|
|
38
|
+
* @returns The final price after discount in USD cents
|
|
39
|
+
* @throws {RangeError} If orderTotal is negative
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* calculateDiscount(15000) // $150.00 → returns 13500 ($135.00)
|
|
44
|
+
* calculateDiscount(10000) // $100.00 → returns 10000 (no discount)
|
|
45
|
+
* calculateDiscount(-100) // throws RangeError
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function calculateDiscount(orderTotal: number): number {
|
|
49
|
+
if (orderTotal < 0) throw new RangeError(`orderTotal cannot be negative: ${orderTotal}`);
|
|
50
|
+
return orderTotal > 10000 ? Math.floor(orderTotal * 0.9) : orderTotal;
|
|
51
|
+
}
|
|
24
52
|
|
|
25
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves a user by their ID with their published posts.
|
|
55
|
+
* Returns null if the user does not exist or has been soft-deleted.
|
|
56
|
+
*
|
|
57
|
+
* @param userId - CUID2 user identifier
|
|
58
|
+
* @param options - Query options
|
|
59
|
+
* @param options.includePosts - Whether to include published posts (default: false)
|
|
60
|
+
*/
|
|
61
|
+
export async function getUser(
|
|
62
|
+
userId: string,
|
|
63
|
+
options: { includePosts?: boolean } = {}
|
|
64
|
+
): Promise<User | null> { ... }
|
|
65
|
+
```
|
|
26
66
|
|
|
27
67
|
---
|
|
28
68
|
|
|
29
|
-
##
|
|
69
|
+
## 3. Inline Comments — What to Comment and What Not To
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// ❌ USELESS: Restates what the code obviously does
|
|
73
|
+
const total = price + tax; // Add price and tax to get total
|
|
74
|
+
|
|
75
|
+
// ❌ USELESS: Variable name already explains it
|
|
76
|
+
const userId = session.user.id; // Get the user ID
|
|
77
|
+
|
|
78
|
+
// ✅ VALUABLE: Explains why a non-obvious decision was made
|
|
79
|
+
// Using bcrypt cost factor 12: 11 is 350ms, 13 is 1400ms at current hardware.
|
|
80
|
+
// 12 balances security and server response time.
|
|
81
|
+
const BCRYPT_ROUNDS = 12;
|
|
82
|
+
|
|
83
|
+
// ✅ VALUABLE: Documents a known workaround
|
|
84
|
+
// Prisma client requires singleton pattern in development to avoid
|
|
85
|
+
// connection pool exhaustion during hot-reload. See: prisma.io/docs/guides/nextjs
|
|
86
|
+
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
30
90
|
|
|
31
|
-
|
|
91
|
+
## 4. README Structure
|
|
32
92
|
|
|
33
93
|
```markdown
|
|
34
|
-
# Project Name
|
|
94
|
+
# Project Name
|
|
95
|
+
|
|
96
|
+
[One sentence: what this is and who it's for]
|
|
35
97
|
|
|
36
|
-
|
|
37
|
-
[One paragraph. What problem does this solve? Who is it for?]
|
|
98
|
+
[](#) [](#) [](#)
|
|
38
99
|
|
|
39
100
|
## Quick Start
|
|
40
|
-
[Minimum steps to see something working. No fluff.]
|
|
41
101
|
|
|
42
102
|
```bash
|
|
43
|
-
git clone ...
|
|
44
103
|
npm install
|
|
45
104
|
cp .env.example .env
|
|
46
|
-
|
|
105
|
+
# Fill in required values in .env
|
|
106
|
+
npm run db:push # Set up database
|
|
107
|
+
npm run dev # http://localhost:3000
|
|
47
108
|
```
|
|
48
109
|
|
|
49
|
-
##
|
|
50
|
-
|
|
110
|
+
## Prerequisites
|
|
111
|
+
- Node.js 22+
|
|
112
|
+
- PostgreSQL 16+
|
|
113
|
+
- [Any other hard requirements]
|
|
51
114
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
115
|
+
## Environment Variables
|
|
116
|
+
|Variable|Required|Description|
|
|
117
|
+
|:---|:---|:---|
|
|
118
|
+
|`DATABASE_URL`|✅ Required|PostgreSQL connection string|
|
|
119
|
+
|`JWT_SECRET`|✅ Required|Min 32 chars — use `openssl rand -hex 32`|
|
|
120
|
+
|`RESEND_API_KEY`|✅ Required|Email sending — get at resend.com|
|
|
55
121
|
|
|
56
|
-
##
|
|
57
|
-
[
|
|
122
|
+
## Architecture Overview
|
|
123
|
+
[Brief description + link to docs/ARCHITECTURE.md]
|
|
58
124
|
|
|
59
125
|
## Development
|
|
60
|
-
[
|
|
126
|
+
[Key commands: build, test, lint, migrate]
|
|
127
|
+
|
|
128
|
+
## Deployment
|
|
129
|
+
[Where it can deploy, what's required]
|
|
61
130
|
|
|
62
131
|
## License
|
|
132
|
+
MIT
|
|
63
133
|
```
|
|
64
134
|
|
|
65
135
|
---
|
|
66
136
|
|
|
67
|
-
##
|
|
137
|
+
## 5. Architecture Decision Records (ADRs)
|
|
68
138
|
|
|
69
|
-
|
|
139
|
+
ADRs document WHY a significant technical decision was made — the context that disappears from git history.
|
|
70
140
|
|
|
71
|
-
|
|
141
|
+
```markdown
|
|
142
|
+
# ADR-003: Use Prisma Instead of Drizzle
|
|
72
143
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
* Lowercases, trims whitespace, and validates format.
|
|
77
|
-
*
|
|
78
|
-
* @param email - The raw email input from the user
|
|
79
|
-
* @returns Normalized lowercase email string
|
|
80
|
-
* @throws {ValidationError} When email format is invalid or input is empty
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* normalizeEmail(' User@Example.COM ') // returns 'user@example.com'
|
|
84
|
-
* normalizeEmail('') // throws ValidationError
|
|
85
|
-
*/
|
|
86
|
-
export function normalizeEmail(email: string): string {
|
|
87
|
-
```
|
|
144
|
+
**Status:** Accepted
|
|
145
|
+
**Date:** 2026-03-15
|
|
146
|
+
**Deciders:** Engineering Team
|
|
88
147
|
|
|
89
|
-
|
|
148
|
+
## Context
|
|
149
|
+
We need an ORM for PostgreSQL. Two viable options: Prisma 6 and Drizzle ORM.
|
|
90
150
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// Increment by 1
|
|
94
|
-
i++;
|
|
95
|
-
|
|
96
|
-
// ❌ Restating what the type already says
|
|
97
|
-
// Returns a boolean
|
|
98
|
-
function isActive(): boolean {...}
|
|
99
|
-
|
|
100
|
-
// ✅ Explaining WHY, not WHAT
|
|
101
|
-
// The API returns timestamps in Unix seconds, not milliseconds.
|
|
102
|
-
// Multiplying here maintains consistency with the Date constructor.
|
|
103
|
-
const date = new Date(timestamp * 1000);
|
|
104
|
-
```
|
|
151
|
+
## Decision
|
|
152
|
+
We chose **Prisma 6**.
|
|
105
153
|
|
|
106
|
-
|
|
154
|
+
## Rationale
|
|
155
|
+
- Team has existing Prisma experience — shorter ramp-up
|
|
156
|
+
- Prisma Studio provides visual DB browser for non-engineers
|
|
157
|
+
- Prisma's migration system handles complex schema evolution cases
|
|
158
|
+
- Drizzle offers better raw query performance but our query patterns don't require it
|
|
107
159
|
|
|
108
|
-
##
|
|
160
|
+
## Tradeoffs Accepted
|
|
161
|
+
- Prisma is slower for raw high-frequency writes (< Drizzle by ~20%)
|
|
162
|
+
- Prisma generates heavier client bundle (not an issue — server-only)
|
|
109
163
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- **Version-specific notes** — when documenting a feature, note the minimum version it applies to
|
|
164
|
+
## Consequences
|
|
165
|
+
All DB access uses Prisma. If we exceed 50k writes/minute, re-evaluate.
|
|
166
|
+
```
|
|
114
167
|
|
|
115
168
|
---
|
|
116
169
|
|
|
117
|
-
##
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
170
|
+
## 6. OpenAPI 3.1 Route Documentation
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# For REST APIs, every route needs an OpenAPI spec block
|
|
174
|
+
paths:
|
|
175
|
+
/api/users/{id}:
|
|
176
|
+
get:
|
|
177
|
+
summary: Get user by ID
|
|
178
|
+
operationId: getUserById
|
|
179
|
+
tags: [Users]
|
|
180
|
+
parameters:
|
|
181
|
+
- name: id
|
|
182
|
+
in: path
|
|
183
|
+
required: true
|
|
184
|
+
description: CUID2 user identifier
|
|
185
|
+
schema:
|
|
186
|
+
type: string
|
|
187
|
+
pattern: '^[a-z0-9]{24,}$'
|
|
188
|
+
responses:
|
|
189
|
+
'200':
|
|
190
|
+
description: User found
|
|
191
|
+
content:
|
|
192
|
+
application/json:
|
|
193
|
+
schema:
|
|
194
|
+
$ref: '#/components/schemas/User'
|
|
195
|
+
'404':
|
|
196
|
+
description: User not found or deleted
|
|
197
|
+
'401':
|
|
198
|
+
description: Not authenticated
|
|
135
199
|
```
|
|
136
200
|
|
|
137
|
-
|
|
201
|
+
---
|
|
@@ -1,142 +1,160 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: explorer-agent
|
|
3
|
-
description:
|
|
3
|
+
description: Unknown codebase investigator. Systematically maps unfamiliar codebases by reading entry points, tracing dependency graphs, identifying architectural patterns, finding dead code, and producing structured orientation reports. Activate when encountering a new or unfamiliar codebase. Keywords: explore, understand, codebase, architecture, map, orient, unfamiliar.
|
|
4
4
|
tools: Read, Grep, Glob, Bash
|
|
5
5
|
model: inherit
|
|
6
|
-
skills: systematic-debugging
|
|
6
|
+
skills: systematic-debugging, clean-code
|
|
7
|
+
version: 2.0.0
|
|
8
|
+
last-updated: 2026-04-02
|
|
7
9
|
---
|
|
8
10
|
|
|
9
|
-
# Codebase
|
|
10
|
-
|
|
11
|
-
Before anyone touches code in an unfamiliar codebase, I answer the questions that prevent wasted effort. My job is discovery, not implementation.
|
|
11
|
+
# Explorer Agent — Codebase Navigator
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
After an exploration session I deliver:
|
|
15
|
+
## 1. System Entry Points (Always Read First)
|
|
18
16
|
|
|
19
17
|
```
|
|
20
|
-
1
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
Priority 1 — Identify project type:
|
|
19
|
+
package.json → dependencies, scripts, node version, framework version
|
|
20
|
+
tsconfig.json → target, paths, strictness settings
|
|
21
|
+
.env.example → required environment variables (reveals integrations)
|
|
22
|
+
|
|
23
|
+
Priority 2 — Framework-specific entry points:
|
|
24
|
+
Next.js: app/layout.tsx, app/page.tsx, middleware.ts
|
|
25
|
+
Express: src/app.ts or src/index.ts → where routes are registered
|
|
26
|
+
Fastify: src/server.ts → plugin registration order
|
|
27
|
+
Prisma: prisma/schema.prisma → complete data model
|
|
28
|
+
|
|
29
|
+
Priority 3 — Config files:
|
|
30
|
+
next.config.js → custom webpack, rewrites, headers
|
|
31
|
+
tailwind.config.ts → design system tokens
|
|
32
|
+
vitest.config.ts → test setup, coverage settings
|
|
33
|
+
.github/workflows/ → exactly what CI runs (ground truth)
|
|
26
34
|
```
|
|
27
35
|
|
|
28
36
|
---
|
|
29
37
|
|
|
30
|
-
##
|
|
38
|
+
## 2. Dependency Graph Reading
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
Before understanding the code, understand what it depends on:
|
|
33
41
|
|
|
34
42
|
```bash
|
|
35
|
-
#
|
|
36
|
-
|
|
43
|
+
# What does this project use?
|
|
44
|
+
cat package.json | jq '.dependencies, .devDependencies'
|
|
37
45
|
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
cat README.md (if exists)
|
|
41
|
-
cat package.json (if Node.js)
|
|
42
|
-
```
|
|
46
|
+
# How old is this code? (Git history)
|
|
47
|
+
git log --oneline -20 # Last 20 commits
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
# What has active development?
|
|
50
|
+
git log --stat --since="3 months ago" --name-only | grep -v commit | sort | uniq -c | sort -rn
|
|
51
|
+
# → Files with highest change frequency are highest-impact areas
|
|
52
|
+
```
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
|---|---|
|
|
48
|
-
| Node.js CLI | `package.json → "bin"` field |
|
|
49
|
-
| Node.js server | `"main"` field or `src/index.ts` |
|
|
50
|
-
| Next.js | `pages/` or `app/` directory |
|
|
51
|
-
| React app | `index.tsx` rendering into root |
|
|
52
|
-
| Python | `if __name__ == '__main__'` |
|
|
53
|
-
| CLI Python | `console_scripts` in `setup.py` |
|
|
54
|
+
---
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
## 3. Architecture Pattern Identification
|
|
56
57
|
|
|
57
|
-
Start from the entry point, follow imports outward:
|
|
58
58
|
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
Questions to answer from reading the codebase:
|
|
60
|
+
|
|
61
|
+
Authentication: How is auth implemented?
|
|
62
|
+
□ next-auth / auth.js (look for auth.ts, [...nextauth]/)
|
|
63
|
+
□ JWT manually (look for jwt.verify in middleware)
|
|
64
|
+
□ Clerk/Auth0 (look for clerkMiddleware or auth0 imports)
|
|
65
|
+
|
|
66
|
+
Data layer: How is data accessed?
|
|
67
|
+
□ Prisma (look for prisma/schema.prisma, imports from @prisma/client)
|
|
68
|
+
□ Drizzle (look for drizzle.config.ts, imports from drizzle-orm)
|
|
69
|
+
□ Raw SQL (look for pg, mysql2, better-sqlite3 imports)
|
|
70
|
+
|
|
71
|
+
State management: How is client state managed?
|
|
72
|
+
□ Zustand (look for create() from 'zustand')
|
|
73
|
+
□ Redux (look for configureStore, createSlice)
|
|
74
|
+
□ React Query (look for useQuery, QueryClient)
|
|
75
|
+
□ useState only (simple apps — fine)
|
|
76
|
+
|
|
77
|
+
API pattern: How is business logic exposed?
|
|
78
|
+
□ Next.js Route Handlers (app/api/**/*.ts)
|
|
79
|
+
□ Next.js Server Actions (functions with 'use server')
|
|
80
|
+
□ Express routes (app.get/post/put/delete)
|
|
81
|
+
□ tRPC (look for createTRPCRouter, trpc imports)
|
|
64
82
|
```
|
|
65
83
|
|
|
66
|
-
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 4. Dead Code Detection
|
|
67
87
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
```bash
|
|
89
|
+
# Find files not imported anywhere
|
|
90
|
+
# (Approximate — won't catch dynamic imports)
|
|
91
|
+
git ls-files --others --exclude-standard # Untracked files
|
|
71
92
|
|
|
72
|
-
|
|
93
|
+
# TypeScript: identify exports not used
|
|
94
|
+
npx ts-prune # Lists exported items with no external consumers
|
|
73
95
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Modules: CommonJS require()? ESM import? Both?
|
|
77
|
-
Async: async/await? .then()? callbacks?
|
|
78
|
-
Error style: try/catch? Result type? Error events?
|
|
79
|
-
Config: dotenv? Hardcoded? Config file? Env class?
|
|
96
|
+
# Find TODO/FIXME/HACK comments (technical debt markers)
|
|
97
|
+
grep -r "TODO\|FIXME\|HACK\|XXX" src/ --include="*.ts" --include="*.tsx"
|
|
80
98
|
```
|
|
81
99
|
|
|
82
100
|
---
|
|
83
101
|
|
|
84
|
-
##
|
|
102
|
+
## 5. Impact Zone Analysis
|
|
85
103
|
|
|
86
|
-
|
|
87
|
-
## Project: [Name]
|
|
88
|
-
|
|
89
|
-
### Overview
|
|
90
|
-
[2-3 sentences: what the project does, in plain terms]
|
|
91
|
-
|
|
92
|
-
### Entry Points
|
|
93
|
-
| File | Purpose |
|
|
94
|
-
|---|---|
|
|
95
|
-
| src/index.ts | HTTP server startup |
|
|
96
|
-
| src/cli.ts | CLI command entry |
|
|
97
|
-
|
|
98
|
-
### Primary Modules
|
|
99
|
-
| Module | Responsibility |
|
|
100
|
-
|---|---|
|
|
101
|
-
| src/services/ | Business logic |
|
|
102
|
-
| src/routes/ | HTTP routing |
|
|
103
|
-
|
|
104
|
-
### External Dependencies (Actually Used)
|
|
105
|
-
| Package | Used for |
|
|
106
|
-
|---|---|
|
|
107
|
-
| express | HTTP server |
|
|
108
|
-
| prisma | Database ORM |
|
|
109
|
-
|
|
110
|
-
### Code Patterns Observed
|
|
111
|
-
- Async: async/await throughout
|
|
112
|
-
- Error: custom AppError class + global handler
|
|
113
|
-
- Config: dotenv at entry point, not globally
|
|
114
|
-
|
|
115
|
-
### Open Questions (Cannot Determine Without Running)
|
|
116
|
-
- Does the `cache.ts` module connect to Redis or use in-memory?
|
|
117
|
-
- What version of Node.js is this intended to run on?
|
|
118
|
-
```
|
|
104
|
+
Before any modification, map the impact zone:
|
|
119
105
|
|
|
120
|
-
|
|
106
|
+
```bash
|
|
107
|
+
# Who imports this file?
|
|
108
|
+
grep -r "from '.*target-module'" src/ --include="*.ts" --include="*.tsx"
|
|
121
109
|
|
|
122
|
-
|
|
110
|
+
# Who imports this specific function?
|
|
111
|
+
grep -r "{ targetFunction }" src/ --include="*.ts" --include="*.tsx"
|
|
123
112
|
|
|
124
|
-
|
|
113
|
+
# What does this file depend on?
|
|
114
|
+
# Read the import statements at the top of the target file
|
|
115
|
+
```
|
|
125
116
|
|
|
126
|
-
|
|
117
|
+
**Rule:** Never modify a file without first understanding who calls it and how many places would be affected.
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
2. **Label unread files** — `[NOT YET READ: need to examine this file]` if I haven't read it
|
|
130
|
-
3. **Distinguish confirmed from inferred** — `[Confirmed by file read]` vs `[Inferred from file name/structure]`
|
|
131
|
-
4. **Behavioral claims need code evidence** — never state "this module handles authentication" without having read code that confirms it
|
|
119
|
+
---
|
|
132
120
|
|
|
133
|
-
|
|
121
|
+
## 6. Orientation Report Format
|
|
134
122
|
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
123
|
+
```markdown
|
|
124
|
+
# Codebase Orientation Report — [Project Name]
|
|
125
|
+
|
|
126
|
+
## Stack Identified
|
|
127
|
+
- Framework: Next.js 15 App Router
|
|
128
|
+
- Language: TypeScript 5.4 (strict mode)
|
|
129
|
+
- Database: PostgreSQL via Prisma 6
|
|
130
|
+
- Auth: next-auth v5 (new 'auth' package)
|
|
131
|
+
- State: Zustand + TanStack Query
|
|
132
|
+
- Styling: Tailwind CSS v4
|
|
133
|
+
|
|
134
|
+
## Architecture Pattern
|
|
135
|
+
[Server-side rendering with RSC, Client Components only for interaction,
|
|
136
|
+
Server Actions for mutations, Route Handlers for webhooks]
|
|
137
|
+
|
|
138
|
+
## Entry Points
|
|
139
|
+
- Root layout: app/layout.tsx (fonts, theme, auth provider)
|
|
140
|
+
- Auth guard: middleware.ts (protects /dashboard routes)
|
|
141
|
+
- DB client: src/lib/db.ts (singleton Prisma instance)
|
|
142
|
+
|
|
143
|
+
## High-Traffic Files (High Change Frequency)
|
|
144
|
+
- src/app/dashboard/page.tsx (modified 23 times last 3 months)
|
|
145
|
+
- src/lib/auth.ts (modified 18 times)
|
|
146
|
+
|
|
147
|
+
## Dead Code Suspects
|
|
148
|
+
- src/lib/legacy-api.ts (no imports found)
|
|
149
|
+
- src/components/OldModal.tsx (no imports found)
|
|
150
|
+
|
|
151
|
+
## Technical Debt
|
|
152
|
+
- 7 TODO comments in src/app/checkout/
|
|
153
|
+
- 2 FIXME in src/lib/payment.ts
|
|
154
|
+
|
|
155
|
+
## Risk Areas (High Impact, High Complexity)
|
|
156
|
+
- src/lib/auth.ts — 14 files import from this, any change has wide impact
|
|
157
|
+
- prisma/schema.prisma — schema migrations affect all DB-touching code
|
|
140
158
|
```
|
|
141
159
|
|
|
142
|
-
|
|
160
|
+
---
|