ai-developer-skill-os 2.1.1 → 3.1.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.
Files changed (41) hide show
  1. package/.agents/AGENTS.md +81 -0
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +84 -130
  4. package/docs/GOVERNANCE.md +40 -0
  5. package/docs/SPEC.md +37 -0
  6. package/docs/adr/0001-intent-based-architecture.md +19 -0
  7. package/docs/adr/0002-kernel-freeze.md +21 -0
  8. package/docs/adr/0003-risk-based-verification.md +20 -0
  9. package/docs/adr/0004-progressive-evidence.md +19 -0
  10. package/docs/skill-classification.md +25 -0
  11. package/knowledge/backend/nodejs.md +52 -0
  12. package/knowledge/frontend/react.md +81 -0
  13. package/package.json +1 -1
  14. package/skills/qk-access-policy/SKILL.md +40 -127
  15. package/skills/qk-ai-builder/SKILL.md +41 -33
  16. package/skills/qk-api-lifecycle/SKILL.md +62 -420
  17. package/skills/qk-bug-resolution/SKILL.md +67 -371
  18. package/skills/qk-context-loader/SKILL.md +47 -206
  19. package/skills/qk-data-lifecycle/SKILL.md +60 -135
  20. package/skills/qk-design-to-code/SKILL.md +46 -33
  21. package/skills/qk-docs/SKILL.md +52 -335
  22. package/skills/qk-documentation-system/SKILL.md +38 -33
  23. package/skills/qk-engineering-standard/SKILL.md +63 -171
  24. package/skills/qk-feature-delivery/SKILL.md +65 -432
  25. package/skills/qk-help/SKILL.md +37 -95
  26. package/skills/qk-orchestrator/SKILL.md +52 -272
  27. package/skills/qk-policy-engine/SKILL.md +52 -33
  28. package/skills/qk-production-release/SKILL.md +47 -127
  29. package/skills/qk-project-bootstrap/SKILL.md +43 -33
  30. package/skills/qk-project-health/SKILL.md +58 -650
  31. package/skills/qk-project-memory/SKILL.md +35 -33
  32. package/skills/qk-system-evolution/SKILL.md +65 -315
  33. package/skills/qk-ui-audit/SKILL.md +60 -152
  34. package/skills/qk-ui-system-builder/SKILL.md +40 -444
  35. package/skills/qk-validation-gate/SKILL.md +61 -33
  36. package/skills.json +36 -40
  37. package/templates/bug-report.md +21 -0
  38. package/templates/design-report.md +21 -0
  39. package/templates/feature-report.md +20 -0
  40. package/templates/review-report.md +21 -0
  41. package/templates/skill-template.md +38 -0
