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,76 +1,159 @@
1
- ---
2
- name: web-accessibility-auditor
3
- description: Hardcore digital accessibility (a11y) auditor and WCAG 2.2 expert. Enforces semantic HTML, keyboard operability, screen reader support, and robust contrast.
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
- # Web Accessibility (A11y) Auditor
11
-
12
- You are a WCAG 2.2 strict compliance auditor. Your sole purpose is to ruthlessly critique HTML and React codebases for accessibility violations, ensuring digital products remain usable for all individuals, including those operating assistive technologies.
13
-
14
- ## Core Directives
15
-
16
- 1. **Semantic HTML is Law:**
17
- - Do not replace `<button>` with a `<div onClick={...}>`.
18
- - Ensure proper `<label>` to `id` mapping for every single form input.
19
- - Verify correct heading hierarchies (`<h1>` followed by `<h2>`, no skipped levels).
20
-
21
- 2. **Keyboard Operability:**
22
- - All interactive elements must be reachable via the `Tab` key (have a `tabindex="0"` or natively support it).
23
- - Ensure visible focus states are present (`:focus-visible`). Provide highly contrasted outlines; never apply `outline: none` without a fallback visual indicator.
24
-
25
- 3. **Screen Reader (ARIA) Usage:**
26
- - *First rule of ARIA: No ARIA is better than bad ARIA.* Rely on native elements before resorting to `role="..."`.
27
- - Clearly dictate states for dynamic components using `aria-expanded`, `aria-hidden`, `aria-current`, and `aria-live` for notifications.
28
-
29
- 4. **Meaningful Contrast & Media:**
30
- - Ensure text has a minimum contrast ratio of 4.5:1 against its background.
31
- - All `<img>` tags must include descriptive `alt` text. Decorative images must explicitly set `alt=""`.
32
-
33
- ## Execution
34
- When auditing a file, explicitly point out any `onClick` handlers on non-interactive elements, missing `aria-labels` on icon-only buttons, and bad color pairings. Write the exact React/HTML delta needed to pass a strict automated Axe-core scan.
1
+ ---
2
+ name: web-accessibility-auditor
3
+ description: Web Accessibility (a11y) mastery. WCAG 2.2 AA standards, semantic HTML, ARIA attributes, keyboard navigation, focus management, screen reader compatibility, color contrast, and dynamic content announcements. Use when building UI components or auditing frontend code for accessibility compliance.
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
+ ---
35
9
 
10
+ # Web Accessibility (a11y) — Inclusive UI Mastery
36
11
 
37
12
  ---
38
13
 
39
- ## 🤖 LLM-Specific Traps
14
+ ## 1. Semantic HTML over `<div>` Soup
15
+
16
+ The first rule of ARIA: **Use native HTML elements whenever possible.**
17
+
18
+ ```html
19
+ <!-- ❌ BAD: Meaningless markup, screen readers see nothing, no keyboard focus -->
20
+ <div class="submit-button" onclick="submit()">Submit</div>
40
21
 
41
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
22
+ <!-- GOOD: Native semantic element (inherits focus, Enter/Space key behavior) -->
23
+ <button type="submit" class="button">Submit</button>
42
24
 
43
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
44
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
45
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
46
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
47
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
25
+ <!-- BAD: Div as a link -->
26
+ <div onclick="goToPath('/about')">About Us</div>
27
+
28
+ <!-- GOOD: Native anchor -->
29
+ <a href="/about">About Us</a>
30
+ ```
31
+
32
+ ### Layout Semantics
33
+ Replace `<div class="x">` with meaning:
34
+ - `<header>` / `<footer>`
35
+ - `<nav>` (Main navigations)
36
+ - `<main>` (The primary content)
37
+ - `<article>` (Self-contained content blocks)
38
+ - `<aside>` (Sidebars, callouts)
48
39
 
49
40
  ---
50
41
 
51
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
42
+ ## 2. Keyboard Navigation & Focus Management
52
43
 
53
- **Slash command: `/review` or `/tribunal-full`**
54
- **Active reviewers: `logic-reviewer` · `security-auditor`**
44
+ Every interactive element MUST be keyboard accessible.
55
45
 
56
- ### ❌ Forbidden AI Tropes
46
+ ```css
47
+ /* ❌ BAD: Removing focus outlines ruins keyboard navigation */
48
+ *:focus { outline: none; }
57
49
 
58
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
59
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
60
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
50
+ /* GOOD: Using :focus-visible for keyboard users only */
51
+ *:focus { outline: none; } /* Hide for click */
52
+ *:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
53
+ ```
61
54
 
