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.
- package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
- package/.agent/ARCHITECTURE.md +205 -10
- package/.agent/GEMINI.md +37 -7
- package/.agent/agents/accessibility-reviewer.md +134 -0
- package/.agent/agents/ai-code-reviewer.md +129 -0
- package/.agent/agents/frontend-specialist.md +3 -0
- package/.agent/agents/game-developer.md +21 -21
- package/.agent/agents/logic-reviewer.md +12 -0
- package/.agent/agents/mobile-reviewer.md +79 -0
- package/.agent/agents/orchestrator.md +56 -26
- package/.agent/agents/performance-reviewer.md +36 -0
- package/.agent/agents/supervisor-agent.md +156 -0
- package/.agent/agents/swarm-worker-contracts.md +166 -0
- package/.agent/agents/swarm-worker-registry.md +92 -0
- package/.agent/rules/GEMINI.md +134 -5
- package/.agent/scripts/bundle_analyzer.py +259 -0
- package/.agent/scripts/dependency_analyzer.py +247 -0
- package/.agent/scripts/lint_runner.py +188 -0
- package/.agent/scripts/patch_skills_meta.py +177 -0
- package/.agent/scripts/patch_skills_output.py +285 -0
- package/.agent/scripts/schema_validator.py +279 -0
- package/.agent/scripts/security_scan.py +224 -0
- package/.agent/scripts/session_manager.py +144 -3
- package/.agent/scripts/skill_integrator.py +234 -0
- package/.agent/scripts/strengthen_skills.py +220 -0
- package/.agent/scripts/swarm_dispatcher.py +317 -0
- package/.agent/scripts/test_runner.py +192 -0
- package/.agent/scripts/test_swarm_dispatcher.py +163 -0
- package/.agent/skills/agent-organizer/SKILL.md +132 -0
- package/.agent/skills/agentic-patterns/SKILL.md +335 -0
- package/.agent/skills/api-patterns/SKILL.md +226 -50
- package/.agent/skills/app-builder/SKILL.md +215 -52
- package/.agent/skills/architecture/SKILL.md +176 -31
- package/.agent/skills/bash-linux/SKILL.md +150 -134
- package/.agent/skills/behavioral-modes/SKILL.md +152 -160
- package/.agent/skills/brainstorming/SKILL.md +148 -101
- package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
- package/.agent/skills/clean-code/SKILL.md +139 -134
- package/.agent/skills/code-review-checklist/SKILL.md +177 -80
- package/.agent/skills/config-validator/SKILL.md +165 -0
- package/.agent/skills/csharp-developer/SKILL.md +107 -0
- package/.agent/skills/database-design/SKILL.md +252 -29
- package/.agent/skills/deployment-procedures/SKILL.md +122 -175
- package/.agent/skills/devops-engineer/SKILL.md +134 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
- package/.agent/skills/documentation-templates/SKILL.md +175 -121
- package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
- package/.agent/skills/edge-computing/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +76 -0
- package/.agent/skills/frontend-design/color-system.md +18 -0
- package/.agent/skills/frontend-design/typography-system.md +18 -0
- package/.agent/skills/game-development/SKILL.md +69 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
- package/.agent/skills/github-operations/SKILL.md +354 -0
- package/.agent/skills/i18n-localization/SKILL.md +158 -96
- package/.agent/skills/intelligent-routing/SKILL.md +89 -285
- package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
- package/.agent/skills/lint-and-validate/SKILL.md +229 -27
- package/.agent/skills/llm-engineering/SKILL.md +258 -0
- package/.agent/skills/local-first/SKILL.md +203 -0
- package/.agent/skills/mcp-builder/SKILL.md +159 -111
- package/.agent/skills/mobile-design/SKILL.md +102 -282
- package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
- package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
- package/.agent/skills/observability/SKILL.md +285 -0
- package/.agent/skills/parallel-agents/SKILL.md +124 -118
- package/.agent/skills/performance-profiling/SKILL.md +143 -89
- package/.agent/skills/plan-writing/SKILL.md +133 -97
- package/.agent/skills/platform-engineer/SKILL.md +135 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -104
- package/.agent/skills/python-patterns/SKILL.md +149 -361
- package/.agent/skills/python-pro/SKILL.md +114 -0
- package/.agent/skills/react-specialist/SKILL.md +107 -0
- package/.agent/skills/readme-builder/SKILL.md +270 -0
- package/.agent/skills/realtime-patterns/SKILL.md +296 -0
- package/.agent/skills/red-team-tactics/SKILL.md +136 -134
- package/.agent/skills/rust-pro/SKILL.md +237 -173
- package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
- package/.agent/skills/server-management/SKILL.md +155 -104
- package/.agent/skills/sql-pro/SKILL.md +104 -0
- package/.agent/skills/systematic-debugging/SKILL.md +156 -79
- package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
- package/.agent/skills/tdd-workflow/SKILL.md +148 -88
- package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
- package/.agent/skills/testing-patterns/SKILL.md +141 -114
- package/.agent/skills/trend-researcher/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
- package/.agent/skills/vue-expert/SKILL.md +118 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
- package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
- package/.agent/skills/webapp-testing/SKILL.md +171 -122
- package/.agent/skills/whimsy-injector/SKILL.md +349 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
- package/.agent/workflows/api-tester.md +279 -0
- package/.agent/workflows/audit.md +168 -0
- package/.agent/workflows/brainstorm.md +65 -19
- package/.agent/workflows/changelog.md +144 -0
- package/.agent/workflows/create.md +67 -14
- package/.agent/workflows/debug.md +122 -30
- package/.agent/workflows/deploy.md +82 -31
- package/.agent/workflows/enhance.md +59 -27
- package/.agent/workflows/fix.md +143 -0
- package/.agent/workflows/generate.md +84 -20
- package/.agent/workflows/migrate.md +163 -0
- package/.agent/workflows/orchestrate.md +66 -17
- package/.agent/workflows/performance-benchmarker.md +305 -0
- package/.agent/workflows/plan.md +76 -33
- package/.agent/workflows/preview.md +73 -17
- package/.agent/workflows/refactor.md +153 -0
- package/.agent/workflows/review-ai.md +140 -0
- package/.agent/workflows/review.md +83 -16
- package/.agent/workflows/session.md +154 -0
- package/.agent/workflows/status.md +74 -18
- package/.agent/workflows/strengthen-skills.md +99 -0
- package/.agent/workflows/swarm.md +194 -0
- package/.agent/workflows/test.md +80 -31
- package/.agent/workflows/tribunal-backend.md +55 -13
- package/.agent/workflows/tribunal-database.md +62 -18
- package/.agent/workflows/tribunal-frontend.md +58 -12
- package/.agent/workflows/tribunal-full.md +70 -11
- package/.agent/workflows/tribunal-mobile.md +123 -0
- package/.agent/workflows/tribunal-performance.md +152 -0
- package/.agent/workflows/ui-ux-pro-max.md +100 -82
- package/README.md +117 -62
- package/bin/tribunal-kit.js +542 -288
- 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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
51
|
+
### 3. Energy Efficiency & Sustainability
|
|
22
52
|
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
158
|
+
### ✅ Pre-Flight Self-Audit
|
|
51
159
|
|
|
160
|
+
Review these questions before confirming output:
|
|
52
161
|
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
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
|
|
10
|
+
# Web Application Testing
|
|
8
11
|
|
|
9
|
-
>
|
|
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
|
-
|
|
15
|
+
---
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## What Belongs in E2E Tests
|
|
14
18
|
|
|
15
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
34
|
+
---
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
## Playwright Patterns
|
|
28
37
|
|
|
29
|
-
|
|
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
|
-
|
|
40
|
+
Encapsulate page interactions to keep tests maintainable:
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
69
|
+
Prefer locators that reflect how the user thinks about the element:
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
```ts
|
|
72
|
+
// 1. Role (most semantic, most resilient)
|
|
73
|
+
page.getByRole('button', { name: 'Submit' })
|
|
74
|
+
page.getByRole('textbox', { name: 'Email' })
|
|
62
75
|
|
|
63
|
-
|
|
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
|
-
|
|
79
|
+
// 3. Text (works but can be fragile if copy changes)
|
|
80
|
+
page.getByText('Welcome back')
|
|
71
81
|
|
|
72
|
-
|
|
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
|
-
|
|
90
|
+
### Waiting for State
|
|
82
91
|
|
|
83
|
-
|
|
92
|
+
```ts
|
|
93
|
+
// ✅ Wait for network idle before asserting
|
|
94
|
+
await page.waitForLoadState('networkidle');
|
|
84
95
|
|
|
85
|
-
|
|
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
|
-
|
|
99
|
+
// ✅ Assertion-based waiting (Playwright retries automatically)
|
|
100
|
+
await expect(page.getByText('Order confirmed')).toBeVisible();
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
##
|
|
108
|
+
## Test Data Management
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
Keep test data predictable and isolated:
|
|
106
111
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
120
|
+
// Clean up after
|
|
121
|
+
test.afterEach(async ({ request }) => {
|
|
122
|
+
await request.delete('/api/test/cleanup');
|
|
123
|
+
});
|
|
124
|
+
```
|
|
115
125
|
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
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
|
-
##
|
|
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
|
-
|
|
173
|
+
## Scripts
|
|
126
174
|
|
|
127
|
-
|
|
|
128
|
-
|
|
129
|
-
|
|
|
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
|
-
##
|
|
181
|
+
## Output Format
|
|
137
182
|
|
|
138
|
-
|
|
183
|
+
When this skill completes a task, structure your output as:
|
|
139
184
|
|
|
140
185
|
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
##
|
|
199
|
+
## 🤖 LLM-Specific Traps
|
|
158
200
|
|
|
159
|
-
|
|
201
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
160
202
|
|
|
161
|
-
1.
|
|
162
|
-
2.
|
|
163
|
-
3.
|
|
164
|
-
4.
|
|
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
|
-
|
|
209
|
+
---
|
|
167
210
|
|
|
168
|
-
|
|
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
|
-
|
|
216
|
+
### ❌ Forbidden AI Tropes
|
|
177
217
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
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.
|