@@ -0,0 +1,81 @@
1
+ # Global Agent Policies
2
+
3
+ These policies act as the OS Kernel for all AI agents.
4
+ They establish the baseline behavior, engineering standards, and execution lifecycle.
5
+ Skills follow the standard classifications defined in `docs/skill-classification.md`.
6
+
7
+ ## 1. Core Principles
8
+ **Rules:**
9
+ - **MUST** fix the root cause, not the symptom.
10
+ - **MUST NOT** fabricate facts, APIs, packages, or code that doesn't exist.
11
+ - **MUST NOT** guess the shape of APIs or data. Use evidence.
12
+ - **MUST NOT** redesign the system or overengineer unless explicitly requested.
13
+ - **MUST** preserve backward compatibility unless instructed otherwise.
14
+
15
+ **Guidelines:**
16
+ - **Prefer** solving today's problem over speculative future-proofing.
17
+ - **Prefer** keeping changes minimal and isolated.
18
+
19
+ ## 2. Priority Resolution
20
+ If multiple objectives or skills overlap, resolve them in this order:
21
+ 1. Safety
22
+ 2. Correctness
23
+ 3. User Request
24
+ 4. Performance
25
+ 5. Style
26
+
27
+ ## 3. Planning & Context
28
+ **Rules:**
29
+ - **MUST** read before write. Always understand context before modifying code.
30
+ - **MUST NOT** read the whole project unless explicitly required.
31
+
32
+ **Guidelines:**
33
+ - **Context Budget:** Prefer reading `1 file` → `3 files` → `directory` → `project`.
34
+ - **Evidence Priority:** User input → Existing context → Source code → Types → Logs → Runtime → External knowledge.
35
+
36
+ ## 4. Evidence Collection & Confidence
37
+ **Rules:**
38
+ - **MUST NOT** execute speculative actions.
39
+ - **Decision Confidence:** Proceed only when the next action is supported by sufficient evidence. Avoid speculative execution.
40
+
41
+ **Guidelines:**
42
+ - **Progressive Collection:** Collect incrementally. Do not gather all possible information upfront.
43
+ - **Stop early:** Stop collecting evidence as soon as there is sufficient confidence to proceed. If confidence is low, collect exactly *one* additional piece of evidence and repeat.
44
+
45
+ ## 5. Tool Usage
46
+ **Rules:**
47
+ - **MUST** determine if the answer can be derived from the current context before calling any tool.
48
+ - **MUST NOT** use shell commands merely to explore the project (e.g., `pwd`, `ls`, `tree`, `find`) when structure is known.
49
+
50
+ **Guidelines:**
51
+ - **Order of Preference:** Current context → `read_file` → `grep_search` → `search_code` → `run_command`.
52
+ - **Batch Commands:** Batch related operations (e.g., `git status && git diff`).
53
+ - **Command Budget:** Maximum 3 shell commands before producing an initial diagnosis.
54
+
55
+ ## 6. Execution & Repair Loop
56
+ **Rules:**
57
+ - **Repair Loop:** MUST follow: `Observe` → `Hypothesis` → `Evidence` → `Fix` → `Verify` → `Done`. Do NOT jump directly from Observe to Fix.
58
+ - **Escalation Policy:** If 2 consecutive attempts fail (e.g., build fail, permission denied): Stop. Explain the blocker. Request user confirmation before continuing.
59
+ - **Stopping Criteria:** Stop immediately when: Root cause identified, task completed, required evidence collected, or sufficient confidence reached.
60
+
61
+ **Guidelines:**
62
+ - **Cost Policy:** Optimize for: Correctness > Minimal Changes > Minimal Context > Minimal Tool Usage > Minimal Runtime.
63
+
64
+ ## 7. Verification
65
+ **Rules:**
66
+ - **MUST** use the lowest verification level sufficient for the task.
67
+ - **MUST NOT** run build/test unless required by the task or needed for verification.
68
+
69
+ **Guidelines:**
70
+ - **Risk-based Verification:**
71
+ - **Level 0 (Low Risk):** Comment, typo, string changes. Static analysis only.
72
+ - **Level 1:** Read source code.
73
+ - **Level 2 (Medium Risk):** Logic changes. Run targeted test.
74
+ - **Level 3 (High Risk):** Auth, payment, database. Run full validation.
75
+
76
+ ## 8. Output Policy
77
+ **Rules:**
78
+ - **MUST** use English for: Code, reasoning, architecture terms, file names, variables, technical decisions, Git commit messages, logs, and prompt logic (Workflow, Checklist).
79
+ - **MUST** use Vietnamese for: User-facing explanations, questions, summaries, progress updates, and the final report.
80
+ - **MUST NOT** translate: Code snippets, stack traces, file paths, shell commands, config keys, environment variables.
81
+ - **MUST** follow the required reporting structure (Summary, Changes, Reason, Verification, Risks, Next Action).
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to the **AI Developer Skill OS** project will be documented
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.0.1] - 2026-07-02
9
+
10
+ ### Changed
11
+ - Updated skills.json version từ 1.0.1 → 3.0.1 để phản án version skills chính
12
+ - Thay đổi status các skill từ `planned` → `ready`
13
+ - Cập nhật `qk-bug-fix` → `qk-bug-resolution` với version 3.0.0
14
+
15
+ ### Added
16
+ - Thêm `knowledge/backend/nodejs.md` - tài liệu kiến trúc backend Node.js
17
+ - Thêm categories registry cho dễ phân loại skills
18
+
19
+ ### Fixed
20
+ - Sửa lỗi `qk-projects-bootstrap` → `qk-project-bootstrap` typo trong categories
21
+
8
22
  ## [1.0.1] - 2026-07-01
9
23
  ### Fixed
10
24
  - Standardized Language rule across all 23 SKILL.md files for consistency.
