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,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-[skill-name]
|
|
3
|
+
category: [core|frontend|backend|fullstack|security|qa|maintenance|devops|utilities]
|
|
4
|
+
version: 7.5.0
|
|
5
|
+
description: "[One sentence — what it does]"
|
|
6
|
+
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
7
|
+
execution_mode: deterministic
|
|
8
|
+
|
|
9
|
+
# Orchestrator routing metadata
|
|
10
|
+
cost: [low|medium|high]
|
|
11
|
+
latency: [fast|medium|slow]
|
|
12
|
+
risk: [low|medium|high]
|
|
13
|
+
side_effects: [edit_files|run_commands|read_only|none]
|
|
14
|
+
produces: [report|code|schema|plan|tokens]
|
|
15
|
+
consumes: [context-graph|design-md|stack-trace|json-payload|none]
|
|
16
|
+
|
|
17
|
+
token_budget:
|
|
18
|
+
max_files_read: 3
|
|
19
|
+
max_lines_per_read: 150
|
|
20
|
+
max_shell_commands: 2
|
|
21
|
+
stop_early: true
|
|
22
|
+
|
|
23
|
+
exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# qk-[skill-name]
|
|
27
|
+
|
|
28
|
+
> **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese (match user language).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Preconditions
|
|
33
|
+
Before executing, verify ALL exist. STOP with `BLOCKED` if any is missing.
|
|
34
|
+
|
|
35
|
+
- [ ] [Precondition 1 — e.g., "Repository is accessible"]
|
|
36
|
+
- [ ] [Precondition 2 — e.g., "DESIGN.md exists in project root"]
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
On missing precondition:
|
|
40
|
+
EXIT: BLOCKED
|
|
41
|
+
Message: "[Precondition X] not found. Please provide: [what]"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
- ✅ [What this skill explicitly DOES]
|
|
48
|
+
- ✅ [What this skill explicitly DOES]
|
|
49
|
+
|
|
50
|
+
## Non-Goals
|
|
51
|
+
- ❌ [Anti-pattern 1] — because [why]
|
|
52
|
+
- ❌ [Anti-pattern 2]
|
|
53
|
+
- ❌ Never create helper scripts (Node.js/Python/shell) to apply patches — edit files directly
|
|
54
|
+
- ❌ Never read entire files > 150 lines — use targeted reads (StartLine:EndLine)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Priority Order
|
|
59
|
+
When token budget is insufficient, execute checks in this order:
|
|
60
|
+
|
|
61
|
+
| Priority | Check | Skip Threshold |
|
|
62
|
+
|----------|-------|----------------|
|
|
63
|
+
| P1 | [Most critical — never skip] | Never |
|
|
64
|
+
| P2 | [High priority] | Budget < 30% |
|
|
65
|
+
| P3 | [Medium priority] | Budget < 50% |
|
|
66
|
+
| P4 | [Low priority — always optional] | Budget < 70% |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Workflow
|
|
71
|
+
|
|
72
|
+
### Phase 1 — [Name: e.g., Triage]
|
|
73
|
+
|
|
74
|
+
**Steps:**
|
|
75
|
+
1. [Concrete step — specify tool: `grep_search` / `view_file[L1:L50]` / `run_command`]
|
|
76
|
+
2. [Next step]
|
|
77
|
+
|
|
78
|
+
**Exit When (stop this phase, move to next):**
|
|
79
|
+
- [Condition A — e.g., "Root cause identified"]
|
|
80
|
+
- [Condition B — e.g., "`max_files_read` reached"]
|
|
81
|
+
|
|
82
|
+
**On Blocked:**
|
|
83
|
+
```
|
|
84
|
+
EXIT: BLOCKED
|
|
85
|
+
Missing: [what specific info is needed]
|
|
86
|
+
Questions:
|
|
87
|
+
1. [Specific question to user]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### Phase 2 — [Name: e.g., Analyze]
|
|
93
|
+
|
|
94
|
+
**Steps:**
|
|
95
|
+
1. [Step]
|
|
96
|
+
|
|
97
|
+
**Decision:**
|
|
98
|
+
```
|
|
99
|
+
IF [condition met]
|
|
100
|
+
→ proceed to Phase 3
|
|
101
|
+
ELSE IF [edge case]
|
|
102
|
+
→ EXIT: PARTIAL — note: [what was missed]
|
|
103
|
+
ELSE
|
|
104
|
+
→ ESCALATE
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Phase 3 — [Name: e.g., Execute]
|
|
110
|
+
|
|
111
|
+
**Steps:**
|
|
112
|
+
1. Apply fix using `replace_file_content` or `multi_replace_file_content` — NEVER via scripts
|
|
113
|
+
2. [Verification step]
|
|
114
|
+
|
|
115
|
+
**Exit When:**
|
|
116
|
+
- Fix applied and verified → EXIT: SUCCESS
|
|
117
|
+
- Fix applied but unverifiable → EXIT: PARTIAL
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Confidence Model
|
|
122
|
+
|
|
123
|
+
| Level | Condition | Action |
|
|
124
|
+
|-------|-----------|--------|
|
|
125
|
+
| HIGH | Direct evidence (file:line, stack trace, exact match) | Proceed |
|
|
126
|
+
| MEDIUM | Inferred from patterns or similar code | Note assumption, proceed carefully |
|
|
127
|
+
| LOW | Assumption without evidence | STOP — ask user before proceeding |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Severity
|
|
132
|
+
|
|
133
|
+
| Level | Definition | Example |
|
|
134
|
+
|-------|-----------|---------|
|
|
135
|
+
| CRITICAL | Data loss / security breach / app down | Hardcoded secret, SQL injection |
|
|
136
|
+
| HIGH | Core feature broken, blocking users | Null crash, broken API |
|
|
137
|
+
| MEDIUM | Degraded UX, workaround exists | Cyclomatic > 10, missing loading state |
|
|
138
|
+
| LOW | Style/cosmetic, non-blocking | Missing comment, minor inconsistency |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Evidence Format
|
|
143
|
+
|
|
144
|
+
Every finding MUST use this format:
|
|
145
|
+
```
|
|
146
|
+
[SEVERITY] path/to/file.ts:LINE
|
|
147
|
+
Reason: [why this is a violation or finding]
|
|
148
|
+
Confidence: [HIGH|MEDIUM|LOW]
|
|
149
|
+
Fix: [one-line suggestion]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```
|
|
154
|
+
[HIGH] src/auth.service.ts:132
|
|
155
|
+
Reason: Function length 64 lines exceeds threshold of 30
|
|
156
|
+
Confidence: HIGH
|
|
157
|
+
Fix: Extract token validation to `validateToken()`
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Retry Policy
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Action fails
|
|
166
|
+
└─ Attempt auto-fix (if fix is deterministic)
|
|
167
|
+
└─ Re-run verification
|
|
168
|
+
├─ PASS → EXIT: SUCCESS
|
|
169
|
+
└─ FAIL (2nd time) → EXIT: PARTIAL + report
|
|
170
|
+
└─ Do NOT retry more than 2 times
|
|
171
|
+
└─ 3rd failure → ESCALATE to user
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Escalation Rules
|
|
177
|
+
|
|
178
|
+
When blocked, **never just "STOP"** — return structured response:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
BLOCKED: [Reason — specific, not vague]
|
|
182
|
+
Missing:
|
|
183
|
+
- [Specific artifact or information needed]
|
|
184
|
+
Questions:
|
|
185
|
+
1. [Specific question]
|
|
186
|
+
2. [Specific question]
|
|
187
|
+
Recommended Assumptions (if you want me to proceed anyway):
|
|
188
|
+
- [Safe assumption 1]
|
|
189
|
+
- [Safe assumption 2]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Handoff Contract
|
|
195
|
+
|
|
196
|
+
### Consumes (Input from upstream)
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"from": "[skill-name or 'user']",
|
|
200
|
+
"required_fields": ["field1", "field2"],
|
|
201
|
+
"optional_fields": ["field3"]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Produces (Output for downstream)
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"to": "[skill-name or 'user']",
|
|
209
|
+
"output_fields": ["changed_files", "summary", "confidence", "exit_code"]
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Output Format
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
[SKILL_NAME] Result
|
|
219
|
+
─────────────────────────────────────────────────
|
|
220
|
+
Status: [SUCCESS | PARTIAL | BLOCKED | FAILED]
|
|
221
|
+
Confidence: [HIGH | MEDIUM | LOW]
|
|
222
|
+
|
|
223
|
+
[Section specific to this skill]
|
|
224
|
+
|
|
225
|
+
Exit Code: [SUCCESS | PARTIAL | BLOCKED | FAILED]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Exit Codes
|
|
231
|
+
|
|
232
|
+
| Code | Meaning | Orchestrator Action |
|
|
233
|
+
|------|---------|---------------------|
|
|
234
|
+
| SUCCESS | All checks passed, task complete | Continue pipeline |
|
|
235
|
+
| PARTIAL | Task done with degraded quality or skipped P3/P4 checks | Notify user, continue |
|
|
236
|
+
| BLOCKED | Missing precondition or ambiguous requirement | STOP, ask user |
|
|
237
|
+
| FAILED | Task failed after 2 retry attempts | STOP, report error |
|
|
238
|
+
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-access-policy
|
|
3
|
+
category: security
|
|
4
|
+
version: 7.5.0
|
|
5
|
+
description: "Quản lý RBAC, ABAC — định nghĩa role matrix trước, implement middleware sau."
|
|
6
|
+
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
7
|
+
execution_mode: deterministic
|
|
8
|
+
cost: medium
|
|
9
|
+
latency: medium
|
|
10
|
+
risk: high
|
|
11
|
+
side_effects: edit_files
|
|
12
|
+
produces: [code, report]
|
|
13
|
+
consumes: [user-description]
|
|
14
|
+
token_budget:
|
|
15
|
+
max_files_read: 3
|
|
16
|
+
max_lines_per_read: 100
|
|
17
|
+
max_shell_commands: 0
|
|
18
|
+
stop_early: true
|
|
19
|
+
exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
|
|
20
|
+
skill_version: 7.5.0
|
|
21
|
+
runtime_version: 1
|
|
22
|
+
schema_version: 2
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# qk-access-policy — Access Control Designer
|
|
26
|
+
|
|
27
|
+
> **Language rule:** Code, identifiers, file names ? English. Explanations, summaries ? Vietnamese.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Preconditions
|
|
32
|
+
- [ ] User roles and protected resources are defined
|
|
33
|
+
- [ ] Auth system (JWT, session, OAuth) is identified
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
On missing precondition:
|
|
37
|
+
EXIT: BLOCKED
|
|
38
|
+
Message: "Cần định nghĩa: danh sách roles + resources cần bảo vệ."
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Scope
|
|
44
|
+
- ✅ Define explicit Role-Permission Matrix before coding
|
|
45
|
+
- ✅ Implement middleware/guards based strictly on the matrix
|
|
46
|
+
- ✅ Separate auth (who are you?) from authz (what can you do?)
|
|
47
|
+
|
|
48
|
+
## Non-Goals
|
|
49
|
+
- ❌ Grant wildcard (*) permissions
|
|
50
|
+
- ❌ Mix authentication logic with authorization logic
|
|
51
|
+
- ❌ Hardcode role checks in business logic (use middleware/guards)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Priority Order
|
|
56
|
+
| P | Task | Skip Threshold |
|
|
57
|
+
|---|------|----------------|
|
|
58
|
+
| P1 | Define Role-Permission Matrix | Never |
|
|
59
|
+
| P2 | Implement deny-by-default middleware | Never |
|
|
60
|
+
| P3 | Add role guards to routes/controllers | Budget < 30% |
|
|
61
|
+
| P4 | Add audit logging for auth failures | Budget < 60% |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Role-Permission Matrix Format (Required)
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Resource | admin | manager | user | guest
|
|
69
|
+
─────────────────────────────────────────────────
|
|
70
|
+
GET /resource | ✅ | ✅ | ✅ | ✅
|
|
71
|
+
POST /resource | ✅ | ✅ | ❌ | ❌
|
|
72
|
+
DELETE /resource | ✅ | ❌ | ❌ | ❌
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Workflow
|
|
78
|
+
|
|
79
|
+
### Phase 1 — Matrix Definition
|
|
80
|
+
1. List all roles and resources from requirements
|
|
81
|
+
2. Create Role-Permission Matrix (table format above)
|
|
82
|
+
3. Identify conflicts or contradictions
|
|
83
|
+
|
|
84
|
+
**Decision:** `IF matrix has contradiction → EXIT: BLOCKED — resolve ambiguity`
|
|
85
|
+
|
|
86
|
+
### Phase 2 — Implementation
|
|
87
|
+
1. Create deny-by-default guard/middleware
|
|
88
|
+
2. Apply guards to routes using matrix
|
|
89
|
+
3. Add auth failure logging
|
|
90
|
+
|
|
91
|
+
### Phase 3 — Verification
|
|
92
|
+
1. Read matrix vs implementation — spot check 3 routes
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Evidence Format
|
|
97
|
+
```
|
|
98
|
+
[SEVERITY] src/middleware/auth.ts:LINE
|
|
99
|
+
Rule: [WILDCARD | MISSING_GUARD | SOC_VIOLATION | HARDCODED_ROLE]
|
|
100
|
+
Reason: [specific issue]
|
|
101
|
+
Confidence: HIGH
|
|
102
|
+
Fix: [specific change]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Exit Codes
|
|
108
|
+
| Code | Meaning | When |
|
|
109
|
+
|------|---------|------|
|
|
110
|
+
| SUCCESS | Matrix defined, middleware implemented, deny-by-default applied | Implementation complete |
|
|
111
|
+
| PARTIAL | Implemented but missing audit logging or some routes unguarded | Post-verification minor gaps |
|
|
112
|
+
| BLOCKED | Roles or resources undefined — cannot create matrix | Missing inputs |
|
|
113
|
+
| FAILED | Contradiction in matrix or auth/authz mixed | Architectural violation |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Confidence Model
|
|
118
|
+
| Level | Condition | Action |
|
|
119
|
+
|-------|-----------|--------|
|
|
120
|
+
| HIGH | Roles and resources explicitly defined | Build matrix and implement |
|
|
121
|
+
| MEDIUM | Roles inferred from codebase | Build matrix, ask user to verify |
|
|
122
|
+
| LOW | Authentication strategy unknown | EXIT: BLOCKED |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Severity
|
|
127
|
+
| Level | Definition | Example |
|
|
128
|
+
|-------|-----------|---------|
|
|
129
|
+
| CRITICAL | Route unguarded due to missing middleware | Anyone can access DELETE /users |
|
|
130
|
+
| HIGH | Hardcoded roles in business logic | `if (user.role === 'admin')` in service layer |
|
|
131
|
+
| MEDIUM | Wildcard permissions granted | `user` can access `*` |
|
|
132
|
+
| LOW | Audit log missing for auth failure | Unlogged 403 error |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Retry Policy
|
|
137
|
+
```
|
|
138
|
+
Route verification fails
|
|
139
|
+
└─ Route unguarded
|
|
140
|
+
├─ Add missing guard to route
|
|
141
|
+
└─ Do NOT retry more than 1 time per route
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Escalation Rules
|
|
147
|
+
```
|
|
148
|
+
BLOCKED: Roles or resources undefined
|
|
149
|
+
Missing:
|
|
150
|
+
- List of user roles
|
|
151
|
+
- List of protected resources
|
|
152
|
+
Questions:
|
|
153
|
+
1. Hệ thống có những role nào? (ví dụ: admin, user, manager)
|
|
154
|
+
2. Những API/Route nào cần bảo vệ?
|
|
155
|
+
Recommended Assumptions:
|
|
156
|
+
- Deny-by-default for all non-public routes
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Handoff Contract
|
|
162
|
+
### Consumes
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"from": "user",
|
|
166
|
+
"required_fields": ["roles", "resources"],
|
|
167
|
+
"optional_fields": ["auth_strategy"]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
### Produces
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"to": "user",
|
|
174
|
+
"output_fields": ["role_matrix", "middleware_files", "guarded_routes", "exit_code"]
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-ai-builder
|
|
3
|
+
category: core
|
|
4
|
+
version: 7.5.0
|
|
5
|
+
description: "Thiết kế AI logic, Prompts, RAG pipelines với bảo mật chống Injection — structured output bắt buộc."
|
|
6
|
+
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
7
|
+
execution_mode: deterministic
|
|
8
|
+
cost: high
|
|
9
|
+
latency: slow
|
|
10
|
+
risk: high
|
|
11
|
+
side_effects: edit_files
|
|
12
|
+
produces: [code, schema]
|
|
13
|
+
consumes: [user-description]
|
|
14
|
+
skill_version: 7.5.0
|
|
15
|
+
runtime_version: 1
|
|
16
|
+
schema_version: 2
|
|
17
|
+
token_budget:
|
|
18
|
+
max_files_read: 3
|
|
19
|
+
max_lines_per_read: 100
|
|
20
|
+
max_shell_commands: 0
|
|
21
|
+
stop_early: true
|
|
22
|
+
exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# qk-ai-builder — AI Integration Designer
|
|
26
|
+
|
|
27
|
+
> **Language rule:** Code, identifiers, file names ? English. Explanations, summaries ? Vietnamese.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Preconditions
|
|
32
|
+
- [ ] AI task is defined: what input → what output
|
|
33
|
+
- [ ] LLM provider is specified (OpenAI, Anthropic, Gemini, local)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Scope
|
|
38
|
+
- ✅ Design strict, deterministic system prompts
|
|
39
|
+
- ✅ Sanitize user inputs before LLM (Anti-Injection)
|
|
40
|
+
- ✅ Validate LLM output before using in business logic
|
|
41
|
+
- ✅ Structured output (JSON schema) over raw text
|
|
42
|
+
|
|
43
|
+
## Non-Goals
|
|
44
|
+
- ❌ Open-ended chat prompts without system boundaries
|
|
45
|
+
- ❌ Trust LLM output for critical logic without validation
|
|
46
|
+
- ❌ Use raw user input directly in prompts
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## System Prompt Template (Required Structure)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
[ROLE]
|
|
54
|
+
You are a [specific role]. You [specific expertise].
|
|
55
|
+
|
|
56
|
+
[TASK]
|
|
57
|
+
Your task is to [exact task description].
|
|
58
|
+
|
|
59
|
+
[CONSTRAINTS]
|
|
60
|
+
- Always [constraint 1]
|
|
61
|
+
- Never [constraint 2]
|
|
62
|
+
- If [edge case] → [specific action]
|
|
63
|
+
|
|
64
|
+
[OUTPUT FORMAT]
|
|
65
|
+
Return ONLY valid JSON matching this schema:
|
|
66
|
+
{
|
|
67
|
+
"field1": "string",
|
|
68
|
+
"field2": number,
|
|
69
|
+
"confidence": "high|medium|low"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
[EXAMPLES]
|
|
73
|
+
Input: [example]
|
|
74
|
+
Output: {"field1": "...", "field2": 0, "confidence": "high"}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Anti-Injection Checklist
|
|
80
|
+
```
|
|
81
|
+
[ ] User input is wrapped in XML tags: <user_input>{input}</user_input>
|
|
82
|
+
[ ] System instructions are separate from user content
|
|
83
|
+
[ ] Input is validated/sanitized before injection (no raw HTML/JS)
|
|
84
|
+
[ ] Max token limit set for user input
|
|
85
|
+
[ ] Output is parsed as JSON (not eval'd)
|
|
86
|
+
[ ] Confidence field in output triggers human review if "low"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## RAG Pipeline Pattern
|
|
92
|
+
```
|
|
93
|
+
User Query
|
|
94
|
+
└─ Sanitize + embed query
|
|
95
|
+
└─ Vector search (top-K = 5)
|
|
96
|
+
└─ Re-rank by relevance
|
|
97
|
+
└─ Build prompt: [System] + [Retrieved Context] + [User Query]
|
|
98
|
+
└─ LLM call
|
|
99
|
+
└─ Validate output schema
|
|
100
|
+
└─ Return to user
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Priority Order
|
|
109
|
+
|
|
110
|
+
[Placeholder for Priority Order]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Workflow
|
|
116
|
+
|
|
117
|
+
[Placeholder for Workflow]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Output Format
|
|
123
|
+
|
|
124
|
+
[Placeholder for Output Format]
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
## Exit Codes
|
|
129
|
+
| Code | Meaning | When |
|
|
130
|
+
|------|---------|------|
|
|
131
|
+
| SUCCESS | Prompt designed with all required sections, anti-injection applied | All checks passed |
|
|
132
|
+
| PARTIAL | Prompt works but missing examples or output validation | Medium confidence result |
|
|
133
|
+
| BLOCKED | Task or output format not defined clearly enough | Cannot design without clear spec |
|
|
134
|
+
| FAILED | Prompt design has security vulnerability (direct injection risk) | Security gate failure |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Confidence Model
|
|
139
|
+
| Level | Condition | Action |
|
|
140
|
+
|-------|-----------|--------|
|
|
141
|
+
| HIGH | Task clearly defined, output format specified, examples provided | Build directly |
|
|
142
|
+
| MEDIUM | Task clear but output format ambiguous | Note assumption, add validation layer |
|
|
143
|
+
| LOW | Task too vague ("make an AI assistant") | EXIT: BLOCKED — define specific task |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Severity
|
|
148
|
+
| Level | Definition | Example |
|
|
149
|
+
|-------|-----------|---------|
|
|
150
|
+
| CRITICAL | Prompt injection attack possible | User input directly in system prompt |
|
|
151
|
+
| HIGH | LLM output used without validation in business logic | JSON parse without schema check |
|
|
152
|
+
| MEDIUM | Missing examples leads to inconsistent output | No few-shot examples in prompt |
|
|
153
|
+
| LOW | Output format not explicitly stated | Returns text instead of JSON |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Evidence Format
|
|
158
|
+
```
|
|
159
|
+
[SEVERITY] src/prompts/[name].ts:LINE
|
|
160
|
+
Issue: [specific vulnerability or gap]
|
|
161
|
+
Confidence: HIGH
|
|
162
|
+
Fix: [specific change]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Example:**
|
|
166
|
+
```
|
|
167
|
+
[CRITICAL] src/prompts/chat.ts:34
|
|
168
|
+
Issue: User input `${userMessage}` injected directly in system prompt — injection risk
|
|
169
|
+
Confidence: HIGH
|
|
170
|
+
Fix: Wrap in <user_input>{userMessage}</user_input> XML tags
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Retry Policy
|
|
176
|
+
```
|
|
177
|
+
LLM output validation fails
|
|
178
|
+
└─ Retry with stronger output format instruction (add explicit JSON schema)
|
|
179
|
+
├─ PASS on retry → EXIT: SUCCESS, note "required stronger schema enforcement"
|
|
180
|
+
└─ FAIL on retry → EXIT: PARTIAL — add human review gate
|
|
181
|
+
└─ Do NOT auto-retry more than 1 time — risk of infinite loop
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Escalation Rules
|
|
187
|
+
```
|
|
188
|
+
BLOCKED: AI task not specific enough to design prompt
|
|
189
|
+
Missing:
|
|
190
|
+
- Specific task description (what input → what output)
|
|
191
|
+
- Output format specification (JSON schema or text structure)
|
|
192
|
+
Questions:
|
|
193
|
+
1. Input cụ thể là gì? (user text, document, structured data)
|
|
194
|
+
2. Output cần trả về dạng gì? (JSON với field gì / plain text)
|
|
195
|
+
Recommended Assumptions (if proceeding):
|
|
196
|
+
- Structured JSON output with confidence field
|
|
197
|
+
- Deny-by-default: reject off-topic requests in system prompt
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Handoff Contract
|
|
203
|
+
### Consumes
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"from": "user",
|
|
207
|
+
"required_fields": ["task_description", "input_type", "output_format"],
|
|
208
|
+
"optional_fields": ["examples", "llm_provider", "max_tokens"]
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
### Produces
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"to": "user or qk-validation-gate",
|
|
215
|
+
"output_fields": ["system_prompt", "output_schema", "anti_injection_checklist", "exit_code"]
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
|