ai-developer-skill-os 7.5.0 → 7.5.1

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.
Files changed (204) hide show
  1. package/.agents/CHANGELOG.md +2 -1
  2. package/.agents/README.md +51 -10
  3. package/.agents/docs/CHI_TIET_SKILLS.md +2 -1
  4. package/.agents/skills/qk-orchestrator/SKILL.md +3 -2
  5. package/.agents/skills/qk-orchestrator/references/routing-table.md +3 -2
  6. package/.agents/skills/qk-project-bootstrap/SKILL.md +2 -1
  7. package/.agents/skills/qk-project-memory/SKILL.md +46 -0
  8. package/.agents/skills/qk-ui-audit/SKILL.md +3 -2
  9. package/.agents/skills/qk-ui-builder/SKILL.md +446 -0
  10. package/.agents/skills/qk-ui-builder/references/anti-patterns.md +295 -0
  11. package/.agents/skills/qk-ui-builder/references/color.md +115 -0
  12. package/.agents/skills/qk-ui-builder/references/component-cookbook.md +1194 -0
  13. package/.agents/skills/qk-ui-builder/references/copy.md +250 -0
  14. package/.agents/skills/qk-ui-builder/references/interaction-and-states.md +115 -0
  15. package/.agents/skills/qk-ui-builder/references/layout-and-space.md +111 -0
  16. package/.agents/skills/qk-ui-builder/references/macrostructures/01-bento-grid.md +48 -0
  17. package/.agents/skills/qk-ui-builder/references/macrostructures/02-long-document.md +50 -0
  18. package/.agents/skills/qk-ui-builder/references/macrostructures/03-marquee-hero.md +51 -0
  19. package/.agents/skills/qk-ui-builder/references/macrostructures/04-stat-led.md +49 -0
  20. package/.agents/skills/qk-ui-builder/references/macrostructures/05-workbench.md +44 -0
  21. package/.agents/skills/qk-ui-builder/references/macrostructures/06-conversational-faq.md +50 -0
  22. package/.agents/skills/qk-ui-builder/references/macrostructures/07-manifesto.md +51 -0
  23. package/.agents/skills/qk-ui-builder/references/macrostructures/08-photographic.md +50 -0
  24. package/.agents/skills/qk-ui-builder/references/macrostructures/09-quote-led.md +50 -0
  25. package/.agents/skills/qk-ui-builder/references/macrostructures/11-catalogue.md +49 -0
  26. package/.agents/skills/qk-ui-builder/references/macrostructures/12-letter.md +49 -0
  27. package/.agents/skills/qk-ui-builder/references/macrostructures/13-index-first.md +49 -0
  28. package/.agents/skills/qk-ui-builder/references/macrostructures/14-narrative-workflow.md +48 -0
  29. package/.agents/skills/qk-ui-builder/references/macrostructures/15-split-studio.md +48 -0
  30. package/.agents/skills/qk-ui-builder/references/macrostructures/16-feature-stack.md +51 -0
  31. package/.agents/skills/qk-ui-builder/references/macrostructures/17-type-specimen.md +48 -0
  32. package/.agents/skills/qk-ui-builder/references/macrostructures/18-portfolio-grid.md +48 -0
  33. package/.agents/skills/qk-ui-builder/references/macrostructures/19-map-diagram.md +50 -0
  34. package/.agents/skills/qk-ui-builder/references/macrostructures/20-ecosystem-index.md +48 -0
  35. package/.agents/skills/qk-ui-builder/references/macrostructures/21-component-playground.md +45 -0
  36. package/.agents/skills/qk-ui-builder/references/macrostructures.md +38 -0
  37. package/.agents/skills/qk-ui-builder/references/motion.md +95 -0
  38. package/.agents/skills/qk-ui-builder/references/responsive.md +115 -0
  39. package/.agents/skills/qk-ui-builder/references/slop-test.md +135 -0
  40. package/.agents/skills/qk-ui-builder/references/structure.md +280 -0
  41. package/.agents/skills/qk-ui-builder/references/themes/atmospheric.md +53 -0
  42. package/.agents/skills/qk-ui-builder/references/themes/carnival.md +52 -0
  43. package/.agents/skills/qk-ui-builder/references/themes/cobalt.md +52 -0
  44. package/.agents/skills/qk-ui-builder/references/themes/editorial.md +52 -0
  45. package/.agents/skills/qk-ui-builder/references/themes/garden.md +52 -0
  46. package/.agents/skills/qk-ui-builder/references/themes/hum.md +52 -0
  47. package/.agents/skills/qk-ui-builder/references/themes/lumen.md +52 -0
  48. package/.agents/skills/qk-ui-builder/references/themes/midnight.md +52 -0
  49. package/.agents/skills/qk-ui-builder/references/themes/modern-minimal.md +52 -0
  50. package/.agents/skills/qk-ui-builder/references/themes/playful.md +52 -0
  51. package/.agents/skills/qk-ui-builder/references/themes/specimen.md +52 -0
  52. package/.agents/skills/qk-ui-builder/references/themes/terminal.md +52 -0
  53. package/.agents/skills/qk-ui-builder/references/typography.md +129 -0
  54. package/.agents/skills.json +4 -4
  55. package/CHANGELOG.md +2 -1
  56. package/README.md +36 -16
  57. package/bin/lint.js +3 -2
  58. package/docs/CHI_TIET_SKILLS.md +2 -1
  59. package/framework/decision-primitives.md +2 -1
  60. package/package.json +2 -2
  61. package/skills/_template/SKILL.md +2 -1
  62. package/skills/qk-access-policy/SKILL.md +3 -2
  63. package/skills/qk-ai-builder/SKILL.md +3 -2
  64. package/skills/qk-api-lifecycle/SKILL.md +3 -2
  65. package/skills/qk-bug-resolution/SKILL.md +3 -2
  66. package/skills/qk-context-loader/SKILL.md +13 -12
  67. package/skills/qk-data-lifecycle/SKILL.md +3 -2
  68. package/skills/qk-db-optimizer/SKILL.md +3 -2
  69. package/skills/qk-docs/SKILL.md +3 -2
  70. package/skills/qk-engineering-standard/SKILL.md +19 -18
  71. package/skills/qk-fe-api-integration/SKILL.md +3 -2
  72. package/skills/qk-feature-delivery/SKILL.md +3 -2
  73. package/skills/qk-help/SKILL.md +3 -2
  74. package/skills/qk-orchestrator/SKILL.md +18 -16
  75. package/skills/qk-orchestrator/references/routing-table.md +3 -2
  76. package/skills/qk-production-release/SKILL.md +15 -14
  77. package/skills/qk-project-bootstrap/SKILL.md +5 -3
  78. package/skills/qk-project-health/SKILL.md +3 -2
  79. package/skills/qk-project-memory/SKILL.md +49 -2
  80. package/skills/qk-system-evolution/SKILL.md +16 -15
  81. package/skills/qk-ui-audit/SKILL.md +21 -19
  82. package/skills/qk-ui-builder/SKILL.md +447 -0
  83. package/skills/qk-ui-builder/references/anti-patterns.md +295 -0
  84. package/skills/qk-ui-builder/references/color.md +115 -0
  85. package/skills/qk-ui-builder/references/component-cookbook.md +1194 -0
  86. package/skills/qk-ui-builder/references/copy.md +250 -0
  87. package/skills/qk-ui-builder/references/interaction-and-states.md +115 -0
  88. package/skills/qk-ui-builder/references/layout-and-space.md +111 -0
  89. package/skills/qk-ui-builder/references/macrostructures/01-bento-grid.md +48 -0
  90. package/skills/qk-ui-builder/references/macrostructures/02-long-document.md +50 -0
  91. package/skills/qk-ui-builder/references/macrostructures/03-marquee-hero.md +51 -0
  92. package/skills/qk-ui-builder/references/macrostructures/04-stat-led.md +49 -0
  93. package/skills/qk-ui-builder/references/macrostructures/05-workbench.md +44 -0
  94. package/skills/qk-ui-builder/references/macrostructures/06-conversational-faq.md +50 -0
  95. package/skills/qk-ui-builder/references/macrostructures/07-manifesto.md +51 -0
  96. package/skills/qk-ui-builder/references/macrostructures/08-photographic.md +50 -0
  97. package/skills/qk-ui-builder/references/macrostructures/09-quote-led.md +50 -0
  98. package/skills/qk-ui-builder/references/macrostructures/11-catalogue.md +49 -0
  99. package/skills/qk-ui-builder/references/macrostructures/12-letter.md +49 -0
  100. package/skills/qk-ui-builder/references/macrostructures/13-index-first.md +49 -0
  101. package/skills/qk-ui-builder/references/macrostructures/14-narrative-workflow.md +48 -0
  102. package/skills/qk-ui-builder/references/macrostructures/15-split-studio.md +48 -0
  103. package/skills/qk-ui-builder/references/macrostructures/16-feature-stack.md +51 -0
  104. package/skills/qk-ui-builder/references/macrostructures/17-type-specimen.md +48 -0
  105. package/skills/qk-ui-builder/references/macrostructures/18-portfolio-grid.md +48 -0
  106. package/skills/qk-ui-builder/references/macrostructures/19-map-diagram.md +50 -0
  107. package/skills/qk-ui-builder/references/macrostructures/20-ecosystem-index.md +48 -0
  108. package/skills/qk-ui-builder/references/macrostructures/21-component-playground.md +45 -0
  109. package/skills/qk-ui-builder/references/macrostructures.md +38 -0
  110. package/skills/qk-ui-builder/references/motion.md +95 -0
  111. package/skills/qk-ui-builder/references/responsive.md +115 -0
  112. package/skills/qk-ui-builder/references/slop-test.md +135 -0
  113. package/skills/qk-ui-builder/references/structure.md +280 -0
  114. package/skills/qk-ui-builder/references/themes/atmospheric.md +53 -0
  115. package/skills/qk-ui-builder/references/themes/carnival.md +52 -0
  116. package/skills/qk-ui-builder/references/themes/cobalt.md +52 -0
  117. package/skills/qk-ui-builder/references/themes/editorial.md +52 -0
  118. package/skills/qk-ui-builder/references/themes/garden.md +52 -0
  119. package/skills/qk-ui-builder/references/themes/hum.md +52 -0
  120. package/skills/qk-ui-builder/references/themes/lumen.md +52 -0
  121. package/skills/qk-ui-builder/references/themes/midnight.md +52 -0
  122. package/skills/qk-ui-builder/references/themes/modern-minimal.md +52 -0
  123. package/skills/qk-ui-builder/references/themes/playful.md +52 -0
  124. package/skills/qk-ui-builder/references/themes/specimen.md +52 -0
  125. package/skills/qk-ui-builder/references/themes/terminal.md +52 -0
  126. package/skills/qk-ui-builder/references/typography.md +129 -0
  127. package/skills/qk-ui-system-builder/SKILL.md +3 -2
  128. package/skills/qk-validation-gate/SKILL.md +18 -17
  129. package/skills.json +28 -27
  130. package/.agents/_template/BEHAVIOR_SPEC.md +0 -96
  131. package/.agents/_template/examples/example-en.md +0 -49
  132. package/.agents/_template/examples/example-vi.md +0 -49
  133. package/.agents/skills/qk-design-to-code/SKILL.md +0 -285
  134. package/.qk-ai-skill-os/CHANGELOG.md +0 -69
  135. package/.qk-ai-skill-os/LICENSE +0 -21
  136. package/.qk-ai-skill-os/README.md +0 -59
  137. package/.qk-ai-skill-os/_template/BEHAVIOR_SPEC.md +0 -96
  138. package/.qk-ai-skill-os/_template/examples/example-en.md +0 -49
  139. package/.qk-ai-skill-os/_template/examples/example-vi.md +0 -49
  140. package/.qk-ai-skill-os/docs/CHI_TIET_SKILLS.md +0 -125
  141. package/.qk-ai-skill-os/docs/GOVERNANCE.md +0 -40
  142. package/.qk-ai-skill-os/docs/HUONG_DAN_SU_DUNG.md +0 -120
  143. package/.qk-ai-skill-os/docs/SPEC.md +0 -87
  144. package/.qk-ai-skill-os/docs/adr/0001-intent-based-architecture.md +0 -19
  145. package/.qk-ai-skill-os/docs/adr/0002-kernel-freeze.md +0 -21
  146. package/.qk-ai-skill-os/docs/adr/0003-risk-based-verification.md +0 -20
  147. package/.qk-ai-skill-os/docs/adr/0004-progressive-evidence.md +0 -19
  148. package/.qk-ai-skill-os/docs/skill-classification.md +0 -25
  149. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-accessibility-audit/SKILL.md +0 -121
  150. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-agent-orchestrator/SKILL.md +0 -179
  151. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-api-integration/SKILL.md +0 -389
  152. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-auth-security/SKILL.md +0 -96
  153. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-backend-architecture/SKILL.md +0 -125
  154. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-bug-fix/SKILL.md +0 -213
  155. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-component-generator/SKILL.md +0 -136
  156. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-context-manager/SKILL.md +0 -175
  157. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-database-engineer/SKILL.md +0 -104
  158. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-deployment/SKILL.md +0 -96
  159. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-design-system/SKILL.md +0 -137
  160. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-form-builder/SKILL.md +0 -140
  161. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-architecture/SKILL.md +0 -155
  162. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-debug/SKILL.md +0 -133
  163. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-performance/SKILL.md +0 -129
  164. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-frontend-testing/SKILL.md +0 -146
  165. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-git-engineer/SKILL.md +0 -304
  166. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-help/SKILL.md +0 -68
  167. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-migration/SKILL.md +0 -284
  168. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-project-audit/SKILL.md +0 -280
  169. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-refactor/SKILL.md +0 -222
  170. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-state-management/SKILL.md +0 -140
  171. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-table-crud-generator/SKILL.md +0 -127
  172. package/.qk-ai-skill-os/skills/_archive_old_skills/qk-ui-builder/SKILL.md +0 -152
  173. package/.qk-ai-skill-os/skills/_template/SKILL.md +0 -238
  174. package/.qk-ai-skill-os/skills/qk-access-policy/SKILL.md +0 -179
  175. package/.qk-ai-skill-os/skills/qk-ai-builder/SKILL.md +0 -221
  176. package/.qk-ai-skill-os/skills/qk-api-lifecycle/SKILL.md +0 -176
  177. package/.qk-ai-skill-os/skills/qk-bug-resolution/SKILL.md +0 -307
  178. package/.qk-ai-skill-os/skills/qk-context-loader/SKILL.md +0 -218
  179. package/.qk-ai-skill-os/skills/qk-data-lifecycle/SKILL.md +0 -192
  180. package/.qk-ai-skill-os/skills/qk-db-optimizer/SKILL.md +0 -196
  181. package/.qk-ai-skill-os/skills/qk-design-to-code/SKILL.md +0 -291
  182. package/.qk-ai-skill-os/skills/qk-docs/SKILL.md +0 -198
  183. package/.qk-ai-skill-os/skills/qk-engineering-standard/SKILL.md +0 -351
  184. package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/backend.md +0 -122
  185. package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/database.md +0 -3
  186. package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/frontend.md +0 -152
  187. package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/security.md +0 -3
  188. package/.qk-ai-skill-os/skills/qk-engineering-standard/rules/testing.md +0 -3
  189. package/.qk-ai-skill-os/skills/qk-fe-api-integration/SKILL.md +0 -326
  190. package/.qk-ai-skill-os/skills/qk-feature-delivery/SKILL.md +0 -305
  191. package/.qk-ai-skill-os/skills/qk-help/SKILL.md +0 -193
  192. package/.qk-ai-skill-os/skills/qk-orchestrator/SKILL.md +0 -277
  193. package/.qk-ai-skill-os/skills/qk-orchestrator/references/routing-table.md +0 -77
  194. package/.qk-ai-skill-os/skills/qk-production-release/SKILL.md +0 -290
  195. package/.qk-ai-skill-os/skills/qk-project-bootstrap/SKILL.md +0 -240
  196. package/.qk-ai-skill-os/skills/qk-project-health/SKILL.md +0 -199
  197. package/.qk-ai-skill-os/skills/qk-project-memory/SKILL.md +0 -172
  198. package/.qk-ai-skill-os/skills/qk-system-evolution/SKILL.md +0 -285
  199. package/.qk-ai-skill-os/skills/qk-ui-audit/SKILL.md +0 -314
  200. package/.qk-ai-skill-os/skills/qk-ui-audit/references/anti-slop-checklist.md +0 -136
  201. package/.qk-ai-skill-os/skills/qk-ui-system-builder/SKILL.md +0 -225
  202. package/.qk-ai-skill-os/skills/qk-validation-gate/SKILL.md +0 -361
  203. package/.qk-ai-skill-os/skills.json +0 -819
  204. package/skills/qk-design-to-code/SKILL.md +0 -285
