@neyugn/agent-kits 0.5.0 → 0.5.3
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/README.md +66 -81
- package/README.vi.md +79 -52
- package/README.zh.md +69 -88
- package/common/skills/filter-agent/SKILL.md +33 -45
- package/common/skills/filter-skill/SKILL.md +51 -73
- package/common/skills/scan-techstack/SKILL.md +30 -36
- package/dist/cli.js +85 -0
- package/kits/coder/agents/ai-engineer.md +27 -39
- package/kits/coder/agents/backend-specialist.md +31 -45
- package/kits/coder/agents/cloud-architect.md +31 -45
- package/kits/coder/agents/code-reviewer.md +45 -67
- package/kits/coder/agents/data-engineer.md +22 -32
- package/kits/coder/agents/database-specialist.md +30 -44
- package/kits/coder/agents/debugger.md +28 -42
- package/kits/coder/agents/devops-engineer.md +35 -53
- package/kits/coder/agents/documentation-writer.md +48 -68
- package/kits/coder/agents/frontend-specialist.md +30 -46
- package/kits/coder/agents/i18n-specialist.md +37 -51
- package/kits/coder/agents/integration-specialist.md +38 -54
- package/kits/coder/agents/mobile-developer.md +37 -53
- package/kits/coder/agents/multi-tenant-architect.md +25 -37
- package/kits/coder/agents/orchestrator.md +20 -32
- package/kits/coder/agents/performance-analyst.md +43 -65
- package/kits/coder/agents/project-planner.md +25 -39
- package/kits/coder/agents/queue-specialist.md +26 -38
- package/kits/coder/agents/realtime-specialist.md +44 -64
- package/kits/coder/agents/security-auditor.md +44 -64
- package/kits/coder/agents/test-engineer.md +30 -44
- package/kits/coder/agents/ux-researcher.md +26 -38
- package/kits/coder/rules/sections/classifier.md +11 -7
- package/kits/coder/rules/sections/code.md +5 -4
- package/kits/coder/skills/accessibility-patterns/SKILL.md +67 -81
- package/kits/coder/skills/ai-rag-patterns/SKILL.md +27 -23
- package/kits/coder/skills/api-patterns/SKILL.md +40 -43
- package/kits/coder/skills/auth-patterns/SKILL.md +47 -51
- package/kits/coder/skills/aws-patterns/SKILL.md +52 -57
- package/kits/coder/skills/brainstorming/SKILL.md +26 -23
- package/kits/coder/skills/clean-code/SKILL.md +74 -90
- package/kits/coder/skills/database-design/SKILL.md +32 -31
- package/kits/coder/skills/docker-patterns/SKILL.md +46 -49
- package/kits/coder/skills/documentation-templates/SKILL.md +21 -13
- package/kits/coder/skills/e2e-testing/SKILL.md +52 -58
- package/kits/coder/skills/flutter-patterns/SKILL.md +44 -46
- package/kits/coder/skills/frontend-design/SKILL.md +28 -24
- package/kits/coder/skills/github-actions/SKILL.md +43 -45
- package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +35 -33
- package/kits/coder/skills/graphql-patterns/SKILL.md +35 -33
- package/kits/coder/skills/i18n-localization/SKILL.md +37 -35
- package/kits/coder/skills/kubernetes-patterns/SKILL.md +35 -33
- package/kits/coder/skills/mermaid-diagrams/SKILL.md +54 -60
- package/kits/coder/skills/mobile-design/SKILL.md +51 -61
- package/kits/coder/skills/monitoring-observability/SKILL.md +32 -30
- package/kits/coder/skills/multi-tenancy/SKILL.md +16 -8
- package/kits/coder/skills/nodejs-best-practices/SKILL.md +19 -14
- package/kits/coder/skills/performance-profiling/SKILL.md +31 -29
- package/kits/coder/skills/plan-writing/SKILL.md +52 -59
- package/kits/coder/skills/postgres-patterns/SKILL.md +39 -39
- package/kits/coder/skills/prompt-engineering/SKILL.md +40 -42
- package/kits/coder/skills/queue-patterns/SKILL.md +22 -16
- package/kits/coder/skills/react-native-patterns/SKILL.md +35 -33
- package/kits/coder/skills/react-patterns/SKILL.md +46 -52
- package/kits/coder/skills/realtime-patterns/SKILL.md +44 -46
- package/kits/coder/skills/redis-patterns/SKILL.md +35 -33
- package/kits/coder/skills/security-fundamentals/SKILL.md +45 -46
- package/kits/coder/skills/seo-patterns/SKILL.md +56 -62
- package/kits/coder/skills/systematic-debugging/SKILL.md +38 -39
- package/kits/coder/skills/tailwind-patterns/SKILL.md +21 -13
- package/kits/coder/skills/terraform-patterns/SKILL.md +53 -57
- package/kits/coder/skills/testing-patterns/SKILL.md +42 -47
- package/kits/coder/skills/typescript-patterns/SKILL.md +54 -68
- package/kits/coder/skills/ui-ux-pro-max/SKILL.md +362 -364
- package/package.json +1 -1
|
@@ -8,19 +8,26 @@ priority: HIGH
|
|
|
8
8
|
|
|
9
9
|
# Docker Patterns - Container Excellence
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## ⚡ Quick Reference
|
|
12
|
+
|
|
13
|
+
- **Multi-stage builds**: Separate builder + runtime · Copy only compiled artifacts · Never include src in prod image
|
|
14
|
+
- **Base image**: `node:20-alpine` not `node:20` · Pin versions explicitly · Never use `latest`
|
|
15
|
+
- **Security**: Non-root user (`USER node`) · Read-only filesystem · No secrets in image layers
|
|
16
|
+
- **Layers**: `COPY package.json` before `COPY src` · Dependencies cached separately from code
|
|
17
|
+
- **Compose**: Always `healthcheck` · Named volumes not bind mounts for data · `--wait` in CI
|
|
18
|
+
- **Image size**: `apk add --no-cache` · `.dockerignore` always · target < 200MB for Node apps
|
|
19
|
+
|
|
20
|
+
---
|
|
12
21
|
|
|
13
22
|
---
|
|
14
23
|
|
|
15
24
|
## Core Principles
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
| **Reproducible** | Pin versions, multi-stage for consistent builds |
|
|
23
|
-
| **Observable** | Health checks, structured logs, metrics endpoints |
|
|
26
|
+
- **Immutable**: Build once, run anywhere - no runtime modifications
|
|
27
|
+
- **Minimal**: Only include what's needed - smaller = faster + safer
|
|
28
|
+
- **Secure**: Non-root by default, no secrets in layers
|
|
29
|
+
- **Reproducible**: Pin versions, multi-stage for consistent builds
|
|
30
|
+
- **Observable**: Health checks, structured logs, metrics endpoints
|
|
24
31
|
|
|
25
32
|
---
|
|
26
33
|
|
|
@@ -72,26 +79,22 @@ CMD ["node", "dist/index.js"]
|
|
|
72
79
|
|
|
73
80
|
## Layer Optimization Rules
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
| **Order by change frequency** | Least changing → Most changing |
|
|
81
|
-
| **.dockerignore complete** | Exclude node_modules, .git, logs |
|
|
82
|
+
- **COPY package.json first**: Deps layer cached until deps change
|
|
83
|
+
- **Combine RUN commands**: Fewer layers = smaller image
|
|
84
|
+
- **Clean in same RUN**: `npm ci && npm cache clean` not separate
|
|
85
|
+
- **Order by change frequency**: Least changing → Most changing
|
|
86
|
+
- **.dockerignore complete**: Exclude node_modules, .git, logs
|
|
82
87
|
|
|
83
88
|
---
|
|
84
89
|
|
|
85
90
|
## Security Hardening Checklist
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
| **Read-only filesystem** | `--read-only` runtime flag |
|
|
94
|
-
| **Scan for vulnerabilities** | `docker scout`, `trivy` |
|
|
92
|
+
- **Non-root user**: `adduser` + `USER 1001`
|
|
93
|
+
- **Pin base image versions**: `node:20.10.0-alpine`, not `latest`
|
|
94
|
+
- **No secrets in Dockerfile**: Use build secrets or runtime env
|
|
95
|
+
- **Minimal packages**: No vim, curl unless needed
|
|
96
|
+
- **Read-only filesystem**: `--read-only` runtime flag
|
|
97
|
+
- **Scan for vulnerabilities**: `docker scout`, `trivy`
|
|
95
98
|
|
|
96
99
|
### Build Secrets Pattern (BuildKit)
|
|
97
100
|
|
|
@@ -185,17 +188,15 @@ Need shell for debugging?
|
|
|
185
188
|
|
|
186
189
|
## Anti-Patterns (DON'T)
|
|
187
190
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
| No health checks | HEALTHCHECK instruction |
|
|
198
|
-
| 1GB+ images | Multi-stage + alpine base |
|
|
191
|
+
- `FROM node:latest`: `FROM node:20.10.0-alpine`
|
|
192
|
+
- `RUN npm install` (not ci): `RUN npm ci --only=production`
|
|
193
|
+
- Running as root: Create user, `USER 1001`
|
|
194
|
+
- Secrets in ENV: Build secrets or external secrets manager
|
|
195
|
+
- `COPY . .` before package.json: Copy package.json first for caching
|
|
196
|
+
- Separate RUN for cleanup: Clean in same RUN command
|
|
197
|
+
- No .dockerignore: Comprehensive .dockerignore
|
|
198
|
+
- No health checks: HEALTHCHECK instruction
|
|
199
|
+
- 1GB+ images: Multi-stage + alpine base
|
|
199
200
|
|
|
200
201
|
---
|
|
201
202
|
|
|
@@ -214,26 +215,22 @@ Need shell for debugging?
|
|
|
214
215
|
|
|
215
216
|
## 🔴 Self-Check Before Completing
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
| ✅ **Image size?** | Under 500MB for typical apps? |
|
|
225
|
-
| ✅ **.dockerignore?** | Excludes node_modules, .git, logs? |
|
|
218
|
+
- ✅ **Multi-stage?**: Is build separated from runtime?
|
|
219
|
+
- ✅ **Non-root?**: Container runs as non-root user?
|
|
220
|
+
- ✅ **Pinned versions?**: Base image and deps have explicit version?
|
|
221
|
+
- ✅ **Health check?**: HEALTHCHECK or compose healthcheck?
|
|
222
|
+
- ✅ **Secrets safe?**: No secrets in layers or ENV?
|
|
223
|
+
- ✅ **Image size?**: Under 500MB for typical apps?
|
|
224
|
+
- ✅ **.dockerignore?**: Excludes node_modules, .git, logs?
|
|
226
225
|
|
|
227
226
|
---
|
|
228
227
|
|
|
229
228
|
## Related Skills
|
|
230
229
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
| Server management | `server-management` |
|
|
236
|
-
| Deployment workflows | `deployment-procedures` |
|
|
230
|
+
- CI/CD pipelines: `github-actions` (future)
|
|
231
|
+
- Kubernetes deployment: `kubernetes-patterns`
|
|
232
|
+
- Server management: `server-management`
|
|
233
|
+
- Deployment workflows: `deployment-procedures`
|
|
237
234
|
|
|
238
235
|
---
|
|
239
236
|
|
|
@@ -6,6 +6,18 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# Documentation Templates
|
|
8
8
|
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **README must-haves**: Title+tagline · Quick Start (< 5min) · Installation · Features · License
|
|
12
|
+
- **Docs-as-Code**: In same repo as code · PR-reviewed · Auto-deployed · Versioned with releases
|
|
13
|
+
- **API docs**: Every endpoint: method+path+params+request+response+errors+examples
|
|
14
|
+
- **ADR format**: Title · Status · Context · Decision · Consequences · Date
|
|
15
|
+
- **Code comments**: WHY not WHAT · Complex algorithms only · API contracts · Gotchas
|
|
16
|
+
- **AI-friendly**: Structured H1-H3 · Self-contained sections · JSON examples · Mermaid diagrams
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
9
21
|
> Good documentation is the difference between a project that gets adopted and one that gets abandoned.
|
|
10
22
|
|
|
11
23
|
---
|
|
@@ -417,24 +429,20 @@ docs/
|
|
|
417
429
|
|
|
418
430
|
## ❌ Anti-Patterns
|
|
419
431
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
| Wall of text without structure | Use headers, lists, code blocks |
|
|
427
|
-
| Assume reader knows context | Explain the "why" first |
|
|
432
|
+
- Document implementation details: Document behavior and contracts
|
|
433
|
+
- Write docs after release: Write docs during development
|
|
434
|
+
- Skip error documentation: Document all error cases
|
|
435
|
+
- Use outdated examples: Test examples in CI
|
|
436
|
+
- Wall of text without structure: Use headers, lists, code blocks
|
|
437
|
+
- Assume reader knows context: Explain the "why" first
|
|
428
438
|
|
|
429
439
|
---
|
|
430
440
|
|
|
431
441
|
## 🔗 Related Skills
|
|
432
442
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
| Clean code | `clean-code` |
|
|
437
|
-
| Architecture | `mermaid-diagrams` |
|
|
443
|
+
- API design: `api-patterns`
|
|
444
|
+
- Clean code: `clean-code`
|
|
445
|
+
- Architecture: `mermaid-diagrams`
|
|
438
446
|
|
|
439
447
|
---
|
|
440
448
|
|
|
@@ -6,17 +6,27 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# E2E Testing Patterns
|
|
8
8
|
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Tool selection**: Playwright (recommended) for modern · Cypress for existing projects · Avoid Selenium
|
|
12
|
+
- **Code critical paths only**: Login · Checkout · Core flows · Not every UI state
|
|
13
|
+
- **Selectors**: `data-testid` attributes · `getByRole` · Never CSS/XPath class selectors (brittle)
|
|
14
|
+
- **Reliability**: `await expect(locator).toBeVisible()` not `sleep()` · Retry-aware assertions · Isolated test data
|
|
15
|
+
- **CI**: Parallel sharding · Retry flaky tests once · Store traces/screenshots on failure
|
|
16
|
+
- **Page Objects**: Group locators and actions per page · Reusable · Separate from test logic
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
9
21
|
> **Philosophy:** E2E tests should give confidence to ship, not slow you down. Test critical paths, make them reliable, run them fast.
|
|
10
22
|
|
|
11
23
|
---
|
|
12
24
|
|
|
13
25
|
## 📑 Content Map
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| `references/cypress-patterns.md` | Cypress-specific patterns |
|
|
19
|
-
| `references/ci-integration.md` | CI/CD setup and optimization |
|
|
27
|
+
- `references/playwright-api.md`: Playwright-specific patterns
|
|
28
|
+
- `references/cypress-patterns.md`: Cypress-specific patterns
|
|
29
|
+
- `references/ci-integration.md`: CI/CD setup and optimization
|
|
20
30
|
|
|
21
31
|
---
|
|
22
32
|
|
|
@@ -24,23 +34,19 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
24
34
|
|
|
25
35
|
### ✅ Use E2E When
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| Accessibility validation | Full page context needed |
|
|
34
|
-
| Visual regression | Layout/styling verification |
|
|
37
|
+
- Critical user journeys: Full flow validation
|
|
38
|
+
- Authentication flows: Security-critical paths
|
|
39
|
+
- Payment/checkout: Money-critical paths
|
|
40
|
+
- Cross-browser compatibility: Real browser behavior
|
|
41
|
+
- Accessibility validation: Full page context needed
|
|
42
|
+
- Visual regression: Layout/styling verification
|
|
35
43
|
|
|
36
44
|
### ❌ Don't Use E2E When
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| API contract validation | API tests (Supertest, Hurl) |
|
|
43
|
-
| Unstable/frequently changing UI | Lower-level tests first |
|
|
46
|
+
- Unit logic testing: Unit tests (Vitest, Jest)
|
|
47
|
+
- Component behavior: Integration tests (Testing Library)
|
|
48
|
+
- API contract validation: API tests (Supertest, Hurl)
|
|
49
|
+
- Unstable/frequently changing UI: Lower-level tests first
|
|
44
50
|
|
|
45
51
|
---
|
|
46
52
|
|
|
@@ -98,11 +104,9 @@ test("successful login redirects to dashboard", async ({ page }) => {
|
|
|
98
104
|
|
|
99
105
|
### Test Structure (AAA Pattern)
|
|
100
106
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
| **Act** | Perform user actions |
|
|
105
|
-
| **Assert** | Verify expected outcomes |
|
|
107
|
+
- **Arrange**: Navigate, set up test data
|
|
108
|
+
- **Act**: Perform user actions
|
|
109
|
+
- **Assert**: Verify expected outcomes
|
|
106
110
|
|
|
107
111
|
---
|
|
108
112
|
|
|
@@ -120,12 +124,10 @@ test("successful login redirects to dashboard", async ({ page }) => {
|
|
|
120
124
|
|
|
121
125
|
### ❌ Avoid
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
| XPath | Hard to read, fragile |
|
|
128
|
-
| nth-child | Order-dependent, fragile |
|
|
127
|
+
- CSS class: Styling changes break tests
|
|
128
|
+
- Tag name only: Too generic, fragile
|
|
129
|
+
- XPath: Hard to read, fragile
|
|
130
|
+
- nth-child: Order-dependent, fragile
|
|
129
131
|
|
|
130
132
|
---
|
|
131
133
|
|
|
@@ -144,12 +146,10 @@ await expect(page.getByTestId("data")).toContainText("Loaded");
|
|
|
144
146
|
|
|
145
147
|
### Handling Flaky Tests
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
| Animation interference | Disable animations in CI |
|
|
152
|
-
| Timing issues | Use explicit waits, not setTimeout |
|
|
149
|
+
- Element not found: Use auto-wait, increase timeout
|
|
150
|
+
- Race conditions: Wait for network idle, specific element
|
|
151
|
+
- Animation interference: Disable animations in CI
|
|
152
|
+
- Timing issues: Use explicit waits, not setTimeout
|
|
153
153
|
|
|
154
154
|
```typescript
|
|
155
155
|
// ✅ Wait for network idle
|
|
@@ -337,13 +337,11 @@ jobs:
|
|
|
337
337
|
|
|
338
338
|
### CI Optimization
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
| Headless mode | Required in CI |
|
|
346
|
-
| Fail fast | Stop on first failure (optional) |
|
|
340
|
+
- Parallel workers: 2-4x faster
|
|
341
|
+
- Sharding: Distribute across machines
|
|
342
|
+
- Caching browsers: Faster setup
|
|
343
|
+
- Headless mode: Required in CI
|
|
344
|
+
- Fail fast: Stop on first failure (optional)
|
|
347
345
|
|
|
348
346
|
```typescript
|
|
349
347
|
// playwright.config.ts
|
|
@@ -402,15 +400,13 @@ test("debug example", async ({ page }) => {
|
|
|
402
400
|
|
|
403
401
|
## 11. Anti-Patterns
|
|
404
402
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
| Hard-coded credentials | Environment variables, test users |
|
|
413
|
-
| Run against production | Use staging/preview environments |
|
|
403
|
+
- Test implementation details: Test user-visible behavior
|
|
404
|
+
- Use fixed `setTimeout`: Use explicit waits
|
|
405
|
+
- Share state between tests: Isolate each test
|
|
406
|
+
- Test everything in E2E: Use testing pyramid
|
|
407
|
+
- Skip flaky tests: Fix root cause
|
|
408
|
+
- Hard-coded credentials: Environment variables, test users
|
|
409
|
+
- Run against production: Use staging/preview environments
|
|
414
410
|
|
|
415
411
|
---
|
|
416
412
|
|
|
@@ -445,12 +441,10 @@ test("user registration", async ({ page }) => {
|
|
|
445
441
|
|
|
446
442
|
## Related Skills
|
|
447
443
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
| Performance testing | `performance-profiling` |
|
|
453
|
-
| Accessibility | `web-design-guidelines` |
|
|
444
|
+
- Unit/integration testing: `testing-patterns`
|
|
445
|
+
- CI/CD pipelines: `github-actions`
|
|
446
|
+
- Performance testing: `performance-profiling`
|
|
447
|
+
- Accessibility: `web-design-guidelines`
|
|
454
448
|
|
|
455
449
|
---
|
|
456
450
|
|
|
@@ -8,19 +8,27 @@ priority: MEDIUM
|
|
|
8
8
|
|
|
9
9
|
# Flutter Patterns - Cross-Platform Development Excellence
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## ⚡ Quick Reference
|
|
12
|
+
|
|
13
|
+
- **Widgets**: `const` constructors everywhere · `StatelessWidget` by default · `StatefulWidget` only for local state
|
|
14
|
+
- **State**: Local → `setState` · Feature-wide → Riverpod · App-wide → Riverpod Provider
|
|
15
|
+
- **Performance**: `const` widgets skip rebuilds · `RepaintBoundary` for heavy paths · ListView.builder for long lists
|
|
16
|
+
- **Navigation**: GoRouter for complex routing · Named routes · Pass data via constructor not global
|
|
17
|
+
- **Async**: `FutureBuilder`/`StreamBuilder` · Handle loading/error states always · `ref.watch()` for Riverpod
|
|
18
|
+
- **Testing**: Widget tests for UI · Unit tests for logic · Integration tests for flows on real device
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
12
22
|
|
|
13
23
|
---
|
|
14
24
|
|
|
15
25
|
## 🎯 Core Principles
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
| **Platform Aware** | One codebase, platform-specific polish |
|
|
23
|
-
| **Test First** | Widget tests, integration tests, golden tests |
|
|
27
|
+
- **Composition**: Compose widgets, don't inherit
|
|
28
|
+
- **Immutability**: Use `const` constructors for optimal performance
|
|
29
|
+
- **Null Safety**: Dart 3 null safety is mandatory
|
|
30
|
+
- **Platform Aware**: One codebase, platform-specific polish
|
|
31
|
+
- **Test First**: Widget tests, integration tests, golden tests
|
|
24
32
|
|
|
25
33
|
```
|
|
26
34
|
❌ WRONG: Create God widgets with everything
|
|
@@ -152,12 +160,10 @@ class ActionButton extends StatelessWidget {
|
|
|
152
160
|
|
|
153
161
|
### Widget Keys
|
|
154
162
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
| Form fields | `GlobalKey` |
|
|
160
|
-
| Never needs identity | No key |
|
|
163
|
+
- List items with unique IDs: `ValueKey(id)`
|
|
164
|
+
- Animated list items: `ObjectKey(item)`
|
|
165
|
+
- Form fields: `GlobalKey`
|
|
166
|
+
- Never needs identity: No key
|
|
161
167
|
|
|
162
168
|
```dart
|
|
163
169
|
ListView.builder(
|
|
@@ -177,13 +183,11 @@ ListView.builder(
|
|
|
177
183
|
|
|
178
184
|
### Widget Rebuild Prevention
|
|
179
185
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
| `RepaintBoundary` | Isolate expensive paint operations |
|
|
186
|
-
| `ListView.builder` | Large lists (virtualized) |
|
|
186
|
+
- `const` constructors: Always when possible
|
|
187
|
+
- `Consumer` widgets: Scope Riverpod rebuilds
|
|
188
|
+
- `select` in Riverpod: Watch only needed parts
|
|
189
|
+
- `RepaintBoundary`: Isolate expensive paint operations
|
|
190
|
+
- `ListView.builder`: Large lists (virtualized)
|
|
187
191
|
|
|
188
192
|
### Image Optimization
|
|
189
193
|
|
|
@@ -289,41 +293,35 @@ if (kIsWeb) {
|
|
|
289
293
|
|
|
290
294
|
## 🚨 Anti-Patterns
|
|
291
295
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
| Skip null safety | Embrace Dart 3 null safety |
|
|
301
|
-
| Test only happy paths | Test edge cases and errors |
|
|
296
|
+
- Inherit from StatelessWidget/ful: Compose widgets
|
|
297
|
+
- Skip `const` constructors: Add `const` everywhere possible
|
|
298
|
+
- setState in large widgets: Use state management solution
|
|
299
|
+
- Fetch data in build(): Use FutureBuilder or state management
|
|
300
|
+
- Large build() methods: Extract smaller widget functions
|
|
301
|
+
- Hardcode colors/sizes: Use Theme and design tokens
|
|
302
|
+
- Skip null safety: Embrace Dart 3 null safety
|
|
303
|
+
- Test only happy paths: Test edge cases and errors
|
|
302
304
|
|
|
303
305
|
---
|
|
304
306
|
|
|
305
307
|
## ✅ Self-Check Before Completing
|
|
306
308
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
| ✅ **Platform?** | Tested on both iOS and Android? |
|
|
315
|
-
| ✅ **Performance?** | No jank, smooth scrolling? |
|
|
309
|
+
- ✅ **Const?**: Are const constructors used everywhere?
|
|
310
|
+
- ✅ **Keys?**: Do list items have stable keys?
|
|
311
|
+
- ✅ **State?**: Is state management properly scoped?
|
|
312
|
+
- ✅ **Null safe?**: Is null safety properly handled?
|
|
313
|
+
- ✅ **Tested?**: Are widgets and logic tested?
|
|
314
|
+
- ✅ **Platform?**: Tested on both iOS and Android?
|
|
315
|
+
- ✅ **Performance?**: No jank, smooth scrolling?
|
|
316
316
|
|
|
317
317
|
---
|
|
318
318
|
|
|
319
319
|
## 🔗 Related Skills
|
|
320
320
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
| Testing patterns | `testing-patterns` |
|
|
326
|
-
| Performance profiling | `performance-profiling` |
|
|
321
|
+
- React Native comparison: `react-native-patterns`
|
|
322
|
+
- Mobile design: `mobile-design`
|
|
323
|
+
- Testing patterns: `testing-patterns`
|
|
324
|
+
- Performance profiling: `performance-profiling`
|
|
327
325
|
|
|
328
326
|
---
|
|
329
327
|
|
|
@@ -6,6 +6,18 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# Frontend Design Patterns
|
|
8
8
|
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Color**: WCAG 4.5:1 contrast · HSL for tints/shades · 60-30-10 rule (primary/secondary/accent)
|
|
12
|
+
- **Typography**: 16px base · `rem` units · 1.5 line-height body · max 75 chars per line
|
|
13
|
+
- **Spacing**: 4px base unit (4/8/16/24/32/48/64/96) · consistent scale · CSS custom properties
|
|
14
|
+
- **Layout**: Mobile-first · Grid for 2D · Flexbox for 1D · `max-width: 1200px` containers
|
|
15
|
+
- **Micro-interactions**: Hover 150ms ease · Focus rings visible · Loading skeleton not spinner
|
|
16
|
+
- **Dark mode**: CSS custom properties swap · `prefers-color-scheme` media query as default
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
9
21
|
> Design is how it works.
|
|
10
22
|
|
|
11
23
|
---
|
|
@@ -23,14 +35,12 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
23
35
|
|
|
24
36
|
### Palette Structure
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Warning | Caution, pending |
|
|
33
|
-
| Error | Errors, destructive actions |
|
|
38
|
+
- Primary: CTAs, links, brand elements
|
|
39
|
+
- Secondary: Supporting elements
|
|
40
|
+
- Neutral: Text, borders, backgrounds
|
|
41
|
+
- Success: Confirmations, completed
|
|
42
|
+
- Warning: Caution, pending
|
|
43
|
+
- Error: Errors, destructive actions
|
|
34
44
|
|
|
35
45
|
### Contrast (WCAG)
|
|
36
46
|
|
|
@@ -78,21 +88,17 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
78
88
|
|
|
79
89
|
## 📊 Layout Patterns
|
|
80
90
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
| Dashboard | Sidebar nav + header + grid |
|
|
86
|
-
| Cards | Auto-filling responsive grid |
|
|
91
|
+
- Holy Grail: Header, footer, 3-col middle
|
|
92
|
+
- Sidebar: Fixed sidebar + fluid content
|
|
93
|
+
- Dashboard: Sidebar nav + header + grid
|
|
94
|
+
- Cards: Auto-filling responsive grid
|
|
87
95
|
|
|
88
96
|
---
|
|
89
97
|
|
|
90
98
|
## ✨ Micro-Interactions
|
|
91
99
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
| Duration | 150-300ms for interactions |
|
|
95
|
-
| Easing | ease-out for enter, ease-in exit |
|
|
100
|
+
- Duration: 150-300ms for interactions
|
|
101
|
+
- Easing: ease-out for enter, ease-in exit
|
|
96
102
|
|
|
97
103
|
---
|
|
98
104
|
|
|
@@ -109,12 +115,10 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
109
115
|
|
|
110
116
|
## ❌ Anti-Patterns
|
|
111
117
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
| Inconsistent spacing | Use spacing tokens |
|
|
117
|
-
| Animation for decoration | Animate purposefully |
|
|
118
|
+
- Low contrast text: WCAG AA minimum
|
|
119
|
+
- More than 3 fonts: 1-2 fonts
|
|
120
|
+
- Inconsistent spacing: Use spacing tokens
|
|
121
|
+
- Animation for decoration: Animate purposefully
|
|
118
122
|
|
|
119
123
|
---
|
|
120
124
|
|