package/README.md CHANGED
@@ -1,130 +1,84 @@
1
- # 🚀 AI Developer Skill OS (ai-developer-skill-os)
2
-
3
- > Một hệ điều hành (AI-OS) và Nền tảng Kiến trúc Kỹ thuật (Engineering Platform) tối thượng dành cho AI Coding Agents (Cursor, Windsurf, Cline, v.v.).
4
-
5
- Thay vì cung cấp các "công cụ rời rạc" (Toolbox), dự án này xây dựng một hệ thống **22 Siêu Kỹ Năng (Master Skills)**, biến Agent của bạn thành một **Senior Engineer / Chief Architect** thực thụ với khả năng tự học, tự kiểm toán tự viết tài liệu.
6
-
7
- ---
8
-
9
- ## 🏗️ Kiến Trúc Khối (The 7-Layer Architecture)
10
-
11
- Hệ thống được thiết kế hoàn hảo với 7 phân lớp, hoạt động khép kín theo chuỗi End-to-End:
12
-
13
- ### 0. Foundation Layer (Nền Tảng Cốt Lõi)
14
- - `qk-orchestrator`: Bộ điều hướng yêu cầu người dùng, chọn Workflow.
15
- - `qk-context-loader`: Bộ nạp ngữ cảnh, tìm file liên quan, chống tràn token.
16
- - `qk-policy-engine`: Động kiểm tra tính hợp lệ của Request trước khi chạy.
17
- - `qk-access-policy`: Ranh giới bảo mật, phân quyền và RBAC.
18
- - `qk-project-memory`: Bộ nhớ cấu trúc dự án (Architecture, UI Patterns, Conventions).
19
- - `qk-engineering-standard`: Bộ luật thiết kế (Frontend, Backend, Security, Testing rules).
20
- - `qk-project-bootstrap`: Trình khởi tạo dự án từ con số 0.
21
-
22
- ### 1. UI System Layer (Hệ Thống Giao Diện)
23
- - `qk-ui-system-builder`: Quản Design System, Component Library.
24
- - `qk-design-to-code`: Chuyển đổi Figma/Screenshot sang nguồn.
25
- - `qk-ui-audit`: Kiểm toán tính nhất quán, Responsive, Accessibility.
26
-
27
- ### 2. Development Layer (Phát Triển E2E)
28
- - `qk-feature-delivery`: Phân tích, code, test hoàn thiện một tính năng từ A-Z.
29
- - `qk-api-lifecycle`: Vòng đời API (Spec, Service, Type, Test, Docs).
30
- - `qk-data-lifecycle`: Vòng đời dữ liệu (Schema, Migration, Query Tuning).
31
-
32
- ### 3. Quality Assurance Layer (Đảm Bảo Chất Lượng)
33
- - `qk-project-health`: Audit tình trạng dự án, Tech Debt, Code Smell.
34
- - `qk-bug-resolution`: Tái hiện lỗi, tìm Root Cause, Fix và chống Regression.
35
- - `qk-validation-gate`: Cổng chặn an toàn (Lint, Test, Security) trước khi hoàn tất.
36
-
37
- ### 4. Evolution Layer (Tiến Hóa Hệ Thống)
38
- - `qk-system-evolution`: Nâng cấp phiên bản, Impact Analysis, Dry-run.
39
-
40
- ### 5. Operation Layer (Vận Hành)
41
- - `qk-production-release`: CI/CD, Build, Deploy, Observability.
42
-
43
- ### 6. AI Builder Layer
44
- - `qk-ai-builder`: Thiết kế các hệ thống AI App, Agent, RAG.
45
-
46
- ### 7. Knowledge Layer (Tri Thức & Tài Liệu)
47
- - `qk-docs`: Viết tài liệu cho con người (README, Changelog, Developer Guide).
48
- - `qk-documentation-system`: Máy học nội bộ (Chuyển đổi Pattern thành luật nạp vào Memory).
49
- - `qk-help`: Trợ lý tra cứu hướng dẫn kỹ năng.
50
-
51
- ---
52
-
53
- ## 🔄 Luồng Vận Hành Khép Kín (Workflow)
54
-
55
- Khi bạn ra lệnh: `"Thêm tính năng đăng nhập"`:
56
- ```text
57
- User Request
58
-
59
- qk-orchestrator (Phân tích, chọn qk-feature-delivery)
60
-
61
- qk-context-loader (Load code liên quan Auth)
62
-
63
- qk-policy-engine & qk-access-policy (Check quyền)
64
-
65
- qk-engineering-standard (Rút luật Backend/Security)
66
-
67
- [THỰC THI BỞI qk-feature-delivery]
68
-
69
- qk-validation-gate (Test, Lint)
70
-
71
- qk-docs (Cập nhật API doc, Changelog)
72
-
73
- qk-documentation-system (Lưu các Pattern mới vào Memory)
74
- ```
75
-
76
- ---
77
-
78
- ## 💡 Ví Dụ Thực Tế (Common Examples)
79
-
80
- Dưới đây là một số ví dụ sử dụng các kỹ năng phổ biến và mạnh mẽ nhất trong quá trình code hàng ngày của bạn:
81
-
82
- ### 1. `qk-orchestrator` (Trợ lý điều phối trung tâm)
83
- Nếu bạn không biết nên dùng skill nào, hãy gọi Orchestrator. Nó sẽ tự động phân tích và kích hoạt đúng các skill bên dưới.
84
- ```bash
85
- ./qk-orchestrator "Tôi muốn tạo một trang Dashboard hiển thị doanh thu bằng React"
86
- ```
87
-
88
- ### 2. `qk-feature-delivery` (Phát triển tính năng E2E)
89
- Dùng khi bạn muốn xây dựng trọn vẹn một tính năng từ DB, API đến UI và Test.
90
- ```bash
91
- ./qk-feature-delivery "Tạo luồng thanh toán giỏ hàng (Cart Checkout), lưu vào bảng orders và gọi API thanh toán Stripe"
92
- ```
93
-
94
- ### 3. `qk-bug-resolution` (Chẩn đoán và diệt Bug triệt để)
95
- Tuyệt đối không dùng prompt thường để sửa lỗi. Dùng kỹ năng này để ép AI tìm Root Cause và viết Regression Test.
96
- ```bash
97
- ./qk-bug-resolution "API /users/profile đang trả về 500 khi user chưa có avatar, stack trace như sau..."
98
- ```
99
-
100
- ### 4. `qk-ui-system-builder` (Chuẩn hóa giao diện)
101
- Dùng khi thiết kế các component dùng chung (Button, Card, Form) để đảm bảo không bị rác CSS.
102
- ```bash
103
- ./qk-ui-system-builder "Tạo một Data Table Component có hỗ trợ phân trang và filter, sử dụng Design Token hiện tại"
104
- ```
105
-
106
- ### 5. `qk-api-lifecycle` (Thiết kế và Code API)
107
- Dành cho Backend Engineer, đi từ spec đến code, type và test.
108
- ```bash
109
- ./qk-api-lifecycle "Thiết kế API cập nhật mật khẩu, yêu cầu validate JWT token và mã hóa bcrypt"
110
- ```
111
-
112
- ---
113
-
114
- ## 💻 Cách Cài Đặt (Installation)
115
-
116
- Sử dụng npm:
117
- ```bash
118
- npm i -g ai-developer-skill-os
119
- ```
120
- Hoặc sử dụng qua `npx`:
121
- ```bash
122
- npx ai-developer-skill-os init
123
- ```
124
-
125
- ## 🚀 Tra Cứu (Help)
126
-
127
- Để tra cứu danh sách toàn bộ 22 Kỹ năng và các mẹo sử dụng, hãy gọi:
128
- ```bash
129
- ./qk-help "Hiển thị tất cả các skill liên quan đến Frontend"
130
- ```
1
+ # 🚀 AI Developer Skill OS (ai-developer-skill-os) v3.0
2
+
3
+ > Một hệ điều hành (AI-OS) và Nền tảng Kiến trúc Kỹ thuật (Engineering Platform) tối thượng dành cho AI Coding Agents (Claude Code, Cursor, Windsurf, Gemini, Kilo).
4
+
5
+ Thay vì cung cấp các "công cụ rời rạc" (Toolbox) hoặc những prompt cồng kềnh, **AI Developer Skill OS v3.0** được thiết kế lại hoàn toàn theo chuẩn **Enterprise-ready Agentic Framework**. Nó biến Agent của bạn thành một **Senior Engineer / Chief Architect** thực thụ với khả năng tự suy luận bằng Tiếng Anh, nhưng lại báo cáo thân thiện bằng Tiếng Việt.
6
+
7
+ ---
8
+
9
+ ## Tính năng chính
10
+ - **23 Skills chuẩn Enterprise** cho Frontend, Backend, Engineering
11
+ - **Kiến trúc 5 tầng** giúp tối ưu Context Window
12
+ - **Pipeline tự động**: analyze → implement → validate → complete
13
+ - **Decision Tree** cho từng skill, đưa ra quyết định chuẩn xác
14
+ - **Knowledge RAG on-demand** - chỉ tải kiến thức khi cần thiết
15
+
16
+ ## 🏗️ Kiến Trúc 5 Tầng (The 5-Tier Architecture)
17
+
18
+ Hệ thống được thiết kế decoupled (phân tách) hoàn hảo để chống tràn Context Window và tối ưu khả năng suy luận của LLM:
19
+
20
+ ### 1. OS Kernel (`.agents/AGENTS.md`)
21
+ The core of the system is a lightweight, heavily optimized OS Kernel that dictates agent behavior across all tasks.
22
+ - **Intent-Based Policies:** Skills are classified into 4 groups (Static Analysis, Development, Validation, Maintenance) rather than micromanaged with individual exceptions.
23
+ - **Progressive Evidence Collection:** Agents collect context incrementally (1 file → 3 files) and stop at a 80% Confidence Threshold, eliminating "hallucination loops".
24
+ - **Risk-based Verification:** Tests and builds are only run based on the risk level of the change, strictly guided by the Cost and Escalation policies.
25
+
26
+ ### 2. Core Templates (`templates/`)
27
+ Chứa các format báo cáo chuẩn (như `bug-report.md`, `feature-report.md`, `review-report.md`). AI không cần "học lại" cách viết báo cáo, giúp đầu ra luôn nhất quán 100%.
28
+
29
+ ### 3. Skill Definition (`skills/`)
30
+ Bộ 20+ kỹ năng (Skills) cốt lõi được cấu trúc siêu chuẩn xác với **Metadata 12 trường** (Version, Category, Pipeline, Allowed Tools...). Toàn bộ SOP (Standard Operating Procedure), Decision Tree và Constraints được viết 100% bằng Tiếng Anh để tối ưu hóa khả năng hiểu kỹ thuật của AI.
31
+
32
+ ### 4. Knowledge Library (`knowledge/`)
33
+ Tri thức chuyên sâu được tách rời hoàn toàn khỏi Prompt. Ví dụ: Kiến thức về React (`knowledge/frontend/react.md`) chỉ được gọi (On-demand RAG) khi AI thực sự làm việc với React.
34
+
35
+ ### 5. Output Format (Vietnamese Report)
36
+ Toàn bộ kết quả trả về cho bạn đều tuân thủ Output Policy: Báo cáo bằng Tiếng Việt, chia mục rõ ràng (Summary, Changes, Root Cause, Risks, Next Actions).
37
+
38
+ ---
39
+
40
+ ## 🧩 Danh sách 20+ Master Skills
41
+
42
+ Các skill được chia thành các nhóm (Category) rõ ràng:
43
+ - **Orchestration:** `qk-orchestrator`, `qk-context-loader`, `qk-policy-engine`, `qk-access-policy`
44
+ - **Engineering / Dev:** `qk-feature-delivery`, `qk-api-lifecycle`, `qk-data-lifecycle`, `qk-design-to-code`, `qk-ui-system-builder`
45
+ - **Validation & Standards:** `qk-validation-gate`, `qk-engineering-standard`, `qk-ui-audit`, `qk-project-health`, `qk-bug-resolution`
46
+ - **Ops & AI:** `qk-system-evolution`, `qk-production-release`, `qk-ai-builder`, `qk-project-bootstrap`
47
+ - **Docs & Utils:** `qk-docs`, `qk-documentation-system`, `qk-project-memory`, `qk-help`
48
+
49
+ ---
50
+
51
+ ## 🔄 Luồng Handoff Pipeline Khép Kín
52
+
53
+ Bất cứ một tính năng hay lỗi nào cũng được đi qua một đường ống khép kín (Abstract Pipeline):
54
+ ```text
55
+ analyze
56
+
57
+ implement
58
+
59
+ engineering-standard (Ép chuẩn Code, Naming, SOLID)
60
+
61
+ validate (Chạy Linter, Tests, Security Check)
62
+
63
+ complete (Tạo báo cáo bằng tiếng Việt)
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 💻 Cách Cài Đặt (Installation)
69
+
70
+ Sử dụng npm:
71
+ ```bash
72
+ npm i -g ai-developer-skill-os
73
+ ```
74
+ Hoặc sử dụng qua `npx`:
75
+ ```bash
76
+ npx ai-developer-skill-os init
77
+ ```
78
+
79
+ ## 🚀 Tra Cứu (Help)
80
+
81
+ Để tra cứu danh sách toàn bộ 20+ Kỹ năng và các mẹo sử dụng, hãy gọi:
82
+ ```bash
83
+ ./qk-help "Hiển thị tất cả các skill"
84
+ ```
@@ -0,0 +1,40 @@
1
+ # Project Governance
2
+
3
+ This document serves as the "Constitution" for the AI Developer Skill OS. It dictates how the project evolves, when core files can be modified, and how versions are incremented.
4
+
5
+ ## 1. Core Philosophy
6
+ **Architecture-first, features-second.**
7
+ Before submitting any Pull Request, ask yourself:
8
+ 1. *Does this change require modifying the OS Kernel (`AGENTS.md`)?*
9
+ 2. *If not, can this be solved at the Skill, Knowledge, or Template layer?*
10
+
11
+ If the problem can be solved in a Skill, Knowledge document, or Template, **do not touch the Kernel**.
12
+
13
+ ## 2. When to modify `AGENTS.md` (The Kernel)
14
+ The Kernel is **frozen**. Modifications to `AGENTS.md` are strictly prohibited unless:
15
+ - The change introduces a fundamentally new paradigm for ALL agents (e.g., a completely new approach to token management).
16
+ - A critical, framework-breaking hallucination loop is discovered that cannot be solved via Skill guidelines.
17
+ - **Requirement:** Any modification to `AGENTS.md` MUST be accompanied by a new Architecture Decision Record (ADR).
18
+
19
+ ## 3. When to create an ADR (Architecture Decision Record)
20
+ ADRs (located in `docs/adr/`) must be created when:
21
+ - Modifying `AGENTS.md` or `SPEC.md`.
22
+ - Introducing a new lifecycle phase to the pipeline.
23
+ - Deprecating an existing core feature or standard tool.
24
+
25
+ ## 4. Definition of a "Breaking Change"
26
+ A change is considered **Breaking** if it:
27
+ - Alters the required YAML frontmatter contract in `SPEC.md`.
28
+ - Changes the fundamental routing logic or expected `behavior` / `intent` mappings.
29
+ - Removes an existing global policy that downstream agents rely on.
30
+
31
+ ## 5. Versioning Strategy (Semantic Versioning)
32
+ We strictly adhere to SemVer based on the framework's architecture, not just content.
33
+ - **MAJOR (e.g., v4.0.0 to v5.0.0):** Breaking changes to the Kernel (`AGENTS.md`), Metadata Contract (`SPEC.md`), or fundamental routing.
34
+ - **MINOR (e.g., v4.0.0 to v4.1.0):** Adding new Capabilities, new default Skills, new Knowledge docs, or new Templates.
35
+ - **PATCH (e.g., v4.0.0 to v4.0.1):** Fixing typos in docs, updating README, or minor bug fixes within an individual skill's SOP.
36
+
37
+ ## 6. PR Review Process
38
+ 1. **Architecture Compliance:** Does the PR violate the Kernel Freeze? Are all skills compliant with `SPEC.md`?
39
+ 2. **Documentation Consistency:** Are the changes reflected in `CHANGELOG.md`?
40
+ 3. **No Redundancy:** Ensure the PR does not re-introduce tool usage rules or verification overrides into individual skills.
package/docs/SPEC.md ADDED
@@ -0,0 +1,37 @@
1
+ # AI Developer Skill OS - Specification (v4)
2
+
3
+ This document defines the strict contract and schema for developing Custom Skills in the AI Developer Skill OS. The metadata frontmatter is frozen to ensure cross-platform compatibility (Cursor, Claude Code, Windsurf, Gemini).
4
+
5
+ ## 1. Frontmatter Contract (YAML)
6
+
7
+ Every `SKILL.md` must begin with this exact YAML structure. Do not add, remove, or rename fields.
8
+
9
+ ```yaml
10
+ ---
11
+ name: qk-[skill-name]
12
+ version: X.Y.Z
13
+ updated: YYYY-MM-DD
14
+ description: Brief summary of what this skill accomplishes.
15
+ behavior: static-analysis | development | validation | maintenance
16
+ intent: review-code | fix-bug | implement-feature | validate | maintain
17
+ priority: low | medium | high | critical
18
+ tags: [tag1, tag2]
19
+ platforms: [claude-code, cursor, windsurf, gemini-cli]
20
+ trigger: Natural language phrase that activates this skill.
21
+ inputs: [Required inputs]
22
+ outputs: [Expected outputs]
23
+ allowed_tools: [Tool1, Tool2]
24
+ pipeline: [analyze, plan, implement, validate, complete]
25
+ ---
26
+ ```
27
+
28
+ ## 2. Skill Body Structure (Markdown)
29
+
30
+ The body of the `SKILL.md` file MUST contain the following sections:
31
+
32
+ 1. **Goal:** The core objective of the skill.
33
+ 2. **Chain of Thought (SOP):** The exact step-by-step reasoning the agent must follow.
34
+ 3. **Constraints & Rules:** Hard boundaries and limits for this specific skill.
35
+ 4. **Handoff Pipeline (Optional):** How this skill transitions to the next phase (e.g. passing to validation).
36
+
37
+ *Note: Skill documents MUST NOT declare Verification Levels or override Tool Efficiency policies. Those are exclusively managed by the Global Kernel (`AGENTS.md`).*
@@ -0,0 +1,19 @@
1
+ # 1. Intent-Based Architecture
2
+
3
+ Date: 2026-07-02
4
+
5
+ ## Status
6
+ Accepted
7
+
8
+ ## Context
9
+ As the framework grew from 5 to 20+ skills, managing individual tool permissions and specific verification overrides within each `SKILL.md` became a maintenance nightmare (violating DRY). Agents were also suffering from "context bloat" because they had to read sprawling, repetitive rules across different skills.
10
+
11
+ ## Decision
12
+ We transitioned from a "Rule-Based" architecture to an "Intent-Based" architecture.
13
+ - Skills no longer define their own verification exceptions or tool usage logic.
14
+ - Instead, skills declare their `behavior` and `intent` via frozen YAML metadata.
15
+ - The OS Kernel (`AGENTS.md`) intercepts these intents and automatically applies the correct global routing and execution constraints based on the categorized behavior.
16
+
17
+ ## Consequences
18
+ - **Positive:** Massive reduction in skill file size. Easier to scale to 100+ skills. Centralized logic in the Kernel. Agent routing is drastically improved due to clear `intent` mapping.
19
+ - **Negative:** Less granular control over unique outliers, but this enforces better standardization.
@@ -0,0 +1,21 @@
1
+ # 2. Kernel Freeze
2
+
3
+ Date: 2026-07-02
4
+
5
+ ## Status
6
+ Accepted
7
+
8
+ ## Context
9
+ The Global Policy file (`AGENTS.md`), which acts as the OS Kernel, was continuously expanding. Policies like Language, Decision, Engineering, Output, Tool Efficiency, Context Budget, and Escapation were all piled into a single document, threatening to balloon past 1,000 lines. A bloated kernel leads to Agent Hallucinations (due to context window pressure) and conflicting priorities.
10
+
11
+ ## Decision
12
+ We officially "Freeze" the Kernel (`AGENTS.md`) at v4.0.0. The file is strictly rewritten to under 100 lines using absolute Rules (MUST/MUST NOT) and Guidelines (Prefer/Avoid).
13
+ Moving forward, no new policies will be added to the Kernel. All future expansions must occur at the higher layers:
14
+ - New Capabilities
15
+ - New Skills
16
+ - New Knowledge documents
17
+ - New Templates
18
+
19
+ ## Consequences
20
+ - **Positive:** The baseline ruleset is locked, highly token-efficient, and easily digestible by any LLM. The framework achieves enterprise stability.
21
+ - **Negative:** Feature requests that require global policy shifts will be rejected by default unless they fundamentally rewrite the OS paradigm.
@@ -0,0 +1,20 @@
1
+ # 3. Risk-based Verification
2
+
3
+ Date: 2026-07-02
4
+
5
+ ## Status
6
+ Accepted
7
+
8
+ ## Context
9
+ Previously, Verification Levels were hardcoded into the Skill Classification (e.g., Development skills automatically forced Level 2 Verification, meaning test suites were run regardless of the actual change). This caused conflicting behavior. For example, fixing a typo in a comment using the `qk-bug-resolution` skill would still trigger a test run, wasting time and resources.
10
+
11
+ ## Decision
12
+ We completely decoupled Verification Levels from Skill Classifications.
13
+ Skills now only define their "Preferred Evidence Strategy". The actual depth of verification is determined strictly by the **Risk-based Verification Policy** in the Kernel (`AGENTS.md`).
14
+ - Level 0 (Low Risk): Comments, typos (Static Analysis only).
15
+ - Level 2 (Medium Risk): Logic changes (Targeted tests).
16
+ - Level 3 (High Risk): Auth, DB (Full validation).
17
+
18
+ ## Consequences
19
+ - **Positive:** Agents no longer blindly run tests for trivial changes. Verification scales with the danger of the code being modified, vastly improving speed and token efficiency.
20
+ - **Negative:** Agents must use logic to evaluate the "Risk" of their own changes before deciding whether to run a test.
@@ -0,0 +1,19 @@
1
+ # 4. Progressive Evidence Collection
2
+
3
+ Date: 2026-07-02
4
+
5
+ ## Status
6
+ Accepted
7
+
8
+ ## Context
9
+ AI Agents frequently fall into "hallucination loops" or "over-exploration loops", running commands like `ls`, `tree`, or reading entire project directories just to find one file. This burns through context windows rapidly and leads to poor reasoning.
10
+
11
+ ## Decision
12
+ We implemented a strict **Progressive Evidence Collection** pipeline inside the OS Kernel (`AGENTS.md`):
13
+ - **Context Budget:** Agents must start by reading 1 file, then 3 files, then a directory. They must never read the whole project unless explicitly required.
14
+ - **Sufficient Confidence:** Agents must stop collecting evidence the moment they reach an 80% confidence threshold to proceed.
15
+ - **Evidence Priority:** User input > Existing context > Source code > Types > Logs > Runtime > External knowledge.
16
+
17
+ ## Consequences
18
+ - **Positive:** Drastically reduced unnecessary `run_command` usage. Agents act much more like senior developers who pinpoint issues via stack traces instead of blindly searching the filesystem.
19
+ - **Negative:** Requires rigorous enforcement in the Kernel to prevent agents from falling back to old habits.
@@ -0,0 +1,25 @@
1
+ # Skill Classifications (Intent-Based Policies)
2
+
3
+ Skills are classified into behavioral groups that define their **Primary Objective** and **Preferred Evidence Strategy**.
4
+
5
+ *Note: Actual verification depth is NOT determined by the skill itself, but must strictly follow the **Risk-based Verification Policy** defined in `AGENTS.md`.*
6
+
7
+ ## 1. Static Analysis Skills
8
+ *e.g., Code Review, Project Health, Architecture, Documentation*
9
+ - **Primary Goal:** Audit, analyze, or document without altering system behavior.
10
+ - **Preferred Behavior:** Prefer static analysis (`read_file`, `grep_search`). Do not execute code or run test suites unless explicitly requested to validate the audit.
11
+
12
+ ## 2. Development Skills
13
+ *e.g., Feature Delivery, Refactor, Bug Resolution*
14
+ - **Primary Goal:** Modify existing behavior or implement new features safely.
15
+ - **Preferred Behavior:** Apply localized changes. Gather targeted evidence. Avoid speculative full-project validation; verify only what is affected.
16
+
17
+ ## 3. Validation Skills
18
+ *e.g., Validation Gate, CI Check, Release*
19
+ - **Primary Goal:** Ensure code quality, security, and build stability before release.
20
+ - **Preferred Behavior:** Exhaustive scanning. Running automated checks and full builds is encouraged to satisfy the validation gate.
21
+
22
+ ## 4. Maintenance Skills
23
+ *e.g., System Evolution, Dependency Update*
24
+ - **Primary Goal:** Upgrade system foundations safely with a rollback strategy.
25
+ - **Preferred Behavior:** Inspect changelogs and compatibility carefully before updating. Run full system verifications post-update to ensure stability.
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: nodejs-knowledge-base
3
+ domain: backend
4
+ tags: [nodejs, express, api, middleware]
5
+ priority: high
6
+ ---
7
+
8
+ # Node.js Backend Knowledge Base
9
+
10
+ ## Architecture Patterns
11
+ - **Controller Layer:** Handle HTTP requests/responses, input validation, delegate to Service
12
+ - **Service Layer:** Business logic, data transformation, transaction management
13
+ - **Repository Layer:** Direct database queries, ORM interactions
14
+ - **Middleware:** Auth guards, logging, rate limiting, error handling
15
+
16
+ ## Express Best Practices
17
+ ```ts
18
+ // Controller pattern - thin, delegates to service
19
+ export async function createUser(req: Request, res: Response) {
20
+ const result = await userService.create(req.body);
21
+ res.status(201).json(result);
22
+ }
23
+
24
+ // Service pattern - business logic
25
+ export async function create(userData: UserDto) {
26
+ // Validation
27
+ const validated = userSchema.parse(userData);
28
+ // Transaction
29
+ return db.user.create({ data: validated });
30
+ }
31
+
32
+ // Middleware pattern - reusable
33
+ export const requireAuth = (req: Request, res: Response, next: NextFunction) => {
34
+ const user = verifyToken(req.headers.authorization);
35
+ if (!user) return res.status(401).json({ error: 'Unauthorized' });
36
+ req.user = user;
37
+ next();
38
+ };
39
+ ```
40
+
41
+ ## Error Handling
42
+ - Never throw raw Errors. Use custom error classes.
43
+ - Always catch async errors in middleware.
44
+ - Return consistent error format: `{ error: string, code?: string }`
45
+
46
+ ## Security Checklist
47
+ - Use helmet middleware for security headers
48
+ - Validate all inputs with Zod/Joi
49
+ - Never commit .env files
50
+ - Use parameterized queries to prevent SQL injection
51
+ - Rate limit public endpoints
52
+ - Log security events (failed logins, permission denied)
@@ -0,0 +1,81 @@
1
+ ---
2
+ id: react-knowledge-base
3
+ domain: frontend
4
+ tags: [react, hooks, components, state]
5
+ priority: high
6
+ ---
7
+
8
+ # React Knowledge Base
9
+
10
+ ## State Management Rules
11
+ - Use `useState` for strictly local UI state (e.g., dropdown toggle).
12
+ - Use `useContext` or global stores (Zustand/Redux) when prop drilling exceeds 3 levels.
13
+ - Never store derived data in state. Compute it on the fly during render.
14
+ - Never store API responses in Redux if a Server State tool (React Query/SWR) is available.
15
+ - For forms: Use React Hook Form + Zod for validation, NOT useState for each field.
16
+
17
+ ## Hooks Best Practices
18
+ - **useEffect:** Avoid using `useEffect` for data transformation or syncing state. Only use it for actual side effects (subscriptions, API calls, manual DOM mutations).
19
+ - **useMemo / useCallback:** Only use when passing props to heavily memoized child components or when the computation is extremely expensive. Do not use them blindly.
20
+ - **Custom Hooks:** Extract complex logic out of UI components into custom hooks. Prefix them with `use` (e.g., `useUserAuth`).
21
+ - **Custom Hook Pattern:**
22
+ ```ts
23
+ // useApi.ts - Generic API hook
24
+ export function useApi<T>(url: string) {
25
+ const [data, setData] = useState<T | null>(null);
26
+ const [loading, setLoading] = useState(false);
27
+ const [error, setError] = useState<string | null>(null);
28
+
29
+ useEffect(() => {
30
+ fetchData();
31
+ }, [url]);
32
+ }
33
+ ```
34
+
35
+ ## Component Boundaries
36
+ - Follow Single Responsibility Principle. A component should either handle logic (Container) or handle rendering UI (Presentational), ideally not both if it's complex.
37
+ - Keep files under 300 lines. If a file is larger, break it down.
38
+ - **Component Hierarchy:**
39
+ - `components/shared/` - Reusable, no business logic
40
+ - `features/<domain>/components/` - Feature-specific components
41
+ - `layouts/` - Page layouts and wrappers
42
+
43
+ ## Performance Gotchas
44
+ - Stale Closures: Always include all reactive variables in the dependency array of `useEffect` or `useCallback`.
45
+ - Keys in Lists: Always use unique IDs for `key` props. Never use array indices unless the list is completely static.
46
+ - **Re-render Detection:**
47
+ ```ts
48
+ // Use console.log inside component to detect renders
49
+ // Wrap child in React.memo if unnecessary re-renders occur
50
+ export const MemoizedChild = React.memo(ChildComponent);
51
+ ```
52
+
53
+ ## Error Handling Patterns
54
+ ```ts
55
+ // API Error Boundary
56
+ class ErrorBoundary extends React.Component {
57
+ state = { hasError: false };
58
+ static getDerivedStateFromError() {
59
+ return { hasError: true };
60
+ }
61
+ }
62
+
63
+ // Hook error handling
64
+ const { data, error, isLoading } = useQuery(['key'], fetchFn);
65
+ if (error) return <ErrorMessage error={error} />;
66
+ if (isLoading) return <LoadingSpinner />;
67
+ ```
68
+
69
+ ## Testing Patterns
70
+ ```tsx
71
+ // Component test with React Testing Library
72
+ import { render, screen, waitFor } from '@testing-library/react';
73
+ import userEvent from '@testing-library/user-event';
74
+
75
+ test('handles user interaction', async () => {
76
+ render(<LoginForm />);
77
+ const button = screen.getByRole('button', { name: /login/i });
78
+ await userEvent.click(button);
79
+ await waitFor(() => expect(mockSubmit).toHaveBeenCalled());
80
+ });
81
+ ```