@@ -1,152 +0,0 @@
1
- # Frontend Rules
2
-
3
- - Define rules here.
4
-
5
- ---
6
-
7
- ## 🔄 [Merged from qk-frontend-architecture]
8
-
9
- # Frontend Architecture
10
-
11
- > **Language rule:**
12
- > Use English for: code, identifiers, file names, architecture terms, technical decisions.
13
- > Use the user's language for: explanations, questions, summaries, and feedback.
14
- > The user may write in any language — detect and match it automatically.
15
-
16
- ---
17
-
18
- ## Trigger
19
-
20
- Activate this skill when:
21
- - About to create new files or components
22
- - User asks "where should I put this file?" or "how should I organize this?"
23
- - Moving or refactoring code across different modules
24
- - Inheriting an unfamiliar frontend project
25
-
26
- ---
27
-
28
- ## Scope
29
-
30
- - ✅ Discover the existing frontend folder structure
31
- - ✅ Define where new components, hooks, services, and types should be placed
32
- - ✅ Enforce separation of concerns (e.g., UI vs. Business Logic vs. Data)
33
- - ✅ Identify architectural patterns in use (e.g., Feature-based, Layer-based)
34
- - ✅ Validate file placement before execution by other skills
35
-
36
- ---
37
-
38
- ## Non-goals
39
-
40
- - ❌ Do NOT rewrite the entire project architecture unless explicitly asked
41
- - ❌ Do NOT generate code (delegate to `component-generator` or `ui-builder`)
42
- - ❌ Do NOT enforce personal preferences over established project conventions
43
-
44
- ---
45
-
46
- ## Severity Levels
47
-
48
- | Level | Meaning |
49
- |-------|---------|
50
- | P0 | Architectural violation that breaks the build or creates circular dependencies |
51
- | P1 | File placed in completely wrong layer (e.g., API logic in UI component) |
52
- | P2 | Inconsistent folder or file naming |
53
- | P3 | Minor deviation from convention |
54
-
55
- ---
56
-
57
- ## Workflow
58
-
59
- ### Phase 1 — Structure Discovery
60
-
61
- *(Relies on `context-manager` if already loaded)*
62
-
63
- Analyze the root source directory (e.g., `src/`, `app/`):
64
- 1. **Layer-based:** `components/`, `hooks/`, `services/`, `utils/`, `types/`
65
- 2. **Feature-based:** `features/auth/`, `features/products/`
66
- 3. **Framework-specific:** `app/` (Next.js App Router), `pages/` (Next.js Pages Router, Nuxt)
67
- 4. **Domain-driven:** `domains/user/`, `domains/payment/`
68
- 5. **FSD (Feature Sliced Design):** `app/`, `processes/`, `pages/`, `widgets/`, `features/`, `entities/`, `shared/`
69
-
70
- ---
71
-
72
- ### Phase 2 — Rule Extraction
73
-
74
- Based on discovery, define the project's rules for:
75
- - **Components:** Are they flat? Grouped by feature? Atomic design?
76
- - **Hooks:** Shared in `src/hooks/` or collocated with components?
77
- - **State:** Global store vs. feature stores?
78
- - **API/Services:** Where are HTTP calls made?
79
- - **Types:** Centralized `types/` or collocated?
80
- - **Naming Conventions:** PascalCase, camelCase, kebab-case, `index.ts` usage?
81
-
82
- ---
83
-
84
- ### Phase 3 — File Placement Decision
85
-
86
- When a new feature/component is requested, map it to the structure:
87
-
88
- **Input:** "Create a User Profile card that fetches user data."
89
- **Decision:**
90
- - UI Component: `src/features/user/components/UserProfileCard.tsx`
91
- - API Hook: `src/features/user/api/useUser.ts`
92
- - Types: `src/features/user/types/index.ts`
93
-
94
- ---
95
-
96
- ### Phase 4 — Enforcement & Validation
97
-
98
- Before passing control to a generation skill (like `ui-builder`), ensure the plan adheres to the rules.
99
-
100
- - [ ] Does it mix concerns? (e.g., putting an API call directly in a shared UI button)
101
- - [ ] Does it violate import boundaries? (e.g., a shared component importing from a specific feature)
102
- - [ ] Is the naming consistent?
103
-
104
- ---
105
-
106
- ## Decision Tree
107
-
108
- ```
109
- Is the project using a Feature-based structure?
110
- ├── Yes → Place feature-specific code in `features/<feature-name>/`
111
- └── No → Use Layer-based structure (`components/`, `hooks/`, etc.)
112
-
113
- Is the code shared across multiple domains/features?
114
- ├── Yes → Place in `shared/` or global `components/` / `hooks/`
115
- └── No → Collocate with the specific domain/feature
116
-
117
- Are there existing examples of this type of file?
118
- ├── Yes → Copy their placement and naming pattern
119
- └── No → Propose a standard location and ask user to confirm
120
- ```
121
-
122
- ---
123
-
124
- ## Output Format
125
-
126
- ```
127
- 🏗️ Frontend Architecture Plan
128
- ─────────────────────────────────────────────────
129
- Structure Type: [Feature-based / Layer-based / FSD / etc.]
130
- Naming: [PascalCase for components, camelCase for functions]
131
-
132
- File Placement:
133
- 📄 [path/to/new/file1.tsx] — [Why it goes here]
134
- 📄 [path/to/new/file2.ts] — [Why it goes here]
135
-
136
- ⚠️ Constraints enforced:
137
- • [Constraint 1, e.g., "API calls must be in hooks, not components"]
138
- • [Constraint 2, e.g., "Shared UI components cannot import from features/"]
139
-
140
- 🔗 Next Steps:
141
- Delegating to `[skill-name]` to generate the files.
142
- ```
143
-
144
- ---
145
-
146
- ## Validation Checklist
147
-
148
- - [ ] Structure type identified correctly
149
- - [ ] File placement follows existing conventions
150
- - [ ] Naming matches project standards
151
- - [ ] Separation of concerns maintained
152
- - [ ] Plan ready to be executed by generation skills
@@ -1,3 +0,0 @@
1
- # Security Rules
2
-
3
- - Define rules here.
@@ -1,3 +0,0 @@
1
- # Testing Rules
2
-
3
- - Define rules here.
@@ -1,326 +0,0 @@
1
- ---
2
- name: qk-fe-api-integration
3
- category: frontend
4
- version: 7.5.0
5
- description: "Consume API Backend, quản lý State, bind vào UI — tuân thủ kiến trúc Base dự án"
6
- platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
7
- execution_mode: deterministic
8
-
9
- cost: medium
10
- latency: medium
11
- risk: low
12
- side_effects: edit_files
13
- produces: [code]
14
- consumes: [json-payload, context-graph]
15
-
16
- token_budget:
17
- max_files_read: 3
18
- max_lines_per_read: 100
19
- max_shell_commands: 1
20
- stop_early: true
21
-
22
- exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
23
- skill_version: 7.5.0
24
- runtime_version: 1
25
- schema_version: 2
26
- ---
27
-
28
- # qk-fe-api-integration — Frontend API Consumer
29
-
30
- > **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese.
31
-
32
- ---
33
-
34
- ## Preconditions
35
- - [ ] Backend JSON payload hoặc API endpoint schema được cung cấp
36
- - [ ] Project's API client pattern được xác định (Axios wrapper, RTK Query, React Query, etc.)
37
-
38
- ```
39
- On missing precondition:
40
- EXIT: BLOCKED
41
- Message: "Cần cung cấp: JSON response mẫu VÀ xác nhận API client pattern hiện tại của dự án."
42
- ```
43
-
44
- ---
45
-
46
- ## Scope
47
- - ✅ Identify existing API client pattern (NEVER default to raw fetch if wrapper exists)
48
- - ✅ Generate strict TypeScript interfaces from JSON payload
49
- - ✅ Implement service layer (API calls separated from UI)
50
- - ✅ Handle all 3 UI states: Loading, Success, Error
51
- - ✅ Map backend payload → DTO before injecting into UI components
52
-
53
- ## Non-Goals
54
- - ❌ Hardcode API Base URLs in UI components — use env vars or centralized config
55
- - ❌ Inject API logic inside presentational (dumb) components
56
- - ❌ Introduce new state management libraries without explicit user approval
57
- - ❌ Hallucinate data fields not in provided JSON payload
58
- - ❌ Create Node.js/Python scripts to patch — edit files directly
59
- - ❌ Read entire files > 100 lines — use targeted reads
60
- - ❌ Default to raw fetch if wrapper exists — ALWAYS reuse existing client
61
-
62
- ---
63
-
64
- ## Priority Order
65
-
66
- | Priority | Task | Skip Threshold |
67
- |----------|------|----------------|
68
- | P1 | Identify existing API client (grep package.json, src/api/) | Never |
69
- | P2 | Generate TypeScript interfaces from JSON payload | Never |
70
- | P3 | Implement service layer (API calls) | Never |
71
- | P4 | Bind to UI with Loading + Success + Error states | Budget < 30% |
72
- | P5 | Cache invalidation after mutations (POST/PUT/DELETE) | Budget < 60% |
73
- | P6 | DTO mapping (backend payload → clean UI data) | Budget < 70% |
74
-
75
- ---
76
-
77
- ## Workflow
78
-
79
- ### Phase 1 — Identify Base Architecture
80
-
81
- **Steps:**
82
- 1. `grep_search` in `package.json` → identify: axios, react-query, rtk-query, swr, or custom
83
- 2. `view_file[src/api/]` (first 30 lines) → confirm wrapper pattern
84
- 3. Identify: base URL config, auth header injection, error interceptor location
85
-
86
- **Decision:**
87
- ```
88
- IF wrapper/client found (e.g., apiClient.ts, axiosInstance.ts)
89
- → Use it. NEVER bypass with raw fetch/axios.
90
- → Confidence: HIGH → go to Phase 2
91
-
92
- ELSE IF no wrapper found
93
- → Confirm with user: "Dùng raw fetch hay tạo wrapper mới?"
94
- → Confidence: MEDIUM → go to Phase 2
95
-
96
- ELSE IF conflicting patterns found (mix of fetch + axios + rtk)
97
- → EXIT: BLOCKED — ask which pattern to follow
98
- ```
99
-
100
- **Exit When:**
101
- - API client pattern identified → go to Phase 2
102
- - `max_files_read` reached → go to Phase 2 with MEDIUM confidence
103
-
104
- ---
105
-
106
- ### Phase 2 — Generate Types
107
-
108
- **Steps:**
109
- 1. Parse provided JSON payload → extract all fields with types
110
- 2. Generate TypeScript interface (Request + Response)
111
- 3. Flag any field that could be `null` or optional
112
-
113
- **Decision:**
114
- ```
115
- IF all fields clearly typed from JSON
116
- → Confidence: HIGH → go to Phase 3
117
-
118
- ELSE IF some fields ambiguous (null | undefined)
119
- → Mark as optional (?:) + add comment "// verify with backend"
120
- → Confidence: MEDIUM → go to Phase 3
121
-
122
- ELSE IF nested objects contain mixed null/non-null patterns
123
- → EXIT: BLOCKED — cannot safely generate types without backend clarification
124
- ```
125
-
126
- ---
127
-
128
- ### Phase 3 — Implement Service + UI Binding
129
-
130
- **Steps:**
131
- 1. Create/update service file (API calls only — no UI logic)
132
- 2. Bind to component: implement Loading state (skeleton/spinner)
133
- 3. Bind Success state: render data using generated types
134
- 4. Bind Error state: handle HTTP errors per table below
135
-
136
- **HTTP Error Handling (mandatory for ALL integrations):**
137
- ```
138
- 401 Unauthorized → redirect to login or show auth error toast
139
- 403 Forbidden → show permission error toast
140
- 404 Not Found → show empty state component (not a crash)
141
- 422 Validation → map field errors to form fields
142
- 500 Server Error → show generic error toast + retry button
143
- Network Error → show offline banner or retry prompt
144
- ```
145
-
146
- **Decision:**
147
- ```
148
- IF all 3 states (Loading, Success, Error) implemented + service created → go to Phase 4
149
- ELSE IF error state incomplete → EXIT: PARTIAL — missing HTTP error handling
150
- ELSE → EXIT: BLOCKED — cannot complete binding
151
- ```
152
-
153
- **Exit When:**
154
- - All 3 states implemented + service created → go to Phase 4
155
-
156
- ---
157
-
158
- ### Phase 4 — Self-Audit
159
-
160
- **Steps:**
161
- 1. Re-read service file: confirm no hardcoded URLs, no UI logic
162
- 2. Re-read component: confirm no API calls inside JSX
163
- 3. Verify cache invalidation if mutation (POST/PUT/DELETE)
164
-
165
- **Decision:**
166
- ```
167
- IF all audit points pass → EXIT: SUCCESS
168
- ELSE IF 1–2 minor issues → fix inline → EXIT: SUCCESS
169
- ELSE IF architectural violation found → fix → EXIT: PARTIAL
170
- ELSE IF hardcoded URL (http://localhost, 127.0.0.1) found → EXIT: FAILED — do not ship
171
- ```
172
-
173
- ---
174
-
175
- ## Confidence Model
176
-
177
- | Level | Condition | Action |
178
- |-------|-----------|--------|
179
- | HIGH | API client found, JSON payload complete, all types inferred | Implement directly |
180
- | MEDIUM | Some fields ambiguous, wrapper partially identified | Note assumptions, proceed |
181
- | LOW | No JSON payload provided OR conflicting API patterns OR nested nulls unresolved | EXIT: BLOCKED |
182
-
183
- ---
184
-
185
- ## Severity
186
-
187
- | Level | Definition | Example |
188
- |-------|-----------|---------|
189
- | CRITICAL | Security data leakage from improper DTO mapping | Auth token in dumb component |
190
- | HIGH | Missing error state causes white screen of death | No 500 handler |
191
- | MEDIUM | Hardcoded URL breaks in production | `axios.get("http://localhost:3000/api")` |
192
- | LOW | Missing cache invalidation after mutation | Stale data after POST |
193
-
194
- ---
195
-
196
- ## Evidence Format
197
-
198
- ```
199
- [SEVERITY] path/to/component.tsx:LINE
200
- Issue: [specific violation]
201
- Confidence: [HIGH|MEDIUM|LOW]
202
- Fix: [one-line suggestion]
203
- ```
204
-
205
- **Example:**
206
- ```
207
- [HIGH] src/pages/Dashboard.tsx:45
208
- Issue: API call `axios.get('/api/data')` inside JSX render — violates smart/dumb separation
209
- Confidence: HIGH
210
- Fix: Move to `src/services/dashboard.service.ts`, inject via hook
211
- ```
212
-
213
- ---
214
-
215
- ## Retry Policy
216
-
217
- ```
218
- API call fails (runtime verification)
219
- └─ Check error type
220
- ├─ Network error → show retry button (user-triggered retry, not auto)
221
- ├─ 401/403 → do NOT retry — redirect or show permission error
222
- ├─ 500 → auto-retry once after 1s delay
223
- │ └─ Still fails → show error toast with "Try again" button
224
- └─ Never auto-retry more than 1 time (avoid hammering server)
225
-
226
- Skill execution fails
227
- └─ Check failure type
228
- ├─ Syntax error in generated code → fix and retry once
229
- └─ Architectural mismatch → EXIT: FAILED, do NOT retry
230
- ```
231
-
232
- ---
233
-
234
- ## Escalation Rules
235
-
236
- ```
237
- BLOCKED: Cannot determine API client pattern
238
- Missing:
239
- - package.json contents OR
240
- - Location of existing API client file (e.g., src/lib/api.ts)
241
- Questions:
242
- 1. Dự án dùng thư viện nào để gọi API? (axios / fetch / react-query / rtk-query)
243
- 2. Có file API wrapper/client nào sẵn không? (ví dụ: src/api/client.ts)
244
- Recommended Assumptions (if proceeding):
245
- - Create new Axios instance with interceptors for auth + error handling
246
- ```
247
-
248
- ---
249
-
250
- ## Handoff Contract
251
-
252
- ### Consumes
253
- ```json
254
- {
255
- "from": "user or qk-context-loader",
256
- "required_fields": ["json_payload_sample", "api_endpoint"],
257
- "optional_fields": ["existing_api_client_path", "component_to_bind"]
258
- }
259
- ```
260
-
261
- ### Produces
262
- ```json
263
- {
264
- "to": "user",
265
- "output_fields": ["types_file", "service_file", "component_file", "states_implemented", "exit_code"]
266
- }
267
- ```
268
-
269
- ---
270
-
271
- ## Output Format
272
-
273
- ```
274
- 🔌 FE API Integration
275
- ─────────────────────────────────────────────────
276
- API Client: [identified — axiosInstance.ts | created new]
277
- Types: [src/types/[resource].types.ts]
278
- Service: [src/services/[resource].service.ts]
279
-
280
- States implemented:
281
- ✅ Loading (skeleton/spinner)
282
- ✅ Success (data rendered)
283
- ✅ Error (toast/empty state per HTTP code)
284
- ⚠️ [any state skipped — reason]
285
-
286
- Assumptions:
287
- - [any assumption made]
288
-
289
- Exit Code: [SUCCESS | PARTIAL | BLOCKED | FAILED]
290
- ```
291
-
292
- ---
293
-
294
- ## Exit Codes
295
-
296
- | Code | Meaning | When |
297
- |------|---------|------|
298
- | SUCCESS | Types + service + UI binding complete with all 3 states | Full integration |
299
- | PARTIAL | Integration done, missing error/loading state or cache invalidation | Follow-up needed |
300
- | BLOCKED | No JSON payload or conflicting API patterns | Ask user |
301
- | FAILED | Cannot integrate without breaking existing architecture | Escalate |
302
-
303
- ---
304
-
305
- Consume backend API safely in frontend: identify existing client, generate types, implement service layer, and bind to UI with proper states.
306
- Triggered when user needs to integrate a backend API endpoint into a frontend application. Requires JSON payload sample and knowledge of existing API client patterns.
307
- - JSON payload sample (request/response)
308
- - API endpoint specification
309
- - Existing API client path (if any)
310
- - Component to bind (if specified)
311
- - Context graph (for existing patterns)
312
- 1. **Identify:** Find existing API client or confirm need for new one
313
- 2. **Generate:** Create TypeScript interfaces from JSON payload
314
- 3. **Implement:** Build service layer with proper HTTP methods
315
- 4. **Bind:** Connect to UI with Loading/Success/Error states
316
- 5. **Audit:** Verify no hardcoded URLs, no API in JSX, proper error handling
317
- - NEVER bypass existing wrapper with raw fetch/axios
318
- - MUST generate strict TypeScript interfaces (no `any`)
319
- - MUST handle all 3 UI states: Loading, Success, Error
320
- - MUST NOT exceed token_budget (max 3 files, 100 lines each, 1 shell command)
321
- - MUST stop early if confidence threshold reached
322
- - Zero-Trust: Use existing client pattern, never invent new one without approval
323
- - Type Safety: All API responses must have explicit TypeScript types
324
- - Error Handling: All HTTP errors must be handled per mandatory table
325
- - Separation: Service layer only — no API calls in presentational components
326
- ---