62
- ### Pre-Flight Self-Audit
55
+ ### Managing Focus in Modals (Dialogs)
56
+ When a modal opens:
57
+ 1. Focus must move into the modal (first focusable element).
58
+ 2. Focus must be trapped inside the modal (Tabbing loops inside it).
59
+ 3. Background must be hidden from screen readers (`aria-hidden="true"`).
60
+ 4. `Escape` key must close it.
61
+ 5. When closed, focus returns to the button that opened it.
63
62
 
64
- Review these questions before confirming output:
63
+ ```html
64
+ <!-- ✅ BEST: Use the native <dialog> element. It handles focus trapping automatically! -->
65
+ <dialog id="myModal">
66
+ <h2>Settings</h2>
67
+ <button formmethod="dialog">Close</button>
68
+ </dialog>
69
+ <script>document.getElementById('myModal').showModal();</script>
65
70
  ```
66
- ✅ Did I rely ONLY on real, verified tools and methods?
67
- ✅ Is this solution appropriately scoped to the user's constraints?
68
- ✅ Did I handle potential failure modes and edge cases?
69
- Have I avoided generic boilerplate that doesn't add value?
71
+
72
+ ---
73
+
74
+ ## 3. ARIA Roles & Attributes
75
+
76
+ When you build complex custom widgets (like tabs or accordions), you must apply ARIA attributes to tell screen readers what it is and what state it's in.
77
+
78
+ ```html
79
+ <!-- Example: Custom Accordion/Disclosure -->
80
+ <!-- ❌ BAD: Screen reader sees plain text, doesn't know it's expandable -->
81
+ <div class="accordion">
82
+ <div class="header">Advanced Settings</div>
83
+ <div class="content" style="display: none;">...</div>
84
+ </div>
85
+
86
+ <!-- ✅ GOOD: ARIA provides context -->
87
+ <div class="accordion">
88
+ <button
89
+ aria-expanded="false"
90
+ aria-controls="panel-id"
91
+ id="header-id"
92
+ >
93
+ Advanced Settings
94
+ </button>
95
+ <div
96
+ id="panel-id"
97
+ role="region"
98
+ aria-labelledby="header-id"
99
+ hidden
100
+ >
101
+ ...
102
+ </div>
103
+ </div>
70
104
  ```
71
105
 
72
- ### 🛑 Verification-Before-Completion (VBC) Protocol
106
+ **Crucial ARIA states:**
107
+ - `aria-expanded="true/false"`: For accordions, dropdowns, menus.
108
+ - `aria-hidden="true"`: Removes decorative icons/containers from the screen reader tree.
109
+ - `aria-pressed="true/false"`: For toggle buttons.
110
+ - `aria-invalid="true"`: For invalid form fields.
111
+
112
+ ---
73
113
 
