tribunal-kit 2.4.6 โ 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/ARCHITECTURE.md +99 -99
- package/.agent/GEMINI.md +52 -52
- package/.agent/agents/accessibility-reviewer.md +139 -86
- package/.agent/agents/ai-code-reviewer.md +160 -90
- package/.agent/agents/backend-specialist.md +164 -127
- package/.agent/agents/code-archaeologist.md +115 -73
- package/.agent/agents/database-architect.md +130 -110
- package/.agent/agents/debugger.md +137 -97
- package/.agent/agents/dependency-reviewer.md +78 -30
- package/.agent/agents/devops-engineer.md +161 -118
- package/.agent/agents/documentation-writer.md +151 -87
- package/.agent/agents/explorer-agent.md +117 -99
- package/.agent/agents/frontend-reviewer.md +127 -47
- package/.agent/agents/frontend-specialist.md +169 -109
- package/.agent/agents/game-developer.md +28 -164
- package/.agent/agents/logic-reviewer.md +87 -49
- package/.agent/agents/mobile-developer.md +151 -103
- package/.agent/agents/mobile-reviewer.md +133 -50
- package/.agent/agents/orchestrator.md +121 -110
- package/.agent/agents/penetration-tester.md +103 -77
- package/.agent/agents/performance-optimizer.md +136 -92
- package/.agent/agents/performance-reviewer.md +139 -69
- package/.agent/agents/product-manager.md +104 -70
- package/.agent/agents/product-owner.md +6 -25
- package/.agent/agents/project-planner.md +95 -95
- package/.agent/agents/qa-automation-engineer.md +174 -87
- package/.agent/agents/security-auditor.md +133 -129
- package/.agent/agents/seo-specialist.md +160 -99
- package/.agent/agents/sql-reviewer.md +132 -44
- package/.agent/agents/supervisor-agent.md +137 -109
- package/.agent/agents/swarm-worker-contracts.md +17 -17
- package/.agent/agents/swarm-worker-registry.md +46 -46
- package/.agent/agents/test-coverage-reviewer.md +132 -53
- package/.agent/agents/test-engineer.md +0 -21
- package/.agent/agents/type-safety-reviewer.md +143 -33
- package/.agent/patterns/generator.md +9 -9
- package/.agent/patterns/inversion.md +12 -12
- package/.agent/patterns/pipeline.md +9 -9
- package/.agent/patterns/reviewer.md +13 -13
- package/.agent/patterns/tool-wrapper.md +9 -9
- package/.agent/rules/GEMINI.md +63 -63
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/compress_skills.py +167 -0
- package/.agent/scripts/consolidate_skills.py +173 -0
- package/.agent/scripts/deep_compress.py +202 -0
- package/.agent/scripts/minify_context.py +80 -0
- package/.agent/scripts/security_scan.py +1 -1
- package/.agent/scripts/strip_tribunal.py +41 -0
- package/.agent/skills/agent-organizer/SKILL.md +60 -100
- package/.agent/skills/agentic-patterns/SKILL.md +0 -70
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +108 -53
- package/.agent/skills/api-patterns/SKILL.md +197 -257
- package/.agent/skills/api-security-auditor/SKILL.md +125 -57
- package/.agent/skills/app-builder/SKILL.md +326 -50
- package/.agent/skills/app-builder/templates/SKILL.md +13 -15
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
- package/.agent/skills/appflow-wireframe/SKILL.md +71 -98
- package/.agent/skills/architecture/SKILL.md +161 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +121 -54
- package/.agent/skills/bash-linux/SKILL.md +71 -166
- package/.agent/skills/behavioral-modes/SKILL.md +8 -69
- package/.agent/skills/brainstorming/SKILL.md +345 -127
- package/.agent/skills/building-native-ui/SKILL.md +125 -57
- package/.agent/skills/clean-code/SKILL.md +266 -149
- package/.agent/skills/code-review-checklist/SKILL.md +0 -62
- package/.agent/skills/config-validator/SKILL.md +73 -131
- package/.agent/skills/csharp-developer/SKILL.md +434 -73
- package/.agent/skills/database-design/SKILL.md +190 -275
- package/.agent/skills/deployment-procedures/SKILL.md +81 -158
- package/.agent/skills/devops-engineer/SKILL.md +255 -94
- package/.agent/skills/devops-incident-responder/SKILL.md +50 -69
- package/.agent/skills/doc.md +5 -5
- package/.agent/skills/documentation-templates/SKILL.md +19 -63
- package/.agent/skills/edge-computing/SKILL.md +75 -165
- package/.agent/skills/extract-design-system/SKILL.md +84 -58
- package/.agent/skills/framer-motion-expert/SKILL.md +195 -0
- package/.agent/skills/frontend-design/SKILL.md +151 -499
- package/.agent/skills/game-design-expert/SKILL.md +71 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +88 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +52 -178
- package/.agent/skills/github-operations/SKILL.md +197 -272
- package/.agent/skills/gsap-expert/SKILL.md +194 -0
- package/.agent/skills/i18n-localization/SKILL.md +60 -172
- package/.agent/skills/intelligent-routing/SKILL.md +123 -103
- package/.agent/skills/lint-and-validate/SKILL.md +8 -52
- package/.agent/skills/llm-engineering/SKILL.md +281 -195
- package/.agent/skills/local-first/SKILL.md +76 -159
- package/.agent/skills/mcp-builder/SKILL.md +48 -188
- package/.agent/skills/mobile-design/SKILL.md +213 -219
- package/.agent/skills/motion-engineering/SKILL.md +184 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +184 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +403 -185
- package/.agent/skills/observability/SKILL.md +211 -203
- package/.agent/skills/parallel-agents/SKILL.md +53 -146
- package/.agent/skills/performance-profiling/SKILL.md +171 -151
- package/.agent/skills/plan-writing/SKILL.md +49 -153
- package/.agent/skills/platform-engineer/SKILL.md +57 -103
- package/.agent/skills/playwright-best-practices/SKILL.md +110 -63
- package/.agent/skills/powershell-windows/SKILL.md +61 -179
- package/.agent/skills/python-patterns/SKILL.md +7 -35
- package/.agent/skills/python-pro/SKILL.md +273 -114
- package/.agent/skills/react-specialist/SKILL.md +227 -108
- package/.agent/skills/readme-builder/SKILL.md +15 -85
- package/.agent/skills/realtime-patterns/SKILL.md +216 -243
- package/.agent/skills/red-team-tactics/SKILL.md +10 -51
- package/.agent/skills/rust-pro/SKILL.md +525 -142
- package/.agent/skills/seo-fundamentals/SKILL.md +92 -153
- package/.agent/skills/server-management/SKILL.md +110 -166
- package/.agent/skills/shadcn-ui-expert/SKILL.md +154 -55
- package/.agent/skills/skill-creator/SKILL.md +18 -58
- package/.agent/skills/sql-pro/SKILL.md +543 -68
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +28 -68
- package/.agent/skills/swiftui-expert/SKILL.md +124 -57
- package/.agent/skills/systematic-debugging/SKILL.md +49 -151
- package/.agent/skills/tailwind-patterns/SKILL.md +433 -149
- package/.agent/skills/tdd-workflow/SKILL.md +63 -169
- package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
- package/.agent/skills/testing-patterns/SKILL.md +437 -130
- package/.agent/skills/trend-researcher/SKILL.md +30 -71
- package/.agent/skills/ui-ux-pro-max/SKILL.md +0 -41
- package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
- package/.agent/skills/vue-expert/SKILL.md +225 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +264 -226
- package/.agent/skills/web-accessibility-auditor/SKILL.md +141 -58
- package/.agent/skills/web-design-guidelines/SKILL.md +17 -61
- package/.agent/skills/webapp-testing/SKILL.md +71 -196
- package/.agent/skills/whimsy-injector/SKILL.md +58 -132
- package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
- package/.agent/workflows/api-tester.md +96 -224
- package/.agent/workflows/audit.md +81 -122
- package/.agent/workflows/brainstorm.md +69 -105
- package/.agent/workflows/changelog.md +65 -97
- package/.agent/workflows/create.md +73 -88
- package/.agent/workflows/debug.md +80 -111
- package/.agent/workflows/deploy.md +119 -92
- package/.agent/workflows/enhance.md +80 -91
- package/.agent/workflows/fix.md +68 -97
- package/.agent/workflows/generate.md +165 -164
- package/.agent/workflows/migrate.md +106 -109
- package/.agent/workflows/orchestrate.md +103 -86
- package/.agent/workflows/performance-benchmarker.md +77 -268
- package/.agent/workflows/plan.md +120 -98
- package/.agent/workflows/preview.md +39 -96
- package/.agent/workflows/refactor.md +105 -97
- package/.agent/workflows/review-ai.md +63 -102
- package/.agent/workflows/review.md +71 -110
- package/.agent/workflows/session.md +53 -113
- package/.agent/workflows/status.md +42 -88
- package/.agent/workflows/strengthen-skills.md +90 -51
- package/.agent/workflows/swarm.md +114 -129
- package/.agent/workflows/test.md +125 -102
- package/.agent/workflows/tribunal-backend.md +60 -78
- package/.agent/workflows/tribunal-database.md +62 -100
- package/.agent/workflows/tribunal-frontend.md +62 -82
- package/.agent/workflows/tribunal-full.md +56 -100
- package/.agent/workflows/tribunal-mobile.md +65 -94
- package/.agent/workflows/tribunal-performance.md +62 -105
- package/.agent/workflows/ui-ux-pro-max.md +72 -121
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -329
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/typography-system.md +0 -363
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
|
@@ -1,188 +1,84 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plan-writing
|
|
3
|
-
description:
|
|
3
|
+
description: Technical design and implementation planning mastery. Writing structured execution checklists, dependency mapping, establishing rollback protocols, segmenting monolithic tasks, writing ADRs (Architecture Decision Records), and defining verification criteria. Use when transitioning from ideation to coordinated execution.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
7
|
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
> A plan is not a promise. It is a map.
|
|
13
|
-
> Maps get updated when the terrain doesn't match them.
|
|
10
|
+
# Plan Writing โ Execution Blueprints Mastery
|
|
14
11
|
|
|
15
12
|
---
|
|
16
13
|
|
|
17
|
-
##
|
|
14
|
+
## 1. The Implementation Plan Structure (ADR-Lite)
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
- The task touches more than 2 files in non-trivial ways
|
|
21
|
-
- The task has dependencies (thing B can't start until thing A is done)
|
|
22
|
-
- The task involves a risky operation (migration, data transformation, breaking change)
|
|
23
|
-
- The team needs to review the approach before time is spent implementing it
|
|
16
|
+
Before altering multiple files or introducing a new system architecture, a rigid `implementation_plan.md` MUST be generated and approved.
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
**Core Sections:**
|
|
19
|
+
1. **Objective Context:** 2-sentence summary of the requested goal.
|
|
20
|
+
2. **Architectural Handoff:** (What stack, what libraries, what constraints).
|
|
21
|
+
3. **Dependency Tree Execution Order:** (Cannot build frontend UI until backend API exists).
|
|
22
|
+
4. **File Blueprint:** Exact files expected to be touched (`[NEW] src/api/user.ts`, `[MODIFY] src/db/schema.prisma`).
|
|
23
|
+
5. **Verification Protocol:** Exactly how the agent/human will prove the task is completed successfully.
|
|
26
24
|
|
|
27
25
|
---
|
|
28
26
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
```markdown
|
|
32
|
-
# Plan: [Feature or Task Name]
|
|
33
|
-
|
|
34
|
-
## Goal
|
|
35
|
-
One sentence: what outcome does this achieve?
|
|
36
|
-
|
|
37
|
-
## Context
|
|
38
|
-
- Why is this being done?
|
|
39
|
-
- What problem does it solve or what requirement does it satisfy?
|
|
40
|
-
- What exists today that this changes?
|
|
41
|
-
|
|
42
|
-
## Approach
|
|
43
|
-
High-level strategy. Enough detail for someone unfamiliar with the code to understand the direction.
|
|
44
|
-
Not implementation details โ those go in the tasks.
|
|
45
|
-
|
|
46
|
-
## Tasks
|
|
27
|
+
## 2. Segmenting Monolithic Tasks (Chunking)
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
- [ ] Task 1.1: Description
|
|
50
|
-
- [ ] Task 1.2: Description (depends on 1.1)
|
|
29
|
+
LLMs degrade significantly when asked to process >10 file alterations across multiple directories simultaneously. The Plan Writer must break work into logical, isolated "Waves."
|
|
51
30
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## Files That Will Change
|
|
67
|
-
- `path/to/file.ts` โ what changes
|
|
68
|
-
- `path/to/schema.sql` โ what changes
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Dependency Notation
|
|
74
|
-
|
|
75
|
-
When tasks have a strict order, mark it:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
Task A โ (no dependencies, do first)
|
|
79
|
-
Task B โ (requires A complete)
|
|
80
|
-
Task C โ (can run parallel with B)
|
|
81
|
-
Task D โ (requires B and C complete)
|
|
31
|
+
```markdown
|
|
32
|
+
### Wave 1: Data Layer (The Foundation)
|
|
33
|
+
1. Add `Subscription` model to Prisma schema.
|
|
34
|
+
2. Generate migration (`npx prisma migrate dev`).
|
|
35
|
+
3. Add mock seed data.
|
|
36
|
+
|
|
37
|
+
### Wave 2: API Layer (The Bridge)
|
|
38
|
+
1. Build `/api/subscriptions/route.ts` with explicit Zod validation.
|
|
39
|
+
2. Write Vitest logic enforcing authorization roles.
|
|
40
|
+
|
|
41
|
+
### Wave 3: UI Layer (The Implementation)
|
|
42
|
+
1. Build `SubscriptionCard.tsx`.
|
|
43
|
+
2. Connect to API using MSW mocked tests first.
|
|
44
|
+
3. Integrate into main dashboard.
|
|
82
45
|
```
|
|
83
46
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Task Granularity
|
|
89
|
-
|
|
90
|
-
Each task should be:
|
|
91
|
-
- Completable in one session by one person
|
|
92
|
-
- Independently reviewable (a PR could represent one task)
|
|
93
|
-
- Testable: there is a concrete way to know if it's done
|
|
94
|
-
|
|
95
|
-
**Too vague:** "Implement the auth system"
|
|
96
|
-
**Right size:** "Add `POST /api/auth/login` endpoint with JWT issuance and Zod validation"
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Updating the Plan
|
|
101
|
-
|
|
102
|
-
Plans are living documents:
|
|
103
|
-
|
|
104
|
-
- Mark tasks `[x]` when complete, not when started
|
|
105
|
-
- Add `[!]` to blocked tasks with a note on what is blocking
|
|
106
|
-
- When an assumption proves wrong, update the approach section โ don't silently deviate from the plan
|
|
47
|
+
*Crucial:* Each wave MUST be executable and testable independently. Do not begin Wave 2 until Wave 1 passes Verification Protocols.
|
|
107
48
|
|
|
108
49
|
---
|
|
109
50
|
|
|
110
|
-
##
|
|
51
|
+
## 3. Rollback & Contingency Planning
|
|
111
52
|
|
|
112
|
-
|
|
53
|
+
No plan survives first contact with the compiler. The plan must implicitly include safe-fail procedures.
|
|
113
54
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
โ
Observable: `POST /api/users` returns 201 with a user ID in the response body
|
|
119
|
-
โ
Failure mode: `POST /api/users` with a duplicate email returns 409, not 500
|
|
120
|
-
```
|
|
55
|
+
- **Non-Destructive Defaults:** If a schema migration fails, how do we revert? (e.g., explicit instruction to backup SQLite DB locally before operations).
|
|
56
|
+
- **Graceful Feature Toggles:** Is the new feature walled behind an environment variable (`ENABLE_NEW_DASHBOARD=true`) so it can be disabled instantly if it crashes in production?
|
|
121
57
|
|
|
122
58
|
---
|
|
123
59
|
|
|
124
|
-
##
|
|
60
|
+
## 4. The `task.md` Execution Ledger
|
|
125
61
|
|
|
126
|
-
|
|
127
|
-
- โ **Forbidden:** Writing vague verification steps like "Check that it looks right," "Ensure the code makes sense," or "Verify the logic."
|
|
128
|
-
- โ
**Required:** Verification criteria MUST demand **concrete terminal/compiler evidence** (e.g., test success logs, CLI execution outputs, compiler success states, or network trace results). Explicitly state that an agent CANNOT consider the task complete until it captures this hard evidence.
|
|
62
|
+
Unlike the high-level `implementation_plan.md`, the `task.md` serves as the live, mutating execution state.
|
|
129
63
|
|
|
130
|
-
|
|
64
|
+
```markdown
|
|
65
|
+
# Current Objective: Upgrade Authentication
|
|
131
66
|
|
|
132
|
-
##
|
|
67
|
+
## Pre-Flight
|
|
68
|
+
- [x] Dump existing environment variables locally
|
|
69
|
+
- [x] Verify current tests pass (Baseline health)
|
|
133
70
|
|
|
134
|
-
|
|
71
|
+
## Wave 1 (OAuth Scaffold)
|
|
72
|
+
- [/] Install auth.js dependencies
|
|
73
|
+
- [ ] Connect Google Provider inside `[...nextauth].ts`
|
|
135
74
|
|
|
75
|
+
## Wave 2 (Database Mappings)
|
|
76
|
+
- [ ] Update Users table to handle polymorphic OAuth links
|
|
136
77
|
```
|
|
137
|
-
โโโ Plan Writing Recommendation โโโโโโโโโโโโโโโโ
|
|
138
|
-
Decision: [what was chosen / proposed]
|
|
139
|
-
Rationale: [why โ one concise line]
|
|
140
|
-
Trade-offs: [what is consciously accepted]
|
|
141
|
-
Next action: [concrete next step for the user]
|
|
142
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
143
|
-
Pre-Flight: โ
All checks passed
|
|
144
|
-
or โ [blocking item that must be resolved first]
|
|
145
|
-
```
|
|
146
|
-
|
|
147
78
|
|
|
79
|
+
*Rules:*
|
|
80
|
+
- `[ ]` = Unstarted
|
|
81
|
+
- `[/]` = In Progress (Current Focus)
|
|
82
|
+
- `[x]` = Verified Complete
|
|
148
83
|
|
|
149
84
|
---
|
|
150
|
-
|
|
151
|
-
## ๐ค LLM-Specific Traps
|
|
152
|
-
|
|
153
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
154
|
-
|
|
155
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
156
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
157
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
158
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
159
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
164
|
-
|
|
165
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
166
|
-
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
167
|
-
|
|
168
|
-
### โ Forbidden AI Tropes
|
|
169
|
-
|
|
170
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
171
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
172
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
173
|
-
|
|
174
|
-
### โ
Pre-Flight Self-Audit
|
|
175
|
-
|
|
176
|
-
Review these questions before confirming output:
|
|
177
|
-
```
|
|
178
|
-
โ
Did I rely ONLY on real, verified tools and methods?
|
|
179
|
-
โ
Is this solution appropriately scoped to the user's constraints?
|
|
180
|
-
โ
Did I handle potential failure modes and edge cases?
|
|
181
|
-
โ
Have I avoided generic boilerplate that doesn't add value?
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### ๐ Verification-Before-Completion (VBC) Protocol
|
|
185
|
-
|
|
186
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
187
|
-
- โ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
188
|
-
- โ
**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,135 +1,89 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: platform-engineer
|
|
3
|
-
description:
|
|
3
|
+
description: Platform Engineering and Internal Developer Portal (IDP) mastery. Golden Paths, self-service infrastructure, cognitive load reduction, GitOps synchronization (ArgoCD/Flux), Terraform/OpenTofu architecture, and standardized service scaffolding. Use when designing system-wide development workflows or standardizing infrastructure processes.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
7
|
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Platform
|
|
11
|
-
|
|
12
|
-
You are a senior platform engineer with deep expertise in building internal developer platforms, self-service infrastructure, and developer portals. Your focus spans platform architecture, GitOps workflows, service catalogs, and developer experience optimization with emphasis on reducing cognitive load and accelerating software delivery.
|
|
13
|
-
|
|
14
|
-
## Configuration & Context Assessment
|
|
15
|
-
When invoked:
|
|
16
|
-
1. Query context manager for existing platform capabilities and developer needs
|
|
17
|
-
2. Review current self-service offerings, golden paths, and adoption metrics
|
|
18
|
-
3. Analyze developer pain points, workflow bottlenecks, and platform gaps
|
|
19
|
-
4. Implement solutions maximizing developer productivity and platform adoption
|
|
10
|
+
# Platform Engineering โ Developer Experience Mastery
|
|
20
11
|
|
|
21
12
|
---
|
|
22
13
|
|
|
23
|
-
## The
|
|
24
|
-
- Self-service rate exceeding 90%
|
|
25
|
-
- Provisioning time under 5 minutes
|
|
26
|
-
- Platform uptime 99.9%
|
|
27
|
-
- API response time < 200ms
|
|
28
|
-
- Documentation coverage 100%
|
|
29
|
-
- Developer onboarding < 1 day
|
|
30
|
-
- Golden paths established
|
|
31
|
-
- Feedback loops active
|
|
14
|
+
## 1. The "Golden Path" Architecture
|
|
32
15
|
|
|
33
|
-
|
|
16
|
+
A developer should not have to write a Dockerfile, configure a CI pipeline, request AWS permissions, or setup Prometheus dashboards to launch a new microservice.
|
|
34
17
|
|
|
35
|
-
|
|
18
|
+
The Platform Engineer establishes **Golden Paths**: pre-approved, automated templates that bundle security and infrastructure out-of-the-box.
|
|
36
19
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* **Infrastructure Abstraction:** Crossplane compositions, Terraform modules, Operator patterns, State reconciliation.
|
|
20
|
+
**Example: Local Service Scaffolding (Backstage / Cookiecutter)**
|
|
21
|
+
Instead of cloning complex repos, the developer runs:
|
|
22
|
+
`platform create my-service --stack node-express --db postgres`
|
|
41
23
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Golden Paths & Platform APIs
|
|
48
|
-
* **Golden Paths:** Service scaffolding, CI/CD pipeline templates, Security scanning integration, Best practices enforcement.
|
|
49
|
-
* **Platform APIs:** RESTful API design, Event streaming setup, Rate limiting implementation, SDK generation.
|
|
50
|
-
* **Developer Enablement:** Documentation portals, Success tracking, Workshop delivery.
|
|
24
|
+
This command:
|
|
25
|
+
1. Generates the standard Node/Express repo.
|
|
26
|
+
2. Applies the unified corporate CI/CD GitHub Action.
|
|
27
|
+
3. Configures default Datadog/OpenTelemetry observability metrics.
|
|
28
|
+
4. Generates a Terraform blueprint to provision the RDS Postgres instance.
|
|
51
29
|
|
|
52
30
|
---
|
|
53
31
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
32
|
+
## 2. GitOps (Declarative State Synchronization)
|
|
33
|
+
|
|
34
|
+
Platform Engineers do not log into AWS consoles to click buttons. They do not run `kubectl apply` from their laptops.
|
|
35
|
+
|
|
36
|
+
They push code to Git. A continuous reconciliation loop (e.g., ArgoCD) syncs the live infrastructure to match the Git repository mathematically.
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
# GitOps standard architecture (ArgoCD)
|
|
40
|
+
apiVersion: argoproj.io/v1alpha1
|
|
41
|
+
kind: Application
|
|
42
|
+
metadata:
|
|
43
|
+
name: auth-service
|
|
44
|
+
namespace: argocd
|
|
45
|
+
spec:
|
|
46
|
+
project: default
|
|
47
|
+
source:
|
|
48
|
+
repoURL: 'https://github.com/mycorp/infrastructure-ops'
|
|
49
|
+
path: k8s/auth-service
|
|
50
|
+
targetRevision: HEAD # Automatically deploys any merge to main
|
|
51
|
+
destination:
|
|
52
|
+
server: 'https://kubernetes.default.svc'
|
|
53
|
+
namespace: auth-prod
|
|
54
|
+
syncPolicy:
|
|
55
|
+
automated:
|
|
56
|
+
prune: true
|
|
57
|
+
selfHeal: true # If manual changes occur on cluster, force-reverts back to Git state
|
|
67
58
|
```
|
|
68
59
|
|
|
69
|
-
|
|
70
60
|
---
|
|
71
61
|
|
|
72
|
-
##
|
|
62
|
+
## 3. Infrastructure as Code (IaC) Modules
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
**Active reviewers: `logic` ยท `security`**
|
|
64
|
+
Platform Engineers build reusable Terraform/Tofu modules, hiding extreme complexity from product developers.
|
|
76
65
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
3. **Ticket-Ops Paradigms** โ do not design processes that require Jira/ITSM ticket approvals for routine environment provisioning; push towards self-service automation.
|
|
81
|
-
4. **Ignoring Platform Docs** โ never omit READMEs, interactive API docs, or Backstage catalog entries for newly created internal services.
|
|
82
|
-
5. **Over-Abstraction Without Need** โ avoid wrapping standard tools (like native Kubernetes YAML or pure Terraform) in complex proprietary CLI abstractions unless developer cognitive load dictates it.
|
|
66
|
+
```hcl
|
|
67
|
+
# The Platform Engineer writes the complex module (e.g., VPC, Subnets, IAM, KMS Encryptions)
|
|
68
|
+
# The Product Developer simply consumes the module cleanly:
|
|
83
69
|
|
|
84
|
-
|
|
70
|
+
module "product_database" {
|
|
71
|
+
source = "github.com/mycorp/tf-modules/secure-rds"
|
|
72
|
+
version = "v1.2.0"
|
|
85
73
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
โ
Are the Golden Path templates extensible and versioned?
|
|
91
|
-
โ
Have I properly isolated resources in the multi-tenant architecture proposal?
|
|
92
|
-
โ
Are there built-in mechanisms for cost-visibility and telemetry tracking on generated developer environments?
|
|
74
|
+
app_name = "checkout-service"
|
|
75
|
+
capacity = "medium" # Abstracts complex instance sizing
|
|
76
|
+
needs_replica = true # Abstracts failover architecture
|
|
77
|
+
}
|
|
93
78
|
```
|
|
94
79
|
|
|
95
|
-
|
|
96
80
|
---
|
|
97
81
|
|
|
98
|
-
##
|
|
82
|
+
## 4. Reducing Cognitive Load
|
|
99
83
|
|
|
100
|
-
|
|
84
|
+
DevOps asked product developers to learn Kubernetes, Helm, Terraform, CI/CD, and AWS IAM. The load was too high.
|
|
85
|
+
Platform Engineering hides the Kubernetes complexity behind a portal (e.g., Backstage) or a declarative wrapper (e.g., Score).
|
|
101
86
|
|
|
102
|
-
|
|
103
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
104
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
105
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
106
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
87
|
+
Ensure your infrastructure proposals abstract away the YAML mechanics. Give the developer a simple SLA: *"Push to the `main` branch, and the platform guarantees deployment, logs, and metrics within 3 minutes."*
|
|
107
88
|
|
|
108
89
|
---
|
|
109
|
-
|
|
110
|
-
## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
111
|
-
|
|
112
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
113
|
-
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
114
|
-
|
|
115
|
-
### โ Forbidden AI Tropes
|
|
116
|
-
|
|
117
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
118
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
119
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
120
|
-
|
|
121
|
-
### โ
Pre-Flight Self-Audit
|
|
122
|
-
|
|
123
|
-
Review these questions before confirming output:
|
|
124
|
-
```
|
|
125
|
-
โ
Did I rely ONLY on real, verified tools and methods?
|
|
126
|
-
โ
Is this solution appropriately scoped to the user's constraints?
|
|
127
|
-
โ
Did I handle potential failure modes and edge cases?
|
|
128
|
-
โ
Have I avoided generic boilerplate that doesn't add value?
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### ๐ Verification-Before-Completion (VBC) Protocol
|
|
132
|
-
|
|
133
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
134
|
-
- โ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
135
|
-
- โ
**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,81 +1,128 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: playwright-best-practices
|
|
3
|
-
description: End-to-
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Playwright Best Practices
|
|
11
|
-
|
|
12
|
-
You are an expert in End-to-End (E2E) testing utilizing Playwright. Your goal is to write deterministic, resilient, and fast testing suites that provide extreme confidence in application behavior.
|
|
13
|
-
|
|
14
|
-
## Core Directives
|
|
15
|
-
|
|
16
|
-
1. **Locator Strategy:**
|
|
17
|
-
- Always prefer user-facing locators: `getByRole`, `getByText`, `getByLabel`.
|
|
18
|
-
- Never use XPath or highly coupled CSS selectors (e.g., `.container > div > span`) unless absolutely necessary.
|
|
19
|
-
- For components needing strict test-binding, use `data-testid` via `getByTestId`.
|
|
20
|
-
|
|
21
|
-
2. **Auto-Waiting & Assertions:**
|
|
22
|
-
- Playwright automatically waits for elements to be actionable. Never insert explicit `page.waitForTimeout(5000)` unless debugging.
|
|
23
|
-
- Use web-first assertions: `await expect(locator).toBeVisible()`, `await expect(locator).toHaveText()`. Do not use standard Node.js assertions `assert(true)` for DOM state.
|
|
24
|
-
|
|
25
|
-
3. **Authentication & Setup:**
|
|
26
|
-
- Utilize global setup (`globalSetup` or `test.beforeAll`) for authentication.
|
|
27
|
-
- Save the authentication state (cookies/local storage) into a reusable state file (e.g., `playwright/.auth/user.json`) to skip login UI flows during testing.
|
|
28
|
-
|
|
29
|
-
4. **Parallelization & Structure:**
|
|
30
|
-
- Group related tests logically using `test.describe`.
|
|
31
|
-
- Keep tests independent. Tests should not rely on state mutated by previous tests.
|
|
32
|
-
- Clean up data after tests using `test.afterEach` or isolated contexts.
|
|
33
|
-
|
|
34
|
-
## Output Format
|
|
35
|
-
|
|
36
|
-
When creating or modifying tests:
|
|
37
|
-
1. Explain the User Journey being tested.
|
|
38
|
-
2. Outline the steps and assertions.
|
|
39
|
-
3. Provide the full test code incorporating the best practices above.
|
|
1
|
+
---
|
|
2
|
+
name: playwright-best-practices
|
|
3
|
+
description: Playwright End-to-End (E2E) testing mastery. Resilient selectors, auto-waiting mechanisms, parallel test execution, mocking network requests, fixture management, and cross-browser CI configurations. Use when configuring, deploying, or writing E2E web tests.
|
|
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
|
+
---
|
|
40
9
|
|
|
10
|
+
# Playwright E2E โ Bulletproof Testing Mastery
|
|
41
11
|
|
|
42
12
|
---
|
|
43
13
|
|
|
44
|
-
##
|
|
14
|
+
## 1. Resilience & Auto-Waiting
|
|
15
|
+
|
|
16
|
+
Playwright automatically waits for elements to be actionable (visible, stable, not obscured).
|
|
45
17
|
|
|
46
|
-
|
|
18
|
+
```typescript
|
|
19
|
+
// โ FLAKY: Hardcoded sleeps. Fails on slow CI, wastes time on fast local rings.
|
|
20
|
+
await page.waitForTimeout(3000);
|
|
47
21
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
22
|
+
// โ FLAKY: CSS selectors tied to layout/styling changes
|
|
23
|
+
await page.locator('.btn-primary > span').click();
|
|
24
|
+
|
|
25
|
+
// โ
ROBUST: Playwright auto-waits for actionability based on user-centric selectors
|
|
26
|
+
await page.getByRole('button', { name: "Submit Checkout" }).click();
|
|
27
|
+
|
|
28
|
+
// โ
ROBUST: Testing for expected states
|
|
29
|
+
await expect(page.getByText('Order confirmed')).toBeVisible();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### The Selector Hierarchy (Best to Worst)
|
|
33
|
+
1. `page.getByRole()` โ Checks accessibility simultaneously.
|
|
34
|
+
2. `page.getByText()` โ Finds elements by raw text values.
|
|
35
|
+
3. `page.getByTestId()` โ Resilient to text/translation updates (`data-testid`).
|
|
36
|
+
4. `page.locator('css')` โ Brittle, bound to DOM structures. Use only as last resort.
|
|
53
37
|
|
|
54
38
|
---
|
|
55
39
|
|
|
56
|
-
##
|
|
40
|
+
## 2. Test Isolation & Fixtures
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
**Active reviewers: `logic-reviewer` ยท `security-auditor`**
|
|
42
|
+
Do not cascade tests (where Test B requires Test A to pass first). Playwright gives every test a blank browser context isolated from the rest.
|
|
60
43
|
|
|
61
|
-
|
|
44
|
+
```typescript
|
|
45
|
+
import { test, expect } from '@playwright/test';
|
|
62
46
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
// โ BAD: Cascading state
|
|
48
|
+
test.describe('Dashboard', () => {
|
|
49
|
+
test('Login', async ({ page }) => {
|
|
50
|
+
await login(page); // Next test assumes this succeeded
|
|
51
|
+
});
|
|
52
|
+
test('Action', async ({ page }) => {
|
|
53
|
+
await page.getByRole('button', { name: 'Save' }).click();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
// โ
GOOD: Isolated tests via beforeEach or Custom Fixtures
|
|
58
|
+
test.beforeEach(async ({ page }) => {
|
|
59
|
+
// Login directly via API to bypass slow UI login, seeding cookies
|
|
60
|
+
await performFastApiLogin(page);
|
|
61
|
+
await page.goto('/dashboard');
|
|
62
|
+
});
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
test('Should save settings', async ({ page }) => {
|
|
65
|
+
await page.getByRole('button', { name: 'Save' }).click();
|
|
66
|
+
await expect(page.getByRole('alert')).toHaveText('Saved successfully');
|
|
67
|
+
});
|
|
70
68
|
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 3. Network Mocking
|
|
73
|
+
|
|
74
|
+
E2E tests that rely on external 3rd party APIs (Stripe, SendGrid) will fail randomly due to network latency outside your control.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
test('Should block invalid credit cards', async ({ page }) => {
|
|
78
|
+
// Intercept the outgoing request to the payment processor
|
|
79
|
+
await page.route('**/api/v1/charge*', async route => {
|
|
80
|
+
// Return a mocked failure response immediately
|
|
81
|
+
const json = { status: 'declined', message: 'Insufficient funds' };
|
|
82
|
+
await route.fulfill({ status: 400, json });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await page.getByRole('button', { name: 'Purchase' }).click();
|
|
86
|
+
await expect(page.getByText('Insufficient funds')).toBeVisible();
|
|
87
|
+
});
|
|
75
88
|
```
|
|
76
89
|
|
|
77
|
-
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 4. Configuration for CI/CD
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// playwright.config.ts
|
|
96
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
97
|
+
|
|
98
|
+
export default defineConfig({
|
|
99
|
+
testDir: './tests/e2e',
|
|
100
|
+
fullyParallel: true, // Run tests concurrently
|
|
101
|
+
forbidOnly: !!process.env.CI, // Fail build if `.only` was left in code
|
|
102
|
+
retries: process.env.CI ? 2 : 0, // Retry flakes on CI only
|
|
103
|
+
workers: process.env.CI ? 1 : undefined, // Reduce CI overload
|
|
104
|
+
reporter: 'html',
|
|
78
105
|
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
106
|
+
use: {
|
|
107
|
+
trace: 'on-first-retry', // Record trace viewer ONLY on failure to save space
|
|
108
|
+
video: 'retain-on-failure',
|
|
109
|
+
baseURL: 'http://localhost:3000',
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
projects: [
|
|
113
|
+
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
|
114
|
+
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
|
|
115
|
+
// Mobile Viewport Example
|
|
116
|
+
{ name: 'Mobile Safari', use: { ...devices['iPhone 13'] } },
|
|
117
|
+
],
|
|
118
|
+
|
|
119
|
+
// Spin up local server before running tests
|
|
120
|
+
webServer: {
|
|
121
|
+
command: 'npm run build && npm run start',
|
|
122
|
+
url: 'http://localhost:3000',
|
|
123
|
+
reuseExistingServer: !process.env.CI,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|