tribunal-kit 1.0.0 → 2.4.2

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 (127) hide show
  1. package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
  2. package/.agent/ARCHITECTURE.md +205 -10
  3. package/.agent/GEMINI.md +37 -7
  4. package/.agent/agents/accessibility-reviewer.md +134 -0
  5. package/.agent/agents/ai-code-reviewer.md +129 -0
  6. package/.agent/agents/frontend-specialist.md +3 -0
  7. package/.agent/agents/game-developer.md +21 -21
  8. package/.agent/agents/logic-reviewer.md +12 -0
  9. package/.agent/agents/mobile-reviewer.md +79 -0
  10. package/.agent/agents/orchestrator.md +56 -26
  11. package/.agent/agents/performance-reviewer.md +36 -0
  12. package/.agent/agents/supervisor-agent.md +156 -0
  13. package/.agent/agents/swarm-worker-contracts.md +166 -0
  14. package/.agent/agents/swarm-worker-registry.md +92 -0
  15. package/.agent/rules/GEMINI.md +134 -5
  16. package/.agent/scripts/bundle_analyzer.py +259 -0
  17. package/.agent/scripts/dependency_analyzer.py +247 -0
  18. package/.agent/scripts/lint_runner.py +188 -0
  19. package/.agent/scripts/patch_skills_meta.py +177 -0
  20. package/.agent/scripts/patch_skills_output.py +285 -0
  21. package/.agent/scripts/schema_validator.py +279 -0
  22. package/.agent/scripts/security_scan.py +224 -0
  23. package/.agent/scripts/session_manager.py +144 -3
  24. package/.agent/scripts/skill_integrator.py +234 -0
  25. package/.agent/scripts/strengthen_skills.py +220 -0
  26. package/.agent/scripts/swarm_dispatcher.py +317 -0
  27. package/.agent/scripts/test_runner.py +192 -0
  28. package/.agent/scripts/test_swarm_dispatcher.py +163 -0
  29. package/.agent/skills/agent-organizer/SKILL.md +132 -0
  30. package/.agent/skills/agentic-patterns/SKILL.md +335 -0
  31. package/.agent/skills/api-patterns/SKILL.md +226 -50
  32. package/.agent/skills/app-builder/SKILL.md +215 -52
  33. package/.agent/skills/architecture/SKILL.md +176 -31
  34. package/.agent/skills/bash-linux/SKILL.md +150 -134
  35. package/.agent/skills/behavioral-modes/SKILL.md +152 -160
  36. package/.agent/skills/brainstorming/SKILL.md +148 -101
  37. package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
  38. package/.agent/skills/clean-code/SKILL.md +139 -134
  39. package/.agent/skills/code-review-checklist/SKILL.md +177 -80
  40. package/.agent/skills/config-validator/SKILL.md +165 -0
  41. package/.agent/skills/csharp-developer/SKILL.md +107 -0
  42. package/.agent/skills/database-design/SKILL.md +252 -29
  43. package/.agent/skills/deployment-procedures/SKILL.md +122 -175
  44. package/.agent/skills/devops-engineer/SKILL.md +134 -0
  45. package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
  46. package/.agent/skills/documentation-templates/SKILL.md +175 -121
  47. package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
  48. package/.agent/skills/edge-computing/SKILL.md +213 -0
  49. package/.agent/skills/frontend-design/SKILL.md +76 -0
  50. package/.agent/skills/frontend-design/color-system.md +18 -0
  51. package/.agent/skills/frontend-design/typography-system.md +18 -0
  52. package/.agent/skills/game-development/SKILL.md +69 -0
  53. package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
  54. package/.agent/skills/github-operations/SKILL.md +354 -0
  55. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  56. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  57. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  58. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  59. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  60. package/.agent/skills/local-first/SKILL.md +203 -0
  61. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  62. package/.agent/skills/mobile-design/SKILL.md +102 -282
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  65. package/.agent/skills/observability/SKILL.md +285 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  67. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  68. package/.agent/skills/plan-writing/SKILL.md +133 -97
  69. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  70. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  71. package/.agent/skills/python-patterns/SKILL.md +149 -361
  72. package/.agent/skills/python-pro/SKILL.md +114 -0
  73. package/.agent/skills/react-specialist/SKILL.md +107 -0
  74. package/.agent/skills/readme-builder/SKILL.md +270 -0
  75. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  76. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  77. package/.agent/skills/rust-pro/SKILL.md +237 -173
  78. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  79. package/.agent/skills/server-management/SKILL.md +155 -104
  80. package/.agent/skills/sql-pro/SKILL.md +104 -0
  81. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  82. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  83. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  84. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  85. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  86. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  87. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  88. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  89. package/.agent/skills/vue-expert/SKILL.md +118 -0
  90. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  91. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  92. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  93. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  95. package/.agent/workflows/api-tester.md +279 -0
  96. package/.agent/workflows/audit.md +168 -0
  97. package/.agent/workflows/brainstorm.md +65 -19
  98. package/.agent/workflows/changelog.md +144 -0
  99. package/.agent/workflows/create.md +67 -14
  100. package/.agent/workflows/debug.md +122 -30
  101. package/.agent/workflows/deploy.md +82 -31
  102. package/.agent/workflows/enhance.md +59 -27
  103. package/.agent/workflows/fix.md +143 -0
  104. package/.agent/workflows/generate.md +84 -20
  105. package/.agent/workflows/migrate.md +163 -0
  106. package/.agent/workflows/orchestrate.md +66 -17
  107. package/.agent/workflows/performance-benchmarker.md +305 -0
  108. package/.agent/workflows/plan.md +76 -33
  109. package/.agent/workflows/preview.md +73 -17
  110. package/.agent/workflows/refactor.md +153 -0
  111. package/.agent/workflows/review-ai.md +140 -0
  112. package/.agent/workflows/review.md +83 -16
  113. package/.agent/workflows/session.md +154 -0
  114. package/.agent/workflows/status.md +74 -18
  115. package/.agent/workflows/strengthen-skills.md +99 -0
  116. package/.agent/workflows/swarm.md +194 -0
  117. package/.agent/workflows/test.md +80 -31
  118. package/.agent/workflows/tribunal-backend.md +55 -13
  119. package/.agent/workflows/tribunal-database.md +62 -18
  120. package/.agent/workflows/tribunal-frontend.md +58 -12
  121. package/.agent/workflows/tribunal-full.md +70 -11
  122. package/.agent/workflows/tribunal-mobile.md +123 -0
  123. package/.agent/workflows/tribunal-performance.md +152 -0
  124. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  125. package/README.md +117 -62
  126. package/bin/tribunal-kit.js +542 -288
  127. package/package.json +10 -6