74
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
75
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
76
- - ✅ **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.
114
+ ## 4. Forms & Labels
115
+
116
+ **Every input must have an associated label.** `placeholder` is NOT a label (it disappears when typing, causing cognitive loss).
117
+
118
+ ```html
119
+ <!-- ❌ BAD -->
120
+ <input type="text" placeholder="Email Address">
121
+
122
+ <!-- ✅ GOOD: Explicit linking via id/for -->
123
+ <label for="email">Email Address</label>
124
+ <input type="email" id="email" name="email">
125
+
126
+ <!-- ✅ GOOD: Implicit wrapping -->
127
+ <label>
128
+ Email Address
129
+ <input type="email" name="email">
130
+ </label>
131
+
132
+ <!-- Accessible Error Messages -->
133
+ <label for="username">Username</label>
134
+ <input
135
+ type="text"
136
+ id="username"
137
+ aria-invalid="true"
138
+ aria-describedby="username-error"
139
+
140
+ <span id="username-error" role="alert" class="error-msg">Username is already taken</span>
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 5. Live Regions (Dynamic Updates)
146
+
147
+ When content changes dynamically without a page reload (e.g., Toast notifications, AI responding, search results updating), the screen reader needs to be notified.
148
+
149
+ ```html
150
+ <!--
151
+ role="alert": Interrupts the user immediately (e.g., error).
152
+ role="status" (or aria-live="polite"): Waits until the user pauses, then announces.
153
+ -->
154
+ <div aria-live="polite" class="sr-only">
155
+ <!-- JavaScript injects: "3 items found" here, screen reader reads it aloud -->
156
+ </div>
157
+ ```
158
+
159
+ ---
@@ -9,9 +9,6 @@ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
9
9
 
10
10
  # Next-Gen Web Interface Review Guidelines (Pro-Max Level)
11
11
 
12
- > Good UI is invisible. Users think about their task, not about the interface.
13
- > Great UI anticipates the task and reacts at the speed of thought.
14
-
15
12
  ---
16
13
 
17
14
  ## Review Trigger
@@ -30,23 +27,23 @@ Load this skill when asked to:
30
27
 
31
28
  Non-negotiable baseline for any public interface in 2026+:
32
29
 
33
- | Check | How to Verify |
30
+ |Check|How to Verify|
34
31
  |---|---|
35
- | **APCA Contrast** | Ensure Lc (Lightness Contrast) is > 75 for body text, > 60 for large text. (Do not rely solely on old WCAG 2.1 4.5:1 math). |
36
- | **Cognitive Safety** | Check if `prefers-reduced-motion` is respected. No infinite spinning loaders. |
37
- | **Keyboard Fluidity** | Tab order must follow visual order. Focus states cannot be just a 1px dotted line; use `outline: 2px solid var(--focus-color); outline-offset: 2px;`. |
38
- | **Semantic AI Context** | Images must have `alt` tags, but complex charts need full `<details>` breakdowns for screen readers and AI agents crawling the site. |
39
- | **Interaction Buffers** | Are touch targets mathematically ≥48px (Fitts' Law)? |
32
+ |**APCA Contrast**|Ensure Lc (Lightness Contrast) is > 75 for body text, > 60 for large text. (Do not rely solely on old WCAG 2.1 4.5:1 math).|
33
+ |**Cognitive Safety**|Check if `prefers-reduced-motion` is respected. No infinite spinning loaders.|
34
+ |**Keyboard Fluidity**|Tab order must follow visual order. Focus states cannot be just a 1px dotted line; use `outline: 2px solid var(--focus-color); outline-offset: 2px;`.|
35
+ |**Semantic AI Context**|Images must have `alt` tags, but complex charts need full `<details>` breakdowns for screen readers and AI agents crawling the site.|
36
+ |**Interaction Buffers**|Are touch targets mathematically ≥48px (Fitts' Law)?|
40
37
 
41
38
  ### 2. Extreme Core Web Vitals (CWV)
42
39
 
43
40
  Drop the old 2022 standards. The new baseline for premium web:
44
41
 
45
- | Metric | Premium Target | Common Failures |
42
+ |Metric|Premium Target|Common Failures|
46
43
  |---|---|---|
47
- | **LCP** (Largest Contentful Paint) | **< 1.5s** | Missing `fetchpriority="high"` on hero images. Heavy client-side React rendering blocking the paint. |
48
- | **INP** (Interaction to Next Paint) | **< 100ms** | Main thread blocked by React hydrate. Use `startTransition` or Web Workers for heavy JS. |
49
- | **CLS** (Cumulative Layout Shift) | **0.00** | Missing `width` and `height` on images. Late-loading web fonts (use `font-display: optional`). |
44
+ |**LCP** (Largest Contentful Paint)|**< 1.5s**|Missing `fetchpriority="high"` on hero images. Heavy client-side React rendering blocking the paint.|
45
+ |**INP** (Interaction to Next Paint)|**< 100ms**|Main thread blocked by React hydrate. Use `startTransition` or Web Workers for heavy JS.|
46
+ |**CLS** (Cumulative Layout Shift)|**0.00**|Missing `width` and `height` on images. Late-loading web fonts (use `font-display: optional`).|
50
47
 
51
48
  ### 3. Energy Efficiency & Sustainability
52
49
 
@@ -75,14 +72,14 @@ Evaluate these brutally honestly:
75
72
 
76
73
  ## Common Review Findings
77
74
 
78
- | Finding | Severity | Fix |
75
+ |Finding|Severity|Fix|
79
76
  |---|---|---|
80
- | Missing/Weak focus styles | High | Add visible `:focus-visible` with offset |
81
- | `margin`/`padding` animated | High | Change to `transform: translate()` |
82
- | Touch targets under 48px | High | Increase padding/min-height |
83
- | Layout shifts on load (CLS > 0) | High | Pre-allocate space for async content/images |
84
- | Linear CSS transitions | Medium | Upgrade to spring-based `cubic-bezier` curves |
85
- | Purple as primary color | Low/Brand | Rethink palette — overused AI design cliché |
77
+ |Missing/Weak focus styles|High|Add visible `:focus-visible` with offset|
78
+ |`margin`/`padding` animated|High|Change to `transform: translate()`|
79
+ |Touch targets under 48px|High|Increase padding/min-height|
80
+ |Layout shifts on load (CLS > 0)|High|Pre-allocate space for async content/images|
81
+ |Linear CSS transitions|Medium|Upgrade to spring-based `cubic-bezier` curves|
82
+ |Purple as primary color|Low/Brand|Rethink palette — overused AI design cliché|
86
83
 
87
84
  ---
88
85
 
@@ -128,45 +125,4 @@ Pre-Flight: ✅ All checks passed
128
125
  or ❌ [blocking item that must be resolved first]
129
126
  ```
