ai-developer-skill-os 1.8.1 → 2.0.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/README.md +130 -171
- package/docs/CHI_TIET_SKILLS.md +89 -81
- package/docs/HUONG_DAN_SU_DUNG.md +120 -152
- package/package.json +1 -1
- package/skills/{qk-accessibility-audit → _archive_old_skills/qk-accessibility-audit}/SKILL.md +1 -1
- package/skills/{qk-agent-orchestrator → _archive_old_skills/qk-agent-orchestrator}/SKILL.md +1 -1
- package/skills/{qk-bug-fix → _archive_old_skills/qk-bug-fix}/SKILL.md +1 -1
- package/skills/{qk-component-generator → _archive_old_skills/qk-component-generator}/SKILL.md +1 -1
- package/skills/{qk-database-engineer → _archive_old_skills/qk-database-engineer}/SKILL.md +1 -1
- package/skills/{qk-design-system → _archive_old_skills/qk-design-system}/SKILL.md +1 -1
- package/skills/{qk-form-builder → _archive_old_skills/qk-form-builder}/SKILL.md +1 -1
- package/skills/{qk-frontend-architecture → _archive_old_skills/qk-frontend-architecture}/SKILL.md +1 -1
- package/skills/{qk-frontend-debug → _archive_old_skills/qk-frontend-debug}/SKILL.md +1 -1
- package/skills/{qk-frontend-performance → _archive_old_skills/qk-frontend-performance}/SKILL.md +1 -1
- package/skills/{qk-git-engineer → _archive_old_skills/qk-git-engineer}/SKILL.md +1 -1
- package/skills/_archive_old_skills/qk-help/SKILL.md +67 -0
- package/skills/{qk-state-management → _archive_old_skills/qk-state-management}/SKILL.md +1 -1
- package/skills/{qk-table-crud-generator → _archive_old_skills/qk-table-crud-generator}/SKILL.md +1 -1
- package/skills/qk-access-policy/SKILL.md +127 -0
- package/skills/qk-ai-builder/SKILL.md +33 -0
- package/skills/qk-api-lifecycle/SKILL.md +420 -0
- package/skills/qk-bug-resolution/SKILL.md +371 -0
- package/skills/qk-context-loader/SKILL.md +206 -0
- package/skills/qk-data-lifecycle/SKILL.md +135 -0
- package/skills/qk-design-to-code/SKILL.md +33 -0
- package/skills/qk-docs/SKILL.md +335 -0
- package/skills/qk-documentation-system/SKILL.md +33 -0
- package/skills/qk-engineering-standard/SKILL.md +171 -0
- package/skills/qk-engineering-standard/rules/backend.md +122 -0
- package/skills/qk-engineering-standard/rules/database.md +3 -0
- package/skills/qk-engineering-standard/rules/frontend.md +152 -0
- package/skills/qk-engineering-standard/rules/security.md +3 -0
- package/skills/qk-engineering-standard/rules/testing.md +3 -0
- package/skills/qk-feature-delivery/SKILL.md +432 -0
- package/skills/qk-help/SKILL.md +95 -67
- package/skills/qk-orchestrator/SKILL.md +272 -0
- package/skills/qk-policy-engine/SKILL.md +33 -0
- package/skills/qk-production-release/SKILL.md +127 -0
- package/skills/qk-project-bootstrap/SKILL.md +33 -0
- package/skills/qk-project-health/SKILL.md +650 -0
- package/skills/qk-project-memory/SKILL.md +33 -0
- package/skills/qk-system-evolution/SKILL.md +315 -0
- package/skills/qk-ui-audit/SKILL.md +152 -0
- package/skills/qk-ui-system-builder/SKILL.md +444 -0
- package/skills/qk-validation-gate/SKILL.md +33 -0
- /package/skills/{qk-api-integration → _archive_old_skills/qk-api-integration}/SKILL.md +0 -0
- /package/skills/{qk-auth-security → _archive_old_skills/qk-auth-security}/SKILL.md +0 -0
- /package/skills/{qk-backend-architecture → _archive_old_skills/qk-backend-architecture}/SKILL.md +0 -0
- /package/skills/{qk-context-manager → _archive_old_skills/qk-context-manager}/SKILL.md +0 -0
- /package/skills/{qk-deployment → _archive_old_skills/qk-deployment}/SKILL.md +0 -0
- /package/skills/{qk-frontend-testing → _archive_old_skills/qk-frontend-testing}/SKILL.md +0 -0
- /package/skills/{qk-migration → _archive_old_skills/qk-migration}/SKILL.md +0 -0
- /package/skills/{qk-project-audit → _archive_old_skills/qk-project-audit}/SKILL.md +0 -0
- /package/skills/{qk-refactor → _archive_old_skills/qk-refactor}/SKILL.md +0 -0
- /package/skills/{qk-ui-builder → _archive_old_skills/qk-ui-builder}/SKILL.md +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-system-evolution
|
|
3
|
+
purpose: Nâng cấp version, Impact Analysis, dry-run, apply và rollback.
|
|
4
|
+
mode_supported: [enterprise]
|
|
5
|
+
input: [Upgrade target]
|
|
6
|
+
output: [Upgraded system]
|
|
7
|
+
workflow: [1. Analyze -> 2. Plan -> 3. Dry-run -> 4. Apply -> 5. Verify -> 6. Rollback (if fail)]
|
|
8
|
+
allowed_tools: [run_command, write_to_file]
|
|
9
|
+
handoff_to: [qk-validation-gate]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 🛠️ qk-system-evolution - Quy Trình Vận Hành Chuẩn (SOP)
|
|
13
|
+
|
|
14
|
+
> **Mô tả:** Nâng cấp version, Impact Analysis, dry-run, apply và rollback.
|
|
15
|
+
|
|
16
|
+
## 🎯 1. Mục Tiêu (Goal)
|
|
17
|
+
- Hoàn thành thành công tác vụ được giao liên quan đến nhiệm vụ của skill.
|
|
18
|
+
- Đảm bảo chất lượng mã nguồn và tính nhất quán của hệ thống.
|
|
19
|
+
|
|
20
|
+
## 🔄 2. Chuỗi Hành Động (Chain of Thought / SOP)
|
|
21
|
+
*(Bắt buộc AI phải suy nghĩ và làm theo đúng thứ tự)*
|
|
22
|
+
1. **Phân tích (Analyze):** Thu thập ngữ cảnh và hiểu rõ yêu cầu đầu vào.
|
|
23
|
+
2. **Lên kế hoạch (Plan):** Xác định các bước cần thay đổi/tạo mới dựa trên bộ luật (rules).
|
|
24
|
+
3. **Thực thi (Execute):** Tiến hành sửa đổi mã nguồn hoặc tạo tài liệu.
|
|
25
|
+
4. **Xác thực (Verify):** Đảm bảo đầu ra đáp ứng đúng yêu cầu và không vi phạm quy định.
|
|
26
|
+
|
|
27
|
+
## 🛡️ 3. Ràng Buộc & Quy Tắc (Constraints)
|
|
28
|
+
- CẤM bỏ qua việc kiểm tra `qk-engineering-standard` trước khi viết code.
|
|
29
|
+
- Mọi quyết định kỹ thuật phải dựa trên nội dung tại phần Deep Knowledge (nếu có).
|
|
30
|
+
|
|
31
|
+
## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
|
|
32
|
+
- Đích đến: `qk-validation-gate`
|
|
33
|
+
- Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh và kết quả đã thực thi cho bước tiếp theo.
|
|
34
|
+
|
|
35
|
+
## 📚 5. Kiến Thức Chuyên Sâu (Deep Knowledge)
|
|
36
|
+
|
|
37
|
+
*(Nền tảng kiến thức và quy tắc chi tiết kế thừa từ kỹ sư)*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Migration & Dependency Upgrade
|
|
44
|
+
|
|
45
|
+
> **Language rule:**
|
|
46
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
47
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
48
|
+
> The user may write in any language — detect and match it automatically.
|
|
49
|
+
|
|
50
|
+
> ⚠️ **Always create a rollback plan before starting any migration.**
|
|
51
|
+
> Never apply breaking upgrades to production without a verified fallback.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Trigger
|
|
56
|
+
|
|
57
|
+
Activate this skill when:
|
|
58
|
+
- User wants to upgrade a package or dependency
|
|
59
|
+
- Framework has a new major version (React 17→19, Vue 2→3, Next.js 13→15)
|
|
60
|
+
- A library is deprecated or has a security vulnerability (CVE)
|
|
61
|
+
- User wants to replace one library with another
|
|
62
|
+
- `project-audit` flagged outdated or risky dependencies (P1/P2)
|
|
63
|
+
- User says "update packages", "upgrade to v5", "migrate to new version"
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Scope
|
|
68
|
+
|
|
69
|
+
- ✅ Dependency version upgrades (patch, minor, major)
|
|
70
|
+
- ✅ Framework version migrations with breaking changes
|
|
71
|
+
- ✅ Library replacement (swap one library for another)
|
|
72
|
+
- ✅ Package conflict resolution
|
|
73
|
+
- ✅ Configuration updates required by new versions
|
|
74
|
+
- ✅ Code changes required by breaking API changes
|
|
75
|
+
- ✅ Rollback planning
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Non-goals
|
|
80
|
+
|
|
81
|
+
- ❌ Do NOT upgrade everything at once — always upgrade incrementally
|
|
82
|
+
- ❌ Do NOT skip reading the changelog/migration guide
|
|
83
|
+
- ❌ Do NOT ignore peer dependency warnings without investigating
|
|
84
|
+
- ❌ Do NOT apply breaking changes without a rollback plan
|
|
85
|
+
- ❌ Do NOT upgrade dev dependencies and prod dependencies in the same step
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Severity Levels
|
|
90
|
+
|
|
91
|
+
| Level | Meaning |
|
|
92
|
+
|-------|---------|
|
|
93
|
+
| P0 | Security vulnerability (CVE) — upgrade immediately |
|
|
94
|
+
| P1 | Breaking change affecting core functionality |
|
|
95
|
+
| P2 | Deprecated API with upcoming removal |
|
|
96
|
+
| P3 | Minor version lag — low risk, upgrade when convenient |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Migration Types
|
|
101
|
+
|
|
102
|
+
| Type | Risk | Strategy |
|
|
103
|
+
|------|------|----------|
|
|
104
|
+
| **Patch** (1.0.x → 1.0.y) | Low | Upgrade directly, verify tests |
|
|
105
|
+
| **Minor** (1.x.0 → 1.y.0) | Low-Medium | Read changelog, upgrade, verify |
|
|
106
|
+
| **Major** (x.0.0 → y.0.0) | High | Read migration guide, upgrade incrementally, test thoroughly |
|
|
107
|
+
| **Framework** (React 17→19) | Very High | Follow official migration guide step by step |
|
|
108
|
+
| **Library swap** | High | Strangler fig pattern — migrate incrementally |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Workflow
|
|
113
|
+
|
|
114
|
+
### Phase 1 — Audit Current State
|
|
115
|
+
|
|
116
|
+
Before upgrading:
|
|
117
|
+
1. List all dependencies with current versions
|
|
118
|
+
2. Identify which are outdated (use `npm outdated` / `pnpm outdated`)
|
|
119
|
+
3. Check for known CVEs (`npm audit` / `pnpm audit`)
|
|
120
|
+
4. Classify each outdated package by migration type and risk
|
|
121
|
+
5. Check peer dependency constraints
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm outdated # See what's outdated
|
|
125
|
+
npm audit # Security vulnerabilities
|
|
126
|
+
npx depcheck # Unused dependencies
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Phase 2 — Read Migration Guide
|
|
132
|
+
|
|
133
|
+
For every major version upgrade:
|
|
134
|
+
1. Read the official CHANGELOG or migration guide
|
|
135
|
+
2. List all breaking changes that affect the project
|
|
136
|
+
3. List all deprecated APIs still in use
|
|
137
|
+
4. Estimate effort: number of files to change, complexity of changes
|
|
138
|
+
|
|
139
|
+
Document findings before touching any code.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### Phase 3 — Plan the Migration
|
|
144
|
+
|
|
145
|
+
Create an ordered upgrade sequence:
|
|
146
|
+
|
|
147
|
+
**Rules:**
|
|
148
|
+
- Security fixes first (P0)
|
|
149
|
+
- Dev dependencies before prod dependencies (lower risk)
|
|
150
|
+
- Upgrade one major dependency at a time — not everything together
|
|
151
|
+
- Group related packages (e.g., all `@tanstack/*` together)
|
|
152
|
+
|
|
153
|
+
**Example order:**
|
|
154
|
+
```
|
|
155
|
+
Step 1: Security patch — package-x 2.1.0 → 2.1.4 (CVE fix)
|
|
156
|
+
Step 2: Dev tools — eslint 8 → 9 (no runtime impact)
|
|
157
|
+
Step 3: Minor upgrades — axios 1.4 → 1.7 (non-breaking)
|
|
158
|
+
Step 4: Major upgrade — react-query 4 → 5 (breaking — separate PR)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### Phase 4 — Create Rollback Plan
|
|
164
|
+
|
|
165
|
+
Before applying any change:
|
|
166
|
+
```
|
|
167
|
+
Rollback method:
|
|
168
|
+
Option A: git revert / git checkout to previous state
|
|
169
|
+
Option B: Pin version in package.json to previous known-good version
|
|
170
|
+
Option C: Feature flag to disable new behavior
|
|
171
|
+
|
|
172
|
+
Rollback trigger:
|
|
173
|
+
- Tests fail after upgrade
|
|
174
|
+
- Runtime errors in staging
|
|
175
|
+
- Performance regression detected
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### Phase 5 — Execute the Upgrade
|
|
181
|
+
|
|
182
|
+
For each package in the plan:
|
|
183
|
+
|
|
184
|
+
1. **Upgrade package:**
|
|
185
|
+
```bash
|
|
186
|
+
npm install package-name@version
|
|
187
|
+
# or
|
|
188
|
+
pnpm add package-name@version
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
2. **Update configuration** (if required by new version)
|
|
192
|
+
|
|
193
|
+
3. **Fix breaking changes** in code:
|
|
194
|
+
- Update import paths
|
|
195
|
+
- Replace deprecated APIs
|
|
196
|
+
- Update type signatures
|
|
197
|
+
- Update config files
|
|
198
|
+
|
|
199
|
+
4. **Run verification** (see Phase 6) before moving to next package
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### Phase 6 — Verify After Each Step
|
|
204
|
+
|
|
205
|
+
After every upgrade step:
|
|
206
|
+
- [ ] `npm install` / `pnpm install` — no resolution errors
|
|
207
|
+
- [ ] `npm run build` — builds successfully
|
|
208
|
+
- [ ] `npm run type-check` — no new TypeScript errors
|
|
209
|
+
- [ ] `npm run lint` — clean
|
|
210
|
+
- [ ] `npm test` — all tests pass
|
|
211
|
+
- [ ] Manual smoke test of affected features
|
|
212
|
+
|
|
213
|
+
**If any check fails → rollback this step before continuing.**
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Phase 7 — Library Replacement (Strangler Fig Pattern)
|
|
218
|
+
|
|
219
|
+
When replacing one library with another (e.g., moment → date-fns):
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
Step 1: Install new library alongside old one
|
|
223
|
+
Step 2: Create adapter/wrapper that abstracts the library
|
|
224
|
+
Step 3: Migrate usage file by file (not all at once)
|
|
225
|
+
Step 4: Verify each file after migration
|
|
226
|
+
Step 5: Remove old library when 100% migrated
|
|
227
|
+
Step 6: Remove adapter if no longer needed
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
This allows incremental migration with rollback possible at any step.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Decision Tree
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
What type of upgrade?
|
|
238
|
+
├── Patch/Minor → Upgrade directly, run tests
|
|
239
|
+
├── Major → Read changelog → plan → upgrade → verify
|
|
240
|
+
└── Framework → Follow official migration guide step by step
|
|
241
|
+
|
|
242
|
+
Security vulnerability?
|
|
243
|
+
├── P0 (critical) → Upgrade immediately, prioritize over other work
|
|
244
|
+
└── P1/P2 → Include in next planned upgrade cycle
|
|
245
|
+
|
|
246
|
+
Library replacement?
|
|
247
|
+
└── Use strangler fig pattern — never replace all at once
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Output Format
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
📦 Migration Report
|
|
256
|
+
─────────────────────────────────────────────────
|
|
257
|
+
Scope: [What was upgraded / migrated]
|
|
258
|
+
Type: [Patch / Minor / Major / Framework / Library swap]
|
|
259
|
+
Risk: [Low / Medium / High]
|
|
260
|
+
|
|
261
|
+
Changes:
|
|
262
|
+
✅ package-x: 2.1.0 → 2.1.4 (CVE fix — no code changes)
|
|
263
|
+
✅ axios: 1.4.0 → 1.7.2 (minor — updated interceptor config)
|
|
264
|
+
✅ react: 18.2.0 → 19.0.0 (major — updated 12 files)
|
|
265
|
+
|
|
266
|
+
Breaking changes handled:
|
|
267
|
+
• [Description of breaking change and how it was resolved]
|
|
268
|
+
|
|
269
|
+
📋 Rollback plan:
|
|
270
|
+
git revert <commit-hash> or pin to previous version in package.json
|
|
271
|
+
|
|
272
|
+
✅ Verification:
|
|
273
|
+
Build: PASS
|
|
274
|
+
Types: Clean
|
|
275
|
+
Tests: PASS (N tests)
|
|
276
|
+
Lint: Clean
|
|
277
|
+
Smoke test: PASS
|
|
278
|
+
|
|
279
|
+
⚠️ Known issues / follow-up:
|
|
280
|
+
• [Any remaining deprecated APIs to address]
|
|
281
|
+
• [Any packages still pending upgrade]
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Validation Checklist
|
|
287
|
+
|
|
288
|
+
- [ ] Migration guide read for every major version change
|
|
289
|
+
- [ ] Rollback plan documented before starting
|
|
290
|
+
- [ ] Upgraded incrementally — one major change at a time
|
|
291
|
+
- [ ] `npm audit` clean after upgrade
|
|
292
|
+
- [ ] Build, types, lint, tests all pass
|
|
293
|
+
- [ ] Smoke test of affected features complete
|
|
294
|
+
- [ ] No new peer dependency warnings left unresolved
|
|
295
|
+
- [ ] Breaking changes documented in output
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Common Migration Cheat Sheet
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
React 17 → 18: Concurrent mode, new root API, Suspense updates
|
|
303
|
+
React 18 → 19: Server components, new hooks (useActionState), ref as prop
|
|
304
|
+
Vue 2 → 3: Composition API, new reactivity system, breaking changes in lifecycle
|
|
305
|
+
Next.js 12 → 13: App Router introduced (pages/ still works)
|
|
306
|
+
Next.js 13 → 14: Server Actions stable, metadata API
|
|
307
|
+
Next.js 14 → 15: React 19, async params, updated caching defaults
|
|
308
|
+
TanStack Query 4 → 5: New API (no more isLoading/isError split), object syntax
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Examples
|
|
314
|
+
|
|
315
|
+
See `examples/` folder.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-ui-audit
|
|
3
|
+
purpose: Kiểm toán giao diện (Consistency, Accessibility, Responsive).
|
|
4
|
+
mode_supported: [standard]
|
|
5
|
+
input: [UI Code]
|
|
6
|
+
output: [Audit Report]
|
|
7
|
+
workflow: [1. Check Radius/Color -> 2. Check A11y -> 3. Check Mobile]
|
|
8
|
+
allowed_tools: [read_file]
|
|
9
|
+
handoff_to: [none]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# 🛠️ qk-ui-audit - Quy Trình Vận Hành Chuẩn (SOP)
|
|
13
|
+
|
|
14
|
+
> **Mô tả:** Kiểm toán giao diện (Consistency, Accessibility, Responsive).
|
|
15
|
+
|
|
16
|
+
## 🎯 1. Mục Tiêu (Goal)
|
|
17
|
+
- Hoàn thành thành công tác vụ được giao liên quan đến nhiệm vụ của skill.
|
|
18
|
+
- Đảm bảo chất lượng mã nguồn và tính nhất quán của hệ thống.
|
|
19
|
+
|
|
20
|
+
## 🔄 2. Chuỗi Hành Động (Chain of Thought / SOP)
|
|
21
|
+
*(Bắt buộc AI phải suy nghĩ và làm theo đúng thứ tự)*
|
|
22
|
+
1. **Phân tích (Analyze):** Thu thập ngữ cảnh và hiểu rõ yêu cầu đầu vào.
|
|
23
|
+
2. **Lên kế hoạch (Plan):** Xác định các bước cần thay đổi/tạo mới dựa trên bộ luật (rules).
|
|
24
|
+
3. **Thực thi (Execute):** Tiến hành sửa đổi mã nguồn hoặc tạo tài liệu.
|
|
25
|
+
4. **Xác thực (Verify):** Đảm bảo đầu ra đáp ứng đúng yêu cầu và không vi phạm quy định.
|
|
26
|
+
|
|
27
|
+
## 🛡️ 3. Ràng Buộc & Quy Tắc (Constraints)
|
|
28
|
+
- CẤM bỏ qua việc kiểm tra `qk-engineering-standard` trước khi viết code.
|
|
29
|
+
- Mọi quyết định kỹ thuật phải dựa trên nội dung tại phần Deep Knowledge (nếu có).
|
|
30
|
+
|
|
31
|
+
## 🤝 4. Giao Thức Bàn Giao (Handoff Protocol)
|
|
32
|
+
- Đích đến: `none`
|
|
33
|
+
- Nội dung bàn giao: Chuyển toàn bộ ngữ cảnh và kết quả đã thực thi cho bước tiếp theo.
|
|
34
|
+
|
|
35
|
+
## 📚 5. Kiến Thức Chuyên Sâu (Deep Knowledge)
|
|
36
|
+
|
|
37
|
+
*(Nền tảng kiến thức và quy tắc chi tiết kế thừa từ kỹ sư)*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Accessibility (A11y) Audit
|
|
44
|
+
|
|
45
|
+
> **Language rule:**
|
|
46
|
+
> Use English for: code, identifiers, file names, architecture terms, technical decisions.
|
|
47
|
+
> Use the user's language for: explanations, questions, summaries, and feedback.
|
|
48
|
+
> The user may write in any language — detect and match it automatically.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Trigger
|
|
53
|
+
|
|
54
|
+
Activate this skill when:
|
|
55
|
+
- User asks to "make this accessible", "fix a11y", or "audit accessibility"
|
|
56
|
+
- Building complex interactive components (modals, dropdowns, tabs, sliders)
|
|
57
|
+
- Preparing an app for production or public release
|
|
58
|
+
- Project audit flags missing semantic HTML or ARIA issues
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Scope
|
|
63
|
+
|
|
64
|
+
- ✅ **Keyboard Navigation:** Ensure all interactive elements are reachable via `Tab`, and operable via `Enter`/`Space`/Arrows. Focus management (trapping focus in modals).
|
|
65
|
+
- ✅ **Screen Reader Support:** Add proper `aria-` attributes, `alt` text, and visually hidden text (`sr-only`).
|
|
66
|
+
- ✅ **Semantic HTML:** Replace `div` soups with `<nav>`, `<main>`, `<article>`, `<button>`, etc.
|
|
67
|
+
- ✅ **Color Contrast:** Verify text vs. background contrast meets WCAG AA (4.5:1 for normal text).
|
|
68
|
+
- ✅ **Form Labels:** Ensure all inputs have associated `<label>`s or `aria-label`s.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Non-goals
|
|
73
|
+
|
|
74
|
+
- ❌ Do NOT completely redesign the UI visually (unless fixing a severe contrast issue, and even then, ask first).
|
|
75
|
+
- ❌ Do NOT overuse ARIA. The first rule of ARIA is: "No ARIA is better than bad ARIA." Use semantic HTML first.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Workflow
|
|
80
|
+
|
|
81
|
+
### Phase 1 — Semantic HTML Check
|
|
82
|
+
|
|
83
|
+
Scan the component for basic HTML semantics:
|
|
84
|
+
- Are buttons actually `<button>` elements (not `<div onClick>`)?
|
|
85
|
+
- Are links actually `<a>` elements with `href`s?
|
|
86
|
+
- Do images have meaningful `alt` text (or `alt=""` if decorative)?
|
|
87
|
+
- Are headings (`h1`-`h6`) in a logical, unbroken hierarchy?
|
|
88
|
+
|
|
89
|
+
### Phase 2 — Keyboard & Focus Management
|
|
90
|
+
|
|
91
|
+
- Can the user tab through the component logically?
|
|
92
|
+
- Does every interactive element have a visible focus state (`:focus-visible`)?
|
|
93
|
+
- For Modals/Dialogs: Is focus trapped inside when open? Is focus restored when closed?
|
|
94
|
+
- For custom widgets (Tabs/Dropdowns): Implement correct arrow key navigation per WAI-ARIA authoring practices.
|
|
95
|
+
|
|
96
|
+
### Phase 3 — Screen Reader (ARIA) Check
|
|
97
|
+
|
|
98
|
+
- Do custom interactive elements have correct `role`s (e.g., `role="tablist"`)?
|
|
99
|
+
- Is dynamic state communicated? (`aria-expanded`, `aria-selected`, `aria-invalid`, `aria-busy`).
|
|
100
|
+
- Are icon-only buttons properly labeled? (`aria-label` or `<span className="sr-only">Label</span>`).
|
|
101
|
+
- Are dynamic live regions used for important announcements (`aria-live="polite"` or `assertive`)?
|
|
102
|
+
|
|
103
|
+
### Phase 4 — Contrast & Visuals
|
|
104
|
+
|
|
105
|
+
- Check text colors against backgrounds.
|
|
106
|
+
- Ensure form fields have visible borders or indicators.
|
|
107
|
+
- Ensure information is not conveyed *only* by color (e.g., a red border for an error must also have error text).
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Decision Tree
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Is the component a native HTML element (e.g., standard `<button>`)?
|
|
115
|
+
├── Yes → Ensure it has accessible text/labels. No ARIA roles needed.
|
|
116
|
+
└── No → (e.g., a custom `div` acting as a checkbox)
|
|
117
|
+
├── Can it be refactored to use native HTML?
|
|
118
|
+
│ ├── Yes → Refactor to native HTML `<input type="checkbox">`
|
|
119
|
+
│ └── No → Apply `role="checkbox"`, `tabIndex={0}`, `aria-checked`, and keyboard event handlers.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Output Format
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
♿ Accessibility Audit Report
|
|
128
|
+
─────────────────────────────────────────────────
|
|
129
|
+
Component: [ComponentName]
|
|
130
|
+
|
|
131
|
+
Issues Found & Fixed:
|
|
132
|
+
✅ Semantic HTML: Replaced `<div onClick>` with `<button>`
|
|
133
|
+
✅ Screen Readers: Added `aria-label` to icon-only close button
|
|
134
|
+
✅ Keyboard: Added focus trap inside the Modal
|
|
135
|
+
✅ Forms: Associated `<label htmlFor="email">` with Input
|
|
136
|
+
|
|
137
|
+
⚠️ Remaining Warnings (Manual Check Required):
|
|
138
|
+
- Please verify color contrast of primary button in light mode (needs 4.5:1 ratio).
|
|
139
|
+
|
|
140
|
+
🔗 Next Steps:
|
|
141
|
+
Code updated. Recommend testing with a screen reader (VoiceOver/NVDA).
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Validation Checklist
|
|
147
|
+
|
|
148
|
+
- [ ] Semantic HTML preferred over ARIA
|
|
149
|
+
- [ ] Keyboard navigation (Tab + Enter/Space) works correctly
|
|
150
|
+
- [ ] Focus is visible on all interactive elements
|
|
151
|
+
- [ ] Forms have proper labels
|
|
152
|
+
- [ ] Icon-only buttons have accessible names
|