@@ -1,57 +1,172 @@
1
1
  ---
2
2
  name: web-design-guidelines
3
- description: Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
4
- metadata:
5
- author: vercel
6
- version: "1.0.0"
7
- argument-hint: <file-or-pattern>
3
+ description: Review UI code for Next-Generation Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-03-12
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
8
  ---
9
9
 
10
- # Web Interface Guidelines
10
+ # Next-Gen Web Interface Review Guidelines (Pro-Max Level)
11
11
 
12
- Review files for compliance with Web Interface Guidelines.
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.
13
14
 
14
- ## How It Works
15
+ ---
16
+
17
+ ## Review Trigger
18
+
19
+ Load this skill when asked to:
20
+ - Review or audit a UI
21
+ - Check accessibility compliance (WCAG 3.0 / APCA)
22
+ - Improve UX & Cognitive Safety
23
+ - Check a site against best practices
24
+
25
+ ---
26
+
27
+ ## Extreme Review Categories
28
+
29
+ ### 1. Neuro-Inclusivity & Accessibility (WCAG 3.0 APCA Base)
30
+
31
+ Non-negotiable baseline for any public interface in 2026+:
32
+
33
+ | Check | How to Verify |
34
+ |---|---|
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)? |
40
+
41
+ ### 2. Extreme Core Web Vitals (CWV)
42
+
43
+ Drop the old 2022 standards. The new baseline for premium web:
15
44
 
