tribunal-kit 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/.manifest.json +78 -0
- package/.agent/ARCHITECTURE.md +19 -241
- package/.agent/agents/accessibility-reviewer.md +23 -16
- package/.agent/agents/ai-code-reviewer.md +25 -21
- package/.agent/agents/anti-pattern-reviewer.md +12 -7
- package/.agent/agents/api-architect.md +1 -0
- package/.agent/agents/backend-specialist.md +23 -22
- package/.agent/agents/cloud-engineer.md +1 -0
- package/.agent/agents/code-archaeologist.md +1 -0
- package/.agent/agents/complexity-reviewer.md +10 -7
- package/.agent/agents/database-architect.md +3 -2
- package/.agent/agents/db-latency-auditor.md +6 -2
- package/.agent/agents/debugger.md +3 -2
- package/.agent/agents/dependency-reviewer.md +1 -0
- package/.agent/agents/devops-engineer.md +9 -8
- package/.agent/agents/documentation-writer.md +6 -5
- package/.agent/agents/explorer-agent.md +1 -0
- package/.agent/agents/frontend-reviewer.md +21 -17
- package/.agent/agents/frontend-specialist.md +23 -20
- package/.agent/agents/game-developer.md +1 -0
- package/.agent/agents/interaction-reviewer.md +10 -5
- package/.agent/agents/logic-reviewer.md +3 -0
- package/.agent/agents/minimalist-reviewer.md +6 -0
- package/.agent/agents/mobile-developer.md +7 -6
- package/.agent/agents/mobile-reviewer.md +14 -13
- package/.agent/agents/orchestrator.md +3 -0
- package/.agent/agents/penetration-tester.md +1 -0
- package/.agent/agents/performance-optimizer.md +6 -5
- package/.agent/agents/performance-reviewer.md +6 -6
- package/.agent/agents/pipeline-reviewer.md +144 -0
- package/.agent/agents/precedence-reviewer.md +1 -0
- package/.agent/agents/product-manager.md +1 -0
- package/.agent/agents/product-owner.md +1 -0
- package/.agent/agents/product-reviewer.md +12 -7
- package/.agent/agents/project-planner.md +3 -0
- package/.agent/agents/qa-automation-engineer.md +50 -43
- package/.agent/agents/resilience-reviewer.md +1 -0
- package/.agent/agents/schema-reviewer.md +1 -0
- package/.agent/agents/security-auditor.md +24 -24
- package/.agent/agents/seo-specialist.md +33 -23
- package/.agent/agents/sql-reviewer.md +5 -4
- package/.agent/agents/supervisor-agent.md +12 -2
- package/.agent/agents/swarm-worker-contracts.md +13 -13
- package/.agent/agents/swarm-worker-registry.md +51 -51
- package/.agent/agents/system-architect.md +1 -0
- package/.agent/agents/test-coverage-reviewer.md +25 -22
- package/.agent/agents/test-engineer.md +12 -11
- package/.agent/agents/throughput-optimizer.md +45 -40
- package/.agent/agents/type-safety-reviewer.md +5 -4
- package/.agent/agents/ui-ux-auditor.md +6 -4
- package/.agent/agents/ui-visual-auditor.md +3 -0
- package/.agent/agents/ux-reviewer.md +11 -6
- package/.agent/agents/visual-reviewer.md +11 -6
- package/.agent/agents/vitals-reviewer.md +5 -4
- package/.agent/history/memory/.memory.idx +3716 -1
- package/.agent/history/memory/MEMORY.md +246 -1
- package/.agent/mcp_config.json +1 -6
- package/.agent/routing_index.json +2034 -263
- package/.agent/rules/GEMINI.md +12 -10
- package/.agent/rules/GEMINI_PLANNER.md +19 -21
- package/.agent/scripts/_colors.js +52 -54
- package/.agent/scripts/_utils.js +52 -53
- package/.agent/scripts/auto_preview.js +39 -43
- package/.agent/scripts/bundle_analyzer.js +47 -60
- package/.agent/scripts/case_law_manager.js +200 -294
- package/.agent/scripts/checklist.js +73 -94
- package/.agent/scripts/cicd_validator.js +305 -0
- package/.agent/scripts/compile_router.py +4 -111
- package/.agent/scripts/context_broker.js +317 -412
- package/.agent/scripts/contract_engine.js +402 -0
- package/.agent/scripts/dependency_analyzer.js +112 -124
- package/.agent/scripts/graph_builder.js +75 -103
- package/.agent/scripts/graph_visualizer.js +10 -12
- package/.agent/scripts/graph_zoom.js +38 -55
- package/.agent/scripts/guardrail_engine.js +195 -145
- package/.agent/scripts/impact_classifier.js +55 -30
- package/.agent/scripts/inner_loop_validator.js +108 -159
- package/.agent/scripts/integrity_manifest.js +59 -67
- package/.agent/scripts/lint_runner.js +65 -75
- package/.agent/scripts/marathon_harness.js +131 -208
- package/.agent/scripts/migrate_skills_frontmatter.py +4 -63
- package/.agent/scripts/minify_context.js +29 -33
- package/.agent/scripts/minimal_change_engine.js +95 -87
- package/.agent/scripts/mutation_runner.js +46 -62
- package/.agent/scripts/pipeline_engine.js +320 -209
- package/.agent/scripts/prompt_compiler.js +118 -93
- package/.agent/scripts/schema_validator.js +73 -121
- package/.agent/scripts/security_scan.js +88 -117
- package/.agent/scripts/session_manager.js +52 -69
- package/.agent/scripts/signal_detector.js +24 -22
- package/.agent/scripts/skill_evolution.js +184 -245
- package/.agent/scripts/skill_integrator.js +35 -48
- package/.agent/scripts/socratic_gate_policy.js +15 -12
- package/.agent/scripts/strengthen_skills.js +29 -33
- package/.agent/scripts/swarm_dispatcher.js +120 -151
- package/.agent/scripts/test_runner.js +54 -56
- package/.agent/scripts/token_budget_broker.js +9 -7
- package/.agent/scripts/trace_engine.js +126 -0
- package/.agent/scripts/verify_all.js +76 -93
- package/.agent/scripts/visual_audit.js +16 -21
- package/.agent/skill_topic_map.json +237 -0
- package/.agent/skills/12-principles-of-animation/SKILL.md +7 -0
- package/.agent/skills/60fps-animation/SKILL.md +7 -0
- package/.agent/skills/accessible-animation/SKILL.md +5 -1
- package/.agent/skills/adapt/SKILL.md +7 -1
- package/.agent/skills/advanced-rag-pipelines/SKILL.md +1 -0
- package/.agent/skills/agent-organizer/SKILL.md +1 -0
- package/.agent/skills/agentic-patterns/SKILL.md +33 -25
- package/.agent/skills/agentic-workflows-2026/SKILL.md +80 -0
- package/.agent/skills/ai-app-hardening/SKILL.md +59 -0
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +7 -6
- package/.agent/skills/animation-on-scroll/SKILL.md +24 -15
- package/.agent/skills/animation-systems/SKILL.md +11 -10
- package/.agent/skills/antfu-conventions/SKILL.md +7 -2
- package/.agent/skills/api-patterns/SKILL.md +14 -10
- package/.agent/skills/api-security-auditor/SKILL.md +15 -14
- package/.agent/skills/app-builder/SKILL.md +1 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +2 -2
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +12 -12
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +3 -3
- package/.agent/skills/apple-design/SKILL.md +8 -7
- package/.agent/skills/architecture/SKILL.md +3 -2
- package/.agent/skills/audit-and-fix/SKILL.md +8 -5
- package/.agent/skills/authentication-best-practices/SKILL.md +9 -8
- package/.agent/skills/backend-security-expert/SKILL.md +1 -0
- package/.agent/skills/baseline-ui/SKILL.md +8 -7
- package/.agent/skills/bash-linux/SKILL.md +1 -0
- package/.agent/skills/behavioral-modes/SKILL.md +1 -0
- package/.agent/skills/better-colors/SKILL.md +11 -7
- package/.agent/skills/better-typography/SKILL.md +30 -16
- package/.agent/skills/better-ui/SKILL.md +17 -10
- package/.agent/skills/bolder/SKILL.md +6 -0
- package/.agent/skills/brainstorming/SKILL.md +6 -4
- package/.agent/skills/browser-native-ai/SKILL.md +5 -4
- package/.agent/skills/build-primitive/SKILL.md +5 -0
- package/.agent/skills/building-native-ui/SKILL.md +1 -0
- package/.agent/skills/cicd-pro/SKILL.md +2 -1
- package/.agent/skills/clarify/SKILL.md +19 -14
- package/.agent/skills/clean-code/SKILL.md +16 -15
- package/.agent/skills/cloud-architect/SKILL.md +1 -0
- package/.agent/skills/cobejs/SKILL.md +7 -9
- package/.agent/skills/code-review-checklist/SKILL.md +1 -0
- package/.agent/skills/codebase-design/SKILL.md +7 -2
- package/.agent/skills/colorize/SKILL.md +8 -3
- package/.agent/skills/compact-landing/SKILL.md +8 -3
- package/.agent/skills/company-logos/SKILL.md +6 -0
- package/.agent/skills/config-validator/SKILL.md +10 -9
- package/.agent/skills/containerization-pro/SKILL.md +6 -5
- package/.agent/skills/context-engineering-pro/SKILL.md +70 -0
- package/.agent/skills/create-design-md/SKILL.md +13 -5
- package/.agent/skills/critique/SKILL.md +10 -8
- package/.agent/skills/csharp-developer/SKILL.md +1 -0
- package/.agent/skills/data-validation-schemas/SKILL.md +28 -23
- package/.agent/skills/database-design/SKILL.md +2 -1
- package/.agent/skills/delight/SKILL.md +6 -0
- package/.agent/skills/deployment-procedures/SKILL.md +2 -1
- package/.agent/skills/design-lab/SKILL.md +5 -0
- package/.agent/skills/devops-engineer/SKILL.md +3 -2
- package/.agent/skills/devops-incident-responder/SKILL.md +2 -1
- package/.agent/skills/diagnosing-bugs/SKILL.md +12 -2
- package/.agent/skills/distill/SKILL.md +7 -2
- package/.agent/skills/documentation-templates/SKILL.md +3 -2
- package/.agent/skills/domain-modeling/SKILL.md +12 -4
- package/.agent/skills/duckdb-analytical-sql/SKILL.md +59 -0
- package/.agent/skills/edge-ai-mobile/SKILL.md +50 -0
- package/.agent/skills/edge-computing/SKILL.md +9 -8
- package/.agent/skills/emil-design-eng/SKILL.md +43 -27
- package/.agent/skills/error-resilience/SKILL.md +34 -16
- package/.agent/skills/expo-router-v4/SKILL.md +81 -0
- package/.agent/skills/extract-design-system/SKILL.md +12 -11
- package/.agent/skills/fabel-protocol/SKILL.md +24 -17
- package/.agent/skills/fixing-accessibility/SKILL.md +23 -16
- package/.agent/skills/fixing-metadata/SKILL.md +24 -13
- package/.agent/skills/fixing-motion-performance/SKILL.md +7 -5
- package/.agent/skills/framer-motion-expert/SKILL.md +29 -15
- package/.agent/skills/frontend-design/SKILL.md +21 -13
- package/.agent/skills/frontend-security-expert/SKILL.md +1 -0
- package/.agent/skills/game-design-expert/SKILL.md +1 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +1 -0
- package/.agent/skills/generative-ui-expert/SKILL.md +3 -2
- package/.agent/skills/geo-fundamentals/SKILL.md +2 -1
- package/.agent/skills/git-pro/SKILL.md +10 -9
- package/.agent/skills/github-operations/SKILL.md +2 -1
- package/.agent/skills/gpt-taste/SKILL.md +7 -0
- package/.agent/skills/gsap-core/SKILL.md +26 -22
- package/.agent/skills/gsap-frameworks/SKILL.md +6 -5
- package/.agent/skills/gsap-performance/SKILL.md +4 -3
- package/.agent/skills/gsap-plugins/SKILL.md +34 -33
- package/.agent/skills/gsap-react/SKILL.md +9 -8
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +34 -33
- package/.agent/skills/gsap-timeline/SKILL.md +18 -15
- package/.agent/skills/gsap-utils/SKILL.md +25 -24
- package/.agent/skills/harden/SKILL.md +9 -3
- package/.agent/skills/harness-protocol/SKILL.md +1 -0
- package/.agent/skills/i18n-localization/SKILL.md +10 -9
- package/.agent/skills/impeccable/SKILL.md +5 -0
- package/.agent/skills/improve-codebase-architecture/SKILL.md +10 -5
- package/.agent/skills/improve-ui/SKILL.md +12 -5
- package/.agent/skills/intelligent-routing/SKILL.md +7 -6
- package/.agent/skills/knowledge-graph/SKILL.md +1 -0
- package/.agent/skills/landing-page/SKILL.md +1 -0
- package/.agent/skills/lint-and-validate/SKILL.md +9 -4
- package/.agent/skills/llm-engineering/SKILL.md +55 -54
- package/.agent/skills/local-first/SKILL.md +20 -19
- package/.agent/skills/local-first-architecture/SKILL.md +6 -1
- package/.agent/skills/lottie-animation/SKILL.md +7 -3
- package/.agent/skills/marquee-loop/SKILL.md +1 -0
- package/.agent/skills/masked-reveal/SKILL.md +17 -4
- package/.agent/skills/mcp-builder/SKILL.md +13 -10
- package/.agent/skills/micro-interaction/SKILL.md +20 -5
- package/.agent/skills/mobile-design/SKILL.md +26 -15
- package/.agent/skills/monorepo-management/SKILL.md +3 -2
- package/.agent/skills/morphing-icons/SKILL.md +16 -6
- package/.agent/skills/motion-engineering/SKILL.md +19 -15
- package/.agent/skills/nextjs-react-expert/SKILL.md +26 -21
- package/.agent/skills/nodejs-best-practices/SKILL.md +89 -76
- package/.agent/skills/observability/SKILL.md +45 -44
- package/.agent/skills/opentelemetry-observability/SKILL.md +59 -0
- package/.agent/skills/page-transition-animation/SKILL.md +6 -3
- package/.agent/skills/parallel-agents/SKILL.md +7 -2
- package/.agent/skills/performance-profiling/SKILL.md +24 -13
- package/.agent/skills/plan-writing/SKILL.md +1 -0
- package/.agent/skills/platform-engineer/SKILL.md +3 -2
- package/.agent/skills/platform-engineering-opentofu/SKILL.md +68 -0
- package/.agent/skills/playwright-ai-e2e/SKILL.md +60 -0
- package/.agent/skills/playwright-best-practices/SKILL.md +29 -28
- package/.agent/skills/polish/SKILL.md +13 -12
- package/.agent/skills/powershell-windows/SKILL.md +1 -0
- package/.agent/skills/pricing-page/SKILL.md +8 -3
- package/.agent/skills/product-aware-heuristics/SKILL.md +122 -72
- package/.agent/skills/progressive-blur/SKILL.md +9 -4
- package/.agent/skills/project-idioms/SKILL.md +1 -0
- package/.agent/skills/property-based-testing/SKILL.md +58 -0
- package/.agent/skills/python-patterns/SKILL.md +1 -0
- package/.agent/skills/python-pro/SKILL.md +1 -0
- package/.agent/skills/quieter/SKILL.md +6 -0
- package/.agent/skills/react-doctor/SKILL.md +6 -0
- package/.agent/skills/react-specialist/SKILL.md +32 -28
- package/.agent/skills/readme-builder/SKILL.md +1 -0
- package/.agent/skills/realtime-patterns/SKILL.md +34 -33
- package/.agent/skills/red-team-tactics/SKILL.md +1 -0
- package/.agent/skills/redesign-skill/SKILL.md +6 -0
- package/.agent/skills/review-animations/SKILL.md +5 -2
- package/.agent/skills/review-animations/STANDARDS.md +37 -23
- package/.agent/skills/rust-pro/SKILL.md +1 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +4 -3
- package/.agent/skills/server-management/SKILL.md +1 -0
- package/.agent/skills/shadcn-ui-expert/SKILL.md +28 -22
- package/.agent/skills/shape/SKILL.md +9 -2
- package/.agent/skills/skill-creator/SKILL.md +1 -0
- package/.agent/skills/soft-skill/SKILL.md +6 -0
- package/.agent/skills/sounds-on-the-web/SKILL.md +1 -0
- package/.agent/skills/sql-pro/SKILL.md +1 -0
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +1 -0
- package/.agent/skills/svg-animation/SKILL.md +16 -7
- package/.agent/skills/swiftui-expert/SKILL.md +1 -0
- package/.agent/skills/swiss-design/SKILL.md +5 -0
- package/.agent/skills/system-design-pro/SKILL.md +1 -0
- package/.agent/skills/systematic-debugging/SKILL.md +1 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +25 -11
- package/.agent/skills/taste-skill/SKILL.md +6 -0
- package/.agent/skills/tdd-workflow/SKILL.md +5 -0
- package/.agent/skills/test-result-analyzer/SKILL.md +1 -0
- package/.agent/skills/testing-patterns/SKILL.md +123 -115
- package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +5 -0
- package/.agent/skills/thinking-protocol/SKILL.md +3 -0
- package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +9 -8
- package/.agent/skills/transitions-dev/SKILL.md +19 -6
- package/.agent/skills/trend-researcher/SKILL.md +1 -0
- package/.agent/skills/typescript-advanced/SKILL.md +23 -18
- package/.agent/skills/typeset/SKILL.md +10 -1
- package/.agent/skills/ui-reasoning-engine/SKILL.md +67 -48
- package/.agent/skills/ui-skill-packs/SKILL.md +6 -1
- package/.agent/skills/ui-skills-root/SKILL.md +39 -38
- package/.agent/skills/ui-ux-pro-max/SKILL.md +34 -26
- package/.agent/skills/ui-ux-researcher/SKILL.md +1 -0
- package/.agent/skills/vector-search-pgvector/SKILL.md +78 -0
- package/.agent/skills/vue-expert/SKILL.md +22 -19
- package/.agent/skills/vulnerability-scanner/SKILL.md +22 -21
- package/.agent/skills/web-accessibility-auditor/SKILL.md +2 -1
- package/.agent/skills/web-design-guidelines/SKILL.md +16 -10
- package/.agent/skills/web-quality-audit/SKILL.md +5 -0
- package/.agent/skills/webapp-testing/SKILL.md +14 -13
- package/.agent/skills/webgpu-performance/SKILL.md +1 -0
- package/.agent/skills/whimsy-injector/SKILL.md +9 -5
- package/.agent/skills/workflow-optimizer/SKILL.md +1 -0
- package/.agent/skills/zero-trust-passkeys/SKILL.md +90 -0
- package/.agent/templates/DESIGN.md +119 -110
- package/.agent/templates/design-tokens.json +9 -6
- package/.agent/workflows/acf.md +1 -0
- package/.agent/workflows/api-tester.md +1 -0
- package/.agent/workflows/audit.md +1 -0
- package/.agent/workflows/brainstorm.md +1 -0
- package/.agent/workflows/changelog.md +1 -0
- package/.agent/workflows/contract.md +60 -0
- package/.agent/workflows/create.md +1 -0
- package/.agent/workflows/debug.md +1 -0
- package/.agent/workflows/deploy.md +1 -0
- package/.agent/workflows/enhance.md +1 -0
- package/.agent/workflows/fix-ci.md +89 -0
- package/.agent/workflows/fix.md +1 -0
- package/.agent/workflows/generate.md +1 -0
- package/.agent/workflows/marathon.md +1 -0
- package/.agent/workflows/migrate.md +1 -0
- package/.agent/workflows/minimal.md +9 -7
- package/.agent/workflows/orchestrate.md +1 -0
- package/.agent/workflows/performance-benchmarker.md +1 -0
- package/.agent/workflows/pipeline.md +26 -21
- package/.agent/workflows/plan.md +1 -0
- package/.agent/workflows/preview.md +1 -0
- package/.agent/workflows/refactor.md +3 -2
- package/.agent/workflows/review-ai.md +4 -3
- package/.agent/workflows/review.md +1 -0
- package/.agent/workflows/session.md +1 -0
- package/.agent/workflows/status.md +1 -0
- package/.agent/workflows/strengthen-skills.md +1 -0
- package/.agent/workflows/super-prompt.md +1 -0
- package/.agent/workflows/swarm.md +15 -3
- package/.agent/workflows/test.md +8 -7
- package/.agent/workflows/tribunal-backend.md +3 -2
- package/.agent/workflows/tribunal-cicd.md +104 -0
- package/.agent/workflows/tribunal-database.md +1 -0
- package/.agent/workflows/tribunal-frontend.md +8 -6
- package/.agent/workflows/tribunal-full.md +15 -14
- package/.agent/workflows/tribunal-mobile.md +6 -5
- package/.agent/workflows/tribunal-performance.md +1 -0
- package/.agent/workflows/tribunal-speed.md +1 -0
- package/.agent/workflows/tribunal-ui.md +29 -21
- package/.agent/workflows/ui-ux-pro-max.md +19 -15
- package/CONTRIBUTING.md +3 -3
- package/README.md +160 -88
- package/SECURITY.md +11 -11
- package/bin/mcp-server.js +512 -233
- package/bin/tribunal-kit.js +29 -30
- package/bin/wrapper.js +45 -48
- package/dist/cli.js +26 -0
- package/dist/commands/case.js +2 -0
- package/dist/commands/contract.js +440 -0
- package/dist/commands/memory.js +3 -2
- package/dist/commands/native.js +36 -0
- package/dist/commands/status.js +6 -0
- package/dist/esm/index.mjs +32 -0
- package/dist/index.d.ts +58 -3
- package/package.json +20 -16
- package/scripts/benchmark.js +62 -86
- package/scripts/changelog.js +67 -73
- package/scripts/fix-vbc.js +13 -15
- package/scripts/fix-vbc.ps1 +2 -118
- package/scripts/stress_benchmark.js +358 -0
- package/scripts/sync-version.js +71 -41
- package/scripts/validate-payload.js +23 -30
- package/scripts/visual_audit.js +23 -13
|
@@ -21,6 +21,7 @@ You are the master designer of APIs. You do not merely write controllers; you de
|
|
|
21
21
|
## Mandatory Pre-Flight Context Inspection
|
|
22
22
|
|
|
23
23
|
Before designing API contracts, you MUST inspect:
|
|
24
|
+
|
|
24
25
|
1. `openapi.json` / `routes/` / `api/` → Review existing API endpoints, path versioning standards (`/v1/`), and route naming conventions
|
|
25
26
|
2. `package.json` → Check web framework (Hono, Express, Fastify, Next.js Route Handlers) and schema validation engine (Zod, Pydantic)
|
|
26
27
|
3. Client consumption contracts → Confirm response envelope formats (`data`, `meta`, `error`) across active frontend components
|
|
@@ -22,6 +22,7 @@ last-updated: 2026-07-29
|
|
|
22
22
|
## Mandatory Pre-Flight Context Inspection
|
|
23
23
|
|
|
24
24
|
Before generating API routes, server actions, or middleware, you MUST inspect:
|
|
25
|
+
|
|
25
26
|
1. `package.json` → Check Node.js framework (Express, Fastify, Hono, Next.js Server Actions), validation library (Zod, Valibot), and ORM (Prisma v6, Drizzle, Kysely)
|
|
26
27
|
2. `env.mjs` / `.env.example` → Verify required environment variable schemas and secret keys
|
|
27
28
|
3. Auth configuration (`lib/auth.ts`, `middleware.ts`) → Inspect active session management, JWT algorithms, and RBAC roles
|
|
@@ -48,16 +49,16 @@ Every route handler starts with schema validation. Never trust incoming data.
|
|
|
48
49
|
|
|
49
50
|
```typescript
|
|
50
51
|
// ✅ APPROVED: Zod validates at the boundary before any business logic
|
|
51
|
-
import { z } from
|
|
52
|
+
import { z } from 'zod';
|
|
52
53
|
|
|
53
54
|
const CreateUserSchema = z.object({
|
|
54
55
|
email: z.string().email(),
|
|
55
56
|
name: z.string().min(2).max(100),
|
|
56
|
-
role: z.enum([
|
|
57
|
+
role: z.enum(['user', 'admin']).default('user'),
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
// Hono route with validation
|
|
60
|
-
app.post(
|
|
61
|
+
app.post('/users', async c => {
|
|
61
62
|
const raw = await c.req.json();
|
|
62
63
|
const result = CreateUserSchema.safeParse(raw);
|
|
63
64
|
|
|
@@ -88,11 +89,11 @@ async function updateProfile(req: Request) {
|
|
|
88
89
|
async function updateProfile(req: Request) {
|
|
89
90
|
// 1. Authentication — verify identity
|
|
90
91
|
const session = await auth.verifySession(req);
|
|
91
|
-
if (!session) return Response.json({ error:
|
|
92
|
+
if (!session) return Response.json({ error: 'Unauthorized' }, { status: 401 });
|
|
92
93
|
|
|
93
94
|
// 2. Authorization — verify permission
|
|
94
|
-
if (session.userId !== req.params.id && session.role !==
|
|
95
|
-
return Response.json({ error:
|
|
95
|
+
if (session.userId !== req.params.id && session.role !== 'admin') {
|
|
96
|
+
return Response.json({ error: 'Forbidden' }, { status: 403 });
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
// 3. Input validation
|
|
@@ -111,29 +112,29 @@ async function updateProfile(req: Request) {
|
|
|
111
112
|
|
|
112
113
|
```typescript
|
|
113
114
|
// ❌ BAD: Leaks internal details, no type contract
|
|
114
|
-
app.get(
|
|
115
|
+
app.get('/users/:id', async (req, res) => {
|
|
115
116
|
const user = await db.query(`SELECT * FROM users WHERE id = ${req.params.id}`);
|
|
116
117
|
res.json(user.rows[0]); // Could throw and send HTML error page with stack trace
|
|
117
118
|
});
|
|
118
119
|
|
|
119
120
|
// ✅ APPROVED: Typed error response, no information leak
|
|
120
|
-
app.get(
|
|
121
|
+
app.get('/users/:id', async (req, res) => {
|
|
121
122
|
try {
|
|
122
123
|
const id = IdSchema.parse(req.params.id);
|
|
123
124
|
const user = await db.users.findUnique({ where: { id } });
|
|
124
125
|
|
|
125
126
|
if (!user) {
|
|
126
|
-
return res.status(404).json({ error:
|
|
127
|
+
return res.status(404).json({ error: 'User not found', code: 'NOT_FOUND' });
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
return res.json(user);
|
|
130
131
|
} catch (error) {
|
|
131
132
|
if (error instanceof z.ZodError) {
|
|
132
|
-
return res.status(400).json({ error:
|
|
133
|
+
return res.status(400).json({ error: 'Invalid ID format', code: 'VALIDATION_ERROR' });
|
|
133
134
|
}
|
|
134
135
|
// Log internally, never expose internal details
|
|
135
|
-
logger.error({ error, userId: req.params.id },
|
|
136
|
-
return res.status(500).json({ error:
|
|
136
|
+
logger.error({ error, userId: req.params.id }, 'Failed to fetch user');
|
|
137
|
+
return res.status(500).json({ error: 'Internal server error', code: 'INTERNAL_ERROR' });
|
|
137
138
|
}
|
|
138
139
|
});
|
|
139
140
|
```
|
|
@@ -176,7 +177,7 @@ return res.json({
|
|
|
176
177
|
const user = await db.query(`SELECT * FROM users WHERE email = '${email}'`);
|
|
177
178
|
|
|
178
179
|
// ❌ Hardcoded secret
|
|
179
|
-
const JWT_SECRET =
|
|
180
|
+
const JWT_SECRET = 'mysecretkey123';
|
|
180
181
|
|
|
181
182
|
// ❌ Algorithm bypass-risk
|
|
182
183
|
jwt.verify(token, secret); // Missing: { algorithms: ['HS256'] }
|
|
@@ -187,17 +188,17 @@ await db.users.update({ where: { id }, data: req.body }); // User could set role
|
|
|
187
188
|
|
|
188
189
|
```typescript
|
|
189
190
|
// ✅ Parameterized query
|
|
190
|
-
const user = await db.execute(
|
|
191
|
+
const user = await db.execute('SELECT * FROM users WHERE email = $1', [email]);
|
|
191
192
|
|
|
192
193
|
// ✅ Environment variable
|
|
193
194
|
const JWT_SECRET =
|
|
194
195
|
process.env.JWT_SECRET ??
|
|
195
196
|
(() => {
|
|
196
|
-
throw new Error(
|
|
197
|
+
throw new Error('JWT_SECRET not set');
|
|
197
198
|
})();
|
|
198
199
|
|
|
199
200
|
// ✅ Algorithm enforced
|
|
200
|
-
jwt.verify(token, secret, { algorithms: [
|
|
201
|
+
jwt.verify(token, secret, { algorithms: ['HS256'] });
|
|
201
202
|
|
|
202
203
|
// ✅ Explicit field allowlist
|
|
203
204
|
const { name, bio } = UpdateProfileSchema.parse(req.body); // Only allowed fields
|
|
@@ -209,21 +210,21 @@ await db.users.update({ where: { id }, data: { name, bio } });
|
|
|
209
210
|
## 7. Rate Limiting — Required on All Public Endpoints
|
|
210
211
|
|
|
211
212
|
```typescript
|
|
212
|
-
import { Ratelimit } from
|
|
213
|
-
import { Redis } from
|
|
213
|
+
import { Ratelimit } from '@upstash/ratelimit';
|
|
214
|
+
import { Redis } from '@upstash/redis';
|
|
214
215
|
|
|
215
216
|
const ratelimit = new Ratelimit({
|
|
216
217
|
redis: Redis.fromEnv(),
|
|
217
|
-
limiter: Ratelimit.slidingWindow(10,
|
|
218
|
+
limiter: Ratelimit.slidingWindow(10, '10 s'), // 10 requests per 10 seconds
|
|
218
219
|
});
|
|
219
220
|
|
|
220
221
|
// Apply to every public auth endpoint at minimum
|
|
221
|
-
app.post(
|
|
222
|
-
const identifier = c.req.header(
|
|
222
|
+
app.post('/auth/login', async c => {
|
|
223
|
+
const identifier = c.req.header('CF-Connecting-IP') ?? 'anonymous';
|
|
223
224
|
const { success, remaining } = await ratelimit.limit(identifier);
|
|
224
225
|
|
|
225
226
|
if (!success) {
|
|
226
|
-
return c.json({ error:
|
|
227
|
+
return c.json({ error: 'Too many requests' }, 429);
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
// ... rest of login logic
|
|
@@ -17,6 +17,7 @@ last-updated: 2026-07-29
|
|
|
17
17
|
## Mandatory Pre-Flight Context Inspection
|
|
18
18
|
|
|
19
19
|
Before generating IaC, Dockerfiles, or CI/CD pipelines, you MUST inspect:
|
|
20
|
+
|
|
20
21
|
1. `Dockerfile` / `.dockerignore` / `.github/workflows/` / `terraform/` → Inspect existing infra declarations
|
|
21
22
|
2. `package.json` / `requirements.txt` / `Cargo.toml` → Determine runtime language, version, and build steps
|
|
22
23
|
3. Secrets & AWS IAM configuration → Verify OIDC auth setup for GitHub Actions and S3 state backend configuration
|
|
@@ -17,6 +17,7 @@ last-updated: 2026-07-29
|
|
|
17
17
|
## Mandatory Pre-Flight Context Inspection
|
|
18
18
|
|
|
19
19
|
Before auditing legacy codebases, you MUST inspect:
|
|
20
|
+
|
|
20
21
|
1. `package.json` / `requirements.txt` → Read project dependencies, deprecated library usages, and version ages
|
|
21
22
|
2. Entry point files (`server.ts`, `index.js`, `app/`) → Locate active listeners, API routers, and scheduled jobs
|
|
22
23
|
3. Test suite directory (`tests/`, `__tests__/`, `spec/`) → Check baseline test coverage before recommending refactors
|
|
@@ -21,6 +21,7 @@ You have one job: enforce the **Dependency Ladder** and prevent over-engineering
|
|
|
21
21
|
## Mandatory Pre-Flight Context Inspection
|
|
22
22
|
|
|
23
23
|
Before auditing complexity, you MUST inspect:
|
|
24
|
+
|
|
24
25
|
1. `package.json` / `requirements.txt` → Verify existing dependencies before permitting new package imports
|
|
25
26
|
2. Project directory structure → Check if similar utility functions or abstractions already exist in the codebase
|
|
26
27
|
3. Native platform features → Determine if browser/Node/Python native standard library APIs can solve the task without extra code
|
|
@@ -44,13 +45,13 @@ Before code is accepted, you must verify that the implementation sits at the low
|
|
|
44
45
|
|
|
45
46
|
## Section 1: Common Over-Engineering Patterns to Reject
|
|
46
47
|
|
|
47
|
-
| Anti-Pattern
|
|
48
|
-
|
|
|
49
|
-
| Importing `lodash` or similar utility library
|
|
50
|
-
| Custom React/Vue slider/carousel component
|
|
51
|
-
| Hand-rolling custom cryptographic / hashing utils | Prone to security vulnerabilities and bugs
|
|
52
|
-
| Elaborate helper/wrapper layers for simple APIs
|
|
53
|
-
| Adding new NPM packages for simple tasks
|
|
48
|
+
| Anti-Pattern | Why It's Rejected | Real Alternative (Lower Rung) |
|
|
49
|
+
| :------------------------------------------------ | :------------------------------------------------ | :--------------------------------------------------------- |
|
|
50
|
+
| Importing `lodash` or similar utility library | Standard library handles most collections/strings | Use native `Array.prototype` methods or modern JS features |
|
|
51
|
+
| Custom React/Vue slider/carousel component | Heavy, complex, prone to accessibility bugs | Native CSS Scroll Snap or standard platform elements |
|
|
52
|
+
| Hand-rolling custom cryptographic / hashing utils | Prone to security vulnerabilities and bugs | Use standard Node.js `crypto` or Web Crypto API |
|
|
53
|
+
| Elaborate helper/wrapper layers for simple APIs | Wastes context, adds cognitive overhead | Direct API consumption (Keep It Simple) |
|
|
54
|
+
| Adding new NPM packages for simple tasks | Bloats bundle, introduces supply-chain risk | Write a simple pure function locally |
|
|
54
55
|
|
|
55
56
|
---
|
|
56
57
|
|
|
@@ -59,9 +60,11 @@ Before code is accepted, you must verify that the implementation sits at the low
|
|
|
59
60
|
Your review should output one of two verdicts:
|
|
60
61
|
|
|
61
62
|
### 1. `✅ APPROVED`
|
|
63
|
+
|
|
62
64
|
The code is simple, uses native platform capabilities, does not introduce unnecessary dependencies, and follows the Dependency Ladder.
|
|
63
65
|
|
|
64
66
|
### 2. `❌ REJECTED`
|
|
67
|
+
|
|
65
68
|
The code is over-engineered, introduces a redundant dependency, or implements custom logic where a standard library/platform API exists. Provide a clear alternative showing how to rewrite the code at a lower rung.
|
|
66
69
|
|
|
67
70
|
---
|
|
@@ -19,6 +19,7 @@ last-updated: 2026-07-29
|
|
|
19
19
|
## Mandatory Pre-Flight Context Inspection
|
|
20
20
|
|
|
21
21
|
Before generating schemas, migrations, or database queries, you MUST inspect:
|
|
22
|
+
|
|
22
23
|
1. `schema.prisma` / `drizzle.schema.ts` / `migrations/` → Read existing database models and active migration history
|
|
23
24
|
2. `package.json` / `requirements.txt` → Check ORM version (Prisma v6 vs v5, Drizzle, SQLAlchemy) and database engine (PostgreSQL, SQLite, MySQL)
|
|
24
25
|
3. Foreign key constraints & Indexes → Check existing composite indices and foreign key constraints to prevent duplicate or missing index definitions
|
|
@@ -146,7 +147,7 @@ const user = await prisma.user.create({ data: userData });
|
|
|
146
147
|
const account = await prisma.account.create({ data: { userId: user.id } });
|
|
147
148
|
|
|
148
149
|
// ✅ ATOMIC: Both succeed or both rollback
|
|
149
|
-
const result = await prisma.$transaction(async
|
|
150
|
+
const result = await prisma.$transaction(async tx => {
|
|
150
151
|
const user = await tx.user.create({ data: userData });
|
|
151
152
|
const account = await tx.account.create({ data: { userId: user.id } });
|
|
152
153
|
return { user, account };
|
|
@@ -167,7 +168,7 @@ const users = await prisma.user.findMany({
|
|
|
167
168
|
include: {
|
|
168
169
|
posts: {
|
|
169
170
|
where: { published: true },
|
|
170
|
-
orderBy: { createdAt:
|
|
171
|
+
orderBy: { createdAt: 'desc' },
|
|
171
172
|
take: 5,
|
|
172
173
|
},
|
|
173
174
|
},
|
|
@@ -21,6 +21,7 @@ You audit **database layer files only** — `.sql`, `schema.prisma`, and source
|
|
|
21
21
|
## Mandatory Pre-Flight Context Inspection
|
|
22
22
|
|
|
23
23
|
Before auditing database latency, you MUST inspect:
|
|
24
|
+
|
|
24
25
|
1. `schema.prisma` / `drizzle.schema.ts` → Read existing model indexes, foreign key declarations, and connection pool string settings
|
|
25
26
|
2. `package.json` → Check ORM driver type (pg, postgres-js, sqlite3, @libsql/client) and pool configuration settings
|
|
26
27
|
3. Direct DB call loops → Scan for `.findMany()`, `select()`, or `.query()` executed inside loops or resolvers
|
|
@@ -70,7 +71,10 @@ for (const user of users) {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
// ✅ APPROVED: Drizzle with join
|
|
73
|
-
const result = await db
|
|
74
|
+
const result = await db
|
|
75
|
+
.select()
|
|
76
|
+
.from(usersTable)
|
|
77
|
+
.leftJoin(ordersTable, eq(usersTable.id, ordersTable.userId));
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
---
|
|
@@ -177,7 +181,7 @@ if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
|
177
181
|
|
|
178
182
|
```typescript
|
|
179
183
|
// ❌ OVER-SCOPED TRANSACTION: Lock held during external API call
|
|
180
|
-
await prisma.$transaction(async
|
|
184
|
+
await prisma.$transaction(async tx => {
|
|
181
185
|
const order = await tx.order.create({ data: orderData });
|
|
182
186
|
const payment = await stripe.charges.create({ amount: order.total }); // 2-5 sec external call!
|
|
183
187
|
await tx.order.update({ where: { id: order.id }, data: { paymentId: payment.id } });
|
|
@@ -16,6 +16,7 @@ last-updated: 2026-07-29
|
|
|
16
16
|
## Mandatory Pre-Flight Context Inspection
|
|
17
17
|
|
|
18
18
|
Before beginning a debugging session, you MUST inspect:
|
|
19
|
+
|
|
19
20
|
1. Exact error logs / stack trace output → Read full un-truncated error traceback and exception frames
|
|
20
21
|
2. Git status / recent commits (`git log -n 5`) → Identify recent changes, file edits, or dependency updates
|
|
21
22
|
3. Runtime environment configs (`package.json`, `.env.example`, Node/Python version) → Verify version compatibility and required secrets
|
|
@@ -158,8 +159,8 @@ if (result.name) {
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
// Error swallowed — exception disappears
|
|
161
|
-
fetch(
|
|
162
|
-
.then(
|
|
162
|
+
fetch('/api')
|
|
163
|
+
.then(r => r.json())
|
|
163
164
|
.catch(() => {}); // Error silently discarded
|
|
164
165
|
|
|
165
166
|
// Promise in useEffect without cleanup
|
|
@@ -18,6 +18,7 @@ You are the last line of defense against fabricated dependencies. An AI model wi
|
|
|
18
18
|
## Mandatory Pre-Flight Context Inspection
|
|
19
19
|
|
|
20
20
|
Before auditing package imports, you MUST inspect:
|
|
21
|
+
|
|
21
22
|
1. `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) or `requirements.txt` / `pyproject.toml`
|
|
22
23
|
2. `node_modules` structure or import maps (if present)
|
|
23
24
|
3. Framework sub-package export maps (e.g. Next.js 15 subpath exports `@tanstack/react-query`, `lucide-react`, `framer-motion`)
|
|
@@ -21,6 +21,7 @@ last-updated: 2026-07-29
|
|
|
21
21
|
## Mandatory Pre-Flight Context Inspection
|
|
22
22
|
|
|
23
23
|
Before generating DevOps pipelines or infrastructure manifests, you MUST inspect:
|
|
24
|
+
|
|
24
25
|
1. `Dockerfile` / `.github/workflows/` / `k8s/` → Review existing CI/CD automation and container configurations
|
|
25
26
|
2. `package.json` / runtime dependency lockfiles → Inspect Node/Python version, build commands, and script targets
|
|
26
27
|
3. Production deployment targets → Verify GitOps setup (ArgoCD vs GitHub Actions vs Terraform) and cluster readiness probes
|
|
@@ -100,8 +101,8 @@ jobs:
|
|
|
100
101
|
- name: Setup Node
|
|
101
102
|
uses: actions/setup-node@v4
|
|
102
103
|
with:
|
|
103
|
-
node-version:
|
|
104
|
-
cache:
|
|
104
|
+
node-version: '22'
|
|
105
|
+
cache: 'npm'
|
|
105
106
|
|
|
106
107
|
- run: npm ci
|
|
107
108
|
- run: npm run type-check # tsc --noEmit
|
|
@@ -141,11 +142,11 @@ metadata:
|
|
|
141
142
|
spec:
|
|
142
143
|
project: default
|
|
143
144
|
source:
|
|
144
|
-
repoURL:
|
|
145
|
+
repoURL: 'https://github.com/mycorp/k8s-manifests'
|
|
145
146
|
path: apps/api-service
|
|
146
147
|
targetRevision: HEAD
|
|
147
148
|
destination:
|
|
148
|
-
server:
|
|
149
|
+
server: 'https://kubernetes.default.svc'
|
|
149
150
|
namespace: production
|
|
150
151
|
syncPolicy:
|
|
151
152
|
automated:
|
|
@@ -189,11 +190,11 @@ spec:
|
|
|
189
190
|
# Resource limits — ALWAYS set in production
|
|
190
191
|
resources:
|
|
191
192
|
requests:
|
|
192
|
-
memory:
|
|
193
|
-
cpu:
|
|
193
|
+
memory: '128Mi'
|
|
194
|
+
cpu: '100m'
|
|
194
195
|
limits:
|
|
195
|
-
memory:
|
|
196
|
-
cpu:
|
|
196
|
+
memory: '512Mi'
|
|
197
|
+
cpu: '500m'
|
|
197
198
|
```
|
|
198
199
|
|
|
199
200
|
---
|
|
@@ -18,6 +18,7 @@ last-updated: 2026-07-29
|
|
|
18
18
|
## Mandatory Pre-Flight Context Inspection
|
|
19
19
|
|
|
20
20
|
Before generating documentation or ADRs, you MUST inspect:
|
|
21
|
+
|
|
21
22
|
1. `package.json` / `README.md` / `openapi.json` → Read current project name, scripts, environment variables, and existing API specs
|
|
22
23
|
2. `ARCHITECTURE.md` / `docs/` → Review existing system design, past ADR decisions, and folder layout
|
|
23
24
|
3. Exported functions & modules → Verify function signatures and parameter types before drafting JSDoc blocks
|
|
@@ -202,17 +203,17 @@ paths:
|
|
|
202
203
|
description: CUID2 user identifier
|
|
203
204
|
schema:
|
|
204
205
|
type: string
|
|
205
|
-
pattern:
|
|
206
|
+
pattern: '^[a-z0-9]{24,}$'
|
|
206
207
|
responses:
|
|
207
|
-
|
|
208
|
+
'200':
|
|
208
209
|
description: User found
|
|
209
210
|
content:
|
|
210
211
|
application/json:
|
|
211
212
|
schema:
|
|
212
|
-
$ref:
|
|
213
|
-
|
|
213
|
+
$ref: '#/components/schemas/User'
|
|
214
|
+
'404':
|
|
214
215
|
description: User not found or deleted
|
|
215
|
-
|
|
216
|
+
'401':
|
|
216
217
|
description: Not authenticated
|
|
217
218
|
```
|
|
218
219
|
|
|
@@ -18,6 +18,7 @@ last-updated: 2026-07-29
|
|
|
18
18
|
## Mandatory Pre-Flight Context Inspection
|
|
19
19
|
|
|
20
20
|
Before generating orientation reports or mapping unknown codebases, you MUST inspect:
|
|
21
|
+
|
|
21
22
|
1. `package.json` / `requirements.txt` / `Cargo.toml` → Read root project dependencies, frameworks, and scripts
|
|
22
23
|
2. Root entry points (`app/layout.tsx`, `src/index.ts`, `server.ts`) → Locate main server listeners and router mounts
|
|
23
24
|
3. System configuration files (`tsconfig.json`, `tailwind.config.ts`, `.env.example`) → Check strictness and env variable bindings
|
|
@@ -21,6 +21,7 @@ React 19 and Next.js 15 App Router introduce new error categories that didn't ex
|
|
|
21
21
|
## Mandatory Pre-Flight Context Inspection
|
|
22
22
|
|
|
23
23
|
Before auditing React/Next.js code, you MUST inspect:
|
|
24
|
+
|
|
24
25
|
1. `package.json` → Confirm React version (React 19 vs 18) and Next.js version (Next.js 15 vs 14)
|
|
25
26
|
2. Target component file directives → Check for `"use client"` or `"use server"` declarations
|
|
26
27
|
3. Import statements → Verify hooks, components, and server actions align with boundaries
|
|
@@ -34,12 +35,13 @@ The official React 19 hook list — anything else from `'react'` is hallucinated
|
|
|
34
35
|
**Valid hooks:** `useState`, `useEffect`, `useContext`, `useReducer`, `useCallback`, `useMemo`, `useRef`, `useId`, `useTransition`, `useDeferredValue`, `useImperativeHandle`, `useLayoutEffect`, `useDebugValue`, `useOptimistic`, `useFormStatus`, `useActionState`
|
|
35
36
|
|
|
36
37
|
**Removed/renamed in React 19:**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
|
|
39
|
+
| Old | New | Notes |
|
|
40
|
+
| :---------------------------------- | :---------------------------------- | :----------------------------- |
|
|
41
|
+
| `useFormState()` | `useActionState()` | Renamed, different signature |
|
|
42
|
+
| `React.createServerContext()` | Removed | Use standard `createContext()` |
|
|
43
|
+
| `ReactDOM.render()` | `ReactDOM.createRoot().render()` | Removed in React 19 |
|
|
44
|
+
| `React.FC` with `children` implicit | Explicit `children: ReactNode` prop | Breaking change |
|
|
43
45
|
|
|
44
46
|
---
|
|
45
47
|
|
|
@@ -54,29 +56,29 @@ export default async function Page() {
|
|
|
54
56
|
|
|
55
57
|
// ❌ REJECTED: onClick in a Server Component
|
|
56
58
|
export default async function Page() {
|
|
57
|
-
return <button onClick={() => alert(
|
|
59
|
+
return <button onClick={() => alert('hi')}>Click</button>; // Serialization error
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
// ❌ REJECTED: Importing a client-only library in RSC
|
|
61
|
-
import { motion } from
|
|
63
|
+
import { motion } from 'framer-motion'; // framer-motion uses hooks internally
|
|
62
64
|
export default async function Page() {
|
|
63
65
|
/* ... */
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
// ✅ APPROVED: Boundary correctly split
|
|
67
69
|
// app/page.tsx (Server Component)
|
|
68
|
-
import { Counter } from
|
|
70
|
+
import { Counter } from './Counter'; // Client Component
|
|
69
71
|
export default async function Page() {
|
|
70
72
|
const data = await fetchData();
|
|
71
73
|
return <Counter initialCount={data.count} />;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
// app/Counter.tsx (Client Component — has 'use client' directive)
|
|
75
|
-
(
|
|
76
|
-
import { useState } from
|
|
77
|
+
('use client');
|
|
78
|
+
import { useState } from 'react';
|
|
77
79
|
export function Counter({ initialCount }: { initialCount: number }) {
|
|
78
80
|
const [count, setCount] = useState(initialCount);
|
|
79
|
-
return <button onClick={() => setCount(
|
|
81
|
+
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
|
|
80
82
|
}
|
|
81
83
|
```
|
|
82
84
|
|
|
@@ -94,7 +96,7 @@ function UserCard({ isAdmin }: { isAdmin: boolean }) {
|
|
|
94
96
|
|
|
95
97
|
// ❌ REJECTED: Hook inside loop
|
|
96
98
|
function List({ items }: { items: string[] }) {
|
|
97
|
-
return items.map(
|
|
99
|
+
return items.map(item => {
|
|
98
100
|
const [selected, setSelected] = useState(false); // Order changes with items — crash
|
|
99
101
|
return <div>{item}</div>;
|
|
100
102
|
});
|
|
@@ -118,16 +120,16 @@ useEffect(() => {
|
|
|
118
120
|
```tsx
|
|
119
121
|
// ❌ REJECTED: Direct mutation — React cannot detect this change
|
|
120
122
|
const [items, setItems] = useState<string[]>([]);
|
|
121
|
-
items.push(
|
|
123
|
+
items.push('new item'); // Mutates existing reference — UI won't update
|
|
122
124
|
setItems(items); // Same reference = React skips re-render
|
|
123
125
|
|
|
124
126
|
// ❌ REJECTED: Object mutation
|
|
125
|
-
user.name =
|
|
127
|
+
user.name = 'New Name'; // Mutates object-in-state
|
|
126
128
|
setUser(user); // Same reference — skipped
|
|
127
129
|
|
|
128
130
|
// ✅ APPROVED: New reference created
|
|
129
|
-
setItems(
|
|
130
|
-
setUser(
|
|
131
|
+
setItems(prev => [...prev, 'new item']);
|
|
132
|
+
setUser(prev => ({ ...prev, name: 'New Name' }));
|
|
131
133
|
```
|
|
132
134
|
|
|
133
135
|
---
|
|
@@ -174,11 +176,13 @@ const { id } = await params;
|
|
|
174
176
|
## Section 7: Fabel Design Standards
|
|
175
177
|
|
|
176
178
|
### Platform-Aware Rendering Checks
|
|
179
|
+
|
|
177
180
|
- Verify if the component differentiates between desktop and mobile targets where applicable.
|
|
178
181
|
- In components or SVGs, ensure viewport, viewBox, and touch target sizes are adjusted properly (e.g., minimum 44x44px touch targets on mobile).
|
|
179
182
|
- Look for responsive utility classes or hooks (`useMediaQuery`, Tailwind `sm:`, `md:`, etc.) to verify adaptation logic.
|
|
180
183
|
|
|
181
184
|
### Visual Content Safety
|
|
185
|
+
|
|
182
186
|
- Flag any code, assets, SVGs, or mocks containing references to copyrighted characters, brands, logos, or real people's likenesses.
|
|
183
187
|
- Ensure only generic symbols, standard library icons (e.g., Lucide React), or explicitly clean SVGs are used.
|
|
184
188
|
|
|
@@ -25,6 +25,7 @@ You build production-grade, highly accessible, and visually distinct interfaces
|
|
|
25
25
|
## Mandatory Pre-Flight Context Inspection
|
|
26
26
|
|
|
27
27
|
Before generating any frontend component or UI code, you MUST inspect:
|
|
28
|
+
|
|
28
29
|
1. `package.json` → Check React version (React 19 vs 18), Next.js version (Next.js 15 App Router vs Pages Router), styling libraries (Tailwind v4 vs v3, CSS Modules, Radix/shadcn)
|
|
29
30
|
2. `DESIGN.md` / `theme.css` / `index.css` → Read active design tokens, OKLCH color palettes, radii, and typography scales
|
|
30
31
|
3. Existing component tree (`components/`, `app/`) → Check existing layout primitives to prevent duplicated button/card/input abstractions
|
|
@@ -65,6 +66,7 @@ export function ProfileForm() {
|
|
|
65
66
|
## 1. The Pre-Code Design Reasoning Loop
|
|
66
67
|
|
|
67
68
|
Before generating any React component or styling:
|
|
69
|
+
|
|
68
70
|
1. **Analyze Intent & Category:** What is the product type? (SaaS, DevTool, AI Interface, Landing, Fintech).
|
|
69
71
|
2. **Select Visual Direction:** Choose a target visual direction from `DESIGN.md` (e.g., Swiss Precision, Brutalist, Dark Luxury).
|
|
70
72
|
3. **Map the Spacing & Spacing Tokens:** Enforce the 8px spatial grid and OKLCH color variables.
|
|
@@ -77,37 +79,38 @@ Output the **🧠 UI Reasoning Engine Trace** in your response as a collapsed ma
|
|
|
77
79
|
|
|
78
80
|
## 2. Forbidden AI Aesthetics (Anti-Slop Rules)
|
|
79
81
|
|
|
80
|
-
| Forbidden
|
|
81
|
-
|
|
|
82
|
-
| Purple/violet as primary accent | Overused AI template cliché
|
|
83
|
-
| Left text / right image hero
|
|
84
|
-
| Mesh gradient backgrounds
|
|
85
|
-
| Bento grids everywhere
|
|
86
|
-
| Raw hex color codes
|
|
87
|
-
| Cards inside cards
|
|
82
|
+
| Forbidden | Why | Mandatory Alternative |
|
|
83
|
+
| :------------------------------ | :---------------------------- | :-------------------------------------------------- |
|
|
84
|
+
| Purple/violet as primary accent | Overused AI template cliché | Electric blue, signal orange, amber, warm coral. |
|
|
85
|
+
| Left text / right image hero | Uninspired stock layout | Typographic-only hierarchy, layered depth. |
|
|
86
|
+
| Mesh gradient backgrounds | Cheap blurred effect | Solid contrast, noise grain overlays, radial depth. |
|
|
87
|
+
| Bento grids everywhere | Monotonous grid structures | Asymmetric layout, broke-grid elements. |
|
|
88
|
+
| Raw hex color codes | Outdated color representation | OKLCH variables (`oklch(L C H)`). |
|
|
89
|
+
| Cards inside cards | Muddy container hierarchy | Layered ambient shadows, 1px luminous borders. |
|
|
88
90
|
|
|
89
91
|
---
|
|
90
92
|
|
|
91
93
|
## 3. Product-Specific Styling & Layout Rules
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
- **SaaS/Dashboards:** Maximize scannability. Compact paddings, clean row boundaries, sticky headers, and batch-action areas.
|
|
96
|
+
- **Developer Tools:** High data density. Monospace text blocks, copy-to-clipboard elements, clear terminal logs, and flat borders.
|
|
97
|
+
- **AI Interfaces:** Streaming status boxes, input prompts with suggestions, and scroll-locked history.
|
|
98
|
+
- **Marketing/Landing:** Editorial typography scale, fluid clamp font sizing, and controlled scroll animations.
|
|
99
|
+
- **Fintech:** Perfect column alignment using tabular numbers (`font-variant-numeric: tabular-nums`).
|
|
98
100
|
|
|
99
101
|
---
|
|
100
102
|
|
|
101
103
|
## 4. State & Interaction Specifications
|
|
102
104
|
|
|
103
105
|
Every clickable control must explicitly declare styling for all states:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
|
|
107
|
+
- **Default:** The base state.
|
|
108
|
+
- **Hover:** Visual indicator of clickability (micro scale lift or color shift).
|
|
109
|
+
- **Active/Pressed:** Elastic scale down (`active:scale-[0.97]`) to confirm click.
|
|
110
|
+
- **Disabled:** High-contrast opacity drop and disabled mouse cursor.
|
|
111
|
+
- **Focus-visible:** Clear visible ring outline (`outline: 2px solid var(--color-primary)` with outline offset).
|
|
112
|
+
- **Loading:** Skeleton loaders displaying the element shape instead of generic spinners.
|
|
113
|
+
- **Empty:** Clean, styled illustrations or placeholder text instead of empty space.
|
|
111
114
|
|
|
112
115
|
---
|
|
113
116
|
|
|
@@ -17,6 +17,7 @@ last-updated: 2026-07-29
|
|
|
17
17
|
## Mandatory Pre-Flight Context Inspection
|
|
18
18
|
|
|
19
19
|
Before architecting game systems or game loops, you MUST inspect:
|
|
20
|
+
|
|
20
21
|
1. Target game engine (`Unity`, `Godot 4`, `Unreal Engine 5`, `Phaser 3`, `Pygame`) in project configs
|
|
21
22
|
2. Frame delta-time loop (`requestAnimationFrame`, `fixedUpdate`, `physics_process`) → Ensure frame-rate independent movement calculations
|
|
22
23
|
3. Asset pipeline & input mapping → Audit controller/touch input buffers, coyote time, and hitstop configurations
|
|
@@ -18,6 +18,7 @@ You validate that every interactive control provides high-fidelity state feedbac
|
|
|
18
18
|
## Mandatory Pre-Flight Context Inspection
|
|
19
19
|
|
|
20
20
|
Before auditing interactive states and micro-interactions, you MUST inspect:
|
|
21
|
+
|
|
21
22
|
1. Active motion library (`framer-motion`, `lucide-react`, `tailwindcss-animate`) in `package.json`
|
|
22
23
|
2. Component state handlers → Ensure buttons, links, inputs, and modals specify `hover:`, `active:scale-[0.97]`, and `focus-visible:` focus rings
|
|
23
24
|
3. Accessible modal/dialog primitives → Verify focus trap and Escape key bindings on overlays and dialogs
|
|
@@ -27,19 +28,22 @@ Before auditing interactive states and micro-interactions, you MUST inspect:
|
|
|
27
28
|
## What This Reviewer Catches
|
|
28
29
|
|
|
29
30
|
### ❌ REJECTED Criteria (Blocking)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
- **Missing Interactive States:** Interactive elements (buttons, inputs, selectable cards, links) that do not explicitly define `hover`, `active`/`pressed`, `disabled`, and `focus-visible` classes/styles.
|
|
33
|
+
- **No Active Indicator:** Clickable buttons lacking spring active-press feedback (e.g., `active:scale-[0.97]` or similar transition).
|
|
34
|
+
- **Missing Keyboard Focus Rings:** Focus rings completely removed or having low contrast with background elements. Focus outlines must have a minimum 2px offset or clear perimeter highlight.
|
|
33
35
|
|
|
34
36
|
### ⚠️ WARNING Criteria (Non-blocking)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
|
|
38
|
+
- _Pending/Async States:_ Form buttons lacking loading indicators or disabled states during submission.
|
|
39
|
+
- _Interaction Cursor:_ Custom interactive areas lacking `cursor-pointer`.
|
|
37
40
|
|
|
38
41
|
---
|
|
39
42
|
|
|
40
43
|
## Code Comparison Examples
|
|
41
44
|
|
|
42
45
|
### Static Control vs. Multi-State Control
|
|
46
|
+
|
|
43
47
|
```tsx
|
|
44
48
|
// ❌ REJECTED: Flat button without focus-visible, active scale, hover colors, or transitions
|
|
45
49
|
<button className="bg-blue-600 text-white p-2">
|
|
@@ -60,6 +64,7 @@ Before auditing interactive states and micro-interactions, you MUST inspect:
|
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
### Missing Focus Trap vs.Radix Dialog Focus Trap
|
|
67
|
+
|
|
63
68
|
```tsx
|
|
64
69
|
// ❌ REJECTED: Custom modal rendered inline without focus trap or keyboard Escape closing binding
|
|
65
70
|
function SimpleModal({ isOpen }) {
|