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.
Files changed (250) hide show
  1. package/.agent/ARCHITECTURE.md +99 -99
  2. package/.agent/GEMINI.md +52 -52
  3. package/.agent/agents/accessibility-reviewer.md +139 -86
  4. package/.agent/agents/ai-code-reviewer.md +160 -90
  5. package/.agent/agents/backend-specialist.md +164 -127
  6. package/.agent/agents/code-archaeologist.md +115 -73
  7. package/.agent/agents/database-architect.md +130 -110
  8. package/.agent/agents/debugger.md +137 -97
  9. package/.agent/agents/dependency-reviewer.md +78 -30
  10. package/.agent/agents/devops-engineer.md +161 -118
  11. package/.agent/agents/documentation-writer.md +151 -87
  12. package/.agent/agents/explorer-agent.md +117 -99
  13. package/.agent/agents/frontend-reviewer.md +127 -47
  14. package/.agent/agents/frontend-specialist.md +169 -109
  15. package/.agent/agents/game-developer.md +28 -164
  16. package/.agent/agents/logic-reviewer.md +87 -49
  17. package/.agent/agents/mobile-developer.md +151 -103
  18. package/.agent/agents/mobile-reviewer.md +133 -50
  19. package/.agent/agents/orchestrator.md +121 -110
  20. package/.agent/agents/penetration-tester.md +103 -77
  21. package/.agent/agents/performance-optimizer.md +136 -92
  22. package/.agent/agents/performance-reviewer.md +139 -69
  23. package/.agent/agents/product-manager.md +104 -70
  24. package/.agent/agents/product-owner.md +6 -25
  25. package/.agent/agents/project-planner.md +95 -95
  26. package/.agent/agents/qa-automation-engineer.md +174 -87
  27. package/.agent/agents/security-auditor.md +133 -129
  28. package/.agent/agents/seo-specialist.md +160 -99
  29. package/.agent/agents/sql-reviewer.md +132 -44
  30. package/.agent/agents/supervisor-agent.md +137 -109
  31. package/.agent/agents/swarm-worker-contracts.md +17 -17
  32. package/.agent/agents/swarm-worker-registry.md +46 -46
  33. package/.agent/agents/test-coverage-reviewer.md +132 -53
  34. package/.agent/agents/test-engineer.md +0 -21
  35. package/.agent/agents/type-safety-reviewer.md +143 -33
  36. package/.agent/patterns/generator.md +9 -9
  37. package/.agent/patterns/inversion.md +12 -12
  38. package/.agent/patterns/pipeline.md +9 -9
  39. package/.agent/patterns/reviewer.md +13 -13
  40. package/.agent/patterns/tool-wrapper.md +9 -9
  41. package/.agent/rules/GEMINI.md +63 -63
  42. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  43. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  44. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  45. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  46. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  47. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  48. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  49. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  50. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  51. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  52. package/.agent/scripts/compress_skills.py +167 -0
  53. package/.agent/scripts/consolidate_skills.py +173 -0
  54. package/.agent/scripts/deep_compress.py +202 -0
  55. package/.agent/scripts/minify_context.py +80 -0
  56. package/.agent/scripts/security_scan.py +1 -1
  57. package/.agent/scripts/strip_tribunal.py +41 -0
  58. package/.agent/skills/agent-organizer/SKILL.md +60 -100
  59. package/.agent/skills/agentic-patterns/SKILL.md +0 -70
  60. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
  61. package/.agent/skills/api-patterns/SKILL.md +197 -257
  62. package/.agent/skills/api-security-auditor/SKILL.md +125 -57
  63. package/.agent/skills/app-builder/SKILL.md +326 -50
  64. package/.agent/skills/app-builder/templates/SKILL.md +13 -15
  65. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
  66. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
  67. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
  68. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
  69. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
  70. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
  71. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
  72. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
  73. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
  74. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
  75. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
  76. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
  77. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
  78. package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
  79. package/.agent/skills/architecture/SKILL.md +161 -200
  80. package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
  81. package/.agent/skills/bash-linux/SKILL.md +71 -166
  82. package/.agent/skills/behavioral-modes/SKILL.md +8 -69
  83. package/.agent/skills/brainstorming/SKILL.md +345 -127
  84. package/.agent/skills/building-native-ui/SKILL.md +125 -57
  85. package/.agent/skills/clean-code/SKILL.md +266 -149
  86. package/.agent/skills/code-review-checklist/SKILL.md +0 -62
  87. package/.agent/skills/config-validator/SKILL.md +73 -131
  88. package/.agent/skills/csharp-developer/SKILL.md +434 -73
  89. package/.agent/skills/database-design/SKILL.md +190 -275
  90. package/.agent/skills/deployment-procedures/SKILL.md +81 -158
  91. package/.agent/skills/devops-engineer/SKILL.md +255 -94
  92. package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
  93. package/.agent/skills/doc.md +5 -5
  94. package/.agent/skills/documentation-templates/SKILL.md +19 -63
  95. package/.agent/skills/edge-computing/SKILL.md +75 -165
  96. package/.agent/skills/extract-design-system/SKILL.md +84 -58
  97. package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
  98. package/.agent/skills/frontend-design/SKILL.md +151 -499
  99. package/.agent/skills/game-design-expert/SKILL.md +71 -0
  100. package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
  101. package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
  102. package/.agent/skills/github-operations/SKILL.md +197 -272
  103. package/.agent/skills/gsap-expert/SKILL.md +194 -0
  104. package/.agent/skills/i18n-localization/SKILL.md +60 -172
  105. package/.agent/skills/intelligent-routing/SKILL.md +123 -103
  106. package/.agent/skills/lint-and-validate/SKILL.md +8 -52
  107. package/.agent/skills/llm-engineering/SKILL.md +281 -195
  108. package/.agent/skills/local-first/SKILL.md +76 -159
  109. package/.agent/skills/mcp-builder/SKILL.md +48 -188
  110. package/.agent/skills/mobile-design/SKILL.md +213 -219
  111. package/.agent/skills/motion-engineering/SKILL.md +184 -0
  112. package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
  113. package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
  114. package/.agent/skills/observability/SKILL.md +211 -203
  115. package/.agent/skills/parallel-agents/SKILL.md +53 -146
  116. package/.agent/skills/performance-profiling/SKILL.md +171 -151
  117. package/.agent/skills/plan-writing/SKILL.md +49 -153
  118. package/.agent/skills/platform-engineer/SKILL.md +57 -103
  119. package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
  120. package/.agent/skills/powershell-windows/SKILL.md +61 -179
  121. package/.agent/skills/python-patterns/SKILL.md +7 -35
  122. package/.agent/skills/python-pro/SKILL.md +273 -114
  123. package/.agent/skills/react-specialist/SKILL.md +227 -108
  124. package/.agent/skills/readme-builder/SKILL.md +15 -85
  125. package/.agent/skills/realtime-patterns/SKILL.md +216 -243
  126. package/.agent/skills/red-team-tactics/SKILL.md +10 -51
  127. package/.agent/skills/rust-pro/SKILL.md +525 -142
  128. package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
  129. package/.agent/skills/server-management/SKILL.md +110 -166
  130. package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
  131. package/.agent/skills/skill-creator/SKILL.md +18 -58
  132. package/.agent/skills/sql-pro/SKILL.md +543 -68
  133. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
  134. package/.agent/skills/swiftui-expert/SKILL.md +124 -57
  135. package/.agent/skills/systematic-debugging/SKILL.md +49 -151
  136. package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
  137. package/.agent/skills/tdd-workflow/SKILL.md +63 -169
  138. package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
  139. package/.agent/skills/testing-patterns/SKILL.md +437 -130
  140. package/.agent/skills/trend-researcher/SKILL.md +30 -71
  141. package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
  142. package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
  143. package/.agent/skills/vue-expert/SKILL.md +225 -119
  144. package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
  145. package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
  146. package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
  147. package/.agent/skills/webapp-testing/SKILL.md +71 -196
  148. package/.agent/skills/whimsy-injector/SKILL.md +58 -132
  149. package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
  150. package/.agent/workflows/api-tester.md +96 -224
  151. package/.agent/workflows/audit.md +81 -122
  152. package/.agent/workflows/brainstorm.md +69 -105
  153. package/.agent/workflows/changelog.md +65 -97
  154. package/.agent/workflows/create.md +73 -88
  155. package/.agent/workflows/debug.md +80 -111
  156. package/.agent/workflows/deploy.md +119 -92
  157. package/.agent/workflows/enhance.md +80 -91
  158. package/.agent/workflows/fix.md +68 -97
  159. package/.agent/workflows/generate.md +165 -164
  160. package/.agent/workflows/migrate.md +106 -109
  161. package/.agent/workflows/orchestrate.md +103 -86
  162. package/.agent/workflows/performance-benchmarker.md +77 -268
  163. package/.agent/workflows/plan.md +120 -98
  164. package/.agent/workflows/preview.md +39 -96
  165. package/.agent/workflows/refactor.md +105 -97
  166. package/.agent/workflows/review-ai.md +63 -102
  167. package/.agent/workflows/review.md +71 -110
  168. package/.agent/workflows/session.md +53 -113
  169. package/.agent/workflows/status.md +42 -88
  170. package/.agent/workflows/strengthen-skills.md +90 -51
  171. package/.agent/workflows/swarm.md +114 -129
  172. package/.agent/workflows/test.md +125 -102
  173. package/.agent/workflows/tribunal-backend.md +60 -78
  174. package/.agent/workflows/tribunal-database.md +62 -100
  175. package/.agent/workflows/tribunal-frontend.md +62 -82
  176. package/.agent/workflows/tribunal-full.md +56 -100
  177. package/.agent/workflows/tribunal-mobile.md +65 -94
  178. package/.agent/workflows/tribunal-performance.md +62 -105
  179. package/.agent/workflows/ui-ux-pro-max.md +72 -121
  180. package/README.md +11 -15
  181. package/package.json +1 -1
  182. package/.agent/skills/api-patterns/api-style.md +0 -42
  183. package/.agent/skills/api-patterns/auth.md +0 -24
  184. package/.agent/skills/api-patterns/documentation.md +0 -26
  185. package/.agent/skills/api-patterns/graphql.md +0 -41
  186. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  187. package/.agent/skills/api-patterns/response.md +0 -37
  188. package/.agent/skills/api-patterns/rest.md +0 -40
  189. package/.agent/skills/api-patterns/security-testing.md +0 -122
  190. package/.agent/skills/api-patterns/trpc.md +0 -41
  191. package/.agent/skills/api-patterns/versioning.md +0 -22
  192. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  193. package/.agent/skills/app-builder/feature-building.md +0 -53
  194. package/.agent/skills/app-builder/project-detection.md +0 -34
  195. package/.agent/skills/app-builder/scaffolding.md +0 -118
  196. package/.agent/skills/app-builder/tech-stack.md +0 -40
  197. package/.agent/skills/architecture/context-discovery.md +0 -43
  198. package/.agent/skills/architecture/examples.md +0 -94
  199. package/.agent/skills/architecture/pattern-selection.md +0 -68
  200. package/.agent/skills/architecture/patterns-reference.md +0 -50
  201. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  202. package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
  203. package/.agent/skills/database-design/database-selection.md +0 -43
  204. package/.agent/skills/database-design/indexing.md +0 -39
  205. package/.agent/skills/database-design/migrations.md +0 -48
  206. package/.agent/skills/database-design/optimization.md +0 -36
  207. package/.agent/skills/database-design/orm-selection.md +0 -30
  208. package/.agent/skills/database-design/schema-design.md +0 -56
  209. package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
  210. package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
  211. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  212. package/.agent/skills/frontend-design/color-system.md +0 -329
  213. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  214. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  215. package/.agent/skills/frontend-design/typography-system.md +0 -363
  216. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  217. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  218. package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
  219. package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
  220. package/.agent/skills/game-development/SKILL.md +0 -236
  221. package/.agent/skills/game-development/game-art/SKILL.md +0 -185
  222. package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
  223. package/.agent/skills/game-development/game-design/SKILL.md +0 -129
  224. package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
  225. package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
  226. package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
  227. package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
  228. package/.agent/skills/game-development/web-games/SKILL.md +0 -150
  229. package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
  230. package/.agent/skills/mobile-design/decision-trees.md +0 -516
  231. package/.agent/skills/mobile-design/mobile-backend.md +0 -491
  232. package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
  233. package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
  234. package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
  235. package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
  236. package/.agent/skills/mobile-design/mobile-performance.md +0 -767
  237. package/.agent/skills/mobile-design/mobile-testing.md +0 -356
  238. package/.agent/skills/mobile-design/mobile-typography.md +0 -433
  239. package/.agent/skills/mobile-design/platform-android.md +0 -666
  240. package/.agent/skills/mobile-design/platform-ios.md +0 -561
  241. package/.agent/skills/mobile-design/touch-psychology.md +0 -537
  242. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
  243. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
  244. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
  245. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
  246. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
  247. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
  248. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
  249. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
  250. 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
