tribunal-kit 5.8.2 → 5.8.4
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 +12 -12
- package/.agent/agents/complexity-reviewer.md +53 -0
- package/.agent/agents/precedence-reviewer.md +12 -12
- package/.agent/agents/swarm-worker-registry.md +3 -3
- package/.agent/history/integrity_manifest.json +958 -0
- package/.agent/history/memory/.memory.idx +305 -1
- package/.agent/history/memory/MEMORY.md +21 -1
- package/.agent/rules/GEMINI.md +31 -28
- package/.agent/scripts/case_law_manager.js +3 -15
- package/.agent/scripts/context_broker.js +3 -1
- package/.agent/scripts/guardrail_engine.js +643 -0
- package/.agent/scripts/integrity_manifest.js +486 -0
- package/.agent/scripts/signal_detector.js +1 -1
- package/.agent/scripts/skill_evolution.js +3 -15
- package/.agent/scripts/skill_integrator.js +2 -12
- package/.agent/scripts/swarm_dispatcher.js +2 -12
- package/.agent/skills/12-principles-of-animation/SKILL.md +69 -0
- package/.agent/skills/60fps-animation/SKILL.md +78 -0
- package/.agent/skills/accessible-animation/SKILL.md +86 -0
- package/.agent/skills/adapt/SKILL.md +75 -0
- package/.agent/skills/animation-on-scroll/SKILL.md +110 -0
- package/.agent/skills/animation-systems/SKILL.md +69 -0
- package/.agent/skills/antfu-conventions/SKILL.md +74 -0
- package/.agent/skills/app-builder/SKILL.md +1 -1
- package/.agent/skills/apple-design/SKILL.md +108 -0
- package/.agent/skills/audit-and-fix/SKILL.md +83 -0
- package/.agent/skills/baseline-ui/SKILL.md +74 -0
- package/.agent/skills/better-colors/SKILL.md +124 -0
- package/.agent/skills/better-typography/SKILL.md +111 -0
- package/.agent/skills/better-ui/SKILL.md +102 -0
- package/.agent/skills/bolder/SKILL.md +68 -0
- package/.agent/skills/build-primitive/SKILL.md +70 -0
- package/.agent/skills/clarify/SKILL.md +75 -0
- package/.agent/skills/cobejs/SKILL.md +96 -0
- package/.agent/skills/codebase-design/SKILL.md +84 -0
- package/.agent/skills/colorize/SKILL.md +77 -0
- package/.agent/skills/compact-landing/SKILL.md +70 -0
- package/.agent/skills/company-logos/SKILL.md +73 -0
- package/.agent/skills/create-design-md/SKILL.md +104 -0
- package/.agent/skills/critique/SKILL.md +95 -0
- package/.agent/skills/delight/SKILL.md +65 -0
- package/.agent/skills/design-lab/SKILL.md +59 -0
- package/.agent/skills/diagnosing-bugs/SKILL.md +190 -0
- package/.agent/skills/distill/SKILL.md +65 -0
- package/.agent/skills/domain-modeling/SKILL.md +78 -0
- package/.agent/skills/fixing-accessibility/SKILL.md +98 -0
- package/.agent/skills/fixing-metadata/SKILL.md +97 -0
- package/.agent/skills/fixing-motion-performance/SKILL.md +96 -0
- package/.agent/skills/gpt-taste/SKILL.md +68 -0
- package/.agent/skills/harden/SKILL.md +74 -0
- package/.agent/skills/impeccable/SKILL.md +72 -0
- package/.agent/skills/improve-codebase-architecture/SKILL.md +67 -0
- package/.agent/skills/improve-ui/SKILL.md +83 -0
- package/.agent/skills/landing-page/SKILL.md +88 -0
- package/.agent/skills/lint-and-validate/SKILL.md +1 -2
- package/.agent/skills/local-first-architecture/SKILL.md +66 -0
- package/.agent/skills/lottie-animation/SKILL.md +82 -0
- package/.agent/skills/marquee-loop/SKILL.md +96 -0
- package/.agent/skills/masked-reveal/SKILL.md +88 -0
- package/.agent/skills/micro-interaction/SKILL.md +100 -0
- package/.agent/skills/morphing-icons/SKILL.md +85 -0
- package/.agent/skills/page-transition-animation/SKILL.md +108 -0
- package/.agent/skills/parallel-agents/SKILL.md +5 -5
- package/.agent/skills/polish/SKILL.md +63 -0
- package/.agent/skills/pricing-page/SKILL.md +68 -0
- package/.agent/skills/progressive-blur/SKILL.md +100 -0
- package/.agent/skills/project-idioms/SKILL.md +7 -7
- package/.agent/skills/quieter/SKILL.md +68 -0
- package/.agent/skills/react-doctor/SKILL.md +70 -0
- package/.agent/skills/redesign-skill/SKILL.md +65 -0
- package/.agent/skills/shape/SKILL.md +73 -0
- package/.agent/skills/soft-skill/SKILL.md +72 -0
- package/.agent/skills/sounds-on-the-web/SKILL.md +100 -0
- package/.agent/skills/svg-animation/SKILL.md +91 -0
- package/.agent/skills/swiss-design/SKILL.md +64 -0
- package/.agent/skills/taste-skill/SKILL.md +71 -0
- package/.agent/skills/tdd-workflow/SKILL.md +36 -165
- package/.agent/skills/test-result-analyzer/SKILL.md +1 -1
- package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +82 -0
- package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +66 -0
- package/.agent/skills/transitions-dev/SKILL.md +101 -0
- package/.agent/skills/typeset/SKILL.md +76 -0
- package/.agent/skills/ui-skills-root/SKILL.md +85 -0
- package/.agent/skills/web-quality-audit/SKILL.md +67 -0
- package/.agent/workflows/fix.md +2 -2
- package/.agent/workflows/preview.md +5 -5
- package/.agent/workflows/status.md +1 -1
- package/.agent/workflows/tribunal-full.md +3 -3
- package/.agent/workflows/tribunal-speed.md +2 -2
- package/README.md +348 -238
- package/bin/tribunal-kit.js +62 -1482
- package/dist/cli.js +13 -0
- package/dist/commands/align.js +1 -1
- package/dist/commands/compile.js +1 -1
- package/dist/commands/guardrail.js +275 -0
- package/dist/commands/init.js +10 -9
- package/dist/commands/optimize.js +318 -0
- package/dist/utils/version.js +1 -1
- package/package.json +10 -8
- package/scripts/fix-vbc.js +98 -0
- package/scripts/fix-vbc.ps1 +119 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: svg-animation
|
|
3
|
+
description: SVG stroke draw-on effects, path morphing, animated icons, motion paths, and interactive vector graphics.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
7
|
+
routing:
|
|
8
|
+
domain: Vector SVG Motion & Path Animation
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [morphing-icons, 60fps-animation]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [svg-animation, stroke draw-on, path morphing, animated SVG, SVG stroke-dasharray, motion path]
|
|
13
|
+
weak: [svg motion, animated icon]
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# SVG Animation — Stroke Draw-On & Path Morphing
|
|
17
|
+
|
|
18
|
+
Craft crisp, resolution-independent vector animations using CSS, Framer Motion, or GSAP.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 3 SVG Motion Techniques
|
|
23
|
+
|
|
24
|
+
### 1. Pure CSS Stroke Draw-On Effect
|
|
25
|
+
```css
|
|
26
|
+
@keyframes draw-path {
|
|
27
|
+
from { stroke-dashoffset: 1000; }
|
|
28
|
+
to { stroke-dashoffset: 0; }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.draw-signature-path {
|
|
32
|
+
stroke-dasharray: 1000;
|
|
33
|
+
stroke-dashoffset: 1000;
|
|
34
|
+
animation: draw-path 1.8s cubic-bezier(0.65, 0, 0.35, 1) forwards;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Framer Motion SVG Path Length Animation
|
|
39
|
+
```tsx
|
|
40
|
+
import { motion } from "framer-motion";
|
|
41
|
+
|
|
42
|
+
export function DrawCheckmark() {
|
|
43
|
+
return (
|
|
44
|
+
<svg className="w-8 h-8 stroke-emerald-500 stroke-2 fill-none" viewBox="0 0 24 24">
|
|
45
|
+
<motion.path
|
|
46
|
+
d="M5 13l4 4L19 7"
|
|
47
|
+
initial={{ pathLength: 0 }}
|
|
48
|
+
animate={{ pathLength: 1 }}
|
|
49
|
+
transition={{ duration: 0.4, ease: "easeOut" }}
|
|
50
|
+
/>
|
|
51
|
+
</svg>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. SVG Path Morphing (GSAP MorphSVGPlugin)
|
|
57
|
+
- Morph between 2 vector paths with identical point counts or using GSAP MorphSVG:
|
|
58
|
+
```javascript
|
|
59
|
+
gsap.to("#start-shape", {
|
|
60
|
+
morphSVG: "#end-shape",
|
|
61
|
+
duration: 0.6,
|
|
62
|
+
ease: "power2.inOut"
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🤖 LLM-Specific Traps
|
|
69
|
+
|
|
70
|
+
1. **Incorrect `stroke-dasharray` Length**: Guessing path lengths without measuring `path.getTotalLength()`, resulting in clipped or incomplete draw-on animations.
|
|
71
|
+
2. **Missing `fill="none"`**: Forgetting `fill="none"` on draw-on stroke paths, causing black fill shapes during path animation.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
76
|
+
|
|
77
|
+
**Active reviewers: `frontend-reviewer` · `motion-reviewer`**
|
|
78
|
+
|
|
79
|
+
### ✅ Pre-Flight Self-Audit
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
✅ Is `stroke-dasharray` calibrated to match the true SVG path length?
|
|
83
|
+
✅ Is `vector-effect="non-scaling-stroke"` applied if SVG elements scale responsively?
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
87
|
+
|
|
88
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
89
|
+
|
|
90
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
91
|
+
- ✅ **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.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swiss-design
|
|
3
|
+
description: International Typographic Style (Swiss Design) principles for web interfaces. Strict grid discipline, asymmetric layouts, bold typographic contrast, flush-left un-justified text, and mathematical negative space.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
7
|
+
routing:
|
|
8
|
+
domain: Print-Inspired UI & Swiss Typography
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [better-typography, baseline-ui, industrial-brutalist-ui]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [swiss-design, Swiss style UI, International Typographic Style, grid discipline, Helvetica layout, print inspired web]
|
|
13
|
+
weak: [swiss layout, grid UI]
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Swiss Design — International Typographic Style for Web
|
|
17
|
+
|
|
18
|
+
Architect pristine, print-inspired interfaces grounded in grid discipline, objective clarity, and asymmetric typographic hierarchy.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 4 Swiss Design Pillars
|
|
23
|
+
|
|
24
|
+
### 1. Strict Grid Alignment
|
|
25
|
+
- Every layout element MUST align strictly to a visible or invisible 12-column grid.
|
|
26
|
+
- Border dividers use thin, sharp 1px solid lines matching `--foreground` opacity (e.g. `border-color: rgba(0,0,0,0.15)`).
|
|
27
|
+
|
|
28
|
+
### 2. High-Contrast Sans-Serif Typography
|
|
29
|
+
- Use clean grotesque sans-serif fonts (Helvetica, Inter, Geist, Neue Haas Grotesk).
|
|
30
|
+
- Pair large bold display titles (`3rem+`, `font-weight: 700`, `letter-spacing: -0.03em`) with clean flush-left, rag-right body copy (`text-align: left`).
|
|
31
|
+
|
|
32
|
+
### 3. Asymmetric Structural Balance
|
|
33
|
+
- Reject centered, symmetrical layouts. Align headings and content to strong left vertical axes, using generous negative space to anchor visual weight.
|
|
34
|
+
|
|
35
|
+
### 4. Mathematical Numbering & Labels
|
|
36
|
+
- Use small uppercase metadata badges (`SECTION 01 // OVERVIEW`) with tracking (`letter-spacing: 0.08em`) and monospace or tabular numbers (`font-variant-numeric: tabular-nums`).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🤖 LLM-Specific Traps
|
|
41
|
+
|
|
42
|
+
1. **Justified Text Alignment**: Setting `text-align: justify` which creates uneven, ugly gaps ("rivers") between words. Use `text-align: left`.
|
|
43
|
+
2. **Centered Text Overuse**: Centering body text paragraphs. Keep content strictly left-aligned.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
48
|
+
|
|
49
|
+
**Active reviewers: `frontend-reviewer` · `ui-ux-auditor`**
|
|
50
|
+
|
|
51
|
+
### ✅ Pre-Flight Self-Audit
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
✅ Are all text paragraphs aligned flush-left (`text-align: left`)?
|
|
55
|
+
✅ Is layout structured on an explicit grid axis with generous negative space?
|
|
56
|
+
✅ Are tabular numbers (`tabular-nums`) used for numbered section markers?
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
60
|
+
|
|
61
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
62
|
+
|
|
63
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
64
|
+
- ✅ **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.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: taste-skill
|
|
3
|
+
description: Senior UI/UX frontend skill that enforces anti-slop design decisions, motion quality, visual rhythm, micro-craft, and architectural discipline.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
7
|
+
routing:
|
|
8
|
+
domain: Design Taste & Anti-Slop Discipline
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [better-ui, impeccable, frontend-design]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [taste-skill, design taste, anti-slop, frontend craft discipline, high taste UI]
|
|
13
|
+
weak: [taste, good design]
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Taste Skill — Senior Design Taste & Anti-Slop Discipline
|
|
17
|
+
|
|
18
|
+
Enforce senior-level design taste, anti-slop constraints, and visual craft across every component.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## The 5 Rules of Design Taste
|
|
23
|
+
|
|
24
|
+
### 1. Banned AI Visual Clichés (Zero Tolerance)
|
|
25
|
+
- ❌ Purple/violet gradient backgrounds (`from-purple-600 to-indigo-600`).
|
|
26
|
+
- ❌ Glowing neon borders on every card element.
|
|
27
|
+
- ❌ Floating 3D spheres or generic iridescent mesh gradients.
|
|
28
|
+
- ❌ Identical Bento Box 3-column grids on every page.
|
|
29
|
+
|
|
30
|
+
### 2. High-Fidelity Typography
|
|
31
|
+
- Typography accounts for 80% of interface perception.
|
|
32
|
+
- Display headings must use negative tracking (`-0.025em`) and balanced text wrapping (`text-wrap: balance`).
|
|
33
|
+
- Body text line length MUST be bounded to `65ch` max width.
|
|
34
|
+
|
|
35
|
+
### 3. Spatial System Strictness
|
|
36
|
+
- Never use arbitrary `px` paddings or margins (`margin-top: 17px`).
|
|
37
|
+
- Enforce strict 8px spatial grid math (`4px`, `8px`, `12px`, `16px`, `24px`, `32px`, `48px`, `64px`).
|
|
38
|
+
|
|
39
|
+
### 4. Tactile Micro-Feedback
|
|
40
|
+
- All interactive controls MUST respond to press with `transform: scale(0.97)` on `:active` with transition duration $\le 160\text{ms}$.
|
|
41
|
+
|
|
42
|
+
### 5. Multi-Layer Depth Over Flat Lines
|
|
43
|
+
- Replace harsh black borders with multi-layer ambient drop shadows and subtle 8% opacity surface outlines.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🤖 LLM-Specific Traps
|
|
48
|
+
|
|
49
|
+
1. **Defaulting to Plain Templates**: Producing boring, unstyled HTML buttons with zero hover/active states.
|
|
50
|
+
2. **Ignoring Dark Mode Depth**: Leaving card backgrounds flat black (`#000000`) without surface lightness progression.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
55
|
+
|
|
56
|
+
**Active reviewers: `frontend-reviewer` · `ui-ux-auditor`**
|
|
57
|
+
|
|
58
|
+
### ✅ Pre-Flight Self-Audit
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
✅ Are generic purple gradients and glowing borders completely avoided?
|
|
62
|
+
✅ Is text length bounded to 65ch max width for body paragraphs?
|
|
63
|
+
✅ Do interactive elements feature tactile press feedback (`scale(0.97)`)?
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
67
|
+
|
|
68
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
69
|
+
|
|
70
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
71
|
+
- ✅ **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.
|
|
@@ -1,206 +1,77 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tdd-workflow
|
|
3
3
|
description: Test-Driven Development (TDD) mastery. Red-Green-Refactor cycles, behavior-driven design (BDD), strict mutation coverage, test doubles (mocks/stubs/spies), and avoiding test-induced design damage. Use when building complex algorithms, deep business logic, or strictly regulated systems.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
8
7
|
routing:
|
|
9
|
-
domain:
|
|
10
|
-
tier:
|
|
8
|
+
domain: Test-Driven Development & Quality Assurance
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [webapp-testing, clean-code]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [tdd-workflow, red green refactor, test driven development, TDD, slice by slice testing, write test first]
|
|
13
|
+
weak: [write test, unit test logic]
|
|
11
14
|
---
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
# TDD Workflow — Red-Green-Refactor Mastery
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
- ❌ Skipping the Red phase (writing a failing test first) -> ✅ If the test passes before you write the code, it tests nothing
|
|
17
|
-
- ❌ Refactoring during the Red or Green phase -> ✅ Red: write failing test. Green: make it pass minimally. THEN refactor. Never mix phases
|
|
18
|
+
Build features and fixes one slice at a time using strict Test-Driven Development (TDD) discipline.
|
|
18
19
|
|
|
19
20
|
---
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
## The 3-Phase TDD Cycle
|
|
22
23
|
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 1. The Red-Green-Refactor Cycle
|
|
26
|
-
|
|
27
|
-
TDD is a strict, irrevocable discipline. Do not write the implementation first.
|
|
28
|
-
|
|
29
|
-
### Step 1: RED (Write the failing test)
|
|
30
|
-
|
|
31
|
-
Write the test as if the API already exists exactly how you _wish_ it were designed.
|
|
32
|
-
Run the test. It MUST fail (because the function doesn't exist, or returns the wrong value). If it passes, the test is useless.
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
// 1. The failing test
|
|
36
|
-
import { calculateDiscount } from "./pricing";
|
|
37
|
-
|
|
38
|
-
test("Should apply 10% discount for orders over $100", () => {
|
|
39
|
-
expect(calculateDiscount(150)).toBe(135);
|
|
40
|
-
});
|
|
41
|
-
// ❌ FAILS: calculateDiscount is not defined
|
|
42
24
|
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
// 2. The minimum implementation
|
|
50
|
-
export function calculateDiscount(subtotal: number): number {
|
|
51
|
-
if (subtotal >= 100) return subtotal * 0.9;
|
|
52
|
-
return subtotal;
|
|
53
|
-
}
|
|
54
|
-
// ✅ PASSES.
|
|
25
|
+
[ 1. RED ] Write a failing behavioral test for the minimal next requirement.
|
|
26
|
+
↓
|
|
27
|
+
[ 2. GREEN ] Write the simplest production code to make the test pass.
|
|
28
|
+
↓
|
|
29
|
+
[ 3. REFACTOR ] Clean up code & duplicate logic while ensuring tests stay green.
|
|
55
30
|
```
|
|
56
31
|
|
|
57
|
-
### Step 3: REFACTOR
|
|
58
|
-
|
|
59
|
-
Now wrap the implementation in clean architectural principles. The tests guarantee you haven't broken the behavior while you optimize.
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
// 3. The Refactor
|
|
63
|
-
const DISCOUNT_THRESHOLD = 100;
|
|
64
|
-
const DISCOUNT_RATE = 0.9;
|
|
65
|
-
|
|
66
|
-
export function calculateDiscount(subtotal: number): number {
|
|
67
|
-
return subtotal >= DISCOUNT_THRESHOLD ? subtotal * DISCOUNT_RATE : subtotal;
|
|
68
|
-
}
|
|
69
|
-
// ✅ STILL PASSES. Safe to commit.
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## 2. Test Doubles (Mocks, Stubs, Spies)
|
|
75
|
-
|
|
76
|
-
Knowing _how_ to mock separates amateurs from professionals. Over-mocking destroys architectural integrity.
|
|
77
|
-
|
|
78
|
-
| Type | When to use | Example |
|
|
79
|
-
| :-------- | :--------------------------------------------------- | :------------------------------------------------------- |
|
|
80
|
-
| **Dummy** | Filler objects passed but never used | `processOrder(new UserDummy(), payload)` |
|
|
81
|
-
| **Stub** | Hardcodes a specific response | `db.getUser.mockResolvedValue({ id: 1 })` |
|
|
82
|
-
| **Spy** | Records how many times a function was called | `expect(emailService.send).toHaveBeenCalledTimes(1)` |
|
|
83
|
-
| **Mock** | A spy with predefined expectations of exact payloads | `expect(logger.info).toHaveBeenCalledWith('Authorized')` |
|
|
84
|
-
|
|
85
|
-
### The Mocking Rule
|
|
86
|
-
|
|
87
|
-
**Only mock at the architectural boundaries (Database, Network, External FileSystem).**
|
|
88
|
-
NEVER mock internal business logic or child pure-functions. If function A calls function B, test A by allowing it to genuinely call B.
|
|
89
|
-
|
|
90
32
|
---
|
|
91
33
|
|
|
92
|
-
##
|
|
34
|
+
## 4 TDD Rules
|
|
93
35
|
|
|
94
|
-
|
|
36
|
+
### 1. Test Behavior, Not Implementation Details
|
|
37
|
+
- Assert GIVEN / WHEN / THEN behavior results, NOT private class methods or internal variables.
|
|
95
38
|
|
|
96
39
|
```typescript
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
deposit(amount: number) {
|
|
100
|
-
this.balance += amount;
|
|
101
|
-
}
|
|
102
|
-
getBalance() {
|
|
103
|
-
return this.balance;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ❌ BAD: Testing internal state (Fragile)
|
|
108
|
-
test("Deposit updates the internal balance variable", () => {
|
|
109
|
-
const acc = new Account();
|
|
110
|
-
acc.deposit(50);
|
|
111
|
-
expect(acc["balance"]).toBe(50); // Intrusive test breaks if variable is renamed
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// ✅ GOOD: Testing external behavior contract
|
|
115
|
-
test("Deposit makes the funds available via getBalance", () => {
|
|
116
|
-
const acc = new Account();
|
|
117
|
-
acc.deposit(50);
|
|
118
|
-
expect(acc.getBalance()).toBe(50); // Tests the public API only
|
|
119
|
-
});
|
|
120
|
-
```
|
|
40
|
+
// ❌ BAD: Coupling test to internal state
|
|
41
|
+
expect(calculator._memoryBuffer).toBe(42);
|
|
121
42
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
127
|
-
|
|
128
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
129
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
130
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
131
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
132
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
137
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
138
|
-
|
|
139
|
-
### ❌ Forbidden AI Tropes
|
|
140
|
-
|
|
141
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
142
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
143
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
144
|
-
|
|
145
|
-
Review these questions before confirming output:
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
149
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
150
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
151
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
43
|
+
// ✅ GOOD: Asserting public behavior contract
|
|
44
|
+
expect(calculator.add(40, 2)).toBe(42);
|
|
152
45
|
```
|
|
153
46
|
|
|
154
|
-
###
|
|
155
|
-
|
|
156
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
157
|
-
|
|
158
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
159
|
-
- ✅ **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.
|
|
47
|
+
### 2. The Minimal Green Rule
|
|
48
|
+
- In Step 2 (GREEN), write ONLY the minimal code required to pass the test—even if it's hardcoding a return value initially. This forces you to write the next test that proves the hardcoded value inadequate.
|
|
160
49
|
|
|
161
|
-
|
|
50
|
+
### 3. Mock Only External Boundaries
|
|
51
|
+
- Never mock internal domain entities or utility functions. Mock ONLY un-owned external boundaries (database IO, network APIs, payment gateways).
|
|
162
52
|
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
## VBC Protocol (Verification-Before-Completion)
|
|
167
|
-
|
|
168
|
-
You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
|
|
53
|
+
### 4. Triangulation Strategy
|
|
54
|
+
- When uncertain about algorithm logic, write 2 or more tests with different inputs to force general implementation.
|
|
169
55
|
|
|
170
56
|
---
|
|
171
57
|
|
|
172
58
|
## 🤖 LLM-Specific Traps
|
|
173
59
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
177
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
178
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
179
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
180
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
60
|
+
1. **Writing Code First, Tests Later**: Generating 200 lines of implementation code and adding tests as an afterthought.
|
|
61
|
+
2. **Fragile Mock Over-use**: Mocking every internal dependency, creating brittle tests that break during refactoring.
|
|
181
62
|
|
|
182
63
|
---
|
|
183
64
|
|
|
184
65
|
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
185
66
|
|
|
186
|
-
**
|
|
187
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
188
|
-
|
|
189
|
-
### ❌ Forbidden AI Tropes
|
|
190
|
-
|
|
191
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
192
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
193
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
67
|
+
**Active reviewers: `test-engineer` · `logic-reviewer`**
|
|
194
68
|
|
|
195
69
|
### ✅ Pre-Flight Self-Audit
|
|
196
70
|
|
|
197
|
-
Review these questions before confirming output:
|
|
198
|
-
|
|
199
71
|
```
|
|
200
|
-
✅
|
|
201
|
-
✅
|
|
202
|
-
✅
|
|
203
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
72
|
+
✅ Was the failing test written and verified BEFORE writing implementation code?
|
|
73
|
+
✅ Does the test assert external behavior rather than internal private state?
|
|
74
|
+
✅ Are mocks restricted strictly to external IO boundaries?
|
|
204
75
|
```
|
|
205
76
|
|
|
206
77
|
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
@@ -21,7 +21,7 @@ You are a specialist in analyzing test output — not writing tests, but _unders
|
|
|
21
21
|
- After a test run with multiple failures.
|
|
22
22
|
- When the user says "tests are failing", "analyze test results", "what broke?", or "test failed".
|
|
23
23
|
- During CI/CD pipeline debugging.
|
|
24
|
-
- When `test_runner.
|
|
24
|
+
- When `test_runner.js` or any test command exits with failures.
|
|
25
25
|
- When paired with `systematic-debugging` for deep root-cause investigation.
|
|
26
26
|
|
|
27
27
|
## Analysis Pipeline
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: thermo-nuclear-code-quality-review
|
|
3
|
+
description: Run an extremely strict maintainability review for abstraction quality, giant files, spaghetti-condition growth, and architectural debt.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
7
|
+
routing:
|
|
8
|
+
domain: Ultra-Strict Code Quality Review
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [clean-code, codebase-design, code-review-checklist]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [thermo-nuclear-code-quality-review, strict code review, maintainability audit, spaghetti code review, giant file audit, strict maintainability]
|
|
13
|
+
weak: [deep review, strict audit]
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Thermo-Nuclear Code Quality Review — Zero-Tolerance Maintainability Audit
|
|
17
|
+
|
|
18
|
+
Execute a ruthless, zero-tolerance code maintainability audit targeting abstraction leaks, file bloat, and spaghetti conditionals.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 5 Zero-Tolerance Audit Rules
|
|
23
|
+
|
|
24
|
+
### 1. File Size Hard Limit (Max 300 Lines)
|
|
25
|
+
- Flag ANY single file exceeding 300 lines of code. Demand decomposition into modular helper components or sub-packages.
|
|
26
|
+
|
|
27
|
+
### 2. Cyclomatic Complexity & Nested Conditionals (Max 3 Levels)
|
|
28
|
+
- Flag any function with nested conditionals deeper than 3 levels (`if -> if -> if -> for`). Require early guard clause returns.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// ❌ REJECTED: Deep nested spaghetti
|
|
32
|
+
function processOrder(order: Order) {
|
|
33
|
+
if (order) {
|
|
34
|
+
if (order.isValid) {
|
|
35
|
+
if (order.items.length > 0) {
|
|
36
|
+
// Business logic hidden 4 levels deep
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ✅ APPROVED: Early guard returns
|
|
43
|
+
function processOrder(order: Order) {
|
|
44
|
+
if (!order || !order.isValid) return;
|
|
45
|
+
if (order.items.length === 0) return;
|
|
46
|
+
// Business logic at top indentation level
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Magic Values & String Literals
|
|
51
|
+
- Hardcoded status strings (`"PENDING_APPROVAL_V2"`) or raw numbers (`86400000`) outside central `const` or `enum` declarations trigger immediate failure.
|
|
52
|
+
|
|
53
|
+
### 4. Direct Dependency Coupling
|
|
54
|
+
- Modules importing concrete database models or vendor SDKs directly inside domain business logic instead of interface adapters are rejected.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🤖 LLM-Specific Traps
|
|
59
|
+
|
|
60
|
+
1. **Permissive Approvals**: Giving "looks good to me" approvals on 800-line monolithic files with nested conditionals.
|
|
61
|
+
2. **Superficial Formatting Fixes**: Focusing on trailing commas instead of architectural complexity and file bloat.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
66
|
+
|
|
67
|
+
**Active reviewers: `complexity-reviewer` · `logic-reviewer` · `type-safety`**
|
|
68
|
+
|
|
69
|
+
### ✅ Pre-Flight Self-Audit
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
✅ Are all files under the 300-line size threshold?
|
|
73
|
+
✅ Has cyclomatic nesting depth been reduced to $\le 3$ levels via guard clauses?
|
|
74
|
+
✅ Are all magic numbers and status strings extracted into typed constants?
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
78
|
+
|
|
79
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
80
|
+
|
|
81
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
82
|
+
- ✅ **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.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: to-spring-or-not-to-spring
|
|
3
|
+
description: Audit and decide when to use physics-based spring animations (stiffness, damping, mass) vs duration-based cubic-bezier easing curves.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
last-updated: 2026-07-22
|
|
6
|
+
applies-to-model: gemini-3-6-flash, claude-3-7-sonnet
|
|
7
|
+
routing:
|
|
8
|
+
domain: Motion Physics & Animation Decisions
|
|
9
|
+
tier: pro
|
|
10
|
+
co-requires: [emil-design-eng, framer-motion-expert]
|
|
11
|
+
trigger-signals:
|
|
12
|
+
strong: [to-spring-or-not-to-spring, spring physics, spring animation vs cubic bezier, stiffness damping mass, motion physics decision]
|
|
13
|
+
weak: [spring animation, spring vs easing]
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# To Spring or Not to Spring — Motion Physics Decision Matrix
|
|
17
|
+
|
|
18
|
+
Decide when to use physics-driven spring models (Framer Motion / Reanimated) vs duration-based cubic-bezier easing curves.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Spring vs Duration Decision Matrix
|
|
23
|
+
|
|
24
|
+
| Motion Scenario | Use Spring Physics? | Recommended Parameters / Curve |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| **Interruptible Gestures** (Drag, Swipe, Sheet pull) | ✅ **ALWAYS** | `type: "spring", stiffness: 300, damping: 30` (adapts to drag velocity) |
|
|
27
|
+
| **Button Press Feedback** (`:active`) | ❌ **NO (Use Curve)** | `transition: transform 120ms cubic-bezier(0.2, 0, 0, 1)` |
|
|
28
|
+
| **Modal / Dialog Entrance** | ❌ **NO (Use Curve)** | `transition: all 220ms cubic-bezier(0.16, 1, 0.3, 1)` |
|
|
29
|
+
| **Badge Bouncing / Celebration** | ✅ **YES** | `type: "spring", stiffness: 400, damping: 15` (intentional overshoot bounce) |
|
|
30
|
+
| **Page / Route Transitions** | ❌ **NO (Use Curve)** | `transition: opacity 200ms ease-out` |
|
|
31
|
+
| **Toggle Switch Flip** | ✅ **YES** | `type: "spring", stiffness: 500, damping: 35` (crisp snap without wobble) |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3 Core Spring Parameters
|
|
36
|
+
|
|
37
|
+
1. **Stiffness** (Rigidity): High stiffness ($400+$) = snappy and tight; Low stiffness ($100$) = slow and lazy.
|
|
38
|
+
2. **Damping** (Friction): High damping ($30+$) = zero overshoot bounce; Low damping ($10$) = heavy oscillating bounce.
|
|
39
|
+
3. **Mass** (Weight): Higher mass ($2.0$) = feels heavy with momentum inertia.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🤖 LLM-Specific Traps
|
|
44
|
+
|
|
45
|
+
1. **Bouncy Springs on Modals**: Adding low-damping bouncy springs to popovers or modals, making popovers wobble on screen.
|
|
46
|
+
2. **Fixed Duration Springs**: Setting `duration: 0.5` alongside `type: "spring"` in Framer Motion, which overrides natural spring physics.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
51
|
+
|
|
52
|
+
**Active reviewers: `motion-reviewer`**
|
|
53
|
+
|
|
54
|
+
### ✅ Pre-Flight Self-Audit
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
✅ Are spring physics restricted to gestures, toggles, drag targets, and playful badges?
|
|
58
|
+
✅ Are modals, dropdowns, and route transitions using deterministic cubic-bezier curves?
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
62
|
+
|
|
63
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
64
|
+
|
|
65
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
66
|
+
- ✅ **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.
|