ai-developer-skill-os 7.0.2 β 7.5.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/.agents/AGENTS.md +44 -88
- package/.agents/CHANGELOG.md +69 -0
- package/.agents/LICENSE +21 -0
- package/.agents/README.md +59 -0
- package/.agents/_template/BEHAVIOR_SPEC.md +96 -0
- package/.agents/_template/examples/example-en.md +49 -0
- package/.agents/_template/examples/example-vi.md +49 -0
- package/.agents/docs/CHI_TIET_SKILLS.md +125 -0
- package/.agents/docs/GOVERNANCE.md +40 -0
- package/.agents/docs/HUONG_DAN_SU_DUNG.md +120 -0
- package/.agents/docs/SPEC.md +87 -0
- package/.agents/docs/adr/0001-intent-based-architecture.md +19 -0
- package/.agents/docs/adr/0002-kernel-freeze.md +21 -0
- package/.agents/docs/adr/0003-risk-based-verification.md +20 -0
- package/.agents/docs/adr/0004-progressive-evidence.md +19 -0
- package/.agents/docs/skill-classification.md +25 -0
- package/.agents/skills/qk-access-policy/SKILL.md +179 -0
- package/.agents/skills/qk-ai-builder/SKILL.md +215 -0
- package/.agents/skills/qk-api-lifecycle/SKILL.md +176 -0
- package/.agents/skills/qk-bug-resolution/SKILL.md +307 -0
- package/.agents/skills/qk-context-loader/SKILL.md +218 -0
- package/.agents/skills/qk-data-lifecycle/SKILL.md +192 -0
- package/.agents/skills/qk-db-optimizer/SKILL.md +196 -0
- package/.agents/skills/qk-design-to-code/SKILL.md +285 -0
- package/.agents/skills/qk-docs/SKILL.md +198 -0
- package/.agents/skills/qk-engineering-standard/SKILL.md +351 -0
- package/.agents/skills/qk-engineering-standard/rules/backend.md +122 -0
- package/.agents/skills/qk-engineering-standard/rules/database.md +3 -0
- package/.agents/skills/qk-engineering-standard/rules/frontend.md +152 -0
- package/.agents/skills/qk-engineering-standard/rules/security.md +3 -0
- package/.agents/skills/qk-engineering-standard/rules/testing.md +3 -0
- package/.agents/skills/qk-fe-api-integration/SKILL.md +326 -0
- package/.agents/skills/qk-feature-delivery/SKILL.md +305 -0
- package/.agents/skills/qk-help/SKILL.md +193 -0
- package/.agents/skills/qk-orchestrator/SKILL.md +277 -0
- package/.agents/skills/qk-orchestrator/references/routing-table.md +77 -0
- package/.agents/skills/qk-production-release/SKILL.md +284 -0
- package/.agents/skills/qk-project-bootstrap/SKILL.md +234 -0
- package/.agents/skills/qk-project-health/SKILL.md +199 -0
- package/.agents/skills/qk-project-memory/SKILL.md +172 -0
- package/.agents/skills/qk-system-evolution/SKILL.md +281 -0
- package/.agents/skills/qk-ui-audit/SKILL.md +314 -0
- package/.agents/skills/qk-ui-audit/references/anti-slop-checklist.md +136 -0
- package/.agents/skills/qk-ui-system-builder/SKILL.md +221 -0
- package/.agents/skills/qk-validation-gate/SKILL.md +359 -0
- package/.agents/skills.json +819 -0
- package/.github/workflows/ci.yml +1 -1
- package/.qk-ai-skill-os/CHANGELOG.md +69 -0
- package/.qk-ai-skill-os/LICENSE +21 -0
- package/.qk-ai-skill-os/README.md +59 -0
- package/.qk-ai-skill-os/_template/BEHAVIOR_SPEC.md +96 -0
- package/.qk-ai-skill-os/_template/examples/example-en.md +49 -0
- package/.qk-ai-skill-os/_template/examples/example-vi.md +49 -0
- package/.qk-ai-skill-os/docs/CHI_TIET_SKILLS.md +125 -0
- package/.qk-ai-skill-os/docs/GOVERNANCE.md +40 -0
- package/.qk-ai-skill-os/docs/HUONG_DAN_SU_DUNG.md +120 -0
- package/.qk-ai-skill-os/docs/SPEC.md +87 -0
- package/.qk-ai-skill-os/docs/adr/0001-intent-based-architecture.md +19 -0
- package/.qk-ai-skill-os/docs/adr/0002-kernel-freeze.md +21 -0
- package/.qk-ai-skill-os/docs/adr/0003-risk-based-verification.md +20 -0
- package/.qk-ai-skill-os/docs/adr/0004-progressive-evidence.md +19 -0
- package/.qk-ai-skill-os/docs/skill-classification.md +25 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-accessibility-audit/SKILL.md +121 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-agent-orchestrator/SKILL.md +179 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-api-integration/SKILL.md +389 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-auth-security/SKILL.md +96 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-backend-architecture/SKILL.md +125 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-bug-fix/SKILL.md +213 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-component-generator/SKILL.md +136 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-context-manager/SKILL.md +175 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-database-engineer/SKILL.md +104 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-deployment/SKILL.md +96 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-design-system/SKILL.md +137 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-form-builder/SKILL.md +140 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-architecture/SKILL.md +155 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-debug/SKILL.md +133 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-performance/SKILL.md +129 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-testing/SKILL.md +146 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-git-engineer/SKILL.md +304 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-help/SKILL.md +68 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-migration/SKILL.md +284 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-project-audit/SKILL.md +280 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-refactor/SKILL.md +222 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-state-management/SKILL.md +140 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-table-crud-generator/SKILL.md +127 -0
- package/.qk-ai-skill-os/skills/_archive_old_skills/qk-ui-builder/SKILL.md +152 -0
- package/.qk-ai-skill-os/skills/_template/SKILL.md +238 -0
- package/.qk-ai-skill-os/skills/qk-access-policy/SKILL.md +179 -0
- package/.qk-ai-skill-os/skills/qk-ai-builder/SKILL.md +221 -0
- package/.qk-ai-skill-os/skills/qk-api-lifecycle/SKILL.md +176 -0
- package/.qk-ai-skill-os/skills/qk-bug-resolution/SKILL.md +307 -0
- package/.qk-ai-skill-os/skills/qk-context-loader/SKILL.md +218 -0
- package/.qk-ai-skill-os/skills/qk-data-lifecycle/SKILL.md +192 -0
- package/.qk-ai-skill-os/skills/qk-db-optimizer/SKILL.md +196 -0
- package/.qk-ai-skill-os/skills/qk-design-to-code/SKILL.md +291 -0
- package/.qk-ai-skill-os/skills/qk-docs/SKILL.md +198 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/SKILL.md +351 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/backend.md +122 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/database.md +3 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/frontend.md +152 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/security.md +3 -0
- package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/testing.md +3 -0
- package/.qk-ai-skill-os/skills/qk-fe-api-integration/SKILL.md +326 -0
- package/.qk-ai-skill-os/skills/qk-feature-delivery/SKILL.md +305 -0
- package/.qk-ai-skill-os/skills/qk-help/SKILL.md +193 -0
- package/.qk-ai-skill-os/skills/qk-orchestrator/SKILL.md +277 -0
- package/.qk-ai-skill-os/skills/qk-orchestrator/references/routing-table.md +77 -0
- package/.qk-ai-skill-os/skills/qk-production-release/SKILL.md +290 -0
- package/.qk-ai-skill-os/skills/qk-project-bootstrap/SKILL.md +240 -0
- package/.qk-ai-skill-os/skills/qk-project-health/SKILL.md +199 -0
- package/.qk-ai-skill-os/skills/qk-project-memory/SKILL.md +172 -0
- package/.qk-ai-skill-os/skills/qk-system-evolution/SKILL.md +285 -0
- package/.qk-ai-skill-os/skills/qk-ui-audit/SKILL.md +314 -0
- package/.qk-ai-skill-os/skills/qk-ui-audit/references/anti-slop-checklist.md +136 -0
- package/.qk-ai-skill-os/skills/qk-ui-system-builder/SKILL.md +225 -0
- package/.qk-ai-skill-os/skills/qk-validation-gate/SKILL.md +361 -0
- package/.qk-ai-skill-os/skills.json +819 -0
- package/CLAUDE.md +110 -0
- package/README.md +25 -3
- package/add_lang.js +21 -0
- package/add_lang.py +25 -0
- package/add_sections.py +53 -0
- package/bin/install.js +225 -170
- package/bin/lint.js +122 -0
- package/docs/CHI_TIET_SKILLS.md +26 -26
- package/docs/HUONG_DAN_SU_DUNG.md +3 -3
- package/docs/SPEC.md +70 -20
- package/framework/skill-schema.md +310 -0
- package/package.json +15 -4
- package/patch.js +15 -0
- package/patch.py +89 -0
- package/patch2.py +83 -0
- package/skills/_archive_old_skills/qk-accessibility-audit/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-agent-orchestrator/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-api-integration/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-auth-security/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-backend-architecture/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-bug-fix/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-component-generator/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-context-manager/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-database-engineer/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-deployment/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-design-system/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-form-builder/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-frontend-architecture/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-frontend-debug/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-frontend-performance/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-frontend-testing/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-git-engineer/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-help/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-migration/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-project-audit/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-refactor/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-state-management/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-table-crud-generator/SKILL.md +1 -0
- package/skills/_archive_old_skills/qk-ui-builder/SKILL.md +1 -0
- package/skills/_template/SKILL.md +238 -0
- package/skills/qk-access-policy/SKILL.md +179 -39
- package/skills/qk-ai-builder/SKILL.md +215 -40
- package/skills/qk-api-lifecycle/SKILL.md +176 -46
- package/skills/qk-bug-resolution/SKILL.md +307 -46
- package/skills/qk-context-loader/SKILL.md +218 -43
- package/skills/qk-data-lifecycle/SKILL.md +192 -44
- package/skills/qk-db-optimizer/SKILL.md +196 -41
- package/skills/qk-design-to-code/SKILL.md +285 -46
- package/skills/qk-docs/SKILL.md +198 -40
- package/skills/qk-engineering-standard/SKILL.md +351 -42
- package/skills/qk-fe-api-integration/SKILL.md +326 -55
- package/skills/qk-feature-delivery/SKILL.md +305 -48
- package/skills/qk-help/SKILL.md +178 -23
- package/skills/qk-orchestrator/SKILL.md +277 -42
- package/skills/qk-orchestrator/references/routing-table.md +77 -0
- package/skills/qk-production-release/SKILL.md +284 -41
- package/skills/qk-project-bootstrap/SKILL.md +234 -38
- package/skills/qk-project-health/SKILL.md +199 -40
- package/skills/qk-project-memory/SKILL.md +172 -40
- package/skills/qk-system-evolution/SKILL.md +281 -40
- package/skills/qk-ui-audit/SKILL.md +314 -42
- package/skills/qk-ui-audit/references/anti-slop-checklist.md +136 -0
- package/skills/qk-ui-system-builder/SKILL.md +221 -43
- package/skills/qk-validation-gate/SKILL.md +359 -40
- package/skills.json +813 -824
- package/specs/fixtures/user-payload.json +12 -0
- package/specs/regressions/api-integration-null-fields.yaml +19 -0
- package/temp_fix.js +61 -0
- package/tests/registry.test.js +1 -1
- package/update_template.js +28 -0
- package/skills/qk-policy-engine/SKILL.md +0 -39
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-deployment
|
|
3
|
+
description: >-
|
|
4
|
+
CαΊ₯u hΓ¬nh CI/CD pipelines, tαΊ‘o Dockerfile vΓ thiαΊΏt lαΊp mΓ΄i trΖ°α»ng Δα» deploy lΓͺn Vercel, AWS hoαΊ·c VPS.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: backend
|
|
7
|
+
tags: [deploy, ci-cd, docker, github-actions, devops, hosting]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Deployment & DevOps
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
15
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
16
|
+
> The user may write in any language β detect and match it automatically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Trigger
|
|
21
|
+
|
|
22
|
+
Activate this skill when:
|
|
23
|
+
- User asks "how do I deploy this?", "create a Dockerfile", or "setup CI/CD"
|
|
24
|
+
- Configuring GitHub Actions, GitLab CI, or Jenkins
|
|
25
|
+
- Preparing a project for Vercel, Netlify, Render, or AWS
|
|
26
|
+
- Setting up environment variables for production
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
- β
**Containerization:** Write `Dockerfile` and `docker-compose.yml`.
|
|
33
|
+
- β
**CI/CD Pipelines:** Write GitHub Actions YAML for testing, building, and deploying.
|
|
34
|
+
- β
**Environment Setup:** Create `.env.example` and document required production variables.
|
|
35
|
+
- β
**Build Scripts:** Ensure `package.json` has correct build and start commands.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Non-goals
|
|
40
|
+
|
|
41
|
+
- β Do NOT expose real production secrets. Always use placeholders or CI secrets.
|
|
42
|
+
- β Do NOT over-complicate (e.g., don't setup Kubernetes if a simple Docker container on a VPS is enough).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
### Phase 1 β Platform Selection
|
|
49
|
+
|
|
50
|
+
Ask the user where they are deploying (if not specified):
|
|
51
|
+
1. **PaaS (Vercel, Render, Heroku):** Very easy, mostly relies on `vercel.json` or standard build scripts. No Docker needed usually.
|
|
52
|
+
2. **VPS/VM (DigitalOcean, AWS EC2):** Needs Docker and/or PM2 + Nginx reverse proxy.
|
|
53
|
+
3. **Container Service (AWS ECS, Google Cloud Run):** Needs a highly optimized Dockerfile.
|
|
54
|
+
|
|
55
|
+
### Phase 2 β Containerization (If required)
|
|
56
|
+
|
|
57
|
+
Create a multi-stage Dockerfile for minimal image size:
|
|
58
|
+
1. `deps` stage: Install dependencies.
|
|
59
|
+
2. `builder` stage: Build the app.
|
|
60
|
+
3. `runner` stage: Copy only the built assets and prod modules, start the app.
|
|
61
|
+
|
|
62
|
+
### Phase 3 β CI/CD Pipeline
|
|
63
|
+
|
|
64
|
+
Create `.github/workflows/deploy.yml`:
|
|
65
|
+
- Trigger on `push` to `main`.
|
|
66
|
+
- Job 1: Setup Node/Python/Go, install deps, run tests, run linter.
|
|
67
|
+
- Job 2: Build image and push to registry, or deploy to PaaS.
|
|
68
|
+
|
|
69
|
+
### Phase 4 β Environment Variables
|
|
70
|
+
|
|
71
|
+
Audit the codebase for `process.env.XYZ` and create a `.env.example` file listing every required variable.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Output Format
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
π Deployment Plan
|
|
79
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
80
|
+
Target: [Vercel / Docker VPS / AWS]
|
|
81
|
+
Tooling: [GitHub Actions, Docker]
|
|
82
|
+
|
|
83
|
+
Files Created/Modified:
|
|
84
|
+
β
`Dockerfile` (Multi-stage build)
|
|
85
|
+
β
`.github/workflows/deploy.yml`
|
|
86
|
+
β
`.env.example`
|
|
87
|
+
|
|
88
|
+
β οΈ Prerequisites:
|
|
89
|
+
Before deploying, you must set these secrets in GitHub Actions:
|
|
90
|
+
- `DOCKER_USERNAME`
|
|
91
|
+
- `DATABASE_URL`
|
|
92
|
+
|
|
93
|
+
π Next Steps:
|
|
94
|
+
Commit these files and push to `main` to trigger the pipeline.
|
|
95
|
+
```
|
|
96
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-design-system
|
|
3
|
+
description: >-
|
|
4
|
+
Γp buα»c sα» dα»₯ng design system, component library vΓ token hiα»n cΓ³, ngΔn chαΊ·n viα»c viαΊΏt HTML/CSS rΓ‘c.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: frontend
|
|
7
|
+
tags: [design-system, ui-components, styling, tailwind, material-ui, shadcn]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Design System Enforcer
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
15
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
16
|
+
> The user may write in any language β detect and match it automatically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Trigger
|
|
21
|
+
|
|
22
|
+
Activate this skill when:
|
|
23
|
+
- About to build UI screens or components
|
|
24
|
+
- Styling or layout work is required
|
|
25
|
+
- User asks to "make it look good" or "match the design"
|
|
26
|
+
- Integrating a third-party UI library (Tailwind, MUI, AntD, Shadcn)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
- β
Identify the UI library or design system in use
|
|
33
|
+
- β
Map standard HTML elements to project-specific components (e.g., `<button>` β `<Button>`)
|
|
34
|
+
- β
Enforce usage of design tokens (colors, spacing, typography) instead of hardcoded values
|
|
35
|
+
- β
Provide available component variants and props to downstream skills (`ui-builder`)
|
|
36
|
+
- β
Prevent generation of raw CSS/inline styles if utility classes or styled-components are standard
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Non-goals
|
|
41
|
+
|
|
42
|
+
- β Do NOT create new base components if an equivalent already exists
|
|
43
|
+
- β Do NOT introduce a new styling method (e.g., don't add Tailwind if project uses CSS Modules)
|
|
44
|
+
- β Do NOT design full pages (delegate to `ui-builder`)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
### Phase 1 β Detect Design System
|
|
51
|
+
|
|
52
|
+
Analyze dependencies and project files to identify:
|
|
53
|
+
1. **Component Library:** Shadcn UI, MUI, Ant Design, Chakra, Bootstrap, custom internal library?
|
|
54
|
+
2. **Styling Method:** Tailwind CSS, CSS Modules, Styled Components, Emotion, SCSS, Vanilla CSS?
|
|
55
|
+
3. **Location of Shared Components:** Usually `src/components/ui/`, `src/shared/components/`, or from an npm package.
|
|
56
|
+
4. **Design Tokens:** `tailwind.config.js`, `theme.ts`, `variables.scss`.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Phase 2 β Component Mapping
|
|
61
|
+
|
|
62
|
+
Before `ui-builder` generates code, create a mapping table for required elements:
|
|
63
|
+
|
|
64
|
+
| Standard Element | Project Component | Source / Import Path |
|
|
65
|
+
|------------------|-------------------|----------------------|
|
|
66
|
+
| `<button>` | `<Button>` | `@/components/ui/button` |
|
|
67
|
+
| `<input type="text">` | `<Input>` | `@/components/ui/input` |
|
|
68
|
+
| `<div>` (Card) | `<Card>` | `@/components/ui/card` |
|
|
69
|
+
| `<h1>` | `<Typography variant="h1">` | `@mui/material` |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Phase 3 β Token Extraction
|
|
74
|
+
|
|
75
|
+
Identify available tokens for spacing, colors, and typography to avoid hardcoding:
|
|
76
|
+
- *Instead of:* `margin-top: 16px; color: #3b82f6;`
|
|
77
|
+
- *Use:* `mt-4 text-blue-500` (Tailwind) or `theme.spacing(2)` (MUI) or `var(--primary-color)`.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Phase 4 β Rule Enforcement
|
|
82
|
+
|
|
83
|
+
Pass strict instructions to `ui-builder` or `component-generator`:
|
|
84
|
+
- "You MUST use `<Button>` instead of `<button>`."
|
|
85
|
+
- "You MUST use Tailwind classes for all styling. No inline `style={{}}` allowed."
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Decision Tree
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Does the project use a component library (e.g., Shadcn, MUI)?
|
|
93
|
+
βββ Yes β Is the required component available?
|
|
94
|
+
β βββ Yes β Require its use
|
|
95
|
+
β βββ No β Instruct `component-generator` to create it following library style
|
|
96
|
+
βββ No β Check if custom shared components exist
|
|
97
|
+
βββ Yes β Map to custom shared components
|
|
98
|
+
βββ No β Use raw HTML but enforce project's styling method (e.g., Tailwind)
|
|
99
|
+
|
|
100
|
+
Does the project use utility classes (Tailwind)?
|
|
101
|
+
βββ Yes β Forbid inline styles or custom CSS files
|
|
102
|
+
βββ No β Enforce existing CSS Modules / Styled Components patterns
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Output Format
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
π¨ Design System Rules
|
|
111
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
112
|
+
Library: [Shadcn / MUI / Tailwind / Custom / etc.]
|
|
113
|
+
Styling Method: [Tailwind / CSS Modules / Styled Components]
|
|
114
|
+
|
|
115
|
+
Component Mapping for this task:
|
|
116
|
+
β
Button β `<Button>` from `@/components/ui/button`
|
|
117
|
+
β
Input β `<Input>` from `@/components/ui/input`
|
|
118
|
+
β
Layout β Flexbox with Tailwind (`flex flex-col gap-4`)
|
|
119
|
+
|
|
120
|
+
Styling Rules Enforced:
|
|
121
|
+
β’ No raw HTML `<button>` allowed
|
|
122
|
+
β’ No inline styles allowed
|
|
123
|
+
β’ Use primary color token for CTAs
|
|
124
|
+
|
|
125
|
+
π Next Steps:
|
|
126
|
+
Passing these rules to `ui-builder` to generate the UI.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Validation Checklist
|
|
132
|
+
|
|
133
|
+
- [ ] Design system and styling method correctly identified
|
|
134
|
+
- [ ] Mappings created for all necessary UI elements
|
|
135
|
+
- [ ] Design tokens (spacing/colors) prioritized over hardcoded values
|
|
136
|
+
- [ ] Strict enforcement rules passed to next skill
|
|
137
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-form-builder
|
|
3
|
+
description: >-
|
|
4
|
+
XΓ’y dα»±ng Form chuαΊ©n xΓ‘c vα»i quαΊ£n lΓ½ trαΊ‘ng thΓ‘i, validate dα»― liα»u (Zod, Yup) vΓ xα» lΓ½ hiα»n thα» lα»i.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: frontend
|
|
7
|
+
tags: [form, validation, react-hook-form, zod, yup, formik]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Form Builder
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
15
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
16
|
+
> The user may write in any language β detect and match it automatically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Trigger
|
|
21
|
+
|
|
22
|
+
Activate this skill when:
|
|
23
|
+
- User says "create a login form", "add a settings page", "build a contact form"
|
|
24
|
+
- User provides a data model and needs a UI to create/edit it
|
|
25
|
+
- A form needs complex validation logic added
|
|
26
|
+
- Refactoring a messy form into a structured library pattern (e.g., React Hook Form)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
- β
Define the form data schema and validation rules
|
|
33
|
+
- β
Manage form state efficiently (preventing unnecessary re-renders)
|
|
34
|
+
- β
Map form fields to the project's design system components
|
|
35
|
+
- β
Handle submission state (loading, success, error)
|
|
36
|
+
- β
Handle validation errors and display them accessibly
|
|
37
|
+
- β
Integrate with `api-integration` for submission
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Non-goals
|
|
42
|
+
|
|
43
|
+
- β Do NOT reinvent form state management if a library is present
|
|
44
|
+
- β Do NOT use raw HTML inputs if design system components exist
|
|
45
|
+
- β Do NOT skip validation (client-side validation is required)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Workflow
|
|
50
|
+
|
|
51
|
+
### Phase 1 β Schema Design
|
|
52
|
+
|
|
53
|
+
Define the exact shape of the data the form collects.
|
|
54
|
+
Determine validation rules for each field (required, min length, email format, etc.).
|
|
55
|
+
|
|
56
|
+
If the project uses Zod, Yup, or Joi, define the schema first.
|
|
57
|
+
*Example:*
|
|
58
|
+
```typescript
|
|
59
|
+
const userFormSchema = z.object({
|
|
60
|
+
email: z.string().email("Invalid email address"),
|
|
61
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Phase 2 β State Management Selection
|
|
68
|
+
|
|
69
|
+
Check project dependencies for form libraries:
|
|
70
|
+
1. `react-hook-form` (Preferred for React)
|
|
71
|
+
2. `formik`
|
|
72
|
+
3. Custom Vue/Svelte bindings
|
|
73
|
+
4. Standard controlled components (`useState`) if no library exists and form is simple.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Phase 3 β Component Assembly
|
|
78
|
+
|
|
79
|
+
1. Set up the form wrapper and submission handler.
|
|
80
|
+
2. For each field in the schema, render the appropriate UI component (from `design-system`).
|
|
81
|
+
3. Connect the UI component to the form state (register / Controller).
|
|
82
|
+
4. Render error messages below fields if validation fails.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Phase 4 β Submission & Integration
|
|
87
|
+
|
|
88
|
+
- Add `isLoading` state to the submit button.
|
|
89
|
+
- Disable submit button during submission.
|
|
90
|
+
- On success: Show success message or redirect, and optionally reset form.
|
|
91
|
+
- On error: Display backend error messages (toast or form-level alert).
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Decision Tree
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Does the project use a validation library (Zod, Yup)?
|
|
99
|
+
βββ Yes β Use it to define schema and pass to form resolver
|
|
100
|
+
βββ No β Implement standard HTML5 validation or simple manual validation logic
|
|
101
|
+
|
|
102
|
+
Is it a complex multi-step form (wizard)?
|
|
103
|
+
βββ Yes β Break into sub-components, use global or lifted state for form data
|
|
104
|
+
βββ No β Handle state locally within the single form component
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Output Format
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
π Form Built
|
|
113
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
114
|
+
Name: [FormName]
|
|
115
|
+
Schema: [Zod / Yup / Manual]
|
|
116
|
+
Library: [React Hook Form / Formik / Native]
|
|
117
|
+
|
|
118
|
+
Fields Implemented:
|
|
119
|
+
β
email (string, required, email)
|
|
120
|
+
β
password (string, required, min: 8)
|
|
121
|
+
|
|
122
|
+
Integration:
|
|
123
|
+
- Validation: Client-side wired up
|
|
124
|
+
- Submission: Wired to `[submitFunction]`
|
|
125
|
+
- Loading UI: Handled on submit button
|
|
126
|
+
|
|
127
|
+
π Next Steps:
|
|
128
|
+
Make sure the API endpoint is ready to accept this payload.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Validation Checklist
|
|
134
|
+
|
|
135
|
+
- [ ] Form uses existing design system components (Inputs, Buttons)
|
|
136
|
+
- [ ] Client-side validation is implemented
|
|
137
|
+
- [ ] Error messages are displayed properly
|
|
138
|
+
- [ ] Loading state disables the submit button
|
|
139
|
+
- [ ] Accessibility: Inputs have associated labels and error ARIA attributes
|
|
140
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-frontend-architecture
|
|
3
|
+
description: >-
|
|
4
|
+
PhΓ’n tΓch cαΊ₯u trΓΊc thΖ° mα»₯c frontend vΓ quyαΊΏt Δα»nh vα» trΓ ΔαΊ·t file chuαΊ©n xΓ‘c theo kiαΊΏn trΓΊc hiα»n tαΊ‘i.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: frontend
|
|
7
|
+
tags: [architecture, folder-structure, conventions, file-placement]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Frontend Architecture
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
15
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
16
|
+
> The user may write in any language β detect and match it automatically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Trigger
|
|
21
|
+
|
|
22
|
+
Activate this skill when:
|
|
23
|
+
- About to create new files or components
|
|
24
|
+
- User asks "where should I put this file?" or "how should I organize this?"
|
|
25
|
+
- Moving or refactoring code across different modules
|
|
26
|
+
- Inheriting an unfamiliar frontend project
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
- β
Discover the existing frontend folder structure
|
|
33
|
+
- β
Define where new components, hooks, services, and types should be placed
|
|
34
|
+
- β
Enforce separation of concerns (e.g., UI vs. Business Logic vs. Data)
|
|
35
|
+
- β
Identify architectural patterns in use (e.g., Feature-based, Layer-based)
|
|
36
|
+
- β
Validate file placement before execution by other skills
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Non-goals
|
|
41
|
+
|
|
42
|
+
- β Do NOT rewrite the entire project architecture unless explicitly asked
|
|
43
|
+
- β Do NOT generate code (delegate to `component-generator` or `ui-builder`)
|
|
44
|
+
- β Do NOT enforce personal preferences over established project conventions
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Severity Levels
|
|
49
|
+
|
|
50
|
+
| Level | Meaning |
|
|
51
|
+
|-------|---------|
|
|
52
|
+
| P0 | Architectural violation that breaks the build or creates circular dependencies |
|
|
53
|
+
| P1 | File placed in completely wrong layer (e.g., API logic in UI component) |
|
|
54
|
+
| P2 | Inconsistent folder or file naming |
|
|
55
|
+
| P3 | Minor deviation from convention |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
### Phase 1 β Structure Discovery
|
|
62
|
+
|
|
63
|
+
*(Relies on `context-manager` if already loaded)*
|
|
64
|
+
|
|
65
|
+
Analyze the root source directory (e.g., `src/`, `app/`):
|
|
66
|
+
1. **Layer-based:** `components/`, `hooks/`, `services/`, `utils/`, `types/`
|
|
67
|
+
2. **Feature-based:** `features/auth/`, `features/products/`
|
|
68
|
+
3. **Framework-specific:** `app/` (Next.js App Router), `pages/` (Next.js Pages Router, Nuxt)
|
|
69
|
+
4. **Domain-driven:** `domains/user/`, `domains/payment/`
|
|
70
|
+
5. **FSD (Feature Sliced Design):** `app/`, `processes/`, `pages/`, `widgets/`, `features/`, `entities/`, `shared/`
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Phase 2 β Rule Extraction
|
|
75
|
+
|
|
76
|
+
Based on discovery, define the project's rules for:
|
|
77
|
+
- **Components:** Are they flat? Grouped by feature? Atomic design?
|
|
78
|
+
- **Hooks:** Shared in `src/hooks/` or collocated with components?
|
|
79
|
+
- **State:** Global store vs. feature stores?
|
|
80
|
+
- **API/Services:** Where are HTTP calls made?
|
|
81
|
+
- **Types:** Centralized `types/` or collocated?
|
|
82
|
+
- **Naming Conventions:** PascalCase, camelCase, kebab-case, `index.ts` usage?
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Phase 3 β File Placement Decision
|
|
87
|
+
|
|
88
|
+
When a new feature/component is requested, map it to the structure:
|
|
89
|
+
|
|
90
|
+
**Input:** "Create a User Profile card that fetches user data."
|
|
91
|
+
**Decision:**
|
|
92
|
+
- UI Component: `src/features/user/components/UserProfileCard.tsx`
|
|
93
|
+
- API Hook: `src/features/user/api/useUser.ts`
|
|
94
|
+
- Types: `src/features/user/types/index.ts`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Phase 4 β Enforcement & Validation
|
|
99
|
+
|
|
100
|
+
Before passing control to a generation skill (like `ui-builder`), ensure the plan adheres to the rules.
|
|
101
|
+
|
|
102
|
+
- [ ] Does it mix concerns? (e.g., putting an API call directly in a shared UI button)
|
|
103
|
+
- [ ] Does it violate import boundaries? (e.g., a shared component importing from a specific feature)
|
|
104
|
+
- [ ] Is the naming consistent?
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Decision Tree
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Is the project using a Feature-based structure?
|
|
112
|
+
βββ Yes β Place feature-specific code in `features/<feature-name>/`
|
|
113
|
+
βββ No β Use Layer-based structure (`components/`, `hooks/`, etc.)
|
|
114
|
+
|
|
115
|
+
Is the code shared across multiple domains/features?
|
|
116
|
+
βββ Yes β Place in `shared/` or global `components/` / `hooks/`
|
|
117
|
+
βββ No β Collocate with the specific domain/feature
|
|
118
|
+
|
|
119
|
+
Are there existing examples of this type of file?
|
|
120
|
+
βββ Yes β Copy their placement and naming pattern
|
|
121
|
+
βββ No β Propose a standard location and ask user to confirm
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Output Format
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
ποΈ Frontend Architecture Plan
|
|
130
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
131
|
+
Structure Type: [Feature-based / Layer-based / FSD / etc.]
|
|
132
|
+
Naming: [PascalCase for components, camelCase for functions]
|
|
133
|
+
|
|
134
|
+
File Placement:
|
|
135
|
+
π [path/to/new/file1.tsx] β [Why it goes here]
|
|
136
|
+
π [path/to/new/file2.ts] β [Why it goes here]
|
|
137
|
+
|
|
138
|
+
β οΈ Constraints enforced:
|
|
139
|
+
β’ [Constraint 1, e.g., "API calls must be in hooks, not components"]
|
|
140
|
+
β’ [Constraint 2, e.g., "Shared UI components cannot import from features/"]
|
|
141
|
+
|
|
142
|
+
π Next Steps:
|
|
143
|
+
Delegating to `[skill-name]` to generate the files.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Validation Checklist
|
|
149
|
+
|
|
150
|
+
- [ ] Structure type identified correctly
|
|
151
|
+
- [ ] File placement follows existing conventions
|
|
152
|
+
- [ ] Naming matches project standards
|
|
153
|
+
- [ ] Separation of concerns maintained
|
|
154
|
+
- [ ] Plan ready to be executed by generation skills
|
|
155
|
+
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-frontend-debug
|
|
3
|
+
description: >-
|
|
4
|
+
ChαΊ©n ΔoΓ‘n vΓ sα»a cΓ‘c lα»i ΔαΊ·c thΓΉ frontend nhΖ° Hydration error, infinite re-render, stale closure vΓ vα»‘ CSS.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: frontend
|
|
7
|
+
tags: [debug, react, hydration, rerender, css, state-bug]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Frontend Debugger
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
15
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
16
|
+
> The user may write in any language β detect and match it automatically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Trigger
|
|
21
|
+
|
|
22
|
+
Activate this skill when:
|
|
23
|
+
- User reports a UI-specific bug ("screen is blank", "button doesn't work")
|
|
24
|
+
- React throws a Hydration Error (`Text content did not match. Server: "A" Client: "B"`)
|
|
25
|
+
- React throws an infinite loop error (`Too many re-renders`)
|
|
26
|
+
- CSS styling is broken or overflowing unexpectedly
|
|
27
|
+
- Form validation behaves incorrectly
|
|
28
|
+
|
|
29
|
+
**Note:** For backend or general logic bugs, use `bug-fix`. For performance issues, use `frontend-performance`.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
- β
Diagnose and fix React hydration mismatches (Next.js / SSR)
|
|
36
|
+
- β
Fix infinite loops in `useEffect` and missing dependencies
|
|
37
|
+
- β
Resolve state staleness (stale closures in async functions or hooks)
|
|
38
|
+
- β
Fix CSS layout issues (Flexbox/Grid blowouts, z-index stacking context)
|
|
39
|
+
- β
Provide a targeted, minimal fix that doesn't break other UI elements
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Non-goals
|
|
44
|
+
|
|
45
|
+
- β Do NOT rewrite the entire component to fix a small CSS bug
|
|
46
|
+
- β Do NOT disable hydration checks (`suppressHydrationWarning`) unless absolutely necessary and justified
|
|
47
|
+
- β Do NOT apply quick-fixes (like `// @ts-ignore` or wrapping everything in `setTimeout`) without understanding the root cause
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Workflow
|
|
52
|
+
|
|
53
|
+
### Phase 1 β Reproduction & Isolation
|
|
54
|
+
|
|
55
|
+
1. Identify the exact error message or visual symptom.
|
|
56
|
+
2. Isolate the component causing the issue.
|
|
57
|
+
3. Determine the environment (SSR, CSR, mobile, specific browser).
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Phase 2 β Common Issue Diagnosis
|
|
62
|
+
|
|
63
|
+
**Hydration Errors (Next.js/SSR):**
|
|
64
|
+
- Cause: Rendering `window`, `localStorage`, or random data (e.g., `Math.random()`, Dates) on the first pass.
|
|
65
|
+
- Fix: Move client-only rendering inside a `useEffect` (isMounted pattern) or use dynamic imports with `ssr: false`.
|
|
66
|
+
|
|
67
|
+
**Too many re-renders:**
|
|
68
|
+
- Cause: Updating state directly in the render body, or inside a `useEffect` without proper dependencies.
|
|
69
|
+
- Fix: Move state updates into event handlers, or fix `useEffect` dependencies.
|
|
70
|
+
|
|
71
|
+
**Stale Closures:**
|
|
72
|
+
- Cause: A `useEffect` or `useCallback` is using old state because it's missing from the dependency array.
|
|
73
|
+
- Fix: Add dependencies, use refs (`useRef`) for mutable values, or use functional state updates (`setState(prev => prev + 1)`).
|
|
74
|
+
|
|
75
|
+
**CSS Z-Index/Stacking Issues:**
|
|
76
|
+
- Cause: Missing `position: relative/absolute` on parent, or a new stacking context was created.
|
|
77
|
+
- Fix: Inspect parent elements, adjust `z-index`, or use Portals for modals.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Phase 3 β Fix Application
|
|
82
|
+
|
|
83
|
+
Apply the minimal fix required to resolve the issue while preserving surrounding logic and styles.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Decision Tree
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Is it a Hydration Error?
|
|
91
|
+
βββ Yes β Is it caused by client-side APIs (window/localStorage)?
|
|
92
|
+
β βββ Yes β Use `useEffect` to delay rendering until mounted
|
|
93
|
+
β βββ No β Check for mismatched HTML tags (e.g., <p> inside <p>)
|
|
94
|
+
βββ No β Proceed to next check
|
|
95
|
+
|
|
96
|
+
Is it an infinite loop?
|
|
97
|
+
βββ Yes β Check `useEffect` dependencies. Are objects/arrays re-created every render?
|
|
98
|
+
β βββ Yes β Memoize them (`useMemo`) or move outside component
|
|
99
|
+
β βββ No β Ensure `setState` isn't called unconditionally in render
|
|
100
|
+
βββ No β Proceed
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Output Format
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
πͺ² Frontend Debug Report
|
|
109
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
110
|
+
Symptom: [Description of the bug]
|
|
111
|
+
Root Cause: [Explanation of why it failed, e.g., Stale Closure in useEffect]
|
|
112
|
+
|
|
113
|
+
π§ Fix Applied:
|
|
114
|
+
[Brief description of the code change]
|
|
115
|
+
|
|
116
|
+
β
Verification:
|
|
117
|
+
- Error no longer throws
|
|
118
|
+
- UI renders correctly
|
|
119
|
+
|
|
120
|
+
β οΈ Notes:
|
|
121
|
+
[Any side effects or things to watch out for]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Validation Checklist
|
|
127
|
+
|
|
128
|
+
- [ ] Root cause clearly identified (not just patched)
|
|
129
|
+
- [ ] Fix is minimal and targeted
|
|
130
|
+
- [ ] No Hydration warnings remain
|
|
131
|
+
- [ ] Component doesn't infinitely loop
|
|
132
|
+
- [ ] No regression on related UI
|
|
133
|
+
|