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,215 @@
|
|
|
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
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Workflow
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Output Format
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
## Exit Codes
|
|
123
|
+
| Code | Meaning | When |
|
|
124
|
+
|------|---------|------|
|
|
125
|
+
| SUCCESS | Prompt designed with all required sections, anti-injection applied | All checks passed |
|
|
126
|
+
| PARTIAL | Prompt works but missing examples or output validation | Medium confidence result |
|
|
127
|
+
| BLOCKED | Task or output format not defined clearly enough | Cannot design without clear spec |
|
|
128
|
+
| FAILED | Prompt design has security vulnerability (direct injection risk) | Security gate failure |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Confidence Model
|
|
133
|
+
| Level | Condition | Action |
|
|
134
|
+
|-------|-----------|--------|
|
|
135
|
+
| HIGH | Task clearly defined, output format specified, examples provided | Build directly |
|
|
136
|
+
| MEDIUM | Task clear but output format ambiguous | Note assumption, add validation layer |
|
|
137
|
+
| LOW | Task too vague ("make an AI assistant") | EXIT: BLOCKED — define specific task |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Severity
|
|
142
|
+
| Level | Definition | Example |
|
|
143
|
+
|-------|-----------|---------|
|
|
144
|
+
| CRITICAL | Prompt injection attack possible | User input directly in system prompt |
|
|
145
|
+
| HIGH | LLM output used without validation in business logic | JSON parse without schema check |
|
|
146
|
+
| MEDIUM | Missing examples leads to inconsistent output | No few-shot examples in prompt |
|
|
147
|
+
| LOW | Output format not explicitly stated | Returns text instead of JSON |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Evidence Format
|
|
152
|
+
```
|
|
153
|
+
[SEVERITY] src/prompts/[name].ts:LINE
|
|
154
|
+
Issue: [specific vulnerability or gap]
|
|
155
|
+
Confidence: HIGH
|
|
156
|
+
Fix: [specific change]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Example:**
|
|
160
|
+
```
|
|
161
|
+
[CRITICAL] src/prompts/chat.ts:34
|
|
162
|
+
Issue: User input `${userMessage}` injected directly in system prompt — injection risk
|
|
163
|
+
Confidence: HIGH
|
|
164
|
+
Fix: Wrap in <user_input>{userMessage}</user_input> XML tags
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Retry Policy
|
|
170
|
+
```
|
|
171
|
+
LLM output validation fails
|
|
172
|
+
└─ Retry with stronger output format instruction (add explicit JSON schema)
|
|
173
|
+
├─ PASS on retry → EXIT: SUCCESS, note "required stronger schema enforcement"
|
|
174
|
+
└─ FAIL on retry → EXIT: PARTIAL — add human review gate
|
|
175
|
+
└─ Do NOT auto-retry more than 1 time — risk of infinite loop
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Escalation Rules
|
|
181
|
+
```
|
|
182
|
+
BLOCKED: AI task not specific enough to design prompt
|
|
183
|
+
Missing:
|
|
184
|
+
- Specific task description (what input → what output)
|
|
185
|
+
- Output format specification (JSON schema or text structure)
|
|
186
|
+
Questions:
|
|
187
|
+
1. Input cụ thể là gì? (user text, document, structured data)
|
|
188
|
+
2. Output cần trả về dạng gì? (JSON với field gì / plain text)
|
|
189
|
+
Recommended Assumptions (if proceeding):
|
|
190
|
+
- Structured JSON output with confidence field
|
|
191
|
+
- Deny-by-default: reject off-topic requests in system prompt
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Handoff Contract
|
|
197
|
+
### Consumes
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"from": "user",
|
|
201
|
+
"required_fields": ["task_description", "input_type", "output_format"],
|
|
202
|
+
"optional_fields": ["examples", "llm_provider", "max_tokens"]
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
### Produces
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"to": "user or qk-validation-gate",
|
|
209
|
+
"output_fields": ["system_prompt", "output_schema", "anti_injection_checklist", "exit_code"]
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-api-lifecycle
|
|
3
|
+
category: fullstack
|
|
4
|
+
version: 7.5.0
|
|
5
|
+
description: "Thiết kế, triển khai API endpoints với Zero-Trust — contract trước, code sau."
|
|
6
|
+
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
7
|
+
execution_mode: deterministic
|
|
8
|
+
|
|
9
|
+
cost: medium
|
|
10
|
+
latency: medium
|
|
11
|
+
risk: medium
|
|
12
|
+
side_effects: edit_files
|
|
13
|
+
produces: [code, report]
|
|
14
|
+
consumes: [context-graph, user-description]
|
|
15
|
+
|
|
16
|
+
token_budget:
|
|
17
|
+
max_files_read: 3
|
|
18
|
+
max_lines_per_read: 150
|
|
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-api-lifecycle — API Design & Implementation
|
|
29
|
+
|
|
30
|
+
> **Language rule:** Code, identifiers, file names ? English. Explanations, summaries ? Vietnamese.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Preconditions
|
|
35
|
+
- [ ] API purpose and resource name are defined
|
|
36
|
+
- [ ] Request/response shape is specified (or sample JSON provided)
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
On missing precondition:
|
|
40
|
+
EXIT: BLOCKED
|
|
41
|
+
Message: "Cần định nghĩa: resource name + expected request/response shape trước khi code."
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
- ✅ Define OpenAPI/Swagger contract BEFORE writing code
|
|
48
|
+
- ✅ Implement endpoint strictly to contract
|
|
49
|
+
- ✅ Validate all inputs, handle all error cases
|
|
50
|
+
- ✅ Ensure backward compatibility
|
|
51
|
+
|
|
52
|
+
## Non-Goals
|
|
53
|
+
- ❌ Introduce breaking changes without versioning
|
|
54
|
+
- ❌ Bypass auth checks
|
|
55
|
+
- ❌ Guess external API shapes without evidence
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Priority Order
|
|
60
|
+
|
|
61
|
+
| Priority | Task | Skip Threshold |
|
|
62
|
+
|----------|------|----------------|
|
|
63
|
+
| P1 | Contract definition (TypeScript types) | Never |
|
|
64
|
+
| P2 | Success response + correct status code | Never |
|
|
65
|
+
| P3 | Input validation middleware | Never |
|
|
66
|
+
| P4 | Error responses (400, 401, 404, 422, 500) | Budget < 30% |
|
|
67
|
+
| P5 | Documentation (JSDoc or OpenAPI annotation) | Budget < 60% |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Workflow
|
|
72
|
+
|
|
73
|
+
### Phase 1 — Contract Definition
|
|
74
|
+
1. Define TypeScript interfaces for Request + Response
|
|
75
|
+
2. Specify HTTP method, route, status codes
|
|
76
|
+
3. Document error cases
|
|
77
|
+
|
|
78
|
+
**Decision:**
|
|
79
|
+
```
|
|
80
|
+
IF contract is clear → go to Phase 2
|
|
81
|
+
ELSE → EXIT: BLOCKED — define contract first
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Phase 2 — Implementation
|
|
85
|
+
1. Build route handler strictly matching contract
|
|
86
|
+
2. Add input validation (zod/yup/class-validator)
|
|
87
|
+
3. Handle all error cases with correct HTTP status
|
|
88
|
+
|
|
89
|
+
### Phase 3 — Verification
|
|
90
|
+
1. Read implemented code vs defined contract
|
|
91
|
+
2. Verify: method, route, response shape, error codes match
|
|
92
|
+
|
|
93
|
+
**Decision:**
|
|
94
|
+
```
|
|
95
|
+
IF contract and implementation match → EXIT: SUCCESS
|
|
96
|
+
ELSE → fix gaps, EXIT: PARTIAL
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Confidence Model
|
|
102
|
+
| Level | Condition | Action |
|
|
103
|
+
|-------|-----------|--------|
|
|
104
|
+
| HIGH | Contract defined, implementation matches | Report SUCCESS |
|
|
105
|
+
| MEDIUM | Contract inferred from context | Note assumption |
|
|
106
|
+
| LOW | No contract, guessing from usage | EXIT: BLOCKED |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Evidence Format
|
|
111
|
+
```
|
|
112
|
+
[SEVERITY] src/routes/[resource].ts:LINE
|
|
113
|
+
Issue: [mismatch between contract and implementation]
|
|
114
|
+
Confidence: HIGH
|
|
115
|
+
Fix: [specific change needed]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Handoff Contract
|
|
121
|
+
### Consumes
|
|
122
|
+
```json
|
|
123
|
+
{ "from": "user", "required_fields": ["resource_name", "request_shape", "response_shape"] }
|
|
124
|
+
```
|
|
125
|
+
### Produces
|
|
126
|
+
```json
|
|
127
|
+
{ "to": "qk-validation-gate", "output_fields": ["route_file", "types_file", "contract_doc", "exit_code"] }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Exit Codes
|
|
133
|
+
| Code | Meaning | When |
|
|
134
|
+
|------|---------|------|
|
|
135
|
+
| SUCCESS | Contract defined, implemented, verified | Implementation matches contract |
|
|
136
|
+
| PARTIAL | Implemented but missing error cases or docs | Core logic done, edge cases missing |
|
|
137
|
+
| BLOCKED | No contract defined — cannot code | Missing payload/schema |
|
|
138
|
+
| FAILED | Implementation breaks existing contract | Backward incompatibility |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Severity
|
|
143
|
+
| Level | Definition | Example |
|
|
144
|
+
|-------|-----------|---------|
|
|
145
|
+
| CRITICAL | Broken contract on public API | Renamed `userId` to `id` in response |
|
|
146
|
+
| HIGH | Missing input validation | SQL Injection or crash on null input |
|
|
147
|
+
| MEDIUM | Returning 500 for validation errors | Not using 400/422 |
|
|
148
|
+
| LOW | Missing JSDoc | Undocumented route |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Retry Policy
|
|
153
|
+
```
|
|
154
|
+
Contract verification fails
|
|
155
|
+
└─ Implementation does not match contract
|
|
156
|
+
├─ Fix route handler to match contract
|
|
157
|
+
└─ Do NOT retry more than 1 time
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Escalation Rules
|
|
163
|
+
```
|
|
164
|
+
BLOCKED: No contract defined
|
|
165
|
+
Missing:
|
|
166
|
+
- Request payload structure
|
|
167
|
+
- Response payload structure
|
|
168
|
+
Questions:
|
|
169
|
+
1. Payload gửi lên (Request) có những field gì?
|
|
170
|
+
2. Payload trả về (Response) có cấu trúc thế nào?
|
|
171
|
+
Recommended Assumptions:
|
|
172
|
+
- Default JSON response with `{ data, message }` wrapper
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-bug-resolution
|
|
3
|
+
category: maintenance
|
|
4
|
+
version: 7.5.0
|
|
5
|
+
description: "Sửa lỗi (bugs) bằng chu trình khép kín: Quan sát → Giả thuyết → Bằng chứng → Sửa."
|
|
6
|
+
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
7
|
+
execution_mode: deterministic
|
|
8
|
+
|
|
9
|
+
cost: medium
|
|
10
|
+
latency: medium
|
|
11
|
+
risk: medium
|
|
12
|
+
side_effects: edit_files
|
|
13
|
+
produces: [code, report]
|
|
14
|
+
consumes: [stack-trace, error-message, user-description, context-graph]
|
|
15
|
+
|
|
16
|
+
token_budget:
|
|
17
|
+
max_files_read: 3
|
|
18
|
+
max_lines_per_read: 150
|
|
19
|
+
max_shell_commands: 2
|
|
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-bug-resolution — Diagnose & Repair
|
|
29
|
+
|
|
30
|
+
> **Language rule:** Code, identifiers, file names → English. Explanations, summaries → Vietnamese.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Preconditions
|
|
35
|
+
- [ ] A specific symptom is provided (error message, wrong behavior, crash)
|
|
36
|
+
- [ ] The affected file or feature area is identifiable
|
|
37
|
+
- [ ] Reproduction steps or stack trace provided
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
On missing precondition:
|
|
41
|
+
EXIT: BLOCKED
|
|
42
|
+
Message: "Cần thêm thông tin: [error message / stack trace / bước tái hiện lỗi]"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Scope
|
|
48
|
+
- ✅ Diagnose existing defects with concrete evidence
|
|
49
|
+
- ✅ Apply minimal targeted patches directly to source files
|
|
50
|
+
- ✅ Verify fix with evidence (static or runtime)
|
|
51
|
+
|
|
52
|
+
## Non-Goals
|
|
53
|
+
- ❌ Refactor code outside the buggy area
|
|
54
|
+
- ❌ Create Node.js/Python/shell scripts to apply patches — edit source files directly
|
|
55
|
+
- ❌ Read entire files > 150 lines — use `grep_search` or targeted `view_file[StartLine:EndLine]`
|
|
56
|
+
- ❌ Run shell commands > 2 times per cycle
|
|
57
|
+
- ❌ Guess root cause without concrete evidence
|
|
58
|
+
- ❌ Mark as done without verifying the fix
|
|
59
|
+
- ❌ Proceed with MEDIUM confidence — only HIGH confidence is acceptable for fix
|
|
60
|
+
- ❌ Use `?.` or `!` to silence errors instead of fixing root cause
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Priority Order
|
|
65
|
+
|
|
66
|
+
| Priority | Check | Skip Threshold |
|
|
67
|
+
|----------|-------|----------------|
|
|
68
|
+
| P1 | Identify exact file:line of failure | Never |
|
|
69
|
+
| P2 | Trace data flow to root cause | Budget < 30% → EXIT: BLOCKED |
|
|
70
|
+
| P3 | Check adjacent code for similar bugs | Budget < 50% |
|
|
71
|
+
| P4 | Suggest regression test | Budget < 70% |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Workflow
|
|
76
|
+
|
|
77
|
+
### Phase 1 — Triage (Read Only)
|
|
78
|
+
|
|
79
|
+
**Steps:**
|
|
80
|
+
1. `grep_search` — search for error message, function name, or symptom keyword
|
|
81
|
+
2. `view_file[StartLine:EndLine]` — read ONLY the relevant section (≤ 150 lines)
|
|
82
|
+
3. Identify the exact file and approximate line of failure
|
|
83
|
+
|
|
84
|
+
**Exit When:**
|
|
85
|
+
- Exact file:line identified → go to Phase 2
|
|
86
|
+
- `max_files_read` (3) reached without exact identification → EXIT: BLOCKED
|
|
87
|
+
|
|
88
|
+
**Decision:**
|
|
89
|
+
```
|
|
90
|
+
IF stack trace provided
|
|
91
|
+
→ Parse top frame inside project code → go to Phase 2
|
|
92
|
+
|
|
93
|
+
ELSE IF error message provided
|
|
94
|
+
→ grep_search for error string → go to Phase 2
|
|
95
|
+
|
|
96
|
+
ELSE
|
|
97
|
+
→ EXIT: BLOCKED — ask for reproduction steps
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**On Blocked:**
|
|
101
|
+
```
|
|
102
|
+
EXIT: BLOCKED
|
|
103
|
+
Missing: Reproduction steps or error output
|
|
104
|
+
Questions:
|
|
105
|
+
1. Lỗi xảy ra ở bước nào? (URL / action / input)
|
|
106
|
+
2. Error message hoặc stack trace cụ thể là gì?
|
|
107
|
+
Recommended Assumptions: none — cannot proceed without this
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Phase 2 — Root Cause Analysis
|
|
113
|
+
|
|
114
|
+
**Steps:**
|
|
115
|
+
1. Read the identified file section (`view_file[StartLine:EndLine]`, ≤ 150 lines)
|
|
116
|
+
2. Trace: What condition triggers the failure?
|
|
117
|
+
3. Check context graph for blast radius assessment
|
|
118
|
+
4. Assign confidence level
|
|
119
|
+
|
|
120
|
+
**Common Root Cause Categories:**
|
|
121
|
+
- Logic error (wrong condition, wrong operator)
|
|
122
|
+
- Null / undefined / missing data
|
|
123
|
+
- Async timing or race condition
|
|
124
|
+
- Type mismatch or stale state
|
|
125
|
+
- API contract change
|
|
126
|
+
|
|
127
|
+
**Decision:**
|
|
128
|
+
```
|
|
129
|
+
IF root cause found with direct evidence (file:line + stack trace confirms)
|
|
130
|
+
→ Confidence: HIGH → go to Phase 3
|
|
131
|
+
|
|
132
|
+
ELSE IF root cause still unclear after reading identified file
|
|
133
|
+
→ Read 1 more file (budget check)
|
|
134
|
+
→ Still unclear → EXIT: BLOCKED
|
|
135
|
+
|
|
136
|
+
ELSE IF root cause inferred from pattern (no direct evidence)
|
|
137
|
+
→ EXIT: BLOCKED — cannot fix without concrete evidence
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### Phase 3 — Apply Fix (Direct Edit Only)
|
|
143
|
+
|
|
144
|
+
**Steps:**
|
|
145
|
+
1. Apply fix using `replace_file_content` or `multi_replace_file_content`
|
|
146
|
+
- **NEVER** create a helper script to do the patching
|
|
147
|
+
- Keep the change minimal — smallest diff that resolves the issue
|
|
148
|
+
2. Re-read the fixed section to confirm correctness (static verification)
|
|
149
|
+
3. Run shell command ONLY if runtime verification is strictly required (counts toward max 2)
|
|
150
|
+
|
|
151
|
+
**Exit When:**
|
|
152
|
+
- Fix applied and verified statically → EXIT: SUCCESS
|
|
153
|
+
- Fix applied but runtime verification needed and command budget exhausted → EXIT: FAILED — cannot verify
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Confidence Model
|
|
158
|
+
|
|
159
|
+
| Level | Condition | Action |
|
|
160
|
+
|-------|-----------|--------|
|
|
161
|
+
| HIGH | Direct evidence — exact file:line + stack trace confirms it | Proceed with fix |
|
|
162
|
+
| MEDIUM | Inferred from code patterns, similar bugs nearby | EXIT: BLOCKED — collect more evidence |
|
|
163
|
+
| LOW | Assumption without code evidence | STOP — ask user before applying fix |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Severity
|
|
168
|
+
|
|
169
|
+
| Level | Definition | Example |
|
|
170
|
+
|-------|-----------|---------|
|
|
171
|
+
| CRITICAL | Data loss / security / app crash | Hardcoded secret, unhandled null crash on login |
|
|
172
|
+
| HIGH | Core feature broken, blocking users | API returns 500, form submission fails |
|
|
173
|
+
| MEDIUM | Degraded UX, workaround exists | Wrong label, minor calculation off |
|
|
174
|
+
| LOW | Cosmetic, non-blocking | Console.log left in code |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Evidence Format
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
[SEVERITY] path/to/file.ts:LINE
|
|
182
|
+
Reason: [why this causes the bug]
|
|
183
|
+
Impact: [which modules/users are affected]
|
|
184
|
+
Confidence: [HIGH|MEDIUM|LOW]
|
|
185
|
+
Fix: [what was changed]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Example:**
|
|
189
|
+
```
|
|
190
|
+
[HIGH] src/services/auth.service.ts:87
|
|
191
|
+
Reason: Missing null check on `user.profile` — crashes when profile is not yet loaded
|
|
192
|
+
Impact: Affects all login flows; 100% of users hitting this path
|
|
193
|
+
Confidence: HIGH
|
|
194
|
+
Fix: Added `user.profile?.email ?? ''` guard
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Retry Policy
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Fix applied
|
|
203
|
+
└─ Static verification (re-read fixed section)
|
|
204
|
+
├─ PASS → EXIT: SUCCESS
|
|
205
|
+
└─ Issue detected → attempt 1 correction
|
|
206
|
+
└─ Re-verify
|
|
207
|
+
├─ PASS → EXIT: SUCCESS
|
|
208
|
+
└─ FAIL → EXIT: FAILED + report both attempts
|
|
209
|
+
└─ Do NOT attempt 3rd fix — ESCALATE to user
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Escalation Rules
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
BLOCKED: [Specific reason]
|
|
218
|
+
Missing:
|
|
219
|
+
- [Stack trace / error message / reproduction steps]
|
|
220
|
+
Questions:
|
|
221
|
+
1. Lỗi xuất hiện khi nào? (action/URL/input cụ thể)
|
|
222
|
+
2. Lỗi có tái hiện được không?
|
|
223
|
+
Recommended Assumptions (if proceeding without full info):
|
|
224
|
+
- [Safe assumption based on available context]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Handoff Contract
|
|
230
|
+
|
|
231
|
+
### Consumes
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"from": "user or qk-orchestrator",
|
|
235
|
+
"required_fields": ["symptom_description", "context_graph"],
|
|
236
|
+
"optional_fields": ["stack_trace", "error_message", "affected_file"]
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Produces
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"to": "user",
|
|
244
|
+
"output_fields": ["changed_files", "root_cause", "impact", "severity", "confidence", "exit_code"]
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Output Format
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
🐛 Bug Report
|
|
254
|
+
─────────────────────────────────────────────────
|
|
255
|
+
Symptom: [What broke + how to reproduce]
|
|
256
|
+
Root cause: [file:line — exact reason]
|
|
257
|
+
Severity: [CRITICAL | HIGH | MEDIUM | LOW]
|
|
258
|
+
Confidence: [HIGH | MEDIUM | LOW]
|
|
259
|
+
Impact: [Which modules/users affected]
|
|
260
|
+
|
|
261
|
+
🔧 Fix Applied
|
|
262
|
+
─────────────────────────────────────────────────
|
|
263
|
+
File: [path/to/file.ts]
|
|
264
|
+
Change: [What changed and why it's minimal]
|
|
265
|
+
|
|
266
|
+
✅ Verification
|
|
267
|
+
─────────────────────────────────────────────────
|
|
268
|
+
Static: [Re-read section — looks correct]
|
|
269
|
+
Runtime: [PASS | SKIPPED — reason]
|
|
270
|
+
|
|
271
|
+
Exit Code: [SUCCESS | PARTIAL | BLOCKED | FAILED]
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Exit Codes
|
|
277
|
+
|
|
278
|
+
| Code | Meaning | When |
|
|
279
|
+
|------|---------|------|
|
|
280
|
+
| SUCCESS | Bug fixed and verified | Fix applied + static/runtime check passed |
|
|
281
|
+
| PARTIAL | Fix applied, verification inconclusive | Budget exhausted or environment inaccessible |
|
|
282
|
+
| BLOCKED | Cannot diagnose without more info | Missing stack trace / reproduction steps |
|
|
283
|
+
| FAILED | Fix attempted, issue persists after 2 retries OR budget exhausted without verification | Complex race condition or architectural issue |
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
Diagnose and fix a specific bug with minimal, targeted changes while preserving all existing behavior.
|
|
288
|
+
This skill is triggered when a user reports a specific defect with a stack trace, error message, or reproduction steps. It requires concrete evidence before any code modification.
|
|
289
|
+
- Symptom description (error message, wrong behavior, crash)
|
|
290
|
+
- Stack trace or reproduction steps
|
|
291
|
+
- Affected file or feature area (if known)
|
|
292
|
+
- Context graph (for blast radius assessment)
|
|
293
|
+
1. **Observe:** Read error output, stack trace, and affected code section
|
|
294
|
+
2. **Hypothesize:** Identify potential root causes based on evidence
|
|
295
|
+
3. **Verify:** Confirm root cause with direct file:line evidence
|
|
296
|
+
4. **Fix:** Apply minimal patch using direct edit only
|
|
297
|
+
5. **Verify:** Re-read fixed code and confirm correctness
|
|
298
|
+
- MUST have exact file:line before proceeding to fix
|
|
299
|
+
- MUST NOT guess root cause without direct evidence
|
|
300
|
+
- MUST keep changes minimal — smallest diff that resolves the issue
|
|
301
|
+
- MUST NOT exceed token_budget (max 3 files, 150 lines each, 2 shell commands)
|
|
302
|
+
- MUST verify fix before marking done
|
|
303
|
+
- Zero-Trust: No fix without HIGH confidence (direct evidence)
|
|
304
|
+
- Minimal Change: Fix only the bug, no refactoring
|
|
305
|
+
- Backward Compat: Preserve all existing public API behavior
|
|
306
|
+
- Evidence First: Every finding must use Evidence Format with file:line
|
|
307
|
+
---
|