130
127
 
131
-
132
-
133
128
  ---
134
-
135
- ## 🤖 LLM-Specific Traps
136
-
137
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
138
-
139
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
140
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
141
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
142
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
143
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
144
-
145
- ---
146
-
147
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
148
-
149
- **Slash command: `/review` or `/tribunal-full`**
150
- **Active reviewers: `logic-reviewer` · `security-auditor`**
151
-
152
- ### ❌ Forbidden AI Tropes
153
-
154
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
155
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
156
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
157
-
158
- ### ✅ Pre-Flight Self-Audit
159
-
160
- Review these questions before confirming output:
161
- ```
162
- ✅ Did I rely ONLY on real, verified tools and methods?
163
- ✅ Is this solution appropriately scoped to the user's constraints?
164
- ✅ Did I handle potential failure modes and edge cases?
165
- ✅ Have I avoided generic boilerplate that doesn't add value?
166
- ```
167
-
168
- ### 🛑 Verification-Before-Completion (VBC) Protocol
169
-
170
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
171
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
172
- - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -1,236 +1,111 @@
1
1
  ---
2
2
  name: webapp-testing
3
- description: Web application testing principles. E2E, Playwright, deep audit strategies.
3
+ description: Comprehensive Web Application Testing strategy. Test Pyramid, Vitest/Jest for unit logic, React Testing Library for component integrity, MSW (Mock Service Worker) for API layer simulation, and visual regression. Use when setting up testing environments or defining global test strategies across a web stack.
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
- # Web Application Testing
11
-
12
- > E2E tests are the most expensive tests to write and maintain.
13
- > Write them for the flows that would wake someone up at 2am if they broke.
10
+ # Webapp Testing — Full Stack Pipeline Mastery
14
11
 
15
12
  ---
16
13
 
17
- ## What Belongs in E2E Tests
18
-
19
- E2E tests simulate a real user in a real browser. Use them selectively:
14
+ ## 1. The Strategy (The Testing Trophy)
20
15
 
21
- **Should be E2E:**
22
- - User can register and log in
23
- - User can complete a purchase / checkout flow
24
- - Critical form submission that triggers business logic
25
- - OAuth login flows
26
- - File upload and processing
16
+ The traditional "Testing Pyramid" (lots of Unit, little E2E) is outdated for rich UI applications. Use the **Testing Trophy**:
27
17
 
28
- **Should NOT be E2E:**
29
- - Individual UI component appearance (use unit/visual tests)
30
- - API data validation (use API/integration tests)
31
- - Error message text (too brittle, too low value)
32
- - Every edge case (test edge cases at the service/unit level)
18
+ 1. **Static Analysis (10%)**: TypeScript, ESLint, Prettier (Catches typos and type mismatches instantly).
19
+ 2. **Unit Tests (20%)**: Vitest (Tests complex pure functions: math, formatting, data mapping).
20
+ 3. **Integration Tests (60%)**: React Testing Library + MSW (Tests components and network mock interactions together).
21
+ 4. **End-to-End Tests (10%)**: Playwright (Tests the critical path: Login, Checkout, Account Creation on a real browser).
33
22
 
34
23
  ---
35
24
 
36
- ## Playwright Patterns
25
+ ## 2. Integration Layer (React Testing Library + MSW)
37
26
 
38
- ### Page Object Model
27
+ Do not mock child components. Render the specific DOM tree and interact with it as a user would.
39
28
 
40
- Encapsulate page interactions to keep tests maintainable:
29
+ To prevent network calls, utilize Mock Service Worker (MSW) which intercepts requests at the network layer natively.
41
30
 
