claude-code-kit 0.7.0__py3-none-any.whl
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.
- claude_code_kit-0.7.0.dist-info/METADATA +384 -0
- claude_code_kit-0.7.0.dist-info/RECORD +209 -0
- claude_code_kit-0.7.0.dist-info/WHEEL +4 -0
- claude_code_kit-0.7.0.dist-info/entry_points.txt +4 -0
- claude_code_kit-0.7.0.dist-info/licenses/LICENSE +21 -0
- claude_kit/__init__.py +10 -0
- claude_kit/__main__.py +8 -0
- claude_kit/_payload/agents/acceptance-reviewer.md +60 -0
- claude_kit/_payload/agents/auditor.md +76 -0
- claude_kit/_payload/agents/dependency-scanner.md +84 -0
- claude_kit/_payload/agents/developer.md +187 -0
- claude_kit/_payload/agents/devils-advocate.md +62 -0
- claude_kit/_payload/agents/devops-engineer.md +134 -0
- claude_kit/_payload/agents/e2e-tester.md +152 -0
- claude_kit/_payload/agents/em-reviewer.md +105 -0
- claude_kit/_payload/agents/incident-responder.md +64 -0
- claude_kit/_payload/agents/merge-reviewer.md +194 -0
- claude_kit/_payload/agents/observability-engineer.md +94 -0
- claude_kit/_payload/agents/orchestrator.md +551 -0
- claude_kit/_payload/agents/owasp-reviewer.md +76 -0
- claude_kit/_payload/agents/policy-validator.md +63 -0
- claude_kit/_payload/agents/pr-raiser.md +138 -0
- claude_kit/_payload/agents/risk-classifier.md +50 -0
- claude_kit/_payload/agents/sdlc-code-reviewer.md +196 -0
- claude_kit/_payload/agents/secret-scanner.md +70 -0
- claude_kit/_payload/agents/security-reviewer.md +80 -0
- claude_kit/_payload/agents/senior-backend-dev.md +199 -0
- claude_kit/_payload/agents/senior-frontend-dev.md +181 -0
- claude_kit/_payload/agents/senior-tester.md +206 -0
- claude_kit/_payload/agents/spec-doc-writer.md +331 -0
- claude_kit/_payload/agents/story-planner.md +56 -0
- claude_kit/_payload/agents/technical-architect.md +139 -0
- claude_kit/_payload/agents/tester.md +193 -0
- claude_kit/_payload/agents/ui-designer.md +73 -0
- claude_kit/_payload/agents/unit-tester.md +119 -0
- claude_kit/_payload/catalog/mcp.yaml +54 -0
- claude_kit/_payload/catalog/org.yaml +145 -0
- claude_kit/_payload/catalog/profiles.yaml +96 -0
- claude_kit/_payload/catalog/stacks.yaml +96 -0
- claude_kit/_payload/commands/init.md +36 -0
- claude_kit/_payload/commands/sdlc.md +18 -0
- claude_kit/_payload/commands/status.md +20 -0
- claude_kit/_payload/hooks/hooks.json +58 -0
- claude_kit/_payload/hooks/scripts/audit-log.sh +18 -0
- claude_kit/_payload/hooks/scripts/guard-secrets.sh +26 -0
- claude_kit/_payload/hooks/scripts/lint-fix.sh +38 -0
- claude_kit/_payload/hooks/scripts/load-continuity.sh +32 -0
- claude_kit/_payload/hooks/scripts/load-learnings.sh +40 -0
- claude_kit/_payload/hooks/scripts/type-check.sh +23 -0
- claude_kit/_payload/hooks/scripts/validate-frontmatter.sh +34 -0
- claude_kit/_payload/hooks/scripts/validate-settings.sh +21 -0
- claude_kit/_payload/hooks/scripts/warn-large-edits.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-missing-tests.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-sensitive-files.sh +30 -0
- claude_kit/_payload/hooks/scripts/warn-shared-modules.sh +33 -0
- claude_kit/_payload/rules/agent-guardrails.md +83 -0
- claude_kit/_payload/rules/agent-memory.md +106 -0
- claude_kit/_payload/rules/agent-resilience.md +61 -0
- claude_kit/_payload/rules/autonomy-levels.md +30 -0
- claude_kit/_payload/rules/code-organization.md +312 -0
- claude_kit/_payload/rules/continuity.md +84 -0
- claude_kit/_payload/rules/design-patterns.md +422 -0
- claude_kit/_payload/rules/devops-observability.md +57 -0
- claude_kit/_payload/rules/documentation.md +326 -0
- claude_kit/_payload/rules/evals.md +62 -0
- claude_kit/_payload/rules/frontend-best-practices.md +157 -0
- claude_kit/_payload/rules/goal-setting-and-monitoring.md +72 -0
- claude_kit/_payload/rules/human-in-the-loop.md +64 -0
- claude_kit/_payload/rules/linting-and-formatting.md +220 -0
- claude_kit/_payload/rules/mandatory-workflow.md +309 -0
- claude_kit/_payload/rules/model-tiers.md +34 -0
- claude_kit/_payload/rules/quality-gates.md +107 -0
- claude_kit/_payload/rules/rarv-cycle.md +31 -0
- claude_kit/_payload/rules/reasoning-techniques.md +62 -0
- claude_kit/_payload/rules/responsive-and-accessibility.md +353 -0
- claude_kit/_payload/rules/risk-classification.md +36 -0
- claude_kit/_payload/rules/testing.md +417 -0
- claude_kit/_payload/rules/tool-design.md +66 -0
- claude_kit/_payload/skills/_references/accessibility-checklist.md +160 -0
- claude_kit/_payload/skills/_references/orchestration-patterns.md +405 -0
- claude_kit/_payload/skills/_references/performance-checklist.md +153 -0
- claude_kit/_payload/skills/_references/security-checklist.md +134 -0
- claude_kit/_payload/skills/_references/testing-patterns.md +236 -0
- claude_kit/_payload/skills/accessibility-review/SKILL.md +56 -0
- claude_kit/_payload/skills/api-and-interface-design/SKILL.md +294 -0
- claude_kit/_payload/skills/api-integration/SKILL.md +348 -0
- claude_kit/_payload/skills/archive-sprint/SKILL.md +31 -0
- claude_kit/_payload/skills/backlog/SKILL.md +41 -0
- claude_kit/_payload/skills/backlog/item-template.md +20 -0
- claude_kit/_payload/skills/browser-testing-with-devtools/SKILL.md +302 -0
- claude_kit/_payload/skills/ci-cd-and-automation/SKILL.md +402 -0
- claude_kit/_payload/skills/code-review-and-quality/SKILL.md +347 -0
- claude_kit/_payload/skills/code-simplification/SKILL.md +331 -0
- claude_kit/_payload/skills/component-design/SKILL.md +171 -0
- claude_kit/_payload/skills/consolidate-learnings/SKILL.md +55 -0
- claude_kit/_payload/skills/context-engineering/SKILL.md +321 -0
- claude_kit/_payload/skills/debugging-and-error-recovery/SKILL.md +300 -0
- claude_kit/_payload/skills/decision/SKILL.md +46 -0
- claude_kit/_payload/skills/decision/adr-template.md +36 -0
- claude_kit/_payload/skills/deprecation-and-migration/SKILL.md +207 -0
- claude_kit/_payload/skills/documentation-and-adrs/SKILL.md +299 -0
- claude_kit/_payload/skills/doubt-driven-development/SKILL.md +243 -0
- claude_kit/_payload/skills/execute/SKILL.md +27 -0
- claude_kit/_payload/skills/frontend-ui-engineering/SKILL.md +328 -0
- claude_kit/_payload/skills/git-workflow-and-versioning/SKILL.md +300 -0
- claude_kit/_payload/skills/idea-refine/SKILL.md +178 -0
- claude_kit/_payload/skills/idea-refine/examples.md +238 -0
- claude_kit/_payload/skills/idea-refine/frameworks.md +99 -0
- claude_kit/_payload/skills/idea-refine/refinement-criteria.md +113 -0
- claude_kit/_payload/skills/idea-refine/scripts/idea-refine.sh +15 -0
- claude_kit/_payload/skills/incident-postmortem/SKILL.md +74 -0
- claude_kit/_payload/skills/incremental-implementation/SKILL.md +245 -0
- claude_kit/_payload/skills/interview-me/SKILL.md +221 -0
- claude_kit/_payload/skills/load-testing/SKILL.md +83 -0
- claude_kit/_payload/skills/manual-test/SKILL.md +516 -0
- claude_kit/_payload/skills/performance-optimization/SKILL.md +277 -0
- claude_kit/_payload/skills/planning-and-task-breakdown/SKILL.md +223 -0
- claude_kit/_payload/skills/playwright-verification/SKILL.md +205 -0
- claude_kit/_payload/skills/refresh-docs/SKILL.md +63 -0
- claude_kit/_payload/skills/remember/SKILL.md +96 -0
- claude_kit/_payload/skills/scope/SKILL.md +52 -0
- claude_kit/_payload/skills/scope/scope-template.md +82 -0
- claude_kit/_payload/skills/sdlc/SKILL.md +83 -0
- claude_kit/_payload/skills/security-and-hardening/SKILL.md +368 -0
- claude_kit/_payload/skills/security-verification/SKILL.md +209 -0
- claude_kit/_payload/skills/shipping-and-launch/SKILL.md +309 -0
- claude_kit/_payload/skills/smoke-test/SKILL.md +78 -0
- claude_kit/_payload/skills/source-driven-development/SKILL.md +195 -0
- claude_kit/_payload/skills/spec-driven-development/SKILL.md +200 -0
- claude_kit/_payload/skills/sprint/SKILL.md +67 -0
- claude_kit/_payload/skills/sprint/sprint-template.md +90 -0
- claude_kit/_payload/skills/test-driven-development/SKILL.md +383 -0
- claude_kit/_payload/skills/threat-model/SKILL.md +60 -0
- claude_kit/_payload/skills/triage/SKILL.md +87 -0
- claude_kit/_payload/skills/ui-ux-design/SKILL.md +71 -0
- claude_kit/_payload/skills/unit-test/SKILL.md +237 -0
- claude_kit/_payload/skills/using-agent-skills/SKILL.md +180 -0
- claude_kit/_payload/templates/CLAUDE.md +238 -0
- claude_kit/_payload/templates/CLAUDE.stack.md.tmpl +53 -0
- claude_kit/_payload/templates/CONTINUITY.template.md +35 -0
- claude_kit/_payload/templates/README.claude-sdlc.md.tmpl +219 -0
- claude_kit/_payload/templates/agent-memory/MEMORY.md +30 -0
- claude_kit/_payload/templates/agent-memory/api/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/architecture/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/debugging/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/gotchas/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/patterns/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/performance/.gitkeep +0 -0
- claude_kit/_payload/templates/artifacts/adr.md +18 -0
- claude_kit/_payload/templates/artifacts/feature-spec.md +29 -0
- claude_kit/_payload/templates/artifacts/release-plan.md +23 -0
- claude_kit/_payload/templates/artifacts/runbook.md +24 -0
- claude_kit/_payload/templates/artifacts/security-review.md +23 -0
- claude_kit/_payload/templates/artifacts/test-plan.md +22 -0
- claude_kit/_payload/templates/org/README.md +53 -0
- claude_kit/_payload/templates/org/agents/data-workflow-agent.md +59 -0
- claude_kit/_payload/templates/org/agents/founder-prototype-agent.md +61 -0
- claude_kit/_payload/templates/org/agents/internal-tools-builder.md +63 -0
- claude_kit/_payload/templates/org/agents/pm-copilot.md +60 -0
- claude_kit/_payload/templates/org/agents/support-ticket-engineer.md +63 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/README.md +46 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/pack.yaml +32 -0
- claude_kit/_payload/templates/org/packs/engineering-core/README.md +46 -0
- claude_kit/_payload/templates/org/packs/engineering-core/pack.yaml +44 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/README.md +53 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/pack.yaml +39 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/README.md +49 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/pack.yaml +26 -0
- claude_kit/_payload/templates/org/packs/product-to-code/README.md +50 -0
- claude_kit/_payload/templates/org/packs/product-to-code/pack.yaml +34 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/README.md +53 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/pack.yaml +40 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/README.md +50 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/pack.yaml +36 -0
- claude_kit/_payload/templates/org/rules/ai-working-agreement.md +45 -0
- claude_kit/_payload/templates/org/rules/ambiguity-resolution.md +36 -0
- claude_kit/_payload/templates/org/rules/branch-and-pr-policy.md +41 -0
- claude_kit/_payload/templates/org/rules/compliance-policy.md +50 -0
- claude_kit/_payload/templates/org/rules/non-engineer-safe-coding.md +37 -0
- claude_kit/_payload/templates/org/rules/pii-policy.md +46 -0
- claude_kit/_payload/templates/org/rules/production-data-policy.md +35 -0
- claude_kit/_payload/templates/org/rules/prompt-to-task-conversion.md +30 -0
- claude_kit/_payload/templates/org/rules/prototype-boundaries.md +40 -0
- claude_kit/_payload/templates/org/rules/secrets-policy.md +34 -0
- claude_kit/_payload/templates/org/skills/customer-issue-to-fix/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/feature-from-idea/SKILL.md +56 -0
- claude_kit/_payload/templates/org/skills/prompt-to-safe-task/SKILL.md +59 -0
- claude_kit/_payload/templates/org/skills/prototype-to-production/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/repo-onboarding/SKILL.md +60 -0
- claude_kit/_payload/templates/settings.json +53 -0
- claude_kit/_payload/templates/stacks/backend/python/fastapi/rules/fastapi-patterns.md +64 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/migration-specialist.md +61 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/mongodb-specialist.md +59 -0
- claude_kit/_payload/templates/stacks/db/mongodb/rules/mongodb-patterns.md +39 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/db-performance-reviewer.md +66 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/migration-specialist.md +56 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/postgres-specialist.md +58 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/database-performance.md +64 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/postgres-patterns.md +43 -0
- claude_kit/_payload/templates/stacks/frontend/react/rules/react-patterns.md +63 -0
- claude_kit/catalog.py +476 -0
- claude_kit/cli.py +327 -0
- claude_kit/hooks.py +246 -0
- claude_kit/models.py +205 -0
- claude_kit/prompts.py +209 -0
- claude_kit/render.py +146 -0
- claude_kit/scaffold.py +492 -0
- claude_kit/upgrader.py +294 -0
- claude_kit/validator.py +197 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-optimization
|
|
3
|
+
description: Analyze and optimize application performance covering web vitals, bundle size, code splitting, chunking strategy, and rendering best practices for web frontends.
|
|
4
|
+
argument-hint: [page, component, or "bundle"]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Optimize performance for: $ARGUMENTS.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Identify the optimization target**: Determine if this is a bundle optimization, render performance issue, or Core Web Vitals improvement for `$ARGUMENTS`.
|
|
13
|
+
|
|
14
|
+
2. **Gather baseline metrics**: Run the appropriate analysis tools.
|
|
15
|
+
|
|
16
|
+
### Bundle Analysis
|
|
17
|
+
```bash
|
|
18
|
+
# Use the project's bundle analyzer (examples: vite-bundle-visualizer, webpack-bundle-analyzer, esbuild analyzer)
|
|
19
|
+
# Run the project's build and check output for chunk sizes
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Runtime Performance
|
|
23
|
+
- Use the `auditor` agent or Chrome DevTools to run a Lighthouse trace on the target page
|
|
24
|
+
- Check for framework-specific warnings in the browser console
|
|
25
|
+
|
|
26
|
+
3. **Apply optimizations based on category**:
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### A. Bundle Optimization
|
|
31
|
+
|
|
32
|
+
#### Code Splitting (Route-Level)
|
|
33
|
+
Every major route should be lazy-loaded where the framework supports it:
|
|
34
|
+
|
|
35
|
+
**React/Preact example:**
|
|
36
|
+
```typescript
|
|
37
|
+
// App entry point
|
|
38
|
+
const DashboardPage = React.lazy(() => import('./pages/DashboardPage'));
|
|
39
|
+
const DataPage = React.lazy(() => import('./pages/DataPage'));
|
|
40
|
+
|
|
41
|
+
// Wrap in Suspense
|
|
42
|
+
<Suspense fallback={<Spinner />}>
|
|
43
|
+
<Route path="/" element={<DashboardPage />} />
|
|
44
|
+
</Suspense>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Vue example:**
|
|
48
|
+
```javascript
|
|
49
|
+
const routes = [
|
|
50
|
+
{ path: '/', component: () => import('./pages/DashboardPage.vue') },
|
|
51
|
+
{ path: '/data', component: () => import('./pages/DataPage.vue') },
|
|
52
|
+
];
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Angular example:**
|
|
56
|
+
```typescript
|
|
57
|
+
// In routing module
|
|
58
|
+
const routes: Routes = [
|
|
59
|
+
{ path: 'dashboard', loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule) },
|
|
60
|
+
];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Tree Shaking
|
|
64
|
+
- Import only what you use:
|
|
65
|
+
```typescript
|
|
66
|
+
// GOOD
|
|
67
|
+
import { IconName, SpecificIcon } from 'icon-library';
|
|
68
|
+
|
|
69
|
+
// BAD
|
|
70
|
+
import * as Icons from 'icon-library';
|
|
71
|
+
```
|
|
72
|
+
- Verify chart/visualization library imports are specific (e.g., import only the chart types you need)
|
|
73
|
+
|
|
74
|
+
#### Chunk Strategy
|
|
75
|
+
| Chunk | Contents | Target Size |
|
|
76
|
+
|-------|----------|-------------|
|
|
77
|
+
| `vendor-core` | Core framework (react/vue/angular) + router | ~40-50KB gz |
|
|
78
|
+
| `vendor-ui` | UI component library | ~30KB gz |
|
|
79
|
+
| `vendor-charts` | Chart/visualization libraries | ~50KB gz (lazy) |
|
|
80
|
+
| `app` | Application code | <100KB gz |
|
|
81
|
+
| Route chunks | Per-page code | <30KB gz each |
|
|
82
|
+
|
|
83
|
+
**Example configuration (adapt to your bundler):**
|
|
84
|
+
|
|
85
|
+
Vite:
|
|
86
|
+
```typescript
|
|
87
|
+
build: {
|
|
88
|
+
rollupOptions: {
|
|
89
|
+
output: {
|
|
90
|
+
manualChunks: {
|
|
91
|
+
'vendor-core': ['framework', 'framework-router'],
|
|
92
|
+
'vendor-ui': ['ui-library-pkg'],
|
|
93
|
+
'vendor-charts': ['chart-library'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Webpack:
|
|
101
|
+
```javascript
|
|
102
|
+
optimization: {
|
|
103
|
+
splitChunks: {
|
|
104
|
+
cacheGroups: {
|
|
105
|
+
vendor: { test: /[\\/]node_modules[\\/]/, name: 'vendor' },
|
|
106
|
+
// ... custom groups
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Bundle Size Targets
|
|
113
|
+
| Metric | Target | Alert |
|
|
114
|
+
|--------|--------|-------|
|
|
115
|
+
| Initial JS (gzipped) | < 200KB | > 250KB |
|
|
116
|
+
| Largest chunk (gzipped) | < 100KB | > 120KB |
|
|
117
|
+
| Total CSS (gzipped) | < 30KB | > 50KB |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### B. UI Rendering Performance
|
|
122
|
+
|
|
123
|
+
#### Avoid Unnecessary Re-renders
|
|
124
|
+
**React/Preact:**
|
|
125
|
+
```typescript
|
|
126
|
+
// Use memoization for pure display components
|
|
127
|
+
const MetricCard = React.memo(function MetricCard({ title, value }: Props) {
|
|
128
|
+
return <div>...</div>;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Use memoization for expensive derivations
|
|
132
|
+
const sortedItems = useMemo(() =>
|
|
133
|
+
items.sort((a, b) => b.priority - a.priority),
|
|
134
|
+
[items]
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
// Use callbacks for handlers passed as props
|
|
138
|
+
const handleFilter = useCallback((value: string) => {
|
|
139
|
+
setFilter(value);
|
|
140
|
+
}, []);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Vue:**
|
|
144
|
+
```vue
|
|
145
|
+
<script setup>
|
|
146
|
+
// Use computed properties for derived state
|
|
147
|
+
const sortedItems = computed(() =>
|
|
148
|
+
items.value.sort((a, b) => b.priority - a.priority)
|
|
149
|
+
);
|
|
150
|
+
</script>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Angular:**
|
|
154
|
+
```typescript
|
|
155
|
+
// Use OnPush change detection for pure components
|
|
156
|
+
@Component({
|
|
157
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Client State Store Anti-patterns
|
|
162
|
+
**Zustand (React) example:**
|
|
163
|
+
```typescript
|
|
164
|
+
// BAD - subscribes to entire store, re-renders on ANY change
|
|
165
|
+
const store = useStore();
|
|
166
|
+
|
|
167
|
+
// GOOD - subscribe to specific values
|
|
168
|
+
const items = useStore((s) => s.items);
|
|
169
|
+
const setFilter = useStore((s) => s.setFilter);
|
|
170
|
+
|
|
171
|
+
// BAD - creates new reference every render
|
|
172
|
+
const filtered = useStore((s) => s.items.filter(i => i.active));
|
|
173
|
+
|
|
174
|
+
// GOOD - store derived data as state, recompute in actions
|
|
175
|
+
const filteredItems = useStore((s) => s.filteredItems);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Pinia (Vue) / Vuex:**
|
|
179
|
+
```javascript
|
|
180
|
+
// Use getters for derived state, not computed in components
|
|
181
|
+
const store = useMyStore();
|
|
182
|
+
const filteredItems = store.filteredItems; // getter defined in store
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**NgRx (Angular):**
|
|
186
|
+
```typescript
|
|
187
|
+
// Use selectors for derived state
|
|
188
|
+
const filteredItems$ = store.select(selectFilteredItems);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Virtualization
|
|
192
|
+
Use virtualization for lists with > 50 items. Examples by framework:
|
|
193
|
+
|
|
194
|
+
**React:**
|
|
195
|
+
```typescript
|
|
196
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
197
|
+
|
|
198
|
+
function VirtualList({ items }: { items: Item[] }) {
|
|
199
|
+
const parentRef = useRef<HTMLDivElement>(null);
|
|
200
|
+
const virtualizer = useVirtualizer({
|
|
201
|
+
count: items.length,
|
|
202
|
+
getScrollElement: () => parentRef.current,
|
|
203
|
+
estimateSize: () => 64,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div ref={parentRef} className="h-[600px] overflow-auto">
|
|
208
|
+
<div style={{ height: virtualizer.getTotalSize() }} className="relative w-full">
|
|
209
|
+
{virtualizer.getVirtualItems().map((virtualItem) => (
|
|
210
|
+
<div
|
|
211
|
+
key={virtualItem.key}
|
|
212
|
+
className="absolute top-0 left-0 w-full"
|
|
213
|
+
style={{ height: virtualItem.size, transform: `translateY(${virtualItem.start}px)` }}
|
|
214
|
+
>
|
|
215
|
+
<ItemRow item={items[virtualItem.index]} />
|
|
216
|
+
</div>
|
|
217
|
+
))}
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Vue:** Use `vue-virtual-scroller` or `@tanstack/vue-virtual`
|
|
225
|
+
|
|
226
|
+
**Angular:** Use `@angular/cdk/scrolling` with `cdk-virtual-scroll-viewport`
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### C. Core Web Vitals
|
|
231
|
+
|
|
232
|
+
| Metric | Target | Common Fixes |
|
|
233
|
+
|--------|--------|-------------|
|
|
234
|
+
| LCP < 2.5s | Optimize critical rendering path | Lazy-load below-fold content, preload fonts |
|
|
235
|
+
| FID < 100ms | Minimize main thread work | Code-split heavy components, defer non-critical JS |
|
|
236
|
+
| CLS < 0.1 | Prevent layout shifts | Set explicit dimensions on images/containers, use min-height |
|
|
237
|
+
| INP < 200ms | Fast interactions | Debounce handlers, use framework-specific non-blocking APIs (e.g., React `startTransition`) |
|
|
238
|
+
|
|
239
|
+
#### Font Loading
|
|
240
|
+
```html
|
|
241
|
+
<!-- Preconnect to font CDN (if using web fonts) -->
|
|
242
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
243
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
244
|
+
|
|
245
|
+
<!-- Or use font-display: swap in CSS -->
|
|
246
|
+
@font-face {
|
|
247
|
+
font-family: 'CustomFont';
|
|
248
|
+
font-display: swap;
|
|
249
|
+
src: url('/fonts/custom.woff2') format('woff2');
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Image Optimization
|
|
254
|
+
- Use the project's optimized image component if available
|
|
255
|
+
- Specify `width` and `height` attributes to prevent CLS
|
|
256
|
+
- Use `loading="lazy"` for below-fold images
|
|
257
|
+
- Consider using modern formats (WebP, AVIF) with fallbacks
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
4. **Verify improvements**: Re-run analysis tools and compare against baseline.
|
|
262
|
+
|
|
263
|
+
5. **Report**: Output a before/after comparison table:
|
|
264
|
+
|
|
265
|
+
| Metric | Before | After | Change |
|
|
266
|
+
|--------|--------|-------|--------|
|
|
267
|
+
| Initial bundle | Xkb | Ykb | -Z% |
|
|
268
|
+
| LCP | Xs | Ys | -Zms |
|
|
269
|
+
| ... | ... | ... | ... |
|
|
270
|
+
|
|
271
|
+
6. **Run build**: Execute the project's build command to confirm the build still passes.
|
|
272
|
+
|
|
273
|
+
## References
|
|
274
|
+
|
|
275
|
+
- Check the project's bundler config (e.g., `vite.config.ts`, `webpack.config.js`, `angular.json`)
|
|
276
|
+
- Consult the project's design system documentation for image/icon sizing guidelines
|
|
277
|
+
- Use the project's virtualization library (e.g., `@tanstack/react-virtual`, `vue-virtual-scroller`, `@angular/cdk/scrolling`)
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: planning-and-task-breakdown
|
|
3
|
+
description: Breaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. Works across all stacks and languages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Planning and Task Breakdown
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Decompose work into small, verifiable tasks with explicit acceptance criteria. Good task breakdown is the difference between an agent that completes work reliably and one that produces a tangled mess. Every task should be small enough to implement, test, and verify in a single focused session.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- You have a spec and need to break it into implementable units
|
|
15
|
+
- A task feels too large or vague to start
|
|
16
|
+
- Work needs to be parallelized across multiple agents or sessions
|
|
17
|
+
- You need to communicate scope to a human
|
|
18
|
+
- The implementation order isn't obvious
|
|
19
|
+
|
|
20
|
+
**When NOT to use:** Single-file changes with obvious scope, or when the spec already contains well-defined tasks.
|
|
21
|
+
|
|
22
|
+
## The Planning Process
|
|
23
|
+
|
|
24
|
+
### Step 1: Enter Plan Mode
|
|
25
|
+
|
|
26
|
+
Before writing any code, operate in read-only mode:
|
|
27
|
+
|
|
28
|
+
- Read the spec and relevant codebase sections
|
|
29
|
+
- Identify existing patterns and conventions
|
|
30
|
+
- Map dependencies between components
|
|
31
|
+
- Note risks and unknowns
|
|
32
|
+
|
|
33
|
+
**Do NOT write code during planning.** The output is a plan document, not implementation.
|
|
34
|
+
|
|
35
|
+
### Step 2: Identify the Dependency Graph
|
|
36
|
+
|
|
37
|
+
Map what depends on what:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Database schema
|
|
41
|
+
│
|
|
42
|
+
├── API models/types
|
|
43
|
+
│ │
|
|
44
|
+
│ ├── API endpoints
|
|
45
|
+
│ │ │
|
|
46
|
+
│ │ └── Frontend API client
|
|
47
|
+
│ │ │
|
|
48
|
+
│ │ └── UI components
|
|
49
|
+
│ │
|
|
50
|
+
│ └── Validation logic
|
|
51
|
+
│
|
|
52
|
+
└── Seed data / migrations
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Implementation order follows the dependency graph bottom-up: build foundations first.
|
|
56
|
+
|
|
57
|
+
### Step 3: Slice Vertically
|
|
58
|
+
|
|
59
|
+
Instead of building all the database, then all the API, then all the UI — build one complete feature path at a time:
|
|
60
|
+
|
|
61
|
+
**Bad (horizontal slicing):**
|
|
62
|
+
```
|
|
63
|
+
Task 1: Build entire database schema
|
|
64
|
+
Task 2: Build all API endpoints
|
|
65
|
+
Task 3: Build all UI components
|
|
66
|
+
Task 4: Connect everything
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Good (vertical slicing):**
|
|
70
|
+
```
|
|
71
|
+
Task 1: User can create an account (schema + API + UI for registration)
|
|
72
|
+
Task 2: User can log in (auth schema + API + UI for login)
|
|
73
|
+
Task 3: User can create a task (task schema + API + UI for creation)
|
|
74
|
+
Task 4: User can view task list (query + API + UI for list view)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Each vertical slice delivers working, testable functionality.
|
|
78
|
+
|
|
79
|
+
### Step 4: Write Tasks
|
|
80
|
+
|
|
81
|
+
Each task follows this structure:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
## Task [N]: [Short descriptive title]
|
|
85
|
+
|
|
86
|
+
**Description:** One paragraph explaining what this task accomplishes.
|
|
87
|
+
|
|
88
|
+
**Acceptance criteria:**
|
|
89
|
+
- [ ] [Specific, testable condition]
|
|
90
|
+
- [ ] [Specific, testable condition]
|
|
91
|
+
|
|
92
|
+
**Verification:**
|
|
93
|
+
- [ ] Tests pass: run the project's test suite for this feature
|
|
94
|
+
- [ ] Build succeeds: run the project's build
|
|
95
|
+
- [ ] Manual check: [description of what to verify]
|
|
96
|
+
|
|
97
|
+
**Dependencies:** [Task numbers this depends on, or "None"]
|
|
98
|
+
|
|
99
|
+
**Files likely touched:**
|
|
100
|
+
- `path/to/file`
|
|
101
|
+
- `path/to/test`
|
|
102
|
+
|
|
103
|
+
**Estimated scope:** [Small: 1-2 files | Medium: 3-5 files | Large: 5+ files]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 5: Order and Checkpoint
|
|
107
|
+
|
|
108
|
+
Arrange tasks so that:
|
|
109
|
+
|
|
110
|
+
1. Dependencies are satisfied (build foundation first)
|
|
111
|
+
2. Each task leaves the system in a working state
|
|
112
|
+
3. Verification checkpoints occur after every 2-3 tasks
|
|
113
|
+
4. High-risk tasks are early (fail fast)
|
|
114
|
+
|
|
115
|
+
Add explicit checkpoints:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
## Checkpoint: After Tasks 1-3
|
|
119
|
+
- [ ] All tests pass
|
|
120
|
+
- [ ] Application builds without errors
|
|
121
|
+
- [ ] Core user flow works end-to-end
|
|
122
|
+
- [ ] Review with human before proceeding
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Task Sizing Guidelines
|
|
126
|
+
|
|
127
|
+
| Size | Files | Scope | Example |
|
|
128
|
+
|------|-------|-------|---------|
|
|
129
|
+
| **XS** | 1 | Single function or config change | Add a validation rule |
|
|
130
|
+
| **S** | 1-2 | One component or endpoint | Add a new API endpoint |
|
|
131
|
+
| **M** | 3-5 | One feature slice | User registration flow |
|
|
132
|
+
| **L** | 5-8 | Multi-component feature | Search with filtering and pagination |
|
|
133
|
+
| **XL** | 8+ | **Too large — break it down further** | — |
|
|
134
|
+
|
|
135
|
+
If a task is L or larger, it should be broken into smaller tasks. An agent performs best on S and M tasks.
|
|
136
|
+
|
|
137
|
+
**When to break a task down further:**
|
|
138
|
+
- It would take more than one focused session (roughly 2+ hours of agent work)
|
|
139
|
+
- You cannot describe the acceptance criteria in 3 or fewer bullet points
|
|
140
|
+
- It touches two or more independent subsystems (e.g., auth and billing)
|
|
141
|
+
- You find yourself writing "and" in the task title (a sign it is two tasks)
|
|
142
|
+
|
|
143
|
+
## Plan Document Template
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
# Implementation Plan: [Feature/Project Name]
|
|
147
|
+
|
|
148
|
+
## Overview
|
|
149
|
+
[One paragraph summary of what we're building]
|
|
150
|
+
|
|
151
|
+
## Architecture Decisions
|
|
152
|
+
- [Key decision 1 and rationale]
|
|
153
|
+
- [Key decision 2 and rationale]
|
|
154
|
+
|
|
155
|
+
## Task List
|
|
156
|
+
|
|
157
|
+
### Phase 1: Foundation
|
|
158
|
+
- [ ] Task 1: ...
|
|
159
|
+
- [ ] Task 2: ...
|
|
160
|
+
|
|
161
|
+
### Checkpoint: Foundation
|
|
162
|
+
- [ ] Tests pass, builds clean
|
|
163
|
+
|
|
164
|
+
### Phase 2: Core Features
|
|
165
|
+
- [ ] Task 3: ...
|
|
166
|
+
- [ ] Task 4: ...
|
|
167
|
+
|
|
168
|
+
### Checkpoint: Core Features
|
|
169
|
+
- [ ] End-to-end flow works
|
|
170
|
+
|
|
171
|
+
### Phase 3: Polish
|
|
172
|
+
- [ ] Task 5: ...
|
|
173
|
+
- [ ] Task 6: ...
|
|
174
|
+
|
|
175
|
+
### Checkpoint: Complete
|
|
176
|
+
- [ ] All acceptance criteria met
|
|
177
|
+
- [ ] Ready for review
|
|
178
|
+
|
|
179
|
+
## Risks and Mitigations
|
|
180
|
+
| Risk | Impact | Mitigation |
|
|
181
|
+
|------|--------|------------|
|
|
182
|
+
| [Risk] | [High/Med/Low] | [Strategy] |
|
|
183
|
+
|
|
184
|
+
## Open Questions
|
|
185
|
+
- [Question needing human input]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Parallelization Opportunities
|
|
189
|
+
|
|
190
|
+
When multiple agents or sessions are available:
|
|
191
|
+
|
|
192
|
+
- **Safe to parallelize:** Independent feature slices, tests for already-implemented features, documentation
|
|
193
|
+
- **Must be sequential:** Database migrations, shared state changes, dependency chains
|
|
194
|
+
- **Needs coordination:** Features that share an API contract (define the contract first, then parallelize)
|
|
195
|
+
|
|
196
|
+
## Common Rationalizations
|
|
197
|
+
|
|
198
|
+
| Rationalization | Reality |
|
|
199
|
+
|---|---|
|
|
200
|
+
| "I'll figure it out as I go" | That's how you end up with a tangled mess and rework. 10 minutes of planning saves hours. |
|
|
201
|
+
| "The tasks are obvious" | Write them down anyway. Explicit tasks surface hidden dependencies and forgotten edge cases. |
|
|
202
|
+
| "Planning is overhead" | Planning is the task. Implementation without a plan is just typing. |
|
|
203
|
+
| "I can hold it all in my head" | Context windows are finite. Written plans survive session boundaries and compaction. |
|
|
204
|
+
|
|
205
|
+
## Red Flags
|
|
206
|
+
|
|
207
|
+
- Starting implementation without a written task list
|
|
208
|
+
- Tasks that say "implement the feature" without acceptance criteria
|
|
209
|
+
- No verification steps in the plan
|
|
210
|
+
- All tasks are XL-sized
|
|
211
|
+
- No checkpoints between tasks
|
|
212
|
+
- Dependency order isn't considered
|
|
213
|
+
|
|
214
|
+
## Verification
|
|
215
|
+
|
|
216
|
+
Before starting implementation, confirm:
|
|
217
|
+
|
|
218
|
+
- [ ] Every task has acceptance criteria
|
|
219
|
+
- [ ] Every task has a verification step
|
|
220
|
+
- [ ] Task dependencies are identified and ordered correctly
|
|
221
|
+
- [ ] No task touches more than ~5 files
|
|
222
|
+
- [ ] Checkpoints exist between major phases
|
|
223
|
+
- [ ] The human has reviewed and approved the plan
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-verification
|
|
3
|
+
description: Run E2E tests after deployment to verify page loads, navigation flows, user interactions, and cross-browser compatibility using the project's E2E framework.
|
|
4
|
+
argument-hint: [page route, "smoke", "all", or "cross-browser"]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Run E2E verification for: $ARGUMENTS.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Determine test scope**: Based on `$ARGUMENTS`, select the test scope according to the project's E2E framework configuration. Common patterns:
|
|
13
|
+
|
|
14
|
+
| Argument | Scope | Example Command Pattern |
|
|
15
|
+
|----------|-------|------------------------|
|
|
16
|
+
| `smoke` | All smoke tests | Run smoke test suite |
|
|
17
|
+
| `all` | All E2E tests | Run all E2E tests |
|
|
18
|
+
| `cross-browser` | All tests on multiple browsers | Run tests on Chromium + Firefox + WebKit |
|
|
19
|
+
| `/route` | Tests for a specific page | Run tests for a specific route |
|
|
20
|
+
| `mobile` | Mobile viewport tests | Run mobile-specific tests |
|
|
21
|
+
|
|
22
|
+
2. **Ensure dev server is running**: Check if the app is running at the configured URL (e.g., `http://localhost:5173`, `http://localhost:3000`, `http://localhost:8000`). If not, start it according to the project's setup.
|
|
23
|
+
|
|
24
|
+
3. **Run the tests**: Execute the project's E2E test suite with the selected scope.
|
|
25
|
+
|
|
26
|
+
4. **If writing new tests**, follow these conventions:
|
|
27
|
+
|
|
28
|
+
### Test File Structure (Example Pattern)
|
|
29
|
+
```typescript
|
|
30
|
+
// Example using Playwright syntax - adapt to project's E2E framework
|
|
31
|
+
import { test, expect } from '@playwright/test';
|
|
32
|
+
|
|
33
|
+
test.describe('Page Name', () => {
|
|
34
|
+
test.beforeEach(async ({ page }) => {
|
|
35
|
+
await page.goto('/route');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('loads successfully', async ({ page }) => {
|
|
39
|
+
await expect(page.locator('main#main-content')).toBeVisible();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('displays key content', async ({ page }) => {
|
|
43
|
+
await expect(page.getByRole('heading', { name: 'Page Title' })).toBeVisible();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('navigation works', async ({ page }) => {
|
|
47
|
+
await page.click('a[href="/next-page"]');
|
|
48
|
+
await expect(page).toHaveURL('/next-page');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('user interaction flow', async ({ page }) => {
|
|
52
|
+
await page.getByRole('button', { name: 'Action' }).click();
|
|
53
|
+
await expect(page.getByText('Result')).toBeVisible();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Selector Priority (Accessibility-First)
|
|
59
|
+
| Priority | Selector Type | Example |
|
|
60
|
+
|----------|---------------|---------|
|
|
61
|
+
| 1 | Role-based | `getByRole('button', { name: 'Submit' })` |
|
|
62
|
+
| 2 | Text content | `getByText('Exception #1234')` |
|
|
63
|
+
| 3 | Label association | `getByLabel('Search')` |
|
|
64
|
+
| 4 | Placeholder | `getByPlaceholder('Filter by name')` |
|
|
65
|
+
| 5 | Test IDs | `[data-testid="metric-card"]` |
|
|
66
|
+
| 6 | CSS/XPath | `main#main-content` (last resort) |
|
|
67
|
+
|
|
68
|
+
### Page Object Model (for complex pages)
|
|
69
|
+
```typescript
|
|
70
|
+
// Example using Playwright - adapt to project's framework
|
|
71
|
+
import { Page, Locator, expect } from '@playwright/test';
|
|
72
|
+
|
|
73
|
+
export class DashboardPage {
|
|
74
|
+
readonly page: Page;
|
|
75
|
+
readonly heading: Locator;
|
|
76
|
+
readonly metricCards: Locator;
|
|
77
|
+
readonly sidebar: Locator;
|
|
78
|
+
|
|
79
|
+
constructor(page: Page) {
|
|
80
|
+
this.page = page;
|
|
81
|
+
this.heading = page.getByRole('heading', { level: 1 });
|
|
82
|
+
this.metricCards = page.locator('[data-testid="metric-card"]');
|
|
83
|
+
this.sidebar = page.locator('aside');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async goto() {
|
|
87
|
+
await this.page.goto('/');
|
|
88
|
+
await expect(this.page.locator('main#main-content')).toBeVisible();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async getMetricCount() {
|
|
92
|
+
return this.metricCards.count();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async navigateTo(route: string) {
|
|
96
|
+
await this.page.click(`a[href="${route}"]`);
|
|
97
|
+
await expect(this.page).toHaveURL(route);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
5. **Check test results**: Review the output for failures.
|
|
103
|
+
|
|
104
|
+
### On Failure
|
|
105
|
+
- Read the error message and trace
|
|
106
|
+
- Open the test framework's report viewer (e.g., HTML report)
|
|
107
|
+
- Check the trace viewer for step-by-step screenshots/recordings
|
|
108
|
+
- Fix the issue in the application code (not by weakening the test)
|
|
109
|
+
|
|
110
|
+
6. **Report results**: Output a summary table:
|
|
111
|
+
|
|
112
|
+
| Test Suite | Passed | Failed | Skipped | Duration |
|
|
113
|
+
|-----------|--------|--------|---------|----------|
|
|
114
|
+
|
|
115
|
+
For failures:
|
|
116
|
+
| Test | Error | File:Line | Suggested Fix |
|
|
117
|
+
|------|-------|-----------|---------------|
|
|
118
|
+
|
|
119
|
+
## Test Categories
|
|
120
|
+
|
|
121
|
+
### Smoke Tests
|
|
122
|
+
Every route loads without errors:
|
|
123
|
+
- Main content is visible
|
|
124
|
+
- No console errors
|
|
125
|
+
- Navigation works
|
|
126
|
+
- Critical user paths complete
|
|
127
|
+
|
|
128
|
+
### Page Tests
|
|
129
|
+
Feature-specific user flows:
|
|
130
|
+
- Key content renders
|
|
131
|
+
- Filters and search work
|
|
132
|
+
- Interactive elements respond correctly
|
|
133
|
+
- Data displays correctly
|
|
134
|
+
|
|
135
|
+
### Cross-Cutting Tests
|
|
136
|
+
- User state changes (e.g., persona/role switching) update the view
|
|
137
|
+
- Global filters update data across pages
|
|
138
|
+
- Responsive behavior at key breakpoints
|
|
139
|
+
- Authentication flows
|
|
140
|
+
- Error states
|
|
141
|
+
|
|
142
|
+
## E2E Framework Config Reference
|
|
143
|
+
|
|
144
|
+
Example configuration (adapt to project's framework):
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// Example using Playwright - adapt as needed
|
|
148
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
149
|
+
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
testDir: './e2e',
|
|
152
|
+
fullyParallel: true,
|
|
153
|
+
forbidOnly: !!process.env.CI,
|
|
154
|
+
retries: process.env.CI ? 1 : 0,
|
|
155
|
+
workers: process.env.CI ? 1 : undefined,
|
|
156
|
+
reporter: [['html'], ['list']],
|
|
157
|
+
use: {
|
|
158
|
+
baseURL: 'http://localhost:5173', // Adjust to project's dev server
|
|
159
|
+
trace: 'on-first-retry',
|
|
160
|
+
screenshot: 'only-on-failure',
|
|
161
|
+
},
|
|
162
|
+
projects: [
|
|
163
|
+
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
|
164
|
+
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
|
165
|
+
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
|
|
166
|
+
{ name: 'mobile-chrome', use: { ...devices['Pixel 5'] } },
|
|
167
|
+
{ name: 'mobile-safari', use: { ...devices['iPhone 13'] } },
|
|
168
|
+
{ name: 'tablet', use: { ...devices['iPad (gen 7)'] } },
|
|
169
|
+
],
|
|
170
|
+
webServer: {
|
|
171
|
+
command: 'npm run dev', // Adjust to project's dev command
|
|
172
|
+
url: 'http://localhost:5173', // Adjust to project's dev server
|
|
173
|
+
reuseExistingServer: !process.env.CI,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## E2E Directory Structure Example
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
e2e/
|
|
182
|
+
smoke.spec.ts # Smoke tests covering all routes
|
|
183
|
+
pages/
|
|
184
|
+
dashboard.spec.ts # Page-specific tests
|
|
185
|
+
feature-a.spec.ts
|
|
186
|
+
feature-b.spec.ts
|
|
187
|
+
models/
|
|
188
|
+
DashboardPage.ts # Page Object Models
|
|
189
|
+
FeatureAPage.ts
|
|
190
|
+
cross-cutting/
|
|
191
|
+
auth.spec.ts # Authentication flows
|
|
192
|
+
responsive.spec.ts # Responsive behavior tests
|
|
193
|
+
navigation.spec.ts # Global navigation tests
|
|
194
|
+
fixtures/
|
|
195
|
+
test-helpers.ts # Shared test utilities
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Route Organization
|
|
199
|
+
|
|
200
|
+
Structure E2E tests to match the application's route hierarchy. Identify critical user paths and create dedicated test suites for:
|
|
201
|
+
- Landing/dashboard pages
|
|
202
|
+
- Primary features (list, detail, create, edit flows)
|
|
203
|
+
- Admin/settings pages
|
|
204
|
+
- Authentication/authorization flows
|
|
205
|
+
- Error and empty states
|