16
- 1. Fetch the latest guidelines from the source URL below
17
- 2. Read the specified files (or prompt user for files/pattern)
18
- 3. Check against all rules in the fetched guidelines
19
- 4. Output findings in the terse `file:line` format
45
+ | Metric | Premium Target | Common Failures |
46
+ |---|---|---|
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`). |
20
50
 
21
- ## Guidelines Source
51
+ ### 3. Energy Efficiency & Sustainability
22
52
 
23
- Fetch fresh guidelines before each review:
53
+ Code has a carbon footprint and a battery cost.
24
54
 
55
+ - **OLED Pure Black:** Does the dark mode use `#000` or `#010101` to physically turn off pixels?
56
+ - **Animation Tax:** Are animations using CPU-heavy properties (`margin`, `width`) instead of GPU-accelerated ones (`transform`, `opacity`)?
57
+ - **Asset Weight:** Are images AVIF/WebP? Are fonts subsetted Variable Fonts?
58
+
59
+ ### 4. Visual Design Quality (Pro-Max)
60
+
61
+ Evaluate these brutally honestly:
62
+
63
+ - **Mathematical Spacing:** Does spacing follow a strict scale (e.g., 4, 8, 16, 24, 32) or is it a mess of arbitrary pixels?
64
+ - **Fluid Typography:** Is text using `clamp()` to scale, or does it awkwardly jump at breakpoints?
65
+ - **The "Purple Ban":** Is the site heavily relying on deep purple/violet as a primary color? (Flag this as an overused AI-generated cliché).
66
+ - **Z-Axis Depth:** Are shadows realistic (multi-layered CSS shadows) or flat and cheap (`box-shadow: 0 4px 6px #000`)?
67
+ - **Micro-Interactions:** Do buttons scale down slightly on `:active`? Do elements use spring-physics easing (`cubic-bezier(0.34, 1.56, 0.64, 1)`)?
68
+
69
+ ### 5. AI & Streaming UX
70
+
71
+ - **Zero-Wait States:** If the app is waiting for an LLM/Server response, does it show a static spinner (BAD) or stream the skeleton/content (GOOD)?
72
+ - **Optimistic UI:** Do likes/saves update the UI *instantly* before the server confirms?
73
+
74
+ ---
75
+
76
+ ## Common Review Findings
77
+
78
+ | Finding | Severity | Fix |
79
+ |---|---|---|
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é |
86
+
87
+ ---
88
+
89
+ ## Audit Format Template
90
+
91
+ When reporting a UI review, use this exact brutal structure:
92
+
93
+ ```markdown
94
+ ## UI/UX Pro-Max Review: [Component/Page Name]
95
+
96
+ ### ♿ Neuro-Inclusivity & A11y
97
+ - [BLOCKER] [Finding with specific element and fix]
98
+ - [WARN] [Finding]
99
+
100
+ ### ⚡ Performance & Energy (CWV)
101
+ - [Finding]
102
+
103
+ ### 🎨 Visual & Spatial Quality
104
+ - [Finding]
105
+
106
+ ### 🛠️ Interaction & Physics
107
+ - [Finding]
108
+
109
+ ### Summary
110
+ X blockers, Y warnings, Z suggestions.
111
+ Recommended action before shipping: [specific steps]
25
112
  ```
26
- https://raw.githubusercontent.com/vercel-labs/web-interface-guidelines/main/command.md
113
+
114
+ ---
115
+
116
+ ## Output Format
117
+
118
+ When this skill produces a recommendation or design decision, structure your output as:
119
+
120
+ ```
121
+ ━━━ Web Design Guidelines Recommendation ━━━━━━━━━━━━━━━━
122
+ Decision: [what was chosen / proposed]
123
+ Rationale: [why — one concise line]
124
+ Trade-offs: [what is consciously accepted]
125
+ Next action: [concrete next step for the user]
126
+ ─────────────────────────────────────────────────
127
+ Pre-Flight: ✅ All checks passed
128
+ or ❌ [blocking item that must be resolved first]
27
129
  ```
28
130
 
29
- Use WebFetch to retrieve the latest rules. The fetched content contains all the rules and output format instructions.
30
131
 
31
- ## Usage
32
132
 
33
- When a user provides a file or pattern argument:
34
- 1. Fetch guidelines from the source URL above
35
- 2. Read the specified files
36
- 3. Apply all rules from the fetched guidelines
37
- 4. Output findings using the format specified in the guidelines
133
+ ---
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:
38
138
 
39
- If no files specified, ask the user which files to review.
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.
40
144
 
41
145
  ---
42
146
 
43
- ## Related Skills
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
44
153
 
45
- | Skill | When to Use |
46
- |-------|-------------|
47
- | **[frontend-design](../frontend-design/SKILL.md)** | Before coding - Learn design principles (color, typography, UX psychology) |
48
- | **web-design-guidelines** (this) | After coding - Audit for accessibility, performance, and best practices |
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.
49
157
 
50
- ## Design Workflow
158
+ ### Pre-Flight Self-Audit
51
159
 