42
- ```ts
43
- // page-objects/LoginPage.ts
44
- export class LoginPage {
45
- constructor(private page: Page) {}
31
+ ```typescript
32
+ // ❌ BAD: Mocking implementation details
33
+ jest.mock('axios');
34
+ axios.get.mockResolvedValue({ data: { users: [] } });
46
35
 
47
- get emailInput() { return this.page.getByLabel('Email'); }
48
- get passwordInput() { return this.page.getByLabel('Password'); }
49
- get submitButton() { return this.page.getByRole('button', { name: 'Sign in' }); }
36
+ // GOOD: MSW (Mock Service Worker) network level interception
37
+ // The component functions EXACTLY as it would in production
38
+ import { http, HttpResponse } from 'msw'
39
+ import { setupServer } from 'msw/node'
50
40
 
51
- async login(email: string, password: string) {
52
- await this.emailInput.fill(email);
53
- await this.passwordInput.fill(password);
54
- await this.submitButton.click();
55
- }
56
- }
41
+ export const handlers = [
42
+ http.get('/api/users', () => {
43
+ return HttpResponse.json([
44
+ { id: 1, name: 'John Appleseed' },
45
+ ])
46
+ }),
47
+ ]
48
+ const server = setupServer(...handlers)
57
49
 
58
- // tests/auth.spec.ts
59
- test('user can log in with valid credentials', async ({ page }) => {
60
- const loginPage = new LoginPage(page);
61
- await page.goto('/login');
62
- await loginPage.login('user@test.com', 'password123');
63
- await expect(page).toHaveURL('/dashboard');
64
- });
50
+ beforeAll(() => server.listen())
51
+ afterEach(() => server.resetHandlers())
52
+ afterAll(() => server.close())
65
53
  ```
66
54
 
67
- ### Locator Strategy (Priority Order)
68
-
69
- Prefer locators that reflect how the user thinks about the element:
70
-
71
- ```ts
72
- // 1. Role (most semantic, most resilient)
73
- page.getByRole('button', { name: 'Submit' })
74
- page.getByRole('textbox', { name: 'Email' })
75
-
76
- // 2. Label (tied to accessibility — good signal)
77
- page.getByLabel('Email address')
78
-
79
- // 3. Text (works but can be fragile if copy changes)
80
- page.getByText('Welcome back')
81
-
82
- // 4. Test ID (last resort — doesn't break on copy/layout changes)
83
- page.getByTestId('submit-button')
84
-
85
- // ❌ Never (fragile — breaks on any CSS refactor)
86
- page.locator('.btn.btn-primary.submit')
87
- page.locator('#form > div:nth-child(2) > input')
88
- ```
89
-
90
- ### Waiting for State
91
-
92
- ```ts
93
- // ✅ Wait for network idle before asserting
94
- await page.waitForLoadState('networkidle');
55
+ ### Component Testing (RTL)
95
56
 
96
- // ✅ Wait for a specific element
97
- await page.waitForSelector('[data-testid="results"]');
57
+ ```typescript
58
+ import { render, screen, waitFor } from '@testing-library/react';
59
+ import userEvent from '@testing-library/user-event';
98
60
 
99
- // Assertion-based waiting (Playwright retries automatically)
100
- await expect(page.getByText('Order confirmed')).toBeVisible();
61
+ test('Should load users and render names', async () => {
62
+ // userEvent closely replicates real browser physics (focusing, keystrokes)
63
+ const user = userEvent.setup();
64
+
65
+ render(<UserDashboard />);
101
66
 
102
- // Fixed sleep (brittle — too short in CI, too slow locally)
103
- await page.waitForTimeout(2000);
104
- ```
105
-
106
- ---
67
+ // Initial State
68
+ expect(screen.getByText('Loading...')).toBeInTheDocument();
107
69
 
108
- ## Test Data Management
70
+ // Async Resolution (Auto-waits for the MSW mock to return)
71
+ const johnNode = await screen.findByText('John Appleseed');
72
+ expect(johnNode).toBeInTheDocument();
109
73
 
110
- Keep test data predictable and isolated:
74
+ // Interaction
75
+ const deleteBtn = screen.getByRole('button', { name: "Delete John" });
76
+ await user.click(deleteBtn);
111
77
 
112
- ```ts
113
- // Seed database before tests that need specific data
114
- test.beforeEach(async ({ request }) => {
115
- await request.post('/api/test/seed', {
116
- data: { users: [testUser], products: [testProduct] }
117
- });
118
- });
119
-
120
- // Clean up after
121
- test.afterEach(async ({ request }) => {
122
- await request.delete('/api/test/cleanup');
78
+ // Verification
79
+ expect(johnNode).not.toBeInTheDocument();
123
80
  });
124
81
  ```
