tribunal-kit 2.4.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/ARCHITECTURE.md +99 -99
- package/.agent/GEMINI.md +52 -52
- package/.agent/agents/accessibility-reviewer.md +139 -86
- package/.agent/agents/ai-code-reviewer.md +160 -90
- package/.agent/agents/backend-specialist.md +164 -127
- package/.agent/agents/code-archaeologist.md +115 -73
- package/.agent/agents/database-architect.md +130 -110
- package/.agent/agents/debugger.md +137 -97
- package/.agent/agents/dependency-reviewer.md +78 -30
- package/.agent/agents/devops-engineer.md +161 -118
- package/.agent/agents/documentation-writer.md +151 -87
- package/.agent/agents/explorer-agent.md +117 -99
- package/.agent/agents/frontend-reviewer.md +127 -47
- package/.agent/agents/frontend-specialist.md +169 -109
- package/.agent/agents/game-developer.md +28 -164
- package/.agent/agents/logic-reviewer.md +87 -49
- package/.agent/agents/mobile-developer.md +151 -103
- package/.agent/agents/mobile-reviewer.md +133 -50
- package/.agent/agents/orchestrator.md +121 -110
- package/.agent/agents/penetration-tester.md +103 -77
- package/.agent/agents/performance-optimizer.md +136 -92
- package/.agent/agents/performance-reviewer.md +139 -69
- package/.agent/agents/product-manager.md +104 -70
- package/.agent/agents/product-owner.md +6 -25
- package/.agent/agents/project-planner.md +95 -95
- package/.agent/agents/qa-automation-engineer.md +174 -87
- package/.agent/agents/security-auditor.md +133 -129
- package/.agent/agents/seo-specialist.md +160 -99
- package/.agent/agents/sql-reviewer.md +132 -44
- package/.agent/agents/supervisor-agent.md +137 -109
- package/.agent/agents/swarm-worker-contracts.md +17 -17
- package/.agent/agents/swarm-worker-registry.md +46 -46
- package/.agent/agents/test-coverage-reviewer.md +132 -53
- package/.agent/agents/test-engineer.md +0 -21
- package/.agent/agents/type-safety-reviewer.md +143 -33
- package/.agent/patterns/generator.md +9 -9
- package/.agent/patterns/inversion.md +12 -12
- package/.agent/patterns/pipeline.md +9 -9
- package/.agent/patterns/reviewer.md +13 -13
- package/.agent/patterns/tool-wrapper.md +9 -9
- package/.agent/rules/GEMINI.md +63 -63
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/compress_skills.py +167 -0
- package/.agent/scripts/consolidate_skills.py +173 -0
- package/.agent/scripts/deep_compress.py +202 -0
- package/.agent/scripts/minify_context.py +80 -0
- package/.agent/scripts/security_scan.py +1 -1
- package/.agent/scripts/strip_tribunal.py +41 -0
- package/.agent/skills/agent-organizer/SKILL.md +60 -100
- package/.agent/skills/agentic-patterns/SKILL.md +0 -70
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
- package/.agent/skills/api-patterns/SKILL.md +197 -257
- package/.agent/skills/api-security-auditor/SKILL.md +125 -57
- package/.agent/skills/app-builder/SKILL.md +326 -50
- package/.agent/skills/app-builder/templates/SKILL.md +13 -15
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
- package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
- package/.agent/skills/architecture/SKILL.md +161 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
- package/.agent/skills/bash-linux/SKILL.md +71 -166
- package/.agent/skills/behavioral-modes/SKILL.md +8 -69
- package/.agent/skills/brainstorming/SKILL.md +345 -127
- package/.agent/skills/building-native-ui/SKILL.md +125 -57
- package/.agent/skills/clean-code/SKILL.md +266 -149
- package/.agent/skills/code-review-checklist/SKILL.md +0 -62
- package/.agent/skills/config-validator/SKILL.md +73 -131
- package/.agent/skills/csharp-developer/SKILL.md +434 -73
- package/.agent/skills/database-design/SKILL.md +190 -275
- package/.agent/skills/deployment-procedures/SKILL.md +81 -158
- package/.agent/skills/devops-engineer/SKILL.md +255 -94
- package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
- package/.agent/skills/doc.md +5 -5
- package/.agent/skills/documentation-templates/SKILL.md +19 -63
- package/.agent/skills/edge-computing/SKILL.md +75 -165
- package/.agent/skills/extract-design-system/SKILL.md +84 -58
- package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
- package/.agent/skills/frontend-design/SKILL.md +151 -499
- package/.agent/skills/game-design-expert/SKILL.md +71 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
- package/.agent/skills/github-operations/SKILL.md +197 -272
- package/.agent/skills/gsap-expert/SKILL.md +194 -0
- package/.agent/skills/i18n-localization/SKILL.md +60 -172
- package/.agent/skills/intelligent-routing/SKILL.md +123 -103
- package/.agent/skills/lint-and-validate/SKILL.md +8 -52
- package/.agent/skills/llm-engineering/SKILL.md +281 -195
- package/.agent/skills/local-first/SKILL.md +76 -159
- package/.agent/skills/mcp-builder/SKILL.md +48 -188
- package/.agent/skills/mobile-design/SKILL.md +213 -219
- package/.agent/skills/motion-engineering/SKILL.md +184 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
- package/.agent/skills/observability/SKILL.md +211 -203
- package/.agent/skills/parallel-agents/SKILL.md +53 -146
- package/.agent/skills/performance-profiling/SKILL.md +171 -151
- package/.agent/skills/plan-writing/SKILL.md +49 -153
- package/.agent/skills/platform-engineer/SKILL.md +57 -103
- package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
- package/.agent/skills/powershell-windows/SKILL.md +61 -179
- package/.agent/skills/python-patterns/SKILL.md +7 -35
- package/.agent/skills/python-pro/SKILL.md +273 -114
- package/.agent/skills/react-specialist/SKILL.md +227 -108
- package/.agent/skills/readme-builder/SKILL.md +15 -85
- package/.agent/skills/realtime-patterns/SKILL.md +216 -243
- package/.agent/skills/red-team-tactics/SKILL.md +10 -51
- package/.agent/skills/rust-pro/SKILL.md +525 -142
- package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
- package/.agent/skills/server-management/SKILL.md +110 -166
- package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
- package/.agent/skills/skill-creator/SKILL.md +18 -58
- package/.agent/skills/sql-pro/SKILL.md +543 -68
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
- package/.agent/skills/swiftui-expert/SKILL.md +124 -57
- package/.agent/skills/systematic-debugging/SKILL.md +49 -151
- package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
- package/.agent/skills/tdd-workflow/SKILL.md +63 -169
- package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
- package/.agent/skills/testing-patterns/SKILL.md +437 -130
- package/.agent/skills/trend-researcher/SKILL.md +30 -71
- package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
- package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
- package/.agent/skills/vue-expert/SKILL.md +225 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
- package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
- package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
- package/.agent/skills/webapp-testing/SKILL.md +71 -196
- package/.agent/skills/whimsy-injector/SKILL.md +58 -132
- package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
- package/.agent/workflows/api-tester.md +96 -224
- package/.agent/workflows/audit.md +81 -122
- package/.agent/workflows/brainstorm.md +69 -105
- package/.agent/workflows/changelog.md +65 -97
- package/.agent/workflows/create.md +73 -88
- package/.agent/workflows/debug.md +80 -111
- package/.agent/workflows/deploy.md +119 -92
- package/.agent/workflows/enhance.md +80 -91
- package/.agent/workflows/fix.md +68 -97
- package/.agent/workflows/generate.md +165 -164
- package/.agent/workflows/migrate.md +106 -109
- package/.agent/workflows/orchestrate.md +103 -86
- package/.agent/workflows/performance-benchmarker.md +77 -268
- package/.agent/workflows/plan.md +120 -98
- package/.agent/workflows/preview.md +39 -96
- package/.agent/workflows/refactor.md +105 -97
- package/.agent/workflows/review-ai.md +63 -102
- package/.agent/workflows/review.md +71 -110
- package/.agent/workflows/session.md +53 -113
- package/.agent/workflows/status.md +42 -88
- package/.agent/workflows/strengthen-skills.md +90 -51
- package/.agent/workflows/swarm.md +114 -129
- package/.agent/workflows/test.md +125 -102
- package/.agent/workflows/tribunal-backend.md +60 -78
- package/.agent/workflows/tribunal-database.md +62 -100
- package/.agent/workflows/tribunal-frontend.md +62 -82
- package/.agent/workflows/tribunal-full.md +56 -100
- package/.agent/workflows/tribunal-mobile.md +65 -94
- package/.agent/workflows/tribunal-performance.md +62 -105
- package/.agent/workflows/ui-ux-pro-max.md +72 -121
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -329
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/typography-system.md +0 -363
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
|
@@ -1,78 +1,38 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: supabase-postgres-best-practices
|
|
3
|
-
description: Database architect expert in Supabase and PostgreSQL. Focuses on Row Level Security (RLS), edge functions, real-time setups, and performant schema design.
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version: 1.0.0
|
|
6
|
-
last-updated: 2026-03-30
|
|
7
|
-
applies-to-model: claude-3-7-sonnet, gemini-2.5-pro
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Supabase & Postgres Best Practices
|
|
11
|
-
|
|
12
|
-
You are a Supabase Data Architect. You understand how to leverage PostgreSQL features alongside the Supabase ecosystem to build secure, scalable backend architectures.
|
|
13
|
-
|
|
14
|
-
## Core Directives
|
|
15
|
-
|
|
16
|
-
1. **Row Level Security (RLS) is Mandatory:**
|
|
17
|
-
- Never create a table accessible from the public API without enabling RLS.
|
|
18
|
-
- Write strict, performant RLS policies:
|
|
19
|
-
```sql
|
|
20
|
-
alter table documents enable row level security;
|
|
21
|
-
create policy "Users can view their own documents"
|
|
22
|
-
on documents for select using (auth.uid() = user_id);
|
|
23
|
-
```
|
|
24
|
-
- Avoid slow `IN` subqueries inside RLS policies; use direct equality or simpler joins when possible.
|
|
25
|
-
|
|
26
|
-
2. **Supabase Schema Management:**
|
|
27
|
-
- Always map schema changes into standard SQL migration files (`supabase/migrations/...`).
|
|
28
|
-
- Do not hallucinate GUI operations; provide explicit SQL commands to achieve the task.
|
|
29
|
-
|
|
30
|
-
3. **Performance & Indexing:**
|
|
31
|
-
- Generate indexes for foreign keys and frequently queried columns.
|
|
32
|
-
- Recommend vector indexes (pgvector/HNSW) if generating embeddings or performing AI-based similarity searches.
|
|
33
|
-
|
|
34
|
-
4. **Edge Functions & Real-time:**
|
|
35
|
-
- Use Deno for Edge Functions when creating webhooks or external integrations.
|
|
36
|
-
- Clearly delineate which tables need `replica identity full` or replication enabled for real-time subscriptions.
|
|
37
|
-
|
|
38
|
-
|
|
39
1
|
---
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
47
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
48
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
49
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
50
|
-
|
|
2
|
+
name: supabase-postgres-best-practices
|
|
3
|
+
description: Database architect expert in Supabase and PostgreSQL. Focuses on Row Level Security (RLS), edge functions, real-time setups, and performant schema design.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
last-updated: 2026-03-30
|
|
7
|
+
applies-to-model: claude-3-7-sonnet, gemini-2.5-pro
|
|
51
8
|
---
|
|
52
9
|
|
|
53
|
-
|
|
10
|
+
# Supabase & Postgres Best Practices
|
|
54
11
|
|
|
55
|
-
|
|
56
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
12
|
+
You are a Supabase Data Architect. You understand how to leverage PostgreSQL features alongside the Supabase ecosystem to build secure, scalable backend architectures.
|
|
57
13
|
|
|
58
|
-
|
|
14
|
+
## Core Directives
|
|
59
15
|
|
|
60
|
-
1. **
|
|
61
|
-
|
|
62
|
-
|
|
16
|
+
1. **Row Level Security (RLS) is Mandatory:**
|
|
17
|
+
- Never create a table accessible from the public API without enabling RLS.
|
|
18
|
+
- Write strict, performant RLS policies:
|
|
19
|
+
```sql
|
|
20
|
+
alter table documents enable row level security;
|
|
21
|
+
create policy "Users can view their own documents"
|
|
22
|
+
on documents for select using (auth.uid() = user_id);
|
|
23
|
+
```
|
|
24
|
+
- Avoid slow `IN` subqueries inside RLS policies; use direct equality or simpler joins when possible.
|
|
63
25
|
|
|
64
|
-
|
|
26
|
+
2. **Supabase Schema Management:**
|
|
27
|
+
- Always map schema changes into standard SQL migration files (`supabase/migrations/...`).
|
|
28
|
+
- Do not hallucinate GUI operations; provide explicit SQL commands to achieve the task.
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
70
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
71
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
72
|
-
```
|
|
30
|
+
3. **Performance & Indexing:**
|
|
31
|
+
- Generate indexes for foreign keys and frequently queried columns.
|
|
32
|
+
- Recommend vector indexes (pgvector/HNSW) if generating embeddings or performing AI-based similarity searches.
|
|
73
33
|
|
|
74
|
-
|
|
34
|
+
4. **Edge Functions & Real-time:**
|
|
35
|
+
- Use Deno for Edge Functions when creating webhooks or external integrations.
|
|
36
|
+
- Clearly delineate which tables need `replica identity full` or replication enabled for real-time subscriptions.
|
|
75
37
|
|
|
76
|
-
|
|
77
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
78
|
-
- ✅ **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.
|
|
38
|
+
---
|
|
@@ -1,75 +1,142 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: swiftui-expert
|
|
3
|
-
description:
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# SwiftUI Expert
|
|
11
|
-
|
|
12
|
-
You are a top-tier iOS / macOS Application Developer who primarily utilizes SwiftUI to build fast, declarative, and highly native application interfaces.
|
|
13
|
-
|
|
14
|
-
## Core Directives
|
|
15
|
-
|
|
16
|
-
1. **State Ownership & Data Flow:**
|
|
17
|
-
- Use `@State` *strictly* for simple, local, internal view state that isn't shared.
|
|
18
|
-
- Inject dependencies properly throughout the view hierarchy using `@Environment` and push complex controller logic to `@StateObject` or `Observable` architectures. Avoid gigantic God-views passing `@Binding` down ten levels.
|
|
19
|
-
|
|
20
|
-
2. **Semantic View Modifiers:**
|
|
21
|
-
- Respect modifier ordering! In SwiftUI, sequence matters greatly (e.g., `.padding().background(Color.red)` produces drastically different results than `.background(Color.red).padding()`).
|
|
22
|
-
- Build smaller, composable views rather than monolithic structural scopes. Extract components liberally.
|
|
23
|
-
|
|
24
|
-
3. **Animation Idioms:**
|
|
25
|
-
- Prefer native implicit `.animation(.spring())` and explicit `withAnimation { }` blocks over complex timers or geometric transforms.
|
|
26
|
-
- Attach transitions properly during state changes to manage view insertion/removal gracefully.
|
|
27
|
-
|
|
28
|
-
4. **Layout Foundations:**
|
|
29
|
-
- Maximize the usage of `VStack`, `HStack`, `ZStack`, and raw `Grid` components safely over inflexible absolute positions.
|
|
30
|
-
- Accommodate spatial layouts properly by respecting `SafeAreaInsets` and `presentationDetents` for half-sheets.
|
|
31
|
-
|
|
32
|
-
## Execution
|
|
33
|
-
When creating SwiftUI interfaces, avoid UIKit overrides like `UIViewRepresentable` unless absolutely dictated. Deliver pristine `.swift` View structures maximizing Apple's human interface guidelines (HIG).
|
|
1
|
+
---
|
|
2
|
+
name: swiftui-expert
|
|
3
|
+
description: SwiftUI development mastery. View architecture, state management (@State, @Binding, @Environment, @Observable), performance optimization (identifiable loops, implicit vs explicit animations), architectural patterns (MVVM vs TCA), and iOS-native UX paradigms. Use when writing native Apple platforms code.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
34
9
|
|
|
10
|
+
# SwiftUI Expert — Native Apple Platforms Mastery
|
|
35
11
|
|
|
36
12
|
---
|
|
37
13
|
|
|
38
|
-
##
|
|
14
|
+
## 1. Modern State Management (iOS 17+ / Swift 5.9+)
|
|
15
|
+
|
|
16
|
+
Apple deprecated `@StateObject` and `@ObservedObject` in favor of the new `@Observable` macro.
|
|
39
17
|
|
|
40
|
-
|
|
18
|
+
```swift
|
|
19
|
+
// ❌ OLD WAY (Pre-iOS 17)
|
|
20
|
+
class UserProfile: ObservableObject {
|
|
21
|
+
@Published var name: String = "Guest"
|
|
22
|
+
}
|
|
23
|
+
struct ProfileView: View {
|
|
24
|
+
@StateObject var profile = UserProfile()
|
|
25
|
+
// ...
|
|
26
|
+
}
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
// ✅ NEW WAY (iOS 17+ / @Observable)
|
|
29
|
+
import Observation
|
|
30
|
+
|
|
31
|
+
@Observable
|
|
32
|
+
class UserProfile {
|
|
33
|
+
var name: String = "Guest"
|
|
34
|
+
var age: Int = 0
|
|
35
|
+
// No @Published needed! Only properties that are actually read
|
|
36
|
+
// inside the body will trigger view updates.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
struct ProfileView: View {
|
|
40
|
+
// Treat the reference type exactly like a value type!
|
|
41
|
+
@State private var profile = UserProfile()
|
|
42
|
+
|
|
43
|
+
var body: some View {
|
|
44
|
+
VStack {
|
|
45
|
+
TextField("Name", text: $profile.name)
|
|
46
|
+
Text("Hello, \(profile.name)")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Property Data Flow Cheat Sheet
|
|
53
|
+
- `@State`: The view OWNS value (or reference if `@Observable`).
|
|
54
|
+
- `@Binding`: The view mutates a value OWNED by a parent.
|
|
55
|
+
- `@Environment`: The view reads value injected high up in the view hierarchy.
|
|
56
|
+
- `@Bindable`: Creates bindings from an `@Observable` model passed via parameters/environment.
|
|
47
57
|
|
|
48
58
|
---
|
|
49
59
|
|
|
50
|
-
##
|
|
60
|
+
## 2. View Architecture & Modifiers
|
|
61
|
+
|
|
62
|
+
SwiftUI Views should be impossibly small. Extract frequently.
|
|
51
63
|
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
```swift
|
|
65
|
+
// ❌ BAD: Massive body with 10 layers of nesting
|
|
66
|
+
struct MassiveView: View {
|
|
67
|
+
var body: some View { ... }
|
|
68
|
+
}
|
|
54
69
|
|
|
55
|
-
|
|
70
|
+
// ✅ GOOD: Extract via properties, functions, or new View structs
|
|
71
|
+
struct CleanView: View {
|
|
72
|
+
var body: some View {
|
|
73
|
+
VStack {
|
|
74
|
+
headerSection
|
|
75
|
+
CustomScrollingList(items: data)
|
|
76
|
+
footerSection
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private var headerSection: some View {
|
|
81
|
+
Text("Header").font(.headline)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
56
85
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
86
|
+
### Modifier Ordering Matters
|
|
87
|
+
Modifiers wrap views sequentially. The order fundamentally changes the rendering.
|
|
60
88
|
|
|
61
|
-
|
|
89
|
+
```swift
|
|
90
|
+
// Padding BEFORE Background
|
|
91
|
+
Text("Hello")
|
|
92
|
+
.padding()
|
|
93
|
+
.background(Color.blue)
|
|
94
|
+
// Result: A large blue box with text inside.
|
|
62
95
|
|
|
63
|
-
|
|
96
|
+
// Padding AFTER Background
|
|
97
|
+
Text("Hello")
|
|
98
|
+
.background(Color.blue)
|
|
99
|
+
.padding()
|
|
100
|
+
// Result: A tight blue box around text, surrounded by invisible spacing.
|
|
64
101
|
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 3. Performance & Rendering
|
|
106
|
+
|
|
107
|
+
```swift
|
|
108
|
+
// ❌ BAD: Using indices in ForEach
|
|
109
|
+
// If the array mutates (items injected/deleted), SwiftUI loses
|
|
110
|
+
// track of identity and re-renders EVERYTHING aggressively.
|
|
111
|
+
ForEach(0..<items.count, id: \.self) { index in
|
|
112
|
+
ItemRow(item: items[index])
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ✅ GOOD: Identifiable protocol
|
|
116
|
+
struct Item: Identifiable {
|
|
117
|
+
let id = UUID()
|
|
118
|
+
let title: String
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
ForEach(items) { item in
|
|
122
|
+
ItemRow(item: item)
|
|
123
|
+
}
|
|
69
124
|
```
|
|
70
125
|
|
|
71
|
-
###
|
|
126
|
+
### Avoiding Massive Layout Recalculations
|
|
127
|
+
Use `LazyVStack` and `LazyHStack` inside ScrollViews when presenting large lists, but NOT everywhere. Normal `VStack` is faster for < 20 items because it pre-calculates boundaries instantly.
|
|
128
|
+
|
|
129
|
+
---
|
|
72
130
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
131
|
+
## 4. MVVM vs Context-Driven Architecture
|
|
132
|
+
|
|
133
|
+
While MVVM is historically popular, SwiftUI natively represents View-as-a-function-of-State.
|
|
134
|
+
|
|
135
|
+
```swift
|
|
136
|
+
// ✅ Context-Driven / Feature-Driven
|
|
137
|
+
// The Model handles data fetching/logic.
|
|
138
|
+
// The View creates its own local @State and passes @Bindings down.
|
|
139
|
+
// Only use full ViewModels for complex orchestration crossing multiple views.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
@@ -1,186 +1,84 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: systematic-debugging
|
|
3
|
-
description: 4-phase
|
|
3
|
+
description: Systematic debugging framework. Root-cause isolation, 4-phase methodology, hypothesis testing, log tracing, avoiding shotgun-surgery, memory allocation analysis, and empirical evidence gathering. Use when debugging complex, highly-coupled, or elusive bugs across mixed execution environments.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
7
|
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Systematic Debugging
|
|
11
|
-
|
|
12
|
-
> Debugging is not guessing. It is the scientific method applied to broken software.
|
|
13
|
-
> Every guess without evidence is just noise. Every change without verification extends the outage.
|
|
10
|
+
# Systematic Debugging — Root Cause Mastery
|
|
14
11
|
|
|
15
12
|
---
|
|
16
13
|
|
|
17
|
-
## The 4-Phase
|
|
18
|
-
|
|
19
|
-
### Phase 1 — Reproduce
|
|
20
|
-
|
|
21
|
-
A bug you can't reproduce consistently is a bug you can't safely fix.
|
|
22
|
-
|
|
23
|
-
**Steps:**
|
|
24
|
-
1. Document the exact sequence that triggers the bug (input → action → observed result)
|
|
25
|
-
2. Identify the environment: OS, browser, Node version, database version, network conditions
|
|
26
|
-
3. Determine if the bug is consistent or intermittent
|
|
27
|
-
4. Find the smallest reproduction case
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
# Reproduction template
|
|
31
|
-
Trigger: [Exact steps]
|
|
32
|
-
Environment: [Runtime, OS, version]
|
|
33
|
-
Expected: [What should happen]
|
|
34
|
-
Observed: [What actually happens]
|
|
35
|
-
Consistent: [Yes / No / Only under load / Only for specific users]
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If you cannot reproduce — collect more data before attempting a fix.
|
|
39
|
-
|
|
40
|
-
### Phase 2 — Locate
|
|
41
|
-
|
|
42
|
-
Find where the code breaks, not what you think broke.
|
|
43
|
-
|
|
44
|
-
**Tools by layer:**
|
|
14
|
+
## 1. The 4-Phase Debugging Methodology
|
|
45
15
|
|
|
46
|
-
|
|
47
|
-
|---|---|
|
|
48
|
-
| Network | Browser DevTools → Network tab, curl, Wireshark |
|
|
49
|
-
| API | Response body + status code, request logs |
|
|
50
|
-
| Application logic | Debugger, `console.log` with structured context |
|
|
51
|
-
| Database | Query logs, `EXPLAIN ANALYZE`, slow query log |
|
|
52
|
-
| Memory | Heap snapshot, `--inspect` with Chrome DevTools |
|
|
16
|
+
Never jump straight into modifying code when a bug is reported.
|
|
53
17
|
|
|
54
|
-
|
|
18
|
+
### Phase 1: Replication & Isolation
|
|
19
|
+
**Goal:** Prove the bug exists continuously and isolate the execution path.
|
|
20
|
+
1. Write a failing deterministic unit/integration test that replicates the exact condition.
|
|
21
|
+
2. Strip away all unnecessary layers (If the UI button fails to delete a user, curl the endpoint directly. Does the API fail? If yes, UI is fine, bug is in the backend/database).
|
|
55
22
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
- Continue halving until you've isolated the broken unit.
|
|
23
|
+
### Phase 2: Hypothesis Generation
|
|
24
|
+
**Goal:** Formulate logical explanations for the anomaly based on data, not guesses.
|
|
25
|
+
- "Because the log shows `auth: false` even after successful token parse, the RBAC middleware must be overwriting the session."
|
|
60
26
|
|
|
61
|
-
### Phase 3
|
|
27
|
+
### Phase 3: Evidence-Based Testing (The Probe)
|
|
28
|
+
**Goal:** Prove or disprove the hypothesis without mutating the actual program functionality.
|
|
29
|
+
- Insert strict logging probes: `logger.debug("Executing line 45. User.permissions:", user.permissions)`.
|
|
30
|
+
- If the logs match your hypothesis, proceed. If they do not, discard the hypothesis.
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Hypothesis: "The JWT is expiring before the renewal code runs because
|
|
67
|
-
the token TTL and the renewal check interval are both set to 1 hour,
|
|
68
|
-
with no buffer."
|
|
69
|
-
|
|
70
|
-
Test: Reduce token TTL to 5 minutes in dev. Does the error appear in 5 minutes?
|
|
71
|
-
|
|
72
|
-
Result: Yes → hypothesis confirmed
|
|
73
|
-
No → discard and form a new hypothesis
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**One change at a time.** Two changes at once = you don't know which one fixed it.
|
|
77
|
-
|
|
78
|
-
### Phase 4 — Fix and Verify
|
|
79
|
-
|
|
80
|
-
Fix the root cause — not the symptom.
|
|
81
|
-
|
|
82
|
-
**Root cause vs. symptom:**
|
|
83
|
-
```
|
|
84
|
-
Symptom: Users are getting logged out
|
|
85
|
-
Cause: Token TTL is shorter than session duration
|
|
86
|
-
Root cause: TTL and renewal interval were set by two different teams without coordination
|
|
87
|
-
|
|
88
|
-
Symptom fix: Increase TTL
|
|
89
|
-
Root cause fix: Establish a single config source for auth timing values + document the relationship
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**Verification checklist:**
|
|
93
|
-
- [ ] Bug no longer reproduces with the specific steps from Phase 1
|
|
94
|
-
- [ ] Adjacent behavior still works (no regression)
|
|
95
|
-
- [ ] Fix works in the environment where the bug was first reported
|
|
96
|
-
- [ ] A test is added that would have caught this bug before it reached production
|
|
32
|
+
### Phase 4: Resolution & Verification
|
|
33
|
+
**Goal:** Apply the minimal surgical change required, then verify via tests.
|
|
34
|
+
- Re-run the deterministic failing test created in Phase 1. It must now pass.
|
|
97
35
|
|
|
98
36
|
---
|
|
99
37
|
|
|
100
|
-
##
|
|
101
|
-
|
|
102
|
-
### Intermittent Bug
|
|
103
|
-
|
|
104
|
-
- Likely cause: race condition, network timeout, missing error handling on async code
|
|
105
|
-
- Add structured logging with request IDs and timestamps
|
|
106
|
-
- Reproduce under load (`k6`, `ab`)
|
|
107
|
-
- Look for shared mutable state
|
|
38
|
+
## 2. Advanced Diagnostic Vectors
|
|
108
39
|
|
|
109
|
-
|
|
40
|
+
When pure logic errors are ruled out, look for environmental factors.
|
|
110
41
|
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
- Check for hardcoded localhost URLs or conditions
|
|
42
|
+
**1. Race Conditions / Timing Bugs**
|
|
43
|
+
- *Symptom:* The bug only happens 30% of the time, or depends on network speed.
|
|
44
|
+
- *Cause:* Missing `await` statements, relying on asynchronous callbacks returning in a specific order, or concurrent database transacting.
|
|
115
45
|
|
|
116
|
-
|
|
46
|
+
**2. State Leakage**
|
|
47
|
+
- *Symptom:* The first operation works perfectly. The second consecutive operation fails mysteriously.
|
|
48
|
+
- *Cause:* Global variables, cached HTTP clients, or React state lacking proper cleanup functions between unmounts.
|
|
117
49
|
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
- Check for branching logic that depends on user properties
|
|
50
|
+
**3. Silent Failures (Swallowed Errors)**
|
|
51
|
+
- *Symptom:* The application stops processing midway through an operation, but nothing is in the error logs.
|
|
52
|
+
- *Cause:* Empty `catch (e) {}` blocks, unhandled promise rejections, or frontend elements conditionally rendering `null` on missing datasets.
|
|
122
53
|
|
|
123
54
|
---
|
|
124
55
|
|
|
125
|
-
##
|
|
126
|
-
|
|
127
|
-
Keep a running log during complex debugging:
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
[Time] Hypothesis: ...
|
|
131
|
-
[Time] Test: ...
|
|
132
|
-
[Time] Result: ...
|
|
133
|
-
[Time] Conclusion: ...
|
|
134
|
-
[Time] New hypothesis: ...
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
This prevents circular reasoning and gives you a record if you hand off to someone else.
|
|
56
|
+
## 3. The Bisection Method (Git Bisect)
|
|
138
57
|
|
|
139
|
-
|
|
58
|
+
When a catastrophic bug appears in production but worked fine last week, use algorithmic isolation across the git history.
|
|
140
59
|
|
|
141
|
-
|
|
60
|
+
```bash
|
|
61
|
+
git bisect start
|
|
62
|
+
git bisect bad HEAD # The current state is broken
|
|
63
|
+
git bisect good v1.4.0 # It worked fine in the last release
|
|
142
64
|
|
|
143
|
-
|
|
65
|
+
# Git will now jump you exactly halfway between those commits.
|
|
66
|
+
# Run your tests...
|
|
67
|
+
git bisect bad # (If it failed)
|
|
68
|
+
# Or...
|
|
69
|
+
git bisect good # (If it passed)
|
|
144
70
|
|
|
71
|
+
# Git will isolate the exact commit that introduced the bug in O(log N) steps.
|
|
145
72
|
```
|
|
146
|
-
━━━ Systematic Debugging Output ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
147
|
-
Task: [what was performed]
|
|
148
|
-
Result: [outcome summary — one line]
|
|
149
|
-
─────────────────────────────────────────────────
|
|
150
|
-
Checks: ✅ [N passed] · ⚠️ [N warnings] · ❌ [N blocked]
|
|
151
|
-
VBC status: PENDING → VERIFIED
|
|
152
|
-
Evidence: [link to terminal output, test result, or file diff]
|
|
153
|
-
```
|
|
154
|
-
|
|
155
73
|
|
|
156
74
|
---
|
|
157
75
|
|
|
158
|
-
##
|
|
159
|
-
|
|
160
|
-
**Slash command: `/debug`**
|
|
161
|
-
**Active reviewers: `debugger` · `logic-reviewer`**
|
|
162
|
-
|
|
163
|
-
### ❌ Forbidden AI Tropes in Debugging
|
|
76
|
+
## 4. Reading the Stack Trace Properly
|
|
164
77
|
|
|
165
|
-
|
|
166
|
-
2. **Hallucinating stack traces** — never guess the line number or the contents of an error log. Use tools to read it.
|
|
167
|
-
3. **"Rewrite the whole function"** — never suggest rewriting working code just to fix a single bug, unless the structure is the root cause.
|
|
168
|
-
4. **Assuming the fix worked** — always provide a way to verify the fix.
|
|
169
|
-
5. **Changing multiple variables at once** — never provide fixes that change 5 different things simultaneously. Identify ONE root cause.
|
|
78
|
+
Do not skim. Stack traces tell the exact sequence of destruction.
|
|
170
79
|
|
|
171
|
-
|
|
80
|
+
1. **Top line:** The final fatal blow (e.g., `TypeError: Cannot read properties of undefined (reading 'map')`).
|
|
81
|
+
2. **First Application Function:** Scroll down past `node_modules` and framework internals. Find the absolute top-most function call that YOU wrote (e.g., `at UserList (src/components/UserList.tsx:45)`).
|
|
82
|
+
3. **The Parameter Conclusion:** Therefore, line 45 invoked `.map` on a variable that was `undefined`. Why did the parent layer pass `undefined` instead of `[]`?
|
|
172
83
|
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
✅ Do I have the exact error message and stack trace? (If no, ASK the user to provide it or let me look for it).
|
|
176
|
-
✅ Did I isolate the exact line or block of code causing the issue?
|
|
177
|
-
✅ Is my proposed fix addressing the root cause, or just suppressing a symptom?
|
|
178
|
-
✅ Did I only change ONE thing to test the hypothesis?
|
|
179
|
-
✅ Can I explain exactly WHY the code broke in the first place?
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
183
|
-
|
|
184
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
185
|
-
- ❌ **Forbidden:** Declaring a bug "fixed" or completing a task because your updated code "looks correct" to you.
|
|
186
|
-
- ✅ **Required:** You are explicitly forbidden from completing your debug task until you have produced **concrete, observable evidence** (e.g., terminal output, compiler success, passing test logs, network trace results, or CLI execution results) proving the fix works. If you lack a direct test environment, you must attempt to write a focused script to verify the logic.
|
|
84
|
+
---
|