@ngockhoale/ukit 1.6.8 → 2.0.2
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/CHANGELOG.md +43 -0
- package/manifests/platform.full.yaml +47 -0
- package/package.json +2 -1
- package/scripts/skill/audit-skill.mjs +39 -0
- package/src/cli/commands/doctor.js +22 -2
- package/src/cli/commands/memory.js +76 -1
- package/src/core/memory/store.js +125 -1
- package/src/core/skillProfile.js +45 -0
- package/src/skill/auditSkill.js +99 -0
- package/templates/.claude/agents/code-reviewer.md +51 -7
- package/templates/.claude/agents/handoff-planner.md +18 -2
- package/templates/.claude/hooks/context-hardcap-gate.sh +102 -0
- package/templates/.claude/hooks/reset-compact-pressure.sh +25 -0
- package/templates/.claude/settings.json +15 -0
- package/templates/.claude/skills/canvas-design/SKILL.md +2 -20
- package/templates/.claude/skills/canvas-design/philosophy-examples.md +23 -0
- package/templates/.claude/skills/debugging-toolkit/SKILL.md +2 -30
- package/templates/.claude/skills/debugging-toolkit/reference-tables.md +33 -0
- package/templates/.claude/skills/docs-manager/SKILL.md +7 -249
- package/templates/.claude/skills/docs-manager/conventions-and-examples.md +221 -0
- package/templates/.claude/skills/docx/SKILL.md +3 -34
- package/templates/.claude/skills/docx/redlining-reference.md +34 -0
- package/templates/.claude/skills/duraone/SKILL.md +12 -16
- package/templates/.claude/skills/executing-plans/SKILL.md +31 -19
- package/templates/.claude/skills/file-organizer/SKILL.md +2 -170
- package/templates/.claude/skills/file-organizer/examples-and-practices.md +173 -0
- package/templates/.claude/skills/pdf/SKILL.md +1 -62
- package/templates/.claude/skills/pdf/reference.md +65 -0
- package/templates/.claude/skills/pdf-processing-pro/SKILL.md +2 -73
- package/templates/.claude/skills/pdf-processing-pro/workflows-and-troubleshooting.md +80 -0
- package/templates/.claude/skills/pptx/SKILL.md +14 -286
- package/templates/.claude/skills/pptx/design-references.md +81 -0
- package/templates/.claude/skills/pptx/template-replacement-reference.md +150 -0
- package/templates/.claude/skills/pptx/utilities.md +62 -0
- package/templates/.claude/skills/project-learning/SKILL.md +32 -0
- package/templates/.claude/skills/root-cause-tracing/SKILL.md +2 -35
- package/templates/.claude/skills/root-cause-tracing/diagrams.md +44 -0
- package/templates/.claude/skills/sharing-skills/SKILL.md +1 -41
- package/templates/.claude/skills/sharing-skills/complete-example.md +41 -0
- package/templates/.claude/skills/skill-quality/SKILL.md +37 -0
- package/templates/.claude/skills/skill-quality/pressure-scenario-template.md +20 -0
- package/templates/.claude/skills/skill-quality/rationalization-table-template.md +15 -0
- package/templates/.claude/skills/skill-quality/trigger-accuracy-template.md +32 -0
- package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +13 -440
- package/templates/.claude/skills/sql-optimization-patterns/references/advanced-techniques.md +128 -0
- package/templates/.claude/skills/sql-optimization-patterns/references/core-concepts.md +112 -0
- package/templates/.claude/skills/sql-optimization-patterns/references/query-patterns.md +204 -0
- package/templates/.claude/skills/subagent-driven-development/SKILL.md +4 -51
- package/templates/.claude/skills/subagent-driven-development/example-workflow.md +40 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +2 -28
- package/templates/.claude/skills/systematic-debugging/reference-tables.md +33 -0
- package/templates/.claude/skills/test-driven-development/SKILL.md +2 -51
- package/templates/.claude/skills/test-driven-development/reference-tables.md +56 -0
- package/templates/.claude/skills/testing-anti-patterns/SKILL.md +1 -10
- package/templates/.claude/skills/testing-anti-patterns/reference-tables.md +14 -0
- package/templates/.claude/skills/verification-before-completion/SKILL.md +1 -31
- package/templates/.claude/skills/verification-before-completion/key-patterns.md +33 -0
- package/templates/.claude/ukit/runtime/compact-threshold.mjs +28 -0
- package/templates/.claude/ukit/runtime/reinject-context.mjs +14 -1
- package/templates/CLAUDE.md +4 -0
- package/templates/ukit/storage/config.json +4 -0
- package/src/core/memory/index.js +0 -2
- package/src/core/router/index.js +0 -2
- package/src/core/validation/index.js +0 -2
|
@@ -20,63 +20,7 @@ AI agent NÊN dùng skill này khi:
|
|
|
20
20
|
|
|
21
21
|
## Documentation Structure
|
|
22
22
|
|
|
23
|
-
Mọi project sử dụng skill này PHẢI có folder `docs/`
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
docs/
|
|
27
|
-
├── README.md # 🎯 BẮT ĐẦU TẠI ĐÂY - Navigation hub
|
|
28
|
-
├── project.md # 📋 Project overview
|
|
29
|
-
├── memory.md # 🧠 Decisions & context log
|
|
30
|
-
│
|
|
31
|
-
├── architecture/ # 🏗️ System design
|
|
32
|
-
│ ├── overview.md # Architecture tổng quan
|
|
33
|
-
│ ├── tech-stack.md # Technologies sử dụng
|
|
34
|
-
│ ├── data-model.md # Database schema
|
|
35
|
-
│ ├── api-design.md # API specifications
|
|
36
|
-
│ └── deployment.md # Infrastructure
|
|
37
|
-
│
|
|
38
|
-
├── agents/ # 🤖 Multi-agent coordination
|
|
39
|
-
│ ├── agent-roles.md # Vai trò từng agent
|
|
40
|
-
│ ├── orchestration.md # Flow điều phối
|
|
41
|
-
│ ├── prompts/ # System prompts
|
|
42
|
-
│ │ ├── architect.md
|
|
43
|
-
│ │ ├── coder.md
|
|
44
|
-
│ │ ├── debugger.md
|
|
45
|
-
│ │ └── orchestrator.md
|
|
46
|
-
│ └── handoff-rules.md # Quy tắc chuyển giao
|
|
47
|
-
│
|
|
48
|
-
├── standards/ # 📏 Coding standards
|
|
49
|
-
│ ├── coding-conventions.md # Code style
|
|
50
|
-
│ ├── commit-conventions.md # Git conventions
|
|
51
|
-
│ ├── file-structure.md # File organization
|
|
52
|
-
│ ├── error-handling.md # Error handling
|
|
53
|
-
│ └── security.md # Security rules
|
|
54
|
-
│
|
|
55
|
-
├── workflows/ # 🔄 Development processes
|
|
56
|
-
│ ├── development.md # Feature development flow
|
|
57
|
-
│ ├── debugging.md # Debug process
|
|
58
|
-
│ ├── testing.md # Testing strategy
|
|
59
|
-
│ ├── deployment.md # Deployment process
|
|
60
|
-
│ └── code-review.md # Review checklist
|
|
61
|
-
│
|
|
62
|
-
├── context/ # 📚 Business context
|
|
63
|
-
│ ├── business-rules.md # Business logic
|
|
64
|
-
│ ├── constraints.md # Technical constraints
|
|
65
|
-
│ ├── dependencies.md # External dependencies
|
|
66
|
-
│ └── known-issues.md # Known issues & workarounds
|
|
67
|
-
│
|
|
68
|
-
├── guides/ # 📖 How-to guides
|
|
69
|
-
│ ├── onboarding.md # AI onboarding
|
|
70
|
-
│ ├── quick-start.md # Quick setup
|
|
71
|
-
│ ├── troubleshooting.md # Common problems
|
|
72
|
-
│ └── faq.md # FAQs
|
|
73
|
-
│
|
|
74
|
-
└── models/ # 🧠 AI model configs
|
|
75
|
-
├── model-configs.md # Model configurations
|
|
76
|
-
├── model-selection.md # When to use which model
|
|
77
|
-
├── token-optimization.md # Token optimization
|
|
78
|
-
└── fallback-strategy.md # Fallback handling
|
|
79
|
-
```
|
|
23
|
+
Mọi project sử dụng skill này PHẢI có folder `docs/` theo cấu trúc chuẩn (README, project, memory, architecture/, agents/, standards/, workflows/, context/, guides/, models/). Full tree: [`conventions-and-examples.md`](conventions-and-examples.md#documentation-structure).
|
|
80
24
|
|
|
81
25
|
## Workflow: How AI Should Use This Skill
|
|
82
26
|
|
|
@@ -197,213 +141,27 @@ cat docs/architecture/data-model.md
|
|
|
197
141
|
|
|
198
142
|
## Key Principles
|
|
199
143
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
1. **Đọc docs TRƯỚC KHI code**
|
|
203
|
-
- README.md → project.md → memory.md → standards/
|
|
204
|
-
- Không bao giờ skip bước này
|
|
205
|
-
|
|
206
|
-
2. **Follow conventions NGHIÊM NGẶT**
|
|
207
|
-
- Code style from `standards/coding-conventions.md`
|
|
208
|
-
- Database rules from `architecture/data-model.md`
|
|
209
|
-
- Git commits from `standards/commit-conventions.md`
|
|
210
|
-
|
|
211
|
-
3. **Document EVERYTHING quan trọng**
|
|
212
|
-
- Decisions → memory.md
|
|
213
|
-
- Issues → context/known-issues.md
|
|
214
|
-
- Architecture changes → architecture/
|
|
215
|
-
|
|
216
|
-
4. **Cross-reference docs**
|
|
217
|
-
- Khi đọc 1 file, note references đến files khác
|
|
218
|
-
- Build mental map của toàn bộ docs
|
|
219
|
-
|
|
220
|
-
5. **Update proactively**
|
|
221
|
-
- Tìm thấy thông tin mới? Update docs ngay
|
|
222
|
-
- Không để docs outdated
|
|
144
|
+
**DO**: đọc docs trước khi code (README → project → memory → standards, không skip); follow conventions nghiêm ngặt (code style, DB rules, commit conventions); document mọi decision/issue/architecture change ngay khi phát sinh; cross-reference giữa các file để build mental map; update docs proactively khi có thông tin mới.
|
|
223
145
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
1. **Không skip đọc docs**
|
|
227
|
-
- Đừng assume bạn biết project
|
|
228
|
-
- Đừng code trước khi đọc conventions
|
|
229
|
-
|
|
230
|
-
2. **Không violate conventions**
|
|
231
|
-
- Không tự ý thay đổi code style
|
|
232
|
-
- Không bỏ qua architecture constraints
|
|
233
|
-
|
|
234
|
-
3. **Không quên document**
|
|
235
|
-
- Không để decisions chỉ trong chat
|
|
236
|
-
- Không quên update memory.md
|
|
237
|
-
|
|
238
|
-
4. **Không duplicate info**
|
|
239
|
-
- Check docs trước khi thêm mới
|
|
240
|
-
- Consolidate thay vì scatter
|
|
146
|
+
**DON'T**: đừng code trước khi đọc conventions; đừng tự ý đổi code style hay bỏ qua architecture constraints; đừng để decision chỉ nằm trong chat mà không ghi vào memory.md; đừng duplicate thông tin — check docs trước khi thêm mới, consolidate thay vì scatter.
|
|
241
147
|
|
|
242
148
|
---
|
|
243
149
|
|
|
244
|
-
## Code Conventions
|
|
245
|
-
|
|
246
|
-
### Database Rules
|
|
247
|
-
|
|
248
|
-
```javascript
|
|
249
|
-
// ✅ ĐÚNG: UUID primary keys
|
|
250
|
-
id: {
|
|
251
|
-
type: DataTypes.UUID,
|
|
252
|
-
defaultValue: DataTypes.UUIDV4,
|
|
253
|
-
primaryKey: true
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ❌ SAI: Auto-increment
|
|
257
|
-
id: {
|
|
258
|
-
type: DataTypes.INTEGER,
|
|
259
|
-
autoIncrement: true,
|
|
260
|
-
primaryKey: true
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// ✅ ĐÚNG: No foreign key constraints
|
|
264
|
-
user_id: {
|
|
265
|
-
type: DataTypes.UUID,
|
|
266
|
-
allowNull: false
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ❌ SAI: With FK constraint
|
|
270
|
-
user_id: {
|
|
271
|
-
type: DataTypes.UUID,
|
|
272
|
-
references: { model: 'users', key: 'id' }
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Oracle Schema Prefix
|
|
277
|
-
|
|
278
|
-
```sql
|
|
279
|
-
-- ✅ ĐÚNG: With schema prefix
|
|
280
|
-
SELECT * FROM APPS.MTL_SYSTEM_ITEMS_B
|
|
281
|
-
|
|
282
|
-
-- ❌ SAI: Without prefix
|
|
283
|
-
SELECT * FROM MTL_SYSTEM_ITEMS_B
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Naming Conventions
|
|
287
|
-
|
|
288
|
-
```javascript
|
|
289
|
-
// Variables & Functions: camelCase
|
|
290
|
-
const userName = "LeNK";
|
|
291
|
-
function getUserData() {}
|
|
292
|
-
|
|
293
|
-
// Classes: PascalCase
|
|
294
|
-
class UserService {}
|
|
150
|
+
## Code Conventions
|
|
295
151
|
|
|
296
|
-
|
|
297
|
-
const API_BASE_URL = "https://api.example.com";
|
|
298
|
-
|
|
299
|
-
// Files: kebab-case
|
|
300
|
-
user - service.js;
|
|
301
|
-
|
|
302
|
-
// DB tables/columns: snake_case
|
|
303
|
-
(users, user_profiles, created_at);
|
|
304
|
-
```
|
|
152
|
+
UUID primary keys (not auto-increment), no FK constraints, Oracle schema prefixes, and JS/SQL naming patterns: [`conventions-and-examples.md`](conventions-and-examples.md).
|
|
305
153
|
|
|
306
154
|
---
|
|
307
155
|
|
|
308
156
|
## Agent Coordination
|
|
309
157
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
**Architect Agent**
|
|
313
|
-
|
|
314
|
-
- Design system architecture
|
|
315
|
-
- Make technical decisions
|
|
316
|
-
- Review architectural changes
|
|
317
|
-
|
|
318
|
-
**Coder Agent**
|
|
319
|
-
|
|
320
|
-
- Implement features
|
|
321
|
-
- Write tests
|
|
322
|
-
- Follow coding standards
|
|
323
|
-
|
|
324
|
-
**Debugger Agent**
|
|
325
|
-
|
|
326
|
-
- Analyze bugs
|
|
327
|
-
- Find root causes
|
|
328
|
-
- Verify fixes
|
|
329
|
-
|
|
330
|
-
**Orchestrator Agent**
|
|
331
|
-
|
|
332
|
-
- Break down tasks
|
|
333
|
-
- Coordinate agents
|
|
334
|
-
- Track progress
|
|
335
|
-
|
|
336
|
-
### Handoff Rules
|
|
337
|
-
|
|
338
|
-
**Khi nào handoff?**
|
|
339
|
-
|
|
340
|
-
- Architect → Coder: Sau khi design xong
|
|
341
|
-
- Coder → Debugger: Khi gặp bug
|
|
342
|
-
- Debugger → Architect: Bug do design issue
|
|
343
|
-
- Any → Orchestrator: Task phức tạp cần break down
|
|
344
|
-
|
|
345
|
-
**Trước khi handoff:**
|
|
346
|
-
|
|
347
|
-
1. Update `docs/memory.md` với context
|
|
348
|
-
2. Summarize work done
|
|
349
|
-
3. List blockers/questions
|
|
350
|
-
4. Point to relevant docs
|
|
158
|
+
Four agent roles (Architect, Coder, Debugger, Orchestrator) and handoff-trigger rules: [`conventions-and-examples.md`](conventions-and-examples.md#agent-coordination).
|
|
351
159
|
|
|
352
160
|
---
|
|
353
161
|
|
|
354
162
|
## Examples
|
|
355
163
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
# User request: "Add user authentication"
|
|
360
|
-
|
|
361
|
-
# Step 1: Load context
|
|
362
|
-
cat docs/README.md
|
|
363
|
-
cat docs/project.md
|
|
364
|
-
cat docs/memory.md
|
|
365
|
-
|
|
366
|
-
# Step 2: Check if similar feature exists
|
|
367
|
-
grep -r "authentication" docs/memory.md
|
|
368
|
-
cat docs/context/known-issues.md
|
|
369
|
-
|
|
370
|
-
# Step 3: Load relevant docs
|
|
371
|
-
cat docs/architecture/overview.md
|
|
372
|
-
cat docs/architecture/data-model.md
|
|
373
|
-
cat docs/standards/coding-conventions.md
|
|
374
|
-
cat docs/standards/security.md
|
|
375
|
-
|
|
376
|
-
# Step 4: Check workflows
|
|
377
|
-
cat docs/workflows/development.md
|
|
378
|
-
|
|
379
|
-
# Step 5: Start development following conventions
|
|
380
|
-
|
|
381
|
-
# Step 6: Document decision
|
|
382
|
-
echo "## [2025-01-24] - User Authentication
|
|
383
|
-
**Context**: Need secure user auth
|
|
384
|
-
**Decision**: Using bcrypt + JWT
|
|
385
|
-
**Impact**: New users table, auth middleware
|
|
386
|
-
**Next**: Implement signup/login endpoints" >> docs/memory.md
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### Example 2: Debugging Issue
|
|
390
|
-
|
|
391
|
-
```bash
|
|
392
|
-
# User: "PostgreSQL auto-increment not working"
|
|
393
|
-
|
|
394
|
-
# Step 1: Check known issues
|
|
395
|
-
cat docs/context/known-issues.md
|
|
396
|
-
|
|
397
|
-
# Step 2: Check conventions
|
|
398
|
-
cat docs/standards/coding-conventions.md
|
|
399
|
-
# → Found: We use UUID, not auto-increment!
|
|
400
|
-
|
|
401
|
-
# Step 3: Check memory for similar cases
|
|
402
|
-
grep -r "auto-increment\|UUID" docs/memory.md
|
|
403
|
-
|
|
404
|
-
# Step 4: Provide solution based on conventions
|
|
405
|
-
# Step 5: Update docs if needed
|
|
406
|
-
```
|
|
164
|
+
Two worked examples (starting a new feature, debugging an issue) walking through which docs to load and when to write to `memory.md`: [`conventions-and-examples.md`](conventions-and-examples.md).
|
|
407
165
|
|
|
408
166
|
---
|
|
409
167
|
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Docs Manager — Code Conventions and Worked Examples
|
|
2
|
+
|
|
3
|
+
## Documentation Structure
|
|
4
|
+
|
|
5
|
+
Full `docs/` folder layout this skill expects:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
docs/
|
|
9
|
+
├── README.md # 🎯 BẮT ĐẦU TẠI ĐÂY - Navigation hub
|
|
10
|
+
├── project.md # 📋 Project overview
|
|
11
|
+
├── memory.md # 🧠 Decisions & context log
|
|
12
|
+
│
|
|
13
|
+
├── architecture/ # 🏗️ System design
|
|
14
|
+
│ ├── overview.md # Architecture tổng quan
|
|
15
|
+
│ ├── tech-stack.md # Technologies sử dụng
|
|
16
|
+
│ ├── data-model.md # Database schema
|
|
17
|
+
│ ├── api-design.md # API specifications
|
|
18
|
+
│ └── deployment.md # Infrastructure
|
|
19
|
+
│
|
|
20
|
+
├── agents/ # 🤖 Multi-agent coordination
|
|
21
|
+
│ ├── agent-roles.md # Vai trò từng agent
|
|
22
|
+
│ ├── orchestration.md # Flow điều phối
|
|
23
|
+
│ ├── prompts/ # System prompts
|
|
24
|
+
│ │ ├── architect.md
|
|
25
|
+
│ │ ├── coder.md
|
|
26
|
+
│ │ ├── debugger.md
|
|
27
|
+
│ │ └── orchestrator.md
|
|
28
|
+
│ └── handoff-rules.md # Quy tắc chuyển giao
|
|
29
|
+
│
|
|
30
|
+
├── standards/ # 📏 Coding standards
|
|
31
|
+
│ ├── coding-conventions.md # Code style
|
|
32
|
+
│ ├── commit-conventions.md # Git conventions
|
|
33
|
+
│ ├── file-structure.md # File organization
|
|
34
|
+
│ ├── error-handling.md # Error handling
|
|
35
|
+
│ └── security.md # Security rules
|
|
36
|
+
│
|
|
37
|
+
├── workflows/ # 🔄 Development processes
|
|
38
|
+
│ ├── development.md # Feature development flow
|
|
39
|
+
│ ├── debugging.md # Debug process
|
|
40
|
+
│ ├── testing.md # Testing strategy
|
|
41
|
+
│ ├── deployment.md # Deployment process
|
|
42
|
+
│ └── code-review.md # Review checklist
|
|
43
|
+
│
|
|
44
|
+
├── context/ # 📚 Business context
|
|
45
|
+
│ ├── business-rules.md # Business logic
|
|
46
|
+
│ ├── constraints.md # Technical constraints
|
|
47
|
+
│ ├── dependencies.md # External dependencies
|
|
48
|
+
│ └── known-issues.md # Known issues & workarounds
|
|
49
|
+
│
|
|
50
|
+
├── guides/ # 📖 How-to guides
|
|
51
|
+
│ ├── onboarding.md # AI onboarding
|
|
52
|
+
│ ├── quick-start.md # Quick setup
|
|
53
|
+
│ ├── troubleshooting.md # Common problems
|
|
54
|
+
│ └── faq.md # FAQs
|
|
55
|
+
│
|
|
56
|
+
└── models/ # 🧠 AI model configs
|
|
57
|
+
├── model-configs.md # Model configurations
|
|
58
|
+
├── model-selection.md # When to use which model
|
|
59
|
+
├── token-optimization.md # Token optimization
|
|
60
|
+
└── fallback-strategy.md # Fallback handling
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Agent Coordination
|
|
64
|
+
|
|
65
|
+
### Agent Roles (From docs/agents/agent-roles.md)
|
|
66
|
+
|
|
67
|
+
**Architect Agent**
|
|
68
|
+
|
|
69
|
+
- Design system architecture
|
|
70
|
+
- Make technical decisions
|
|
71
|
+
- Review architectural changes
|
|
72
|
+
|
|
73
|
+
**Coder Agent**
|
|
74
|
+
|
|
75
|
+
- Implement features
|
|
76
|
+
- Write tests
|
|
77
|
+
- Follow coding standards
|
|
78
|
+
|
|
79
|
+
**Debugger Agent**
|
|
80
|
+
|
|
81
|
+
- Analyze bugs
|
|
82
|
+
- Find root causes
|
|
83
|
+
- Verify fixes
|
|
84
|
+
|
|
85
|
+
**Orchestrator Agent**
|
|
86
|
+
|
|
87
|
+
- Break down tasks
|
|
88
|
+
- Coordinate agents
|
|
89
|
+
- Track progress
|
|
90
|
+
|
|
91
|
+
### Handoff Rules
|
|
92
|
+
|
|
93
|
+
**Khi nào handoff?**
|
|
94
|
+
|
|
95
|
+
- Architect → Coder: Sau khi design xong
|
|
96
|
+
- Coder → Debugger: Khi gặp bug
|
|
97
|
+
- Debugger → Architect: Bug do design issue
|
|
98
|
+
- Any → Orchestrator: Task phức tạp cần break down
|
|
99
|
+
|
|
100
|
+
**Trước khi handoff:**
|
|
101
|
+
|
|
102
|
+
1. Update `docs/memory.md` với context
|
|
103
|
+
2. Summarize work done
|
|
104
|
+
3. List blockers/questions
|
|
105
|
+
4. Point to relevant docs
|
|
106
|
+
|
|
107
|
+
## Code Conventions (From docs/standards/coding-conventions.md)
|
|
108
|
+
|
|
109
|
+
### Database Rules
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
// ✅ ĐÚNG: UUID primary keys
|
|
113
|
+
id: {
|
|
114
|
+
type: DataTypes.UUID,
|
|
115
|
+
defaultValue: DataTypes.UUIDV4,
|
|
116
|
+
primaryKey: true
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ❌ SAI: Auto-increment
|
|
120
|
+
id: {
|
|
121
|
+
type: DataTypes.INTEGER,
|
|
122
|
+
autoIncrement: true,
|
|
123
|
+
primaryKey: true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ✅ ĐÚNG: No foreign key constraints
|
|
127
|
+
user_id: {
|
|
128
|
+
type: DataTypes.UUID,
|
|
129
|
+
allowNull: false
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ❌ SAI: With FK constraint
|
|
133
|
+
user_id: {
|
|
134
|
+
type: DataTypes.UUID,
|
|
135
|
+
references: { model: 'users', key: 'id' }
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Oracle Schema Prefix
|
|
140
|
+
|
|
141
|
+
```sql
|
|
142
|
+
-- ✅ ĐÚNG: With schema prefix
|
|
143
|
+
SELECT * FROM APPS.MTL_SYSTEM_ITEMS_B
|
|
144
|
+
|
|
145
|
+
-- ❌ SAI: Without prefix
|
|
146
|
+
SELECT * FROM MTL_SYSTEM_ITEMS_B
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Naming Conventions
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Variables & Functions: camelCase
|
|
153
|
+
const userName = "LeNK";
|
|
154
|
+
function getUserData() {}
|
|
155
|
+
|
|
156
|
+
// Classes: PascalCase
|
|
157
|
+
class UserService {}
|
|
158
|
+
|
|
159
|
+
// Constants: UPPER_SNAKE_CASE
|
|
160
|
+
const API_BASE_URL = "https://api.example.com";
|
|
161
|
+
|
|
162
|
+
// Files: kebab-case
|
|
163
|
+
user - service.js;
|
|
164
|
+
|
|
165
|
+
// DB tables/columns: snake_case
|
|
166
|
+
(users, user_profiles, created_at);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Examples
|
|
170
|
+
|
|
171
|
+
### Example 1: Starting New Feature
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# User request: "Add user authentication"
|
|
175
|
+
|
|
176
|
+
# Step 1: Load context
|
|
177
|
+
cat docs/README.md
|
|
178
|
+
cat docs/project.md
|
|
179
|
+
cat docs/memory.md
|
|
180
|
+
|
|
181
|
+
# Step 2: Check if similar feature exists
|
|
182
|
+
grep -r "authentication" docs/memory.md
|
|
183
|
+
cat docs/context/known-issues.md
|
|
184
|
+
|
|
185
|
+
# Step 3: Load relevant docs
|
|
186
|
+
cat docs/architecture/overview.md
|
|
187
|
+
cat docs/architecture/data-model.md
|
|
188
|
+
cat docs/standards/coding-conventions.md
|
|
189
|
+
cat docs/standards/security.md
|
|
190
|
+
|
|
191
|
+
# Step 4: Check workflows
|
|
192
|
+
cat docs/workflows/development.md
|
|
193
|
+
|
|
194
|
+
# Step 5: Start development following conventions
|
|
195
|
+
|
|
196
|
+
# Step 6: Document decision
|
|
197
|
+
echo "## [2025-01-24] - User Authentication
|
|
198
|
+
**Context**: Need secure user auth
|
|
199
|
+
**Decision**: Using bcrypt + JWT
|
|
200
|
+
**Impact**: New users table, auth middleware
|
|
201
|
+
**Next**: Implement signup/login endpoints" >> docs/memory.md
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Example 2: Debugging Issue
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# User: "PostgreSQL auto-increment not working"
|
|
208
|
+
|
|
209
|
+
# Step 1: Check known issues
|
|
210
|
+
cat docs/context/known-issues.md
|
|
211
|
+
|
|
212
|
+
# Step 2: Check conventions
|
|
213
|
+
cat docs/standards/coding-conventions.md
|
|
214
|
+
# → Found: We use UUID, not auto-increment!
|
|
215
|
+
|
|
216
|
+
# Step 3: Check memory for similar cases
|
|
217
|
+
grep -r "auto-increment\|UUID" docs/memory.md
|
|
218
|
+
|
|
219
|
+
# Step 4: Provide solution based on conventions
|
|
220
|
+
# Step 5: Update docs if needed
|
|
221
|
+
```
|
|
@@ -78,17 +78,7 @@ This workflow allows you to plan comprehensive tracked changes using markdown be
|
|
|
78
78
|
|
|
79
79
|
**Batching Strategy**: Group related changes into batches of 3-10 changes. This makes debugging manageable while maintaining efficiency. Test each batch before moving to the next.
|
|
80
80
|
|
|
81
|
-
**Principle: Minimal, Precise Edits**
|
|
82
|
-
When implementing tracked changes, only mark text that actually changes. Repeating unchanged text makes edits harder to review and appears unprofessional. Break replacements into: [unchanged text] + [deletion] + [insertion] + [unchanged text]. Preserve the original run's RSID for unchanged text by extracting the `<w:r>` element from the original and reusing it.
|
|
83
|
-
|
|
84
|
-
Example - Changing "30 days" to "60 days" in a sentence:
|
|
85
|
-
```python
|
|
86
|
-
# BAD - Replaces entire sentence
|
|
87
|
-
'<w:del><w:r><w:delText>The term is 30 days.</w:delText></w:r></w:del><w:ins><w:r><w:t>The term is 60 days.</w:t></w:r></w:ins>'
|
|
88
|
-
|
|
89
|
-
# GOOD - Only marks what changed, preserves original <w:r> for unchanged text
|
|
90
|
-
'<w:r w:rsidR="00AB12CD"><w:t>The term is </w:t></w:r><w:del><w:r><w:delText>30</w:delText></w:r></w:del><w:ins><w:r><w:t>60</w:t></w:r></w:ins><w:r w:rsidR="00AB12CD"><w:t> days.</w:t></w:r>'
|
|
91
|
-
```
|
|
81
|
+
**Principle: Minimal, Precise Edits** — only mark text that actually changes, preserving the original run's RSID for unchanged text. Full explanation and a before/after example: [`redlining-reference.md`](redlining-reference.md).
|
|
92
82
|
|
|
93
83
|
### Tracked changes workflow
|
|
94
84
|
|
|
@@ -97,35 +87,14 @@ Example - Changing "30 days" to "60 days" in a sentence:
|
|
|
97
87
|
pandoc --track-changes=all path-to-file.docx -o current.md
|
|
98
88
|
```
|
|
99
89
|
|
|
100
|
-
2. **Identify and group changes**: Review the document and identify ALL changes needed, organizing them into logical batches:
|
|
101
|
-
|
|
102
|
-
**Location methods** (for finding changes in XML):
|
|
103
|
-
- Section/heading numbers (e.g., "Section 3.2", "Article IV")
|
|
104
|
-
- Paragraph identifiers if numbered
|
|
105
|
-
- Grep patterns with unique surrounding text
|
|
106
|
-
- Document structure (e.g., "first paragraph", "signature block")
|
|
107
|
-
- **DO NOT use markdown line numbers** - they don't map to XML structure
|
|
108
|
-
|
|
109
|
-
**Batch organization** (group 3-10 related changes per batch):
|
|
110
|
-
- By section: "Batch 1: Section 2 amendments", "Batch 2: Section 5 updates"
|
|
111
|
-
- By type: "Batch 1: Date corrections", "Batch 2: Party name changes"
|
|
112
|
-
- By complexity: Start with simple text replacements, then tackle complex structural changes
|
|
113
|
-
- Sequential: "Batch 1: Pages 1-3", "Batch 2: Pages 4-6"
|
|
90
|
+
2. **Identify and group changes**: Review the document and identify ALL changes needed, organizing them into logical batches of 3-10. Location methods and batch-organization strategies: [`redlining-reference.md`](redlining-reference.md). **DO NOT use markdown line numbers** - they don't map to XML structure.
|
|
114
91
|
|
|
115
92
|
3. **Read documentation and unpack**:
|
|
116
93
|
- **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~600 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Pay special attention to the "Document Library" and "Tracked Change Patterns" sections.
|
|
117
94
|
- **Unpack the document**: `python ooxml/scripts/unpack.py <file.docx> <dir>`
|
|
118
95
|
- **Note the suggested RSID**: The unpack script will suggest an RSID to use for your tracked changes. Copy this RSID for use in step 4b.
|
|
119
96
|
|
|
120
|
-
4. **Implement changes in batches**: Group changes logically (by section, by type, or by proximity) and implement them together in a single script
|
|
121
|
-
- Makes debugging easier (smaller batch = easier to isolate errors)
|
|
122
|
-
- Allows incremental progress
|
|
123
|
-
- Maintains efficiency (batch size of 3-10 changes works well)
|
|
124
|
-
|
|
125
|
-
**Suggested batch groupings:**
|
|
126
|
-
- By document section (e.g., "Section 3 changes", "Definitions", "Termination clause")
|
|
127
|
-
- By change type (e.g., "Date changes", "Party name updates", "Legal term replacements")
|
|
128
|
-
- By proximity (e.g., "Changes on pages 1-3", "Changes in first half of document")
|
|
97
|
+
4. **Implement changes in batches**: Group changes logically (by section, by type, or by proximity) and implement them together in a single script — smaller batches make debugging easier and allow incremental progress.
|
|
129
98
|
|
|
130
99
|
For each batch of related changes:
|
|
131
100
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# DOCX Redlining — Batching Detail and Example
|
|
2
|
+
|
|
3
|
+
Supporting detail for the "Redlining workflow for document review" steps in `SKILL.md`.
|
|
4
|
+
|
|
5
|
+
## Principle: Minimal, Precise Edits
|
|
6
|
+
|
|
7
|
+
When implementing tracked changes, only mark text that actually changes. Repeating unchanged text makes edits harder to review and appears unprofessional. Break replacements into: [unchanged text] + [deletion] + [insertion] + [unchanged text]. Preserve the original run's RSID for unchanged text by extracting the `<w:r>` element from the original and reusing it.
|
|
8
|
+
|
|
9
|
+
Example - Changing "30 days" to "60 days" in a sentence:
|
|
10
|
+
```python
|
|
11
|
+
# BAD - Replaces entire sentence
|
|
12
|
+
'<w:del><w:r><w:delText>The term is 30 days.</w:delText></w:r></w:del><w:ins><w:r><w:t>The term is 60 days.</w:t></w:r></w:ins>'
|
|
13
|
+
|
|
14
|
+
# GOOD - Only marks what changed, preserves original <w:r> for unchanged text
|
|
15
|
+
'<w:r w:rsidR="00AB12CD"><w:t>The term is </w:t></w:r><w:del><w:r><w:delText>30</w:delText></w:r></w:del><w:ins><w:r><w:t>60</w:t></w:r></w:ins><w:r w:rsidR="00AB12CD"><w:t> days.</w:t></w:r>'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Locating changes in XML (Step 2)
|
|
19
|
+
|
|
20
|
+
- Section/heading numbers (e.g., "Section 3.2", "Article IV")
|
|
21
|
+
- Paragraph identifiers if numbered
|
|
22
|
+
- Grep patterns with unique surrounding text
|
|
23
|
+
- Document structure (e.g., "first paragraph", "signature block")
|
|
24
|
+
- **DO NOT use markdown line numbers** - they don't map to XML structure
|
|
25
|
+
|
|
26
|
+
## Batch organization (Steps 2 and 4)
|
|
27
|
+
|
|
28
|
+
Group 3-10 related changes per batch:
|
|
29
|
+
- By section: "Batch 1: Section 2 amendments", "Batch 2: Section 5 updates"
|
|
30
|
+
- By type: "Batch 1: Date corrections", "Batch 2: Party name changes"
|
|
31
|
+
- By complexity: Start with simple text replacements, then tackle complex structural changes
|
|
32
|
+
- Sequential: "Batch 1: Pages 1-3", "Batch 2: Pages 4-6"
|
|
33
|
+
|
|
34
|
+
Batching this way makes debugging easier (smaller batch = easier to isolate errors) and allows incremental progress.
|
|
@@ -133,13 +133,12 @@ Xem chi tiết trong `references/workflow.md`.
|
|
|
133
133
|
## Quick Rules (Không Được Vi Phạm)
|
|
134
134
|
|
|
135
135
|
1. **Vue dùng Options API** — KHÔNG dùng `<script setup>` hay Composition API
|
|
136
|
-
2. **ID field
|
|
137
|
-
3. **
|
|
138
|
-
4. **Datetime LUÔN dùng `dayjs()`** — KHÔNG dùng `new Date()`, `Date.now()`, `.getFullYear()`, v.v.
|
|
136
|
+
2. **ID/Boolean field prefix** — xem bảng "Quy Tắc Đặt Tên" ở trên (`id_`, `can_`/`is_`/`has_`/`show_`)
|
|
137
|
+
3. **Datetime LUÔN dùng `dayjs()`** — KHÔNG dùng `new Date()`, `Date.now()`, `.getFullYear()`, v.v.
|
|
139
138
|
- `dayjs().year()` thay `new Date().getFullYear()`
|
|
140
139
|
- `dayjs().startOf("month").format("YYYY-MM-DD")` thay chuỗi string thủ công
|
|
141
140
|
- Mọi biến date trong `data()` phải khởi tạo bằng dayjs
|
|
142
|
-
|
|
141
|
+
4. **CẤM TUYỆT ĐỐI GỌI API RAW — KHÔNG fetch(), KHÔNG axios.get/post/put/delete():**
|
|
143
142
|
- MỌI luồng giao tiếp với server BẮT BUỘC phải dùng các hàm định nghĩa sẵn từ `composables/useRequest.js`.
|
|
144
143
|
- **Nếu phát hiện code sinh ra chứa `fetch(...)`, `axios(...)`, `axios.get(...)`, `axios.post(...)` → LÀM LẠI NGAY LẬP TỨC.**
|
|
145
144
|
- Ba hàm hợp lệ DUY NHẤT:
|
|
@@ -147,18 +146,15 @@ Xem chi tiết trong `references/workflow.md`.
|
|
|
147
146
|
- `requestForm(url, formData)` — Dành riêng cho upload file (multipart/form-data)
|
|
148
147
|
- `request_origin(url, data)` — Gọi custom endpoint (không qua generic `/api/select`)
|
|
149
148
|
- KHÔNG CÓ NGOẠI LỆ. Kể cả khi "chỉ test nhanh", "chỉ gọi 1 lần", hay "endpoint bên ngoài" — vẫn phải dùng 3 hàm trên.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
13. **Foreign key cũng là varchar** — tham chiếu đến UUID của table khác
|
|
160
|
-
14. **workingObj.id mới = `''`** — KHÔNG dùng `= 0`. UUID là varchar, empty string = record mới chưa có id
|
|
161
|
-
15. **Dùng `check_is_null_or_blank(val)`** để check null/blank/array rỗng/object rỗng — hàm này xử lý mọi loại dữ liệu
|
|
149
|
+
5. **Schema luôn dùng `get_schema()`** — không hardcode `qas` hay `prd`
|
|
150
|
+
6. **Error handling**: trả về `[]` hoặc `{}` — không throw exception lên UI
|
|
151
|
+
7. **SQL views luôn có `COALESCE`** cho numeric fields để tránh null
|
|
152
|
+
8. **Dropdown data format**: `{ value: ..., label: ... }` — không đổi key khác
|
|
153
|
+
9. **workingObj pattern** — xem mục "Quy Tắc workingObj & Cấm Từ 'form'" ở trên
|
|
154
|
+
10. **Primary Key luôn là UUID varchar** — dùng uuid_in(overlay(...)) pattern, KHÔNG dùng SERIAL/INT
|
|
155
|
+
11. **Foreign key cũng là varchar** — tham chiếu đến UUID của table khác
|
|
156
|
+
12. **workingObj.id mới = `''`** — KHÔNG dùng `= 0`. UUID là varchar, empty string = record mới chưa có id
|
|
157
|
+
13. **Dùng `check_is_null_or_blank(val)`** để check null/blank/array rỗng/object rỗng — hàm này xử lý mọi loại dữ liệu
|
|
162
158
|
|
|
163
159
|
---
|
|
164
160
|
|