- ## 🤖 LLM-Specific Traps
42
-
43
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
44
-
45
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
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
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
10
+ # Supabase & Postgres Best Practices
54
11
 
55
- **Slash command: `/review` or `/tribunal-full`**
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
- ### Forbidden AI Tropes
14
+ ## Core Directives
59
15
 
60
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
61
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
62
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
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
- ### Pre-Flight Self-Audit
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
- Review these questions before confirming output:
67
- ```
68
- Did I rely ONLY on real, verified tools and methods?
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
- ### 🛑 Verification-Before-Completion (VBC) Protocol
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
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
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: Dedicated Apple-ecosystem App UI architect. Focuses on idiomatic SwiftUI, @State property wrappers, fluid Combine integrations, and native transitions.
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
- # 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
- ## 🤖 LLM-Specific Traps
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
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
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
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
43
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
44
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
45
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
46
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
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
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
60
+ ## 2. View Architecture & Modifiers
61
+
62
+ SwiftUI Views should be impossibly small. Extract frequently.
51
63
 
52
- **Slash command: `/review` or `/tribunal-full`**
53
- **Active reviewers: `logic-reviewer` · `security-auditor`**
64
+ ```swift
65
+ // ❌ BAD: Massive body with 10 layers of nesting
66
+ struct MassiveView: View {
67
+ var body: some View { ... }
68
+ }
54
69
 