125
82
 
126
- **Rules:**
127
- - Each test owns its data and cleans up after itself
128
- - Tests don't share state through the database
129
- - Test accounts are distinguishable from real accounts (prefix: `test_`)
130
-
131
83
  ---
132
84
 
133
- ## CI/CD Integration
134
-
135
- ```yaml
136
- # GitHub Actions example
137
- playwright-tests:
138
- runs-on: ubuntu-latest
139
- steps:
140
- - uses: actions/checkout@v4
141
- - uses: actions/setup-node@v4
142
- - run: npm ci
143
- - run: npx playwright install --with-deps
144
- - run: npm run test:e2e
145
- - uses: actions/upload-artifact@v4
146
- if: failure()
147
- with:
148
- name: playwright-report
149
- path: playwright-report/
150
- ```
151
-
152
- **Key configurations:**
153
-
154
- ```ts
155
- // playwright.config.ts
156
- export default defineConfig({
157
- testDir: './tests/e2e',
158
- fullyParallel: true,
159
- retries: process.env.CI ? 2 : 0, // retry only in CI
160
- workers: process.env.CI ? 4 : 1,
161
- reporter: [['html'], ['github']],
162
- use: {
163
- baseURL: process.env.BASE_URL || 'http://localhost:3000',
164
- screenshot: 'only-on-failure',
165
- video: 'retain-on-failure',
166
- trace: 'on-first-retry',
167
- },
168
- });
169
- ```
170
-
171
- ---
85
+ ## 3. Pure Unit Testing (Vitest)
172
86
 
173
- ## Scripts
87
+ Isolate business logic entirely from React.
174
88
 
175
- | Script | Purpose | Run With |
176
- |---|---|---|
177
- | `scripts/playwright_runner.py` | Runs Playwright test suite and reports | `python scripts/playwright_runner.py <project_path>` |
178
-
179
- ---
180
-
181
- ## Output Format
89
+ ```typescript
90
+ // ✅ Move complex logic OUT of the React component entirely
91
+ export function calculateTax(subtotal: number, state: string): number {
92
+ if (subtotal < 0) throw new Error("Subtotal cannot be negative");
93
+ if (state === "CA") return subtotal * 0.0825;
94
+ return 0; // Default
95
+ }
182
96
 
183
- When this skill completes a task, structure your output as:
97
+ // Test with extreme precision and coverage
98
+ import { describe, it, expect } from 'vitest';
184
99
 
100
+ describe('calculateTax()', () => {
101
+ it('applies CA tax correctly', () => {
102
+ expect(calculateTax(100, 'CA')).toBe(8.25);
103
+ });
104
+
105
+ it('throws on negative input', () => {
106
+ expect(() => calculateTax(-50, 'CA')).toThrowError('negative');
107
+ });
108
+ });
185
109
  ```
186
- ━━━ Webapp Testing Output ━━━━━━━━━━━━━━━━━━━━━━━━
187
- Task: [what was performed]
188
- Result: [outcome summary — one line]
189
- ─────────────────────────────────────────────────
190
- Checks: ✅ [N passed] · ⚠️ [N warnings] · ❌ [N blocked]
191
- VBC status: PENDING → VERIFIED
192
- Evidence: [link to terminal output, test result, or file diff]
193
- ```
194
-
195
-
196
110
 
197
111
  ---
198
-
199
- ## 🤖 LLM-Specific Traps
200
-
201
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
202
-
203
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
204
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
205
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
206
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
207
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
208
-
209
- ---
210
-
211
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
212
-
213
- **Slash command: `/review` or `/tribunal-full`**
214
- **Active reviewers: `logic-reviewer` · `security-auditor`**
215
-
216
- ### ❌ Forbidden AI Tropes
217
-
218
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
219
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
220
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
221
-
222
- ### ✅ Pre-Flight Self-Audit
223
-
224
- Review these questions before confirming output:
225
- ```
226
- ✅ Did I rely ONLY on real, verified tools and methods?
227
- ✅ Is this solution appropriately scoped to the user's constraints?
228
- ✅ Did I handle potential failure modes and edge cases?
229
- ✅ Have I avoided generic boilerplate that doesn't add value?
230
- ```
231
-
232
- ### 🛑 Verification-Before-Completion (VBC) Protocol
233
-
234
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
235
- - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
236
- - ✅ **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.