tribunal-kit 1.0.0 → 2.4.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/.shared/ui-ux-pro-max/README.md +3 -3
- package/.agent/ARCHITECTURE.md +205 -10
- package/.agent/GEMINI.md +37 -7
- package/.agent/agents/accessibility-reviewer.md +134 -0
- package/.agent/agents/ai-code-reviewer.md +129 -0
- package/.agent/agents/frontend-specialist.md +3 -0
- package/.agent/agents/game-developer.md +21 -21
- package/.agent/agents/logic-reviewer.md +12 -0
- package/.agent/agents/mobile-reviewer.md +79 -0
- package/.agent/agents/orchestrator.md +56 -26
- package/.agent/agents/performance-reviewer.md +36 -0
- package/.agent/agents/supervisor-agent.md +156 -0
- package/.agent/agents/swarm-worker-contracts.md +166 -0
- package/.agent/agents/swarm-worker-registry.md +92 -0
- package/.agent/rules/GEMINI.md +134 -5
- package/.agent/scripts/bundle_analyzer.py +259 -0
- package/.agent/scripts/dependency_analyzer.py +247 -0
- package/.agent/scripts/lint_runner.py +188 -0
- package/.agent/scripts/patch_skills_meta.py +177 -0
- package/.agent/scripts/patch_skills_output.py +285 -0
- package/.agent/scripts/schema_validator.py +279 -0
- package/.agent/scripts/security_scan.py +224 -0
- package/.agent/scripts/session_manager.py +144 -3
- package/.agent/scripts/skill_integrator.py +234 -0
- package/.agent/scripts/strengthen_skills.py +220 -0
- package/.agent/scripts/swarm_dispatcher.py +317 -0
- package/.agent/scripts/test_runner.py +192 -0
- package/.agent/scripts/test_swarm_dispatcher.py +163 -0
- package/.agent/skills/agent-organizer/SKILL.md +132 -0
- package/.agent/skills/agentic-patterns/SKILL.md +335 -0
- package/.agent/skills/api-patterns/SKILL.md +226 -50
- package/.agent/skills/app-builder/SKILL.md +215 -52
- package/.agent/skills/architecture/SKILL.md +176 -31
- package/.agent/skills/bash-linux/SKILL.md +150 -134
- package/.agent/skills/behavioral-modes/SKILL.md +152 -160
- package/.agent/skills/brainstorming/SKILL.md +148 -101
- package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
- package/.agent/skills/clean-code/SKILL.md +139 -134
- package/.agent/skills/code-review-checklist/SKILL.md +177 -80
- package/.agent/skills/config-validator/SKILL.md +165 -0
- package/.agent/skills/csharp-developer/SKILL.md +107 -0
- package/.agent/skills/database-design/SKILL.md +252 -29
- package/.agent/skills/deployment-procedures/SKILL.md +122 -175
- package/.agent/skills/devops-engineer/SKILL.md +134 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
- package/.agent/skills/documentation-templates/SKILL.md +175 -121
- package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
- package/.agent/skills/edge-computing/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +76 -0
- package/.agent/skills/frontend-design/color-system.md +18 -0
- package/.agent/skills/frontend-design/typography-system.md +18 -0
- package/.agent/skills/game-development/SKILL.md +69 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
- package/.agent/skills/i18n-localization/SKILL.md +158 -96
- package/.agent/skills/intelligent-routing/SKILL.md +89 -285
- package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
- package/.agent/skills/lint-and-validate/SKILL.md +229 -27
- package/.agent/skills/llm-engineering/SKILL.md +258 -0
- package/.agent/skills/local-first/SKILL.md +203 -0
- package/.agent/skills/mcp-builder/SKILL.md +159 -111
- package/.agent/skills/mobile-design/SKILL.md +102 -282
- package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
- package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
- package/.agent/skills/observability/SKILL.md +285 -0
- package/.agent/skills/parallel-agents/SKILL.md +124 -118
- package/.agent/skills/performance-profiling/SKILL.md +143 -89
- package/.agent/skills/plan-writing/SKILL.md +133 -97
- package/.agent/skills/platform-engineer/SKILL.md +135 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -104
- package/.agent/skills/python-patterns/SKILL.md +149 -361
- package/.agent/skills/python-pro/SKILL.md +114 -0
- package/.agent/skills/react-specialist/SKILL.md +107 -0
- package/.agent/skills/realtime-patterns/SKILL.md +296 -0
- package/.agent/skills/red-team-tactics/SKILL.md +136 -134
- package/.agent/skills/rust-pro/SKILL.md +237 -173
- package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
- package/.agent/skills/server-management/SKILL.md +155 -104
- package/.agent/skills/sql-pro/SKILL.md +104 -0
- package/.agent/skills/systematic-debugging/SKILL.md +156 -79
- package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
- package/.agent/skills/tdd-workflow/SKILL.md +148 -88
- package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
- package/.agent/skills/testing-patterns/SKILL.md +141 -114
- package/.agent/skills/trend-researcher/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
- package/.agent/skills/vue-expert/SKILL.md +118 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
- package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
- package/.agent/skills/webapp-testing/SKILL.md +171 -122
- package/.agent/skills/whimsy-injector/SKILL.md +349 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
- package/.agent/workflows/api-tester.md +279 -0
- package/.agent/workflows/audit.md +168 -0
- package/.agent/workflows/brainstorm.md +65 -19
- package/.agent/workflows/changelog.md +144 -0
- package/.agent/workflows/create.md +67 -14
- package/.agent/workflows/debug.md +122 -30
- package/.agent/workflows/deploy.md +82 -31
- package/.agent/workflows/enhance.md +59 -27
- package/.agent/workflows/fix.md +143 -0
- package/.agent/workflows/generate.md +84 -20
- package/.agent/workflows/migrate.md +163 -0
- package/.agent/workflows/orchestrate.md +66 -17
- package/.agent/workflows/performance-benchmarker.md +305 -0
- package/.agent/workflows/plan.md +76 -33
- package/.agent/workflows/preview.md +73 -17
- package/.agent/workflows/refactor.md +153 -0
- package/.agent/workflows/review-ai.md +140 -0
- package/.agent/workflows/review.md +83 -16
- package/.agent/workflows/session.md +154 -0
- package/.agent/workflows/status.md +74 -18
- package/.agent/workflows/strengthen-skills.md +99 -0
- package/.agent/workflows/swarm.md +194 -0
- package/.agent/workflows/test.md +80 -31
- package/.agent/workflows/tribunal-backend.md +55 -13
- package/.agent/workflows/tribunal-database.md +62 -18
- package/.agent/workflows/tribunal-frontend.md +58 -12
- package/.agent/workflows/tribunal-full.md +70 -11
- package/.agent/workflows/tribunal-mobile.md +123 -0
- package/.agent/workflows/tribunal-performance.md +152 -0
- package/.agent/workflows/ui-ux-pro-max.md +100 -82
- package/README.md +117 -62
- package/bin/tribunal-kit.js +329 -75
- package/package.json +10 -6
|
@@ -1,201 +1,206 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clean-code
|
|
3
3
|
description: Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
|
|
4
|
-
allowed-tools: Read, Write, Edit
|
|
5
|
-
version:
|
|
6
|
-
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
last-updated: 2026-03-12
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
7
8
|
---
|
|
8
9
|
|
|
9
|
-
# Clean Code
|
|
10
|
+
# Clean Code Standards
|
|
10
11
|
|
|
11
|
-
>
|
|
12
|
+
> Code is read far more than it is written. Write for the next person.
|
|
13
|
+
> That person is often you, six months from now, confused.
|
|
12
14
|
|
|
13
15
|
---
|
|
14
16
|
|
|
15
|
-
## Core
|
|
17
|
+
## Core Philosophy
|
|
16
18
|
|
|
17
|
-
|
|
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 |
|
|
19
|
+
Clean code is not aesthetic. It is functional. Messy code is slow to change, easy to break, and hard to debug. These standards exist to make code **safe to modify** — not to make it look clever.
|
|
24
20
|
|
|
25
21
|
---
|
|
26
22
|
|
|
27
|
-
## Naming
|
|
23
|
+
## Naming
|
|
28
24
|
|
|
29
|
-
|
|
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` |
|
|
25
|
+
Names are the primary documentation. Choose them seriously.
|
|
35
26
|
|
|
36
|
-
|
|
27
|
+
**Rules:**
|
|
28
|
+
- Variables and functions describe what they hold or do — not how they do it
|
|
29
|
+
- Boolean names start with `is`, `has`, `can`, `should`
|
|
30
|
+
- No single-letter names except loop counters (`i`, `j`) and throwaway lambdas
|
|
31
|
+
- No abbreviations unless they are industry-wide (`url`, `id`, `dto`, `api`)
|
|
32
|
+
- Name at the right level of abstraction — `user` not `userObjectFromDatabase`
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// ❌ Unclear
|
|
36
|
+
const d = new Date();
|
|
37
|
+
const fn = (x) => x * 1.2;
|
|
38
|
+
|
|
39
|
+
// ✅ Self-documenting
|
|
40
|
+
const createdAt = new Date();
|
|
41
|
+
const applyTax = (price: number) => price * 1.2;
|
|
42
|
+
```
|
|
37
43
|
|
|
38
44
|
---
|
|
39
45
|
|
|
40
|
-
##
|
|
46
|
+
## Functions
|
|
41
47
|
|
|
42
|
-
|
|
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 |
|
|
48
|
+
A function does one thing. If you need "and" to describe it, split it.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
- Max ~20 lines per function before questioning its scope
|
|
51
|
+
- Arguments: 0–2 preferred, 3 acceptable, 4+ is a signal to use an options object
|
|
52
|
+
- No boolean flags as arguments — they mean the function does two things
|
|
53
|
+
- Return early to avoid nesting — guard clauses before main logic
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
```ts
|
|
56
|
+
// ❌ Flag argument
|
|
57
|
+
function createUser(data: UserData, sendEmail: boolean) { ... }
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
| **Composition** | Small functions composed together |
|
|
59
|
-
| **Colocation** | Keep related code close |
|
|
59
|
+
// ✅ Two clear functions
|
|
60
|
+
function createUser(data: UserData) { ... }
|
|
61
|
+
function createUserAndNotify(data: UserData) { ... }
|
|
62
|
+
```
|
|
60
63
|
|
|
61
64
|
---
|
|
62
65
|
|
|
63
|
-
##
|
|
66
|
+
## Comments
|
|
64
67
|
|
|
65
|
-
|
|
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 |
|
|
68
|
+
Comments explain **why** — not **what**.
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
- Code explains what it does. A comment explaining what code does means the code is unclear — rewrite the code.
|
|
71
|
+
- Comments explain intent, business rules, non-obvious constraints, and external references
|
|
72
|
+
- Never leave commented-out code in a commit. Use version control.
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
```ts
|
|
75
|
+
// ❌ Pointless comment
|
|
76
|
+
// Get the user by id
|
|
77
|
+
const user = await getUser(id);
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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 |
|
|
79
|
+
// ✅ Useful comment
|
|
80
|
+
// Retry up to 3 times — payment gateway times out under load
|
|
81
|
+
const result = await retry(() => chargeCard(amount), 3);
|
|
82
|
+
```
|
|
85
83
|
|
|
86
84
|
---
|
|
87
85
|
|
|
88
|
-
##
|
|
86
|
+
## Error Handling
|
|
87
|
+
|
|
88
|
+
Errors are part of the contract. Don't hide them.
|
|
89
|
+
|
|
90
|
+
- Every async function must handle its rejection — `try/catch` or `.catch()`
|
|
91
|
+
- Log full context: what operation failed, with what input, what the error was
|
|
92
|
+
- Never swallow errors silently (`catch (e) {}`)
|
|
93
|
+
- User-facing error messages are different from developer error messages — don't conflate them
|
|
94
|
+
|
|
95
|
+
---
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
## Testing Standards
|
|
91
98
|
|
|
92
|
-
|
|
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 |
|
|
99
|
+
Tests make refactoring safe. Without them, every change is a gamble.
|
|
98
100
|
|
|
99
|
-
**
|
|
101
|
+
**AAA Pattern — every test:**
|
|
100
102
|
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
Arrange → set up what you need
|
|
104
|
+
Act → call the thing being tested
|
|
105
|
+
Assert → verify the outcome
|
|
104
106
|
```
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
**Test pyramid:**
|
|
109
|
+
- Unit tests: fast, isolated, abundant — test one function
|
|
110
|
+
- Integration tests: slower, test how components interact
|
|
111
|
+
- E2E tests: fewest, test the full user path
|
|
112
|
+
|
|
113
|
+
**Rules:**
|
|
114
|
+
- One assertion per concept (multiple `expect` calls OK if they verify the same outcome)
|
|
115
|
+
- Tests must pass consistently — a flaky test is a broken test
|
|
116
|
+
- Descriptive test names: `should return 401 when token is expired` not `test auth`
|
|
108
117
|
|
|
109
118
|
---
|
|
110
119
|
|
|
111
|
-
##
|
|
120
|
+
## Performance
|
|
112
121
|
|
|
113
|
-
|
|
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 |
|
|
122
|
+
Measure first. Optimize what is actually slow.
|
|
121
123
|
|
|
122
|
-
|
|
124
|
+
- Profile before assuming — perceived slowness is not always where you think
|
|
125
|
+
- O(n²) in a list that never exceeds 10 items is not a problem worth solving
|
|
126
|
+
- Premature optimization adds complexity and creates bugs
|
|
127
|
+
- Core Web Vitals are the standard for frontend performance targets (2025)
|
|
123
128
|
|
|
124
129
|
---
|
|
125
130
|
|
|
126
|
-
##
|
|
127
|
-
|
|
128
|
-
**Before saying "task complete", verify:**
|
|
131
|
+
## Security Baseline (Always)
|
|
129
132
|
|
|
130
|
-
|
|
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? |
|
|
133
|
+
These are not optional:
|
|
137
134
|
|
|
138
|
-
|
|
135
|
+
- Secrets in environment variables — never in code
|
|
136
|
+
- All SQL queries parameterized — never string-interpolated
|
|
137
|
+
- User input validated at every boundary — never trusted
|
|
138
|
+
- Authentication checked before business logic executes
|
|
139
139
|
|
|
140
140
|
---
|
|
141
141
|
|
|
142
|
-
##
|
|
142
|
+
## 🤖 LLM-Specific Clean Code Traps
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
AI coding assistants (like you) fall into specific bad habits when writing code. These are strictly forbidden under the clean-code standard:
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
1. **JSDoc/Docstring Spam:** Documenting what a function does when the code is self-evident.
|
|
147
|
+
* *❌ AI Trait:* `/** Adds two numbers. @param a First number @param b Second number @returns The sum */ function add(a, b) { return a + b; }`
|
|
148
|
+
* *✅ Clean Code:* `function add(a: number, b: number): number { return a + b; }`
|
|
149
|
+
2. **Defensive Programming Overkill:** Adding 15 `null` checks where the TypeScript compiler or the previous tier has already guaranteed validity.
|
|
150
|
+
3. **Premature Abstraction:** Creating an `AbstractDataManager` factory class with interfaces to parse a simple CSV file. Code what is needed *now*.
|
|
151
|
+
4. **Variable Diarrhea:** Extracting every step of a calculation into a separate `const` when a single readable line would suffice.
|
|
152
|
+
5. **Apologetic Comments:** `// TODO: Refactor this later` or `// I assumed this was the right way`. If you write it, own it. If it's incomplete, flag the user.
|
|
147
153
|
|
|
148
|
-
|
|
149
|
-
|-------|--------|---------|
|
|
150
|
-
| **frontend-specialist** | UX Audit | `python .agent/skills/frontend-design/scripts/ux_audit.py .` |
|
|
151
|
-
| **frontend-specialist** | A11y Check | `python .agent/skills/frontend-design/scripts/accessibility_checker.py .` |
|
|
152
|
-
| **backend-specialist** | API Validator | `python .agent/skills/api-patterns/scripts/api_validator.py .` |
|
|
153
|
-
| **mobile-developer** | Mobile Audit | `python .agent/skills/mobile-design/scripts/mobile_audit.py .` |
|
|
154
|
-
| **database-architect** | Schema Validate | `python .agent/skills/database-design/scripts/schema_validator.py .` |
|
|
155
|
-
| **security-auditor** | Security Scan | `python .agent/skills/vulnerability-scanner/scripts/security_scan.py .` |
|
|
156
|
-
| **seo-specialist** | SEO Check | `python .agent/skills/seo-fundamentals/scripts/seo_checker.py .` |
|
|
157
|
-
| **seo-specialist** | GEO Check | `python .agent/skills/geo-fundamentals/scripts/geo_checker.py .` |
|
|
158
|
-
| **performance-optimizer** | Lighthouse | `python .agent/skills/performance-profiling/scripts/lighthouse_audit.py <url>` |
|
|
159
|
-
| **test-engineer** | Test Runner | `python .agent/skills/testing-patterns/scripts/test_runner.py .` |
|
|
160
|
-
| **test-engineer** | Playwright | `python .agent/skills/webapp-testing/scripts/playwright_runner.py <url>` |
|
|
161
|
-
| **Any agent** | Lint Check | `python .agent/skills/lint-and-validate/scripts/lint_runner.py .` |
|
|
162
|
-
| **Any agent** | Type Coverage | `python .agent/skills/lint-and-validate/scripts/type_coverage.py .` |
|
|
163
|
-
| **Any agent** | i18n Check | `python .agent/skills/i18n-localization/scripts/i18n_checker.py .` |
|
|
154
|
+
---
|
|
164
155
|
|
|
165
|
-
|
|
166
|
-
> ✅ **CORRECT:** `frontend-specialist` running `ux_audit.py`
|
|
156
|
+
## Output Format
|
|
167
157
|
|
|
168
|
-
|
|
158
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
169
159
|
|
|
170
|
-
|
|
160
|
+
```
|
|
161
|
+
━━━ Clean Code Report ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
162
|
+
Skill: Clean Code
|
|
163
|
+
Language: [detected language / framework]
|
|
164
|
+
Scope: [N files · N functions]
|
|
165
|
+
─────────────────────────────────────────────────
|
|
166
|
+
✅ Passed: [checks that passed, or "All clean"]
|
|
167
|
+
⚠️ Warnings: [non-blocking issues, or "None"]
|
|
168
|
+
❌ Blocked: [blocking issues requiring fix, or "None"]
|
|
169
|
+
─────────────────────────────────────────────────
|
|
170
|
+
VBC status: PENDING → VERIFIED
|
|
171
|
+
Evidence: [test output / lint pass / compile success]
|
|
172
|
+
```
|
|
171
173
|
|
|
172
|
-
**
|
|
174
|
+
**VBC (Verification-Before-Completion) is mandatory.**
|
|
175
|
+
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
173
176
|
|
|
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
177
|
|
|
178
|
-
|
|
179
|
-
## Script Results: [script_name.py]
|
|
178
|
+
---
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
- [File:Line] Error description 1
|
|
183
|
-
- [File:Line] Error description 2
|
|
180
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
184
181
|
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
**Slash command: `/generate`, `/review-types`**
|
|
183
|
+
**Active reviewers: `logic-reviewer` · `type-safety-reviewer`**
|
|
187
184
|
|
|
188
|
-
###
|
|
189
|
-
- Check 1 passed
|
|
190
|
-
- Check 2 passed
|
|
185
|
+
### ❌ Forbidden AI Tropes in Code Generation
|
|
191
186
|
|
|
192
|
-
**
|
|
193
|
-
|
|
187
|
+
1. **Over-engineering:** Solving a problem with 3 classes when 1 function works perfectly.
|
|
188
|
+
2. **Commented-out code:** Submitting commented-out dead code, "just in case." Delete it.
|
|
189
|
+
3. **Implicit `any` types:** Failing to strictly type a critical parameter or return value.
|
|
190
|
+
|
|
191
|
+
### ✅ Pre-Flight Self-Audit
|
|
194
192
|
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
Review these questions before confirming code generation or review:
|
|
194
|
+
```
|
|
195
|
+
✅ Does this function do strictly ONE thing?
|
|
196
|
+
✅ Have I removed all pointless comments explaining *what* the code does?
|
|
197
|
+
✅ Did I use specific, business-logic naming rather than generic abbreviations?
|
|
198
|
+
✅ Are all edge cases and rejections properly handled (no swallowed errors)?
|
|
199
|
+
✅ Did I avoid over-engineering this solution?
|
|
200
|
+
```
|
|
197
201
|
|
|
198
|
-
|
|
199
|
-
> 🔴 **VIOLATION:** Auto-fixing without asking = Not allowed.
|
|
200
|
-
> 🔴 **Rule:** Always READ output → SUMMARIZE → ASK → then fix.
|
|
202
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
201
203
|
|
|
204
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
205
|
+
- ❌ **Forbidden:** Refactoring code or blindly applying "clean code" rules without verifying the code still compiles and works.
|
|
206
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing a refactor without providing **concrete terminal evidence** (e.g., passing unit tests logs, successful linting execution, or type-check success) proving the refactored code maintains the original behavior.
|
|
@@ -1,109 +1,206 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review-checklist
|
|
3
3
|
description: Code review guidelines covering code quality, security, and best practices.
|
|
4
|
-
allowed-tools: Read, Glob, Grep
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
last-updated: 2026-03-12
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
5
8
|
---
|
|
6
9
|
|
|
7
|
-
# Code Review
|
|
10
|
+
# Code Review Standards
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
> A code review is not a gatekeeping exercise.
|
|
13
|
+
> It is a knowledge transfer session that also catches bugs.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Review Mindset
|
|
18
|
+
|
|
19
|
+
Reviews are collaborative. The goal is better code — not proof that the reviewer is smarter.
|
|
20
|
+
|
|
21
|
+
**Before commenting:**
|
|
22
|
+
- Understand what the code is trying to do before judging how it does it
|
|
23
|
+
- Distinguish between personal preference and objective problems
|
|
24
|
+
- Label your findings so the author understands the expected action
|
|
25
|
+
|
|
26
|
+
**Comment label convention:**
|
|
27
|
+
- `BLOCKER:` — must be fixed before merge (bug, security issue, broken behavior)
|
|
28
|
+
- `CONCERN:` — likely problem that needs discussion before proceeding
|
|
29
|
+
- `SUGGESTION:` — would improve the code but is not required
|
|
30
|
+
- `NOTE:` — observation or question, no action needed
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## What to Check
|
|
10
35
|
|
|
11
36
|
### Correctness
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
37
|
+
- Does the code do what it claims to do?
|
|
38
|
+
- Are edge cases handled? (empty input, null, max value, concurrent execution)
|
|
39
|
+
- Does error handling cover realistic failure modes?
|
|
40
|
+
- Are there off-by-one errors? Integer overflow risks?
|
|
16
41
|
|
|
17
42
|
### Security
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
43
|
+
- Is user input validated before it's used?
|
|
44
|
+
- Are SQL queries parameterized — never string-concatenated?
|
|
45
|
+
- Are secrets in environment variables — not in code?
|
|
46
|
+
- Are auth checks happening before business logic executes?
|
|
47
|
+
- Is the OWASP API Top 10 considered for any API routes?
|
|
48
|
+
|
|
49
|
+
### Readability
|
|
50
|
+
- Can you understand the intent in under 30 seconds per function?
|
|
51
|
+
- Are names self-documenting at the right level of abstraction?
|
|
52
|
+
- Are complex sections commented with *why*, not *what*?
|
|
53
|
+
- Is nesting kept to a manageable depth (≤3 levels)?
|
|
54
|
+
|
|
55
|
+
### Design
|
|
56
|
+
- Is this code easy to change? Or would changing one thing break five others?
|
|
57
|
+
- Are there clear boundaries between concerns?
|
|
58
|
+
- Is logic duplicated anywhere that should be shared?
|
|
59
|
+
- Is the new code consistent with how the rest of the codebase does similar things?
|
|
60
|
+
|
|
61
|
+
### Tests
|
|
62
|
+
- Are tests testing behavior or implementation details?
|
|
63
|
+
- Do tests cover the happy path, edge cases, and known failure modes?
|
|
64
|
+
- Do test names describe the expected behavior in plain language?
|
|
65
|
+
- Would these tests catch a regression if someone broke this code?
|
|
24
66
|
|
|
25
67
|
### Performance
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// ❌ Vague prompt in code
|
|
57
|
-
const response = await ai.generate(userInput);
|
|
58
|
-
|
|
59
|
-
// ✅ Structured & Safe prompt
|
|
60
|
-
const response = await ai.generate({
|
|
61
|
-
system: "You are a specialized parser...",
|
|
62
|
-
input: sanitize(userInput),
|
|
63
|
-
schema: ResponseSchema
|
|
64
|
-
});
|
|
68
|
+
- Are there database queries inside loops?
|
|
69
|
+
- Are large datasets loaded into memory when they could be streamed?
|
|
70
|
+
- Are expensive operations (network, file I/O) done unnecessarily?
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Review Process
|
|
75
|
+
|
|
76
|
+
1. **Read the PR description first** — understand intent before reading code
|
|
77
|
+
2. **Read tests first** — they tell you what the code is supposed to do
|
|
78
|
+
3. **Read the implementation** — verify it matches what the tests describe
|
|
79
|
+
4. **Run it locally for significant changes** — static reading misses runtime behavior
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Giving Feedback
|
|
84
|
+
|
|
85
|
+
**Effective feedback is:**
|
|
86
|
+
- Specific — references the exact line and the exact concern
|
|
87
|
+
- Actionable — tells the author what to change, not just that something is wrong
|
|
88
|
+
- Explanatory — gives the reasoning, not just the verdict
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
# ❌ Unhelpful
|
|
92
|
+
This function is too long.
|
|
93
|
+
|
|
94
|
+
# ✅ Helpful
|
|
95
|
+
SUGGESTION: This function handles both data fetching and data transformation.
|
|
96
|
+
Splitting into `fetchUserData()` and `transformUserData()` would make each
|
|
97
|
+
half easier to test independently and reuse elsewhere.
|
|
65
98
|
```
|
|
66
99
|
|
|
67
|
-
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Receiving Feedback
|
|
103
|
+
|
|
104
|
+
- "We disagree" is not the same as "they're wrong"
|
|
105
|
+
- If a comment is unclear, ask for clarification before defending
|
|
106
|
+
- BLOCKER and CONCERN comments need resolution, not just a response
|
|
107
|
+
- SUGGESTION and NOTE are optional — you can explain why you're not acting on them
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🛑 Context Window Discipline
|
|
68
112
|
|
|
69
|
-
|
|
70
|
-
// ❌ Magic numbers
|
|
71
|
-
if (status === 3) { ... }
|
|
113
|
+
When an AI acts as a reviewer, context bloat ruins reasoning:
|
|
72
114
|
|
|
73
|
-
|
|
74
|
-
|
|
115
|
+
1. **Never quote massive blocks of code back to the user.** Use line numbers or tiny 1-3 line snippets.
|
|
116
|
+
2. **Never attach the entire project context to a single file review.**
|
|
117
|
+
3. **Keep reviews scoped.** Do not suggest a full architecture rewrite if the PR is fixing a typo in a CSS class.
|
|
75
118
|
|
|
76
|
-
|
|
77
|
-
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 🤖 LLM-Specific Review Traps
|
|
78
122
|
|
|
79
|
-
|
|
80
|
-
if (!a) return;
|
|
81
|
-
if (!b) return;
|
|
82
|
-
if (!c) return;
|
|
83
|
-
// do work
|
|
123
|
+
AI reviewers frequently fail by focusing on the wrong things. Avoid these strict anti-patterns:
|
|
84
124
|
|
|
85
|
-
|
|
86
|
-
|
|
125
|
+
1. **Syntax Nitpicking:** Commenting on formatting, semicolons, or line length. Let `eslint` or Prettier handle this. Only comment if logic is affected.
|
|
126
|
+
2. **"Clean Code" Hallucinations:** Telling the author to extract a perfectly readable 10-line function into 3 separate abstract classes.
|
|
127
|
+
3. **Invented Methods:** Suggesting the author use `.toSortedMap()` when that method literally does not exist in the language or framework used.
|
|
128
|
+
4. **False Bottlenecks:** Claiming an `O(n^2)` loop is a performance critical error when `n` is a configuration array guaranteed to be < 10 items.
|
|
129
|
+
5. **The Compliment Sandwich:** You do not need to soften every critique with "Great job on the rest of the code!" Be direct, professional, and concise.
|
|
130
|
+
|
|
131
|
+
---
|
|
87
132
|
|
|
88
|
-
|
|
89
|
-
const data: any = ...
|
|
133
|
+
## Output Format
|
|
90
134
|
|
|
91
|
-
|
|
92
|
-
|
|
135
|
+
When this skill completes a task, structure your output as:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
━━━ Code Review Checklist Output ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
139
|
+
Task: [what was performed]
|
|
140
|
+
Result: [outcome summary — one line]
|
|
141
|
+
─────────────────────────────────────────────────
|
|
142
|
+
Checks: ✅ [N passed] · ⚠️ [N warnings] · ❌ [N blocked]
|
|
143
|
+
VBC status: PENDING → VERIFIED
|
|
144
|
+
Evidence: [link to terminal output, test result, or file diff]
|
|
93
145
|
```
|
|
94
146
|
|
|
95
|
-
## Review Comments Guide
|
|
96
147
|
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
151
|
+
|
|
152
|
+
**Slash command: `/review`, `/tribunal-full`**
|
|
153
|
+
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
154
|
+
|
|
155
|
+
### ✅ Pre-Flight Self-Audit
|
|
156
|
+
|
|
157
|
+
Review these questions before submitting your code review findings:
|
|
158
|
+
```
|
|
159
|
+
✅ Did I read the tests to understand the intended behavior before reading the implementation?
|
|
160
|
+
✅ Are my BLOCKER and CONCERN comments actionable and specific?
|
|
161
|
+
✅ Have I verified that any alternative methods or libraries I suggested actually exist?
|
|
162
|
+
✅ Have I refrained from quoting more than 3 lines of code in my response?
|
|
163
|
+
✅ Is my feedback focused on logic, edge cases, and security rather than aesthetic formatting?
|
|
97
164
|
```
|
|
98
|
-
// Blocking issues use 🔴
|
|
99
|
-
🔴 BLOCKING: SQL injection vulnerability here
|
|
100
165
|
|
|
101
|
-
// Important suggestions use 🟡
|
|
102
|
-
🟡 SUGGESTION: Consider using useMemo for performance
|
|
103
166
|
|
|
104
|
-
|
|
105
|
-
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 🤖 LLM-Specific Traps
|
|
170
|
+
|
|
171
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
172
|
+
|
|
173
|
+
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
174
|
+
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
175
|
+
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
176
|
+
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
177
|
+
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
182
|
+
|
|
183
|
+
**Slash command: `/review` or `/tribunal-full`**
|
|
184
|
+
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
106
185
|
|
|
107
|
-
|
|
108
|
-
|
|
186
|
+
### ❌ Forbidden AI Tropes
|
|
187
|
+
|
|
188
|
+
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
189
|
+
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
190
|
+
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
191
|
+
|
|
192
|
+
### ✅ Pre-Flight Self-Audit
|
|
193
|
+
|
|
194
|
+
Review these questions before confirming output:
|
|
109
195
|
```
|
|
196
|
+
✅ Did I rely ONLY on real, verified tools and methods?
|
|
197
|
+
✅ Is this solution appropriately scoped to the user's constraints?
|
|
198
|
+
✅ Did I handle potential failure modes and edge cases?
|
|
199
|
+
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
203
|
+
|
|
204
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
205
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
206
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|