55
- ### Forbidden AI Tropes
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
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
58
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
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
- ### ✅ Pre-Flight Self-Audit
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
- Review these questions before confirming output:
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
- ✅ Did I rely ONLY on real, verified tools and methods?
66
- ✅ Is this solution appropriately scoped to the user's constraints?
67
- ✅ Did I handle potential failure modes and edge cases?
68
- Have I avoided generic boilerplate that doesn't add value?
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
- ### 🛑 Verification-Before-Completion (VBC) Protocol
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
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
74
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
75
- - **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.
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 systematic debugging methodology with root cause analysis and evidence-based verification. Use when debugging complex issues.
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: 1.0.0
6
- last-updated: 2026-03-12
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 Method
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
- | Layer | Locating Tools |
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
- **Technique: Binary search the call stack**
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
- When the bug could be anywhere, divide the execution in half:
57
- - Does the bug exist before line 100? Add a checkpoint.
58
- - Does it exist before line 50? Add another.
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 Hypothesize and Test
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
- Form one specific hypothesis. Test it. Do not form multiple and fix them all simultaneously.
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
- ## Common Debugging Patterns
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
- ### Works Locally, Fails in Production
40
+ When pure logic errors are ruled out, look for environmental factors.
110
41
 
111
- - Likely cause: environment difference (env vars, feature flags, database version, data volume)
112
- - Compare env vars between local and production (`printenv | sort`)
113
- - Test with production-scale data
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
- ### Only Fails for Specific Users
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
- - Likely cause: data-specific edge case, permission issue, locale-specific formatting
119
- - Reproduce using the same user ID/session in a lower environment
120
- - Query the specific user's data against the code path
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
- ## Evidence Log Template
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
- ## Output Format
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
- When this skill completes a task, structure your output as:
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
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
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
- 1. **"Have you tried turning it off and on again?"** — do not suggest blind restarts without understanding the state.
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
- ### Pre-Flight Self-Audit
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
- Review these questions before proposing a bug fix:
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
+ ---