160
+ Review these questions before confirming output:
52
161
  ```
53
- 1. DESIGN → Read frontend-design principles
54
- 2. CODE → Implement the design
55
- 3. AUDIT → Run web-design-guidelines review YOU ARE HERE
56
- 4. FIX → Address findings from audit
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?
57
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,187 +1,236 @@
1
1
  ---
2
2
  name: webapp-testing
3
3
  description: Web application testing principles. E2E, Playwright, deep audit strategies.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 1.0.0
6
+ last-updated: 2026-03-12
7
+ applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
5
8
  ---
6
9
 
7
- # Web App Testing
10
+ # Web Application Testing
8
11
 
9
- > Discover and test everything. Leave no route untested.
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
14
 
11
- ## 🔧 Runtime Scripts
15
+ ---
12
16
 
13
- **Execute these for automated browser testing:**
17
+ ## What Belongs in E2E Tests
14
18
 
15
- | Script | Purpose | Usage |
16
- |--------|---------|-------|
17
- | `scripts/playwright_runner.py` | Basic browser test | `python scripts/playwright_runner.py https://example.com` |
18
- | | With screenshot | `python scripts/playwright_runner.py <url> --screenshot` |
19
- | | Accessibility check | `python scripts/playwright_runner.py <url> --a11y` |
19
+ E2E tests simulate a real user in a real browser. Use them selectively:
20
20
 
21
- **Requires:** `pip install playwright && playwright install chromium`
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
22
27
 
23
- ---
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)
24
33
 
25
- ## 1. Deep Audit Approach
34
+ ---
26
35
 
27
- ### Discovery First
36
+ ## Playwright Patterns
28
37
 
29
- | Target | How to Find |
30
- |--------|-------------|
31
- | Routes | Scan app/, pages/, router files |
32
- | API endpoints | Grep for HTTP methods |
33
- | Components | Find component directories |
34
- | Features | Read documentation |
38
+ ### Page Object Model
35
39
 
36
- ### Systematic Testing
40
+ Encapsulate page interactions to keep tests maintainable:
37
41
 
38
- 1. **Map** - List all routes/APIs
39
- 2. **Scan** - Verify they respond
40
- 3. **Test** - Cover critical paths
42
+ ```ts
43
+ // page-objects/LoginPage.ts
44
+ export class LoginPage {
45
+ constructor(private page: Page) {}
41
46
 
42
- ---
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' }); }
43
50
 
44
- ## 2. Testing Pyramid for Web
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
+ }
45
57
 
46
- ```
47
- /\ E2E (Few)
48
- / \ Critical user flows
49
- /----\
50
- / \ Integration (Some)
51
- /--------\ API, data flow
52
- / \
53
- /------------\ Component (Many)
54
- Individual UI pieces
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
+ });
55
65
  ```
56
66
 
57
- ---
67
+ ### Locator Strategy (Priority Order)
58
68
 
59
- ## 3. E2E Test Principles
69
+ Prefer locators that reflect how the user thinks about the element:
60
70
 
61
- ### What to Test
71
+ ```ts
72
+ // 1. Role (most semantic, most resilient)
73
+ page.getByRole('button', { name: 'Submit' })
74
+ page.getByRole('textbox', { name: 'Email' })
62
75
 
63
- | Priority | Tests |
64
- |----------|-------|
65
- | 1 | Happy path user flows |
66
- | 2 | Authentication flows |
67
- | 3 | Critical business actions |
68
- | 4 | Error handling |
76
+ // 2. Label (tied to accessibility — good signal)
77
+ page.getByLabel('Email address')
69
78
 
70
- ### E2E Best Practices
79
+ // 3. Text (works but can be fragile if copy changes)
80
+ page.getByText('Welcome back')
71
81
 
72
- | Practice | Why |
73
- |----------|-----|
74
- | Use data-testid | Stable selectors |
75
- | Wait for elements | Avoid flaky tests |
76
- | Clean state | Independent tests |
77
- | Avoid implementation details | Test user behavior |
82
+ // 4. Test ID (last resort — doesn't break on copy/layout changes)
83
+ page.getByTestId('submit-button')
78
84
 
79
- ---
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
+ ```
80
89
 
81
- ## 4. Playwright Principles
90
+ ### Waiting for State
82
91
 
83
- ### Core Concepts
92
+ ```ts
93
+ // ✅ Wait for network idle before asserting
94
+ await page.waitForLoadState('networkidle');
84
95
 
