ai-developer-skill-os 5.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/_template/BEHAVIOR_SPEC.md +96 -0
- package/docs/GOVERNANCE.md +1 -1
- package/fix_seeds.js +22 -0
- package/framework/KERNEL.md +65 -40
- package/framework/decision-primitives.md +47 -0
- package/migrate-to-v6.js +130 -0
- package/migrate.js +147 -0
- package/migrate.py +133 -0
- package/migrate_all.cjs +96 -0
- package/package.json +2 -2
- package/skills/qk-access-policy/SKILL.md +18 -40
- package/skills/qk-ai-builder/SKILL.md +20 -40
- package/skills/qk-api-lifecycle/SKILL.md +22 -41
- package/skills/qk-bug-resolution/SKILL.md +22 -40
- package/skills/qk-context-loader/SKILL.md +19 -39
- package/skills/qk-data-lifecycle/SKILL.md +19 -40
- package/skills/qk-db-optimizer/SKILL.md +19 -40
- package/skills/qk-design-to-code/SKILL.md +20 -41
- package/skills/qk-docs/SKILL.md +20 -40
- package/skills/qk-engineering-standard/SKILL.md +21 -40
- package/skills/qk-feature-delivery/SKILL.md +22 -40
- package/skills/qk-help/SKILL.md +18 -36
- package/skills/qk-orchestrator/SKILL.md +18 -41
- package/skills/qk-policy-engine/SKILL.md +18 -38
- package/skills/qk-production-release/SKILL.md +18 -39
- package/skills/qk-project-bootstrap/SKILL.md +20 -41
- package/skills/qk-project-health/SKILL.md +20 -40
- package/skills/qk-project-memory/SKILL.md +19 -40
- package/skills/qk-system-evolution/SKILL.md +19 -40
- package/skills/qk-ui-audit/SKILL.md +19 -41
- package/skills/qk-ui-system-builder/SKILL.md +18 -39
- package/skills/qk-validation-gate/SKILL.md +20 -38
- package/specs/contracts/behavior-contract.yaml +40 -0
- package/specs/expectations/qk-bug-resolution.yaml +35 -0
- package/specs/scenarios/fix-login-nullref.yaml +3 -0
- package/tests/behavior-conformance.test.js +151 -0
- package/_template/SKILL.md +0 -58
- package/tests/spec-compliance.test.js +0 -193
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# 🚀 AI Developer Skill OS (ai-developer-skill-os)
|
|
1
|
+
# 🚀 AI Developer Skill OS (ai-developer-skill-os) v6.0
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **Rule-Skins v6 is a Behavior Specification Format (BSF), not a prompt library, not an agent framework, and not a programming language. It defines reusable behavioral contracts that can be interpreted by different AI runtimes while remaining implementation-agnostic.**
|
|
4
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, **
|
|
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, **Rule-Skins v6** được tái thiết kế hoàn toàn theo chuẩn **Behavior Specification Format**. Các hành vi (Behaviors) giờ đây là các bản Hợp đồng (Contracts) rõ ràng, bao gồm Policies, Capabilities, và Reasoning Boundaries.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,19 +10,19 @@ Thay vì cung cấp các "công cụ rời rạc" (Toolbox) hoặc những promp
|
|
|
10
10
|
|
|
11
11
|
Hệ thống được thiết kế decoupled hoàn hảo:
|
|
12
12
|
|
|
13
|
-
### 1.
|
|
14
|
-
Trái tim của hệ thống định nghĩa
|
|
13
|
+
### 1. BSF Kernel (`framework/KERNEL.md`)
|
|
14
|
+
Trái tim của hệ thống định nghĩa BSF Meta-Model, OS Policy (Invariants), Knowledge Layer, Validation Rules, và Design Principles.
|
|
15
15
|
|
|
16
16
|
### 2. Thư Viện Độc Lập (Library Modules)
|
|
17
|
-
- `framework/bias-library/`: Sửa các lỗi tư duy mặc định của AI
|
|
18
|
-
- `framework/dial-library/`: Định nghĩa các cấu hình điều khiển hành vi
|
|
17
|
+
- `framework/bias-library/`: Sửa các lỗi tư duy mặc định của AI.
|
|
18
|
+
- `framework/dial-library/`: Định nghĩa các cấu hình điều khiển hành vi.
|
|
19
19
|
- `framework/rule-library/`: Các tiêu chí xuất xưởng bắt buộc.
|
|
20
20
|
|
|
21
|
-
### 3.
|
|
22
|
-
Bộ 23
|
|
21
|
+
### 3. Behavior Specifications (`skills/`)
|
|
22
|
+
Bộ 23 Behavior cốt lõi được cấu trúc theo chuẩn BSF (`_template/BEHAVIOR_SPEC.md`). Toàn bộ logic nội bộ được quy hoạch thành các Contracts (Quyền hạn), Policies (Quyết định, Bằng chứng) và Protocol (State Machine tùy chọn).
|
|
23
23
|
|
|
24
24
|
### 4. Output Contract (Decision Summary)
|
|
25
|
-
Toàn bộ kết quả trả về cho bạn đều tuân thủ Output Contract: Báo cáo
|
|
25
|
+
Toàn bộ kết quả trả về cho bạn đều tuân thủ Output Contract: Báo cáo bằng Tiếng Việt, bảo đảm Invariants, và vượt qua các Quality Gates.
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qk-[tên-behavior]
|
|
3
|
+
version: 6.0.0
|
|
4
|
+
updated: 2026-07-10
|
|
5
|
+
description: Behavior Specification theo chuẩn BSF v6.0.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 📜 Behavior Specification: [Tên Behavior]
|
|
9
|
+
|
|
10
|
+
## 1. Behavior (Định danh Hành vi)
|
|
11
|
+
```yaml
|
|
12
|
+
Mission: [Mục tiêu tối thượng của hành vi này]
|
|
13
|
+
Authority: [Thẩm quyền tối đa được phép]
|
|
14
|
+
Responsibility: [Trách nhiệm cốt lõi]
|
|
15
|
+
Limitation: [Giới hạn tuyệt đối không được vượt qua]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 2. Contracts (Hợp đồng)
|
|
19
|
+
|
|
20
|
+
### 2.1. Capability Contract
|
|
21
|
+
```yaml
|
|
22
|
+
Can:
|
|
23
|
+
- [Hành động được phép: VD - read_docs, execute_tests]
|
|
24
|
+
Must:
|
|
25
|
+
- [Hành động bắt buộc: VD - verify assumptions before coding]
|
|
26
|
+
Cannot:
|
|
27
|
+
- [Hành động cấm: VD - invent API, drop database]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2.2. Output Contract
|
|
31
|
+
```yaml
|
|
32
|
+
Artifacts:
|
|
33
|
+
- [Artifact 1: VD - plan.md]
|
|
34
|
+
- [Artifact 2: VD - summary_report]
|
|
35
|
+
Completion: "Artifacts generated & Quality Gates passed."
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 3. Policies (Chính sách)
|
|
39
|
+
|
|
40
|
+
### 3.1. Context Policy
|
|
41
|
+
```yaml
|
|
42
|
+
Scope: [current_repo | whole_workspace | external_docs]
|
|
43
|
+
Priority:
|
|
44
|
+
1: Project Docs
|
|
45
|
+
2: Current Conversation
|
|
46
|
+
3: Source Code
|
|
47
|
+
Trust: "official docs > code > assumptions"
|
|
48
|
+
Fallback: ask_user
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3.2. Reasoning Boundary
|
|
52
|
+
```yaml
|
|
53
|
+
May infer: [VD: Variable naming, Local scope logic]
|
|
54
|
+
Must verify: [VD: Business logic, Auth rules]
|
|
55
|
+
Must ask: [VD: Missing edge cases, Vague requirements]
|
|
56
|
+
Must refuse: [VD: Unsafe assumptions, Security risks]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3.3. Decision Policy
|
|
60
|
+
```yaml
|
|
61
|
+
Priority:
|
|
62
|
+
1: correctness
|
|
63
|
+
2: safety
|
|
64
|
+
3: maintainability
|
|
65
|
+
4: performance
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3.4. Evidence Policy
|
|
69
|
+
```yaml
|
|
70
|
+
Accept: [logs, unit tests, profiling data]
|
|
71
|
+
Prefer: [official vendor docs, architecture repo docs]
|
|
72
|
+
Reject: [guess, outdated internet search, agent memory]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3.5. Escalation Policy
|
|
76
|
+
```yaml
|
|
77
|
+
Warning: [Cảnh báo rủi ro (VD: Rename file)]
|
|
78
|
+
Confirmation: [Cần user cho phép (VD: Override config)]
|
|
79
|
+
Stop: [Dừng ngay lập tức (VD: Đụng vào Auth, Permission Denied)]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 4. Protocol (Tùy chọn)
|
|
83
|
+
*(Chỉ sử dụng nếu behavior này yêu cầu quy trình nhiều bước (State Machine). Xóa phần này nếu không cần thiết).*
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
States:
|
|
87
|
+
- collect_context
|
|
88
|
+
- clarify
|
|
89
|
+
- execute
|
|
90
|
+
|
|
91
|
+
Transitions:
|
|
92
|
+
collect_context:
|
|
93
|
+
if context_missing: -> clarify
|
|
94
|
+
else: -> execute
|
|
95
|
+
# ... (Các rule chuyển trạng thái khác) ...
|
|
96
|
+
```
|
package/docs/GOVERNANCE.md
CHANGED
|
@@ -30,7 +30,7 @@ A change is considered **Breaking** if it:
|
|
|
30
30
|
|
|
31
31
|
## 5. Versioning Strategy (Semantic Versioning)
|
|
32
32
|
We strictly adhere to SemVer based on the framework's architecture, not just content.
|
|
33
|
-
- **MAJOR (e.g., v4.0.0 to
|
|
33
|
+
- **MAJOR (e.g., v4.0.0 to v6.0.0):** Breaking changes to the Kernel (`AGENTS.md`), Metadata Contract (`SPEC.md`), or fundamental routing.
|
|
34
34
|
- **MINOR (e.g., v4.0.0 to v4.1.0):** Adding new Capabilities, new default Skills, new Knowledge docs, or new Templates.
|
|
35
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
36
|
|
package/fix_seeds.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const yaml = require('js-yaml'); // Note: might not be installed
|
|
4
|
+
|
|
5
|
+
const skillsDir = 'd:\\ai-code-skin-mcp\\rules-skill\\skills';
|
|
6
|
+
const seeds = ['qk-bug-resolution', 'qk-feature-delivery', 'qk-access-policy', 'qk-engineering-standard', 'qk-context-loader', 'qk-orchestrator'];
|
|
7
|
+
|
|
8
|
+
seeds.forEach(seed => {
|
|
9
|
+
const specPath = path.join(skillsDir, seed, 'BEHAVIOR_SPEC.md');
|
|
10
|
+
const skillPath = path.join(skillsDir, seed, 'SKILL.md');
|
|
11
|
+
if (fs.existsSync(specPath)) {
|
|
12
|
+
const raw = fs.readFileSync(specPath, 'utf8');
|
|
13
|
+
// Using simple string parsing since js-yaml might not be available
|
|
14
|
+
let md = ---\nname: + seed + \nversion: 6.0.0\n---\n\n;
|
|
15
|
+
md += # + seed + \n\n;
|
|
16
|
+
md += This file follows the 6-Field Minimal Core v6 architecture.\n\n;
|
|
17
|
+
md += raw;
|
|
18
|
+
fs.writeFileSync(skillPath, md);
|
|
19
|
+
fs.unlinkSync(specPath);
|
|
20
|
+
console.log('Fixed', seed);
|
|
21
|
+
}
|
|
22
|
+
});
|
package/framework/KERNEL.md
CHANGED
|
@@ -1,58 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 📘 Behavior Specification Format (BSF) - Kernel v6.0
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Rule-Skins v6 is a Behavior Specification Format.**
|
|
4
|
+
> BSF không phải thư viện prompt, không phải agent framework.
|
|
5
|
+
> BSF định nghĩa **Behavioral Constraints** (Ràng buộc hành vi) thay vì cố gắng chỉ dạy AI "phải làm gì".
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
##
|
|
8
|
-
Triết lý vận hành chung cho mọi kỹ năng. Không được phép vi phạm.
|
|
9
|
-
1. **Minimal Change Policy:** Ưu tiên thay đổi nhỏ nhất an toàn. Cấm rewrite toàn bộ file, cấm reformat các file không liên quan.
|
|
10
|
-
2. **Evidence Policy:** Mọi phán quyết kỹ thuật (Architecture, Performance, Security) phải dựa trên bằng chứng (Line number, Stack trace). Không đoán mò.
|
|
11
|
-
3. **Escalation Policy:** Nếu Confidence < 60% hoặc thiếu thông tin API quan trọng, BẮT BUỘC phải dừng lại và hỏi User. Không tự phát minh yêu cầu.
|
|
12
|
-
4. **Reasoning Policy:** Ưu tiên tái sử dụng code cũ và pattern có sẵn. Luôn nêu rõ Trade-off (sự đánh đổi) khi đưa ra nhiều lựa chọn.
|
|
9
|
+
## 🧭 1. Kernel Principles (Nguyên tắc Hạt nhân)
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
Đây là 5 nguyên tắc tối thượng chi phối toàn bộ kiến trúc Rule-Skins v6.
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- `Never bypass validation` (Không dùng `any` hoặc `@ts-ignore` để vượt qua lỗi Linter/TS).
|
|
22
|
-
- `Never swallow errors` (Không bọc `try/catch` rỗng).
|
|
13
|
+
1. **Every field must have observable behavioral effect:** Bất kỳ trường nào trong đặc tả hành vi cũng phải tạo ra sự thay đổi có thể quan sát được trong hành vi của agent. Nếu không, nó là nhiễu (noise) và phải bị xóa.
|
|
14
|
+
2. **Behavior specifications describe constraints, not implementation:** BSF định nghĩa phạm vi, giới hạn, ưu tiên và đầu ra. Cách suy luận và lên kế hoạch được nhường lại cho LLM tự tối ưu.
|
|
15
|
+
3. **Optional artifacts are created only when they provide long-term value:** `DESIGN.md`, `RATIONALE.md` hay thư mục `specs/` chỉ được tạo ra khi độ phức tạp của hành vi đòi hỏi. Đừng tạo các file/thư mục rỗng.
|
|
16
|
+
4. **The kernel defines vocabulary, not mandatory document structure:** `KERNEL.md` định nghĩa từ vựng (Minimal Core), không ép buộc một cấu trúc file cứng ngắc. Skill nào cần trường nào thì dùng trường đó.
|
|
17
|
+
5. **Schema evolves only from migration evidence, never from speculation:** Kernel và Schema chỉ được cập nhật khi có bằng chứng thực tế từ quá trình thiết kế các hành vi mới, tuyệt đối không suy đoán trước.
|
|
23
18
|
|
|
24
19
|
---
|
|
25
20
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
## 💎 2. Minimal Core Vocabulary
|
|
22
|
+
|
|
23
|
+
Thay vì một schema cố định, BSF cung cấp bộ từ vựng lõi. Mỗi `BEHAVIOR_SPEC.md` có thể chọn lọc sử dụng:
|
|
24
|
+
|
|
25
|
+
- **`metadata`**: Định danh phục vụ tooling, con người và registry.
|
|
26
|
+
- **`scope`**: Thiết lập ranh giới (Ví dụ: "Existing defects only" để ngăn AI code thêm tính năng mới).
|
|
27
|
+
- **`constraints`**: Chứa các semantic rules `must` và `must_not` (Các ràng buộc bắt buộc tuân thủ).
|
|
28
|
+
- **`policies`**: Chứa các `prefer` và `trade-offs` (Hướng dẫn AI chọn đường đi khi có nhiều lựa chọn hợp lệ).
|
|
29
|
+
- **`escalation`**: Kích hoạt điều kiện "Dừng và Hỏi" hoặc "Từ chối".
|
|
30
|
+
- **`output`**: Quy định định dạng artifact phải trả về.
|
|
30
31
|
|
|
31
32
|
---
|
|
32
33
|
|
|
33
|
-
##
|
|
34
|
-
Mỗi Skill sẽ khai báo sử dụng các Capability (Năng lực) sau đây:
|
|
35
|
-
- `inference`: Đọc ngữ cảnh (Risk, Scale, Intent).
|
|
36
|
-
- `planning`: Lập kế hoạch từng bước ngắn gọn.
|
|
37
|
-
- `delegation`: Ủy quyền cho Sub-Skill khác.
|
|
38
|
-
- `execution`: Trực tiếp chỉnh sửa mã nguồn/chạy lệnh.
|
|
39
|
-
- `bias-review`: Kiểm điểm lại kết quả bằng cách chạy các file cấu hình trong `bias-library`.
|
|
40
|
-
- `ship-check`: Kiểm định các điều kiện hoàn thành trong `rule-library`.
|
|
34
|
+
## 🛡️ 3. OS-Level Invariants (Luật Bất biến)
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
Dưới đây là các ràng buộc áp dụng cho mọi skill mà không cần khai báo lại:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
OS_Invariants:
|
|
40
|
+
Security:
|
|
41
|
+
never:
|
|
42
|
+
- guess_passwords
|
|
43
|
+
- hardcode_secrets
|
|
44
|
+
- bypass_auth
|
|
45
|
+
UX_Interaction:
|
|
46
|
+
never:
|
|
47
|
+
- expose_internal_contract
|
|
48
|
+
- expose_internal_policy
|
|
49
|
+
- expose_internal_reasoning
|
|
50
|
+
- quote_yaml_sections
|
|
51
|
+
must:
|
|
52
|
+
- communicate_like_senior_engineer
|
|
53
|
+
- ask_only_necessary_questions
|
|
54
|
+
- explain_decisions_in_user_language
|
|
55
|
+
```
|
|
43
56
|
|
|
44
57
|
---
|
|
45
58
|
|
|
46
|
-
##
|
|
47
|
-
Đầu ra (Output) cuối cùng BẮT BUỘC phải tuân thủ format `Decision Summary` dưới dạng YAML hoặc Markdown gãy gọn:
|
|
59
|
+
## 📁 4. Kiến trúc Thư mục (v6)
|
|
48
60
|
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
```text
|
|
62
|
+
rules-skill/
|
|
63
|
+
├── framework/
|
|
64
|
+
│ ├── KERNEL.md (Bộ luật lõi)
|
|
65
|
+
│ └── behavior-patterns.md (Lưu trữ các mẫu hành vi nguyên thủy)
|
|
66
|
+
└── skills/ (Tập hợp các Behavior Specification)
|
|
67
|
+
├── qk-help/
|
|
68
|
+
│ └── BEHAVIOR_SPEC.md (Skill đơn giản chỉ cần 1 file)
|
|
69
|
+
└── qk-bug-resolution/
|
|
70
|
+
├── BEHAVIOR_SPEC.md
|
|
71
|
+
├── RATIONALE.md (Lưu trữ tri thức thiết kế)
|
|
72
|
+
└── specs/ (Kịch bản kiểm chứng tự đóng gói)
|
|
73
|
+
└── login-failed.yaml
|
|
57
74
|
```
|
|
58
|
-
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🚀 5. Definition of Done (Cho một Skill)
|
|
79
|
+
|
|
80
|
+
Một skill được xem là đã hoàn thành quy trình BSF v6 khi:
|
|
81
|
+
1. Có `BEHAVIOR_SPEC.md` với các trường có tác động hành vi rõ rệt.
|
|
82
|
+
2. Nếu phức tạp, có thêm `RATIONALE.md` giải thích lý do thiết kế.
|
|
83
|
+
3. Nếu cần test, có các file `.yaml` chứa kịch bản và kỳ vọng khép kín trong `specs/`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 🧩 Bảng Tuần Hoàn: Decision Primitives (v6.0)
|
|
2
|
+
|
|
3
|
+
Rule-Skins v6 không coi các Agent là những "con người ảo" (Personas), mà coi chúng là những **Cỗ máy Ra Quyết định (Decision Engines)**.
|
|
4
|
+
Mọi hành vi phức tạp của bất kỳ Agent nào trong hệ thống đều được cấu thành từ sự lắp ghép của **6 Decision Primitives** cốt lõi dưới đây.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. 🧲 Collect (Thu thập)
|
|
9
|
+
- **Bản chất:** Đi tìm kiếm thông tin, tải bối cảnh từ bên ngoài vào bộ nhớ.
|
|
10
|
+
- **Trigger:** Thiếu context hoặc nhận một task yêu cầu đọc dữ liệu.
|
|
11
|
+
- **Evidence Required:** Quyền truy cập repository, cấu trúc file, URL.
|
|
12
|
+
- **Ví dụ Skills:** `qk-context-loader`, bước đầu của `qk-bug-resolution`.
|
|
13
|
+
|
|
14
|
+
## 2. 🩺 Diagnose (Chẩn đoán)
|
|
15
|
+
- **Bản chất:** Phân tích một triệu chứng (symptom) dựa trên bằng chứng để tìm ra nguyên nhân gốc rễ (root cause).
|
|
16
|
+
- **Trigger:** Có lỗi (Bug report, error log, test failure).
|
|
17
|
+
- **Evidence Required:** Stack trace, logs, test output.
|
|
18
|
+
- **Ví dụ Skills:** `qk-bug-resolution`, `qk-project-health`.
|
|
19
|
+
|
|
20
|
+
## 3. 🗺️ Plan (Lập Kế hoạch)
|
|
21
|
+
- **Bản chất:** Vạch ra một lộ trình các bước cần làm trước khi trực tiếp nhúng tay vào việc.
|
|
22
|
+
- **Trigger:** Yêu cầu một tính năng mới hoặc một nhiệm vụ quá phức tạp để làm một bước.
|
|
23
|
+
- **Evidence Required:** Yêu cầu (Requirements), Specs, Architecture.
|
|
24
|
+
- **Ví dụ Skills:** `qk-feature-delivery`, `qk-api-lifecycle`.
|
|
25
|
+
|
|
26
|
+
## 4. ⚖️ Evaluate (Đánh giá)
|
|
27
|
+
- **Bản chất:** Đối chiếu một sản phẩm (artifact) có sẵn với một tiêu chuẩn (standard/policy) để đưa ra phán quyết (Pass/Fail) hoặc gợi ý sửa đổi.
|
|
28
|
+
- **Trigger:** Một đoạn code mới, một bản thiết kế, một PR.
|
|
29
|
+
- **Evidence Required:** Artifact cần review, Guidelines, Linter rules.
|
|
30
|
+
- **Ví dụ Skills:** `qk-engineering-standard`, `qk-validation-gate`, `qk-ui-audit`.
|
|
31
|
+
|
|
32
|
+
## 5. 🛠️ Execute (Thực thi)
|
|
33
|
+
- **Bản chất:** Trực tiếp sửa đổi trạng thái hệ thống (viết code, xóa file, sửa file).
|
|
34
|
+
- **Trigger:** Đã có kế hoạch rõ ràng hoặc đã xác định xong lỗi.
|
|
35
|
+
- **Evidence Required:** Codebase hiện tại, Kế hoạch.
|
|
36
|
+
- **Ví dụ Skills:** `qk-feature-delivery` (bước sau), `qk-design-to-code`.
|
|
37
|
+
|
|
38
|
+
## 6. 🚦 Delegate / Govern (Điều phối / Quản trị)
|
|
39
|
+
- **Bản chất:** Không trực tiếp làm việc, mà làm nhiệm vụ định tuyến (routing) công việc cho Agent khác hoặc kiểm soát quyền (deny/allow) dựa trên luật lệ.
|
|
40
|
+
- **Trigger:** Nhận task không thuộc chuyên môn, hoặc nhận yêu cầu xác thực quyền hạn.
|
|
41
|
+
- **Evidence Required:** Danh sách các Skills khác, Policies (RBAC/ABAC).
|
|
42
|
+
- **Ví dụ Skills:** `qk-orchestrator`, `qk-access-policy`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
> **Nguyên tắc Thiết kế Hệ thống:**
|
|
47
|
+
> Khi tạo một Skill mới, đừng cố gắng mô tả "tính cách" của nó. Hãy tự hỏi: *Nó cần dùng những Primitives nào để hoàn thành nhiệm vụ?*
|
package/migrate-to-v6.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const skillsDir = path.join(__dirname, 'skills');
|
|
4
|
+
|
|
5
|
+
function convertToBSF(content, name) {
|
|
6
|
+
// Extract Frontmatter
|
|
7
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
8
|
+
const fm = fmMatch ? fmMatch[1] : '';
|
|
9
|
+
|
|
10
|
+
// Create v6 Frontmatter
|
|
11
|
+
let newFm = '---\n';
|
|
12
|
+
newFm += fm.split('\n').filter(line => {
|
|
13
|
+
return !line.startsWith('behavior:') &&
|
|
14
|
+
!line.startsWith('intent:') &&
|
|
15
|
+
!line.startsWith('priority:') &&
|
|
16
|
+
!line.startsWith('trigger:') &&
|
|
17
|
+
!line.startsWith('inputs:') &&
|
|
18
|
+
!line.startsWith('outputs:') &&
|
|
19
|
+
!line.startsWith('allowed_tools:') &&
|
|
20
|
+
!line.startsWith('pipeline:');
|
|
21
|
+
}).join('\n');
|
|
22
|
+
newFm += '\n---';
|
|
23
|
+
|
|
24
|
+
const missionMatch = content.match(/## ?? Mission \(Scope\)\n([\s\S]*?)(?=\n## |\n---|$)/);
|
|
25
|
+
const missionText = missionMatch ? missionMatch[1].trim() : 'Define mission here';
|
|
26
|
+
|
|
27
|
+
const bsf = \\
|
|
28
|
+
|
|
29
|
+
# ?? Behavior Specification: \
|
|
30
|
+
|
|
31
|
+
## 1. Behavior (�?nh danh H�nh vi)
|
|
32
|
+
\\\yaml
|
|
33
|
+
Mission: "Th?c thi nhi?m v? c?t l�i theo chu?n v6."
|
|
34
|
+
Authority: "�u?c quy?n y�u c?u th�m th�ng tin n?u thi?u."
|
|
35
|
+
Responsibility: "B?o d?m ch?t lu?ng d?u ra."
|
|
36
|
+
Limitation: "Kh�ng vi ph?m Invariants c?a h? th?ng."
|
|
37
|
+
\\\
|
|
38
|
+
|
|
39
|
+
## 2. Contracts (H?p d?ng)
|
|
40
|
+
|
|
41
|
+
### 2.1. Capability Contract
|
|
42
|
+
\\\yaml
|
|
43
|
+
Can:
|
|
44
|
+
- read_code
|
|
45
|
+
- execute_tests
|
|
46
|
+
Must:
|
|
47
|
+
- verify_assumptions_before_coding
|
|
48
|
+
Cannot:
|
|
49
|
+
- execute_destructive_commands
|
|
50
|
+
\\\
|
|
51
|
+
|
|
52
|
+
### 2.2. Output Contract
|
|
53
|
+
\\\yaml
|
|
54
|
+
Artifacts:
|
|
55
|
+
- summary_report
|
|
56
|
+
Completion: "Artifacts generated & Quality Gates passed."
|
|
57
|
+
\\\
|
|
58
|
+
|
|
59
|
+
## 3. Policies (Ch�nh s�ch)
|
|
60
|
+
|
|
61
|
+
### 3.1. Context Policy
|
|
62
|
+
\\\yaml
|
|
63
|
+
Scope: current_repo
|
|
64
|
+
Priority:
|
|
65
|
+
1: Project Docs
|
|
66
|
+
2: Current Conversation
|
|
67
|
+
Trust: "official docs > code > assumptions"
|
|
68
|
+
Fallback: ask_user
|
|
69
|
+
\\\
|
|
70
|
+
|
|
71
|
+
### 3.2. Reasoning Boundary
|
|
72
|
+
\\\yaml
|
|
73
|
+
May infer: "Bi?n s? c?c b?"
|
|
74
|
+
Must verify: "Logic nghi?p v?"
|
|
75
|
+
Must ask: "Y�u c?u m?p m?"
|
|
76
|
+
Must refuse: "R?i ro b?o m?t"
|
|
77
|
+
\\\
|
|
78
|
+
|
|
79
|
+
### 3.3. Decision Policy
|
|
80
|
+
\\\yaml
|
|
81
|
+
Priority:
|
|
82
|
+
1: correctness
|
|
83
|
+
2: safety
|
|
84
|
+
3: maintainability
|
|
85
|
+
\\\
|
|
86
|
+
|
|
87
|
+
### 3.4. Evidence Policy
|
|
88
|
+
\\\yaml
|
|
89
|
+
Accept: [logs, unit tests]
|
|
90
|
+
Prefer: [official vendor docs]
|
|
91
|
+
Reject: [guesswork]
|
|
92
|
+
\\\
|
|
93
|
+
|
|
94
|
+
### 3.5. Escalation Policy
|
|
95
|
+
\\\yaml
|
|
96
|
+
Warning: "Thay d?i c?u tr�c"
|
|
97
|
+
Confirmation: "X�a file"
|
|
98
|
+
Stop: "L?i Permission"
|
|
99
|
+
\\\
|
|
100
|
+
|
|
101
|
+
## 4. Protocol (T�y ch?n)
|
|
102
|
+
|
|
103
|
+
\\\yaml
|
|
104
|
+
States:
|
|
105
|
+
- collect_context
|
|
106
|
+
- execute
|
|
107
|
+
|
|
108
|
+
Transitions:
|
|
109
|
+
collect_context:
|
|
110
|
+
if context_missing: -> Stop
|
|
111
|
+
else: -> execute
|
|
112
|
+
execute: -> Done
|
|
113
|
+
\\\
|
|
114
|
+
\;
|
|
115
|
+
return bsf.replace(/\n\n\n/g, '\n\n');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fs.readdirSync(skillsDir).forEach(dir => {
|
|
119
|
+
const fullPath = path.join(skillsDir, dir);
|
|
120
|
+
if (fs.statSync(fullPath).isDirectory() && !dir.startsWith('_archive')) {
|
|
121
|
+
const skillPath = path.join(fullPath, 'SKILL.md');
|
|
122
|
+
if (fs.existsSync(skillPath)) {
|
|
123
|
+
if (dir === 'qk-bug-resolution') return; // already done
|
|
124
|
+
const content = fs.readFileSync(skillPath, 'utf8');
|
|
125
|
+
const newContent = convertToBSF(content, dir);
|
|
126
|
+
fs.writeFileSync(skillPath, newContent);
|
|
127
|
+
console.log('Converted ' + dir);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
package/migrate.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const skillsDir = path.join(__dirname, 'skills');
|
|
4
|
+
|
|
5
|
+
function migrateSkill(skillDir) {
|
|
6
|
+
const filePath = path.join(skillsDir, skillDir, 'SKILL.md');
|
|
7
|
+
if (!fs.existsSync(filePath)) return;
|
|
8
|
+
|
|
9
|
+
if (skillDir === 'qk-bug-resolution') return; // Skip already migrated
|
|
10
|
+
|
|
11
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
12
|
+
|
|
13
|
+
// Parse Frontmatter
|
|
14
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
15
|
+
if (!fmMatch) return;
|
|
16
|
+
let frontmatter = fmMatch[1];
|
|
17
|
+
|
|
18
|
+
// Filter old fields
|
|
19
|
+
const validFields = [];
|
|
20
|
+
const lines = frontmatter.split('\n');
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
if (!line.startsWith('behavior:') && !line.startsWith('intent:') && !line.startsWith('priority:') && !line.startsWith('trigger:') && !line.startsWith('inputs:') && !line.startsWith('outputs:') && !line.startsWith('allowed_tools:') && !line.startsWith('pipeline:')) {
|
|
23
|
+
validFields.push(line.replace(/v5\.0/g, 'v6.0'));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const newFm = '---\n' + validFields.join('\n') + '\n---';
|
|
27
|
+
|
|
28
|
+
// Parse Mission
|
|
29
|
+
let mission = 'Th?c thi nhi?m v? c?t l�i.';
|
|
30
|
+
let limitation = 'Kh�ng vi ph?m Invariants c?a h? th?ng.';
|
|
31
|
+
|
|
32
|
+
const missionSection = content.match(/## ?? Mission \(Scope\)[\s\S]*?(?=## |---|$)/);
|
|
33
|
+
if (missionSection) {
|
|
34
|
+
const missionLines = missionSection[0].split('\n');
|
|
35
|
+
const posLines = missionLines.filter(l => l.includes('- ?')).map(l => l.replace('- ?', '').trim());
|
|
36
|
+
const negLines = missionLines.filter(l => l.includes('- ?')).map(l => l.replace('- ?', '').trim());
|
|
37
|
+
|
|
38
|
+
if (posLines.length > 0) mission = posLines.join(' ');
|
|
39
|
+
if (negLines.length > 0) limitation = negLines.join(' ');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Parse Biases (Map to Reasoning Boundary - Must refuse)
|
|
43
|
+
const biasesMatch = content.match(/Biases:[\s\S]*?(?=---|$)/);
|
|
44
|
+
let refuses = [];
|
|
45
|
+
if (biasesMatch) {
|
|
46
|
+
const biasLines = biasesMatch[0].split('\n').filter(l => l.includes('- id:'));
|
|
47
|
+
refuses = biasLines.map(l => l.replace('- id:', '').trim());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Parse Dials (Map to Context Policy / Reasoning)
|
|
51
|
+
const dialsMatch = content.match(/Dials:[\s\S]*?(?=---|$)/);
|
|
52
|
+
let asks = [];
|
|
53
|
+
if (dialsMatch) {
|
|
54
|
+
const dialLines = dialsMatch[0].split('\n').filter(l => l.includes('- id:'));
|
|
55
|
+
asks = dialLines.map(l => l.replace('- id:', '').trim());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Generate BSF content
|
|
59
|
+
const bsfContent = \\
|
|
60
|
+
|
|
61
|
+
# ?? Behavior Specification: \
|
|
62
|
+
|
|
63
|
+
## 1. Behavior (�?nh danh H�nh vi)
|
|
64
|
+
\\\yaml
|
|
65
|
+
Mission: "\"
|
|
66
|
+
Authority: "�u?c quy?n th?c thi c�c t�c v? trong ph?m vi \."
|
|
67
|
+
Responsibility: "B?o d?m ch?t lu?ng d?u ra v� tu�n th? chu?n h? th?ng."
|
|
68
|
+
Limitation: "\"
|
|
69
|
+
\\\
|
|
70
|
+
|
|
71
|
+
## 2. Contracts (H?p d?ng)
|
|
72
|
+
|
|
73
|
+
### 2.1. Capability Contract
|
|
74
|
+
\\\yaml
|
|
75
|
+
Can:
|
|
76
|
+
- read_code
|
|
77
|
+
- execute_tests
|
|
78
|
+
- modify_code
|
|
79
|
+
Must:
|
|
80
|
+
- verify_assumptions_before_coding
|
|
81
|
+
Cannot:
|
|
82
|
+
- execute_destructive_commands
|
|
83
|
+
- bypass_validation
|
|
84
|
+
\\\
|
|
85
|
+
|
|
86
|
+
### 2.2. Output Contract
|
|
87
|
+
\\\yaml
|
|
88
|
+
Artifacts:
|
|
89
|
+
- summary_report: "Decision Summary gi?i th�ch Context, Quy?t d?nh v� Trade-offs."
|
|
90
|
+
Completion: "Nhi?m v? ho�n th�nh & Quality Gates passed."
|
|
91
|
+
\\\
|
|
92
|
+
|
|
93
|
+
## 3. Policies (Ch�nh s�ch)
|
|
94
|
+
|
|
95
|
+
### 3.1. Context Policy
|
|
96
|
+
\\\yaml
|
|
97
|
+
Scope: current_repo
|
|
98
|
+
Priority:
|
|
99
|
+
1: Project Docs
|
|
100
|
+
2: Current Conversation
|
|
101
|
+
3: Source Code
|
|
102
|
+
Trust: "official docs > code > assumptions"
|
|
103
|
+
Fallback: ask_user
|
|
104
|
+
\\\
|
|
105
|
+
|
|
106
|
+
### 3.2. Reasoning Boundary
|
|
107
|
+
\\\yaml
|
|
108
|
+
May infer: "Bi?n s? c?c b?, logic n?i b? kh�ng ?nh hu?ng h? th?ng."
|
|
109
|
+
Must verify: "T�c d?ng d?n c�c module kh�c."
|
|
110
|
+
Must ask: "\"
|
|
111
|
+
Must refuse: "\"
|
|
112
|
+
\\\
|
|
113
|
+
|
|
114
|
+
### 3.3. Decision Policy
|
|
115
|
+
\\\yaml
|
|
116
|
+
Priority:
|
|
117
|
+
1: correctness
|
|
118
|
+
2: safety
|
|
119
|
+
3: maintainability
|
|
120
|
+
4: performance
|
|
121
|
+
\\\
|
|
122
|
+
|
|
123
|
+
### 3.4. Evidence Policy
|
|
124
|
+
\\\yaml
|
|
125
|
+
Accept: [logs, unit tests, official docs]
|
|
126
|
+
Prefer: [unit tests, CI results]
|
|
127
|
+
Reject: [guesswork, outdated internet search]
|
|
128
|
+
\\\
|
|
129
|
+
|
|
130
|
+
### 3.5. Escalation Policy
|
|
131
|
+
\\\yaml
|
|
132
|
+
Warning: "Thay d?i c?u tr�c ho?c public API"
|
|
133
|
+
Confirmation: "Override config ho?c x�a file quan tr?ng"
|
|
134
|
+
Stop: "L?i Permission ho?c xung d?t Invariants"
|
|
135
|
+
\\\
|
|
136
|
+
\;
|
|
137
|
+
|
|
138
|
+
fs.writeFileSync(filePath, bsfContent);
|
|
139
|
+
console.log('Migrated ' + skillDir);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const dirs = fs.readdirSync(skillsDir);
|
|
143
|
+
for (const dir of dirs) {
|
|
144
|
+
if (fs.statSync(path.join(skillsDir, dir)).isDirectory() && !dir.startsWith('_')) {
|
|
145
|
+
migrateSkill(dir);
|
|
146
|
+
}
|
|
147
|
+
}
|