85
- | Concept | Use |
86
- |---------|-----|
87
- | Page Object Model | Encapsulate page logic |
88
- | Fixtures | Reusable test setup |
89
- | Assertions | Built-in auto-wait |
90
- | Trace Viewer | Debug failures |
96
+ // Wait for a specific element
97
+ await page.waitForSelector('[data-testid="results"]');
91
98
 
92
- ### Configuration
99
+ // ✅ Assertion-based waiting (Playwright retries automatically)
100
+ await expect(page.getByText('Order confirmed')).toBeVisible();
93
101
 
94
- | Setting | Recommendation |
95
- |---------|----------------|
96
- | Retries | 2 on CI |
97
- | Trace | on-first-retry |
98
- | Screenshots | on-failure |
99
- | Video | retain-on-failure |
102
+ // Fixed sleep (brittle — too short in CI, too slow locally)
103
+ await page.waitForTimeout(2000);
104
+ ```
100
105
 
101
106
  ---
102
107
 
103
- ## 5. Visual Testing
108
+ ## Test Data Management
104
109
 
105
- ### When to Use
110
+ Keep test data predictable and isolated:
106
111
 
107
- | Scenario | Value |
108
- |----------|-------|
109
- | Design system | High |
110
- | Marketing pages | High |
111
- | Component library | Medium |
112
- | Dynamic content | Lower |
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
+ });
113
119
 
114
- ### Strategy
120
+ // Clean up after
121
+ test.afterEach(async ({ request }) => {
122
+ await request.delete('/api/test/cleanup');
123
+ });
124
+ ```
115
125
 
116
- - Baseline screenshots
117
- - Compare on changes
118
- - Review visual diffs
119
- - Update intentional changes
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_`)
120
130
 
121
131
  ---
122
132
 
123
- ## 6. API Testing Principles
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
+ ---
124
172
 
125
- ### Coverage Areas
173
+ ## Scripts
126
174
 
127
- | Area | Tests |
128
- |------|-------|
129
- | Status codes | 200, 400, 404, 500 |
130
- | Response shape | Matches schema |
131
- | Error messages | User-friendly |
132
- | Edge cases | Empty, large, special chars |
175
+ | Script | Purpose | Run With |
176
+ |---|---|---|
177
+ | `scripts/playwright_runner.py` | Runs Playwright test suite and reports | `python scripts/playwright_runner.py <project_path>` |
133
178
 
134
179
  ---
135
180
 
136
- ## 7. Test Organization
181
+ ## Output Format
137
182
 
138
- ### File Structure
183
+ When this skill completes a task, structure your output as:
139
184
 
140
185
  ```
141
- tests/
142
- ├── e2e/ # Full user flows
143
- ├── integration/ # API, data
144
- ├── component/ # UI units
145
- └── fixtures/ # Shared data
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]
146
193
  ```
147
194
 
148
- ### Naming Convention
149
195
 
150
- | Pattern | Example |
151
- |---------|---------|
152
- | Feature-based | `login.spec.ts` |
153
- | Descriptive | `user-can-checkout.spec.ts` |
154
196
 
155
197
  ---
156
198
 
157
- ## 8. CI Integration
199
+ ## 🤖 LLM-Specific Traps
158
200
 
159
- ### Pipeline Steps
201
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
160
202
 
161
- 1. Install dependencies
162
- 2. Install browsers
163
- 3. Run tests
164
- 4. Upload artifacts (traces, screenshots)
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.
165
208
 
166
- ### Parallelization
209
+ ---
167
210
 
168
- | Strategy | Use |
169
- |----------|-----|
170
- | Per file | Playwright default |
171
- | Sharding | Large suites |
172
- | Workers | Multiple browsers |
211
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
173
212
 
174
- ---
213
+ **Slash command: `/review` or `/tribunal-full`**
214
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
175
215
 
176
- ## 9. Anti-Patterns
216
+ ### Forbidden AI Tropes
177
217
 
178
- | Don't | Do |
179
- |----------|-------|
180
- | Test implementation | Test behavior |
181
- | Hardcode waits | Use auto-wait |
182
- | Skip cleanup | Isolate tests |
183
- | Ignore flaky tests | Fix root cause |
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.
184
221
 
185
- ---
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
186
233
 
187
- > **Remember:** E2E tests are expensive. Use them for critical paths only.
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.