moicle 1.3.0 → 1.3.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/assets/skills/sync-docs/SKILL.md +534 -0
- package/package.json +1 -1
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-docs
|
|
3
|
+
description: Sync documentation workflow - reads codebase and docs folder to generate structured output docs with architecture, use cases, diagrams, and README index. Includes automated review loop. Use when user says "sync docs", "sync documentation", "generate docs", "update docs sync", "doc sync".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sync Docs Workflow
|
|
7
|
+
|
|
8
|
+
Automated workflow that reads codebase and existing docs to generate a complete, structured documentation output with architecture overview, use case diagrams, and a README index linking all sub-files.
|
|
9
|
+
|
|
10
|
+
## Workflow Overview
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
14
|
+
│ 1. SCAN │──▶│2. GENERATE──▶│ 3. REVIEW │──▶│4. COMPLETE│
|
|
15
|
+
└──────────┘ └──────────┘ └──────────┘ └──────────┘
|
|
16
|
+
▲ │
|
|
17
|
+
│ Feedback │
|
|
18
|
+
└──────────────┘
|
|
19
|
+
(loop until pass)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Key**: Phase 3 REVIEW automatically loops back to Phase 2 GENERATE if issues are found. The loop continues until all checks pass.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Phase 1: SCAN
|
|
27
|
+
|
|
28
|
+
**Goal**: Read and understand the entire codebase and existing docs
|
|
29
|
+
|
|
30
|
+
### Actions
|
|
31
|
+
|
|
32
|
+
1. **Identify project stack**:
|
|
33
|
+
- Check `package.json`, `go.mod`, `pubspec.yaml`, `composer.json`, etc.
|
|
34
|
+
- Determine primary language and framework
|
|
35
|
+
|
|
36
|
+
2. **Read existing documentation**:
|
|
37
|
+
```bash
|
|
38
|
+
# Find all doc files
|
|
39
|
+
find . -name "*.md" -not -path "*/node_modules/*" -not -path "*/vendor/*" -not -path "*/.dart_tool/*" | sort
|
|
40
|
+
|
|
41
|
+
# Find existing docs folder
|
|
42
|
+
ls -la docs/ 2>/dev/null
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. **Map codebase structure**:
|
|
46
|
+
```bash
|
|
47
|
+
# Get directory tree (exclude build artifacts)
|
|
48
|
+
tree -L 4 -I 'node_modules|vendor|dist|build|.dart_tool|.git' --dirsfirst
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. **Identify key components**:
|
|
52
|
+
- Entry points (main files, routes, controllers)
|
|
53
|
+
- Domain/business logic (services, use cases, models)
|
|
54
|
+
- Data layer (repositories, database, APIs)
|
|
55
|
+
- Configuration files
|
|
56
|
+
- Test files
|
|
57
|
+
|
|
58
|
+
5. **Extract use cases** from the codebase:
|
|
59
|
+
- Read route definitions, controller methods, service methods
|
|
60
|
+
- Identify distinct user-facing features/flows
|
|
61
|
+
- Group related functionality into use cases
|
|
62
|
+
|
|
63
|
+
6. **Read architecture files** (if exist):
|
|
64
|
+
```bash
|
|
65
|
+
ls .claude/architecture/*.md 2>/dev/null
|
|
66
|
+
ls ~/.claude/architecture/*.md 2>/dev/null
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Output
|
|
70
|
+
```markdown
|
|
71
|
+
## Scan Results
|
|
72
|
+
|
|
73
|
+
### Stack: [identified stack]
|
|
74
|
+
### Architecture: [identified pattern]
|
|
75
|
+
|
|
76
|
+
### Existing Docs
|
|
77
|
+
- [list of existing .md files and their status]
|
|
78
|
+
|
|
79
|
+
### Identified Use Cases
|
|
80
|
+
1. [Use Case 1] - [brief description]
|
|
81
|
+
2. [Use Case 2] - [brief description]
|
|
82
|
+
3. [Use Case N] - [brief description]
|
|
83
|
+
|
|
84
|
+
### Key Components
|
|
85
|
+
- Entry Points: [list]
|
|
86
|
+
- Business Logic: [list]
|
|
87
|
+
- Data Layer: [list]
|
|
88
|
+
- Config: [list]
|
|
89
|
+
|
|
90
|
+
### Docs Output Plan
|
|
91
|
+
- docs/README.md (index)
|
|
92
|
+
- docs/business.md (business overview - ngôn ngữ nghiệp vụ, không technical)
|
|
93
|
+
- docs/architecture.md
|
|
94
|
+
- docs/use-cases/[usecase-name].md (per use case)
|
|
95
|
+
- docs/diagrams/ (embedded in use case files via mermaid)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Gate
|
|
99
|
+
- [ ] Codebase fully scanned
|
|
100
|
+
- [ ] Use cases identified
|
|
101
|
+
- [ ] Existing docs read
|
|
102
|
+
- [ ] Output plan defined
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Phase 2: GENERATE
|
|
107
|
+
|
|
108
|
+
**Goal**: Generate all documentation files with proper structure
|
|
109
|
+
|
|
110
|
+
### Output Structure
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
docs/
|
|
114
|
+
├── README.md # Index - links to all sub-files
|
|
115
|
+
├── business.md # Business overview - ngôn ngữ nghiệp vụ, không technical
|
|
116
|
+
├── architecture.md # Architecture overview + system diagram
|
|
117
|
+
└── use-cases/
|
|
118
|
+
├── [use-case-1].md # Use case doc + sequence diagram
|
|
119
|
+
├── [use-case-2].md # Use case doc + sequence diagram
|
|
120
|
+
└── [use-case-N].md # Use case doc + sequence diagram
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 2.1 Generate `docs/README.md` (Index)
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
# [Project Name] Documentation
|
|
127
|
+
|
|
128
|
+
> Auto-generated documentation synced from codebase.
|
|
129
|
+
|
|
130
|
+
## Overview
|
|
131
|
+
|
|
132
|
+
[1-2 paragraph project description derived from codebase]
|
|
133
|
+
|
|
134
|
+
## Table of Contents
|
|
135
|
+
|
|
136
|
+
### Business
|
|
137
|
+
- [Business Overview](./business.md) - Tổng quan nghiệp vụ, mục tiêu, đối tượng sử dụng
|
|
138
|
+
|
|
139
|
+
### Architecture
|
|
140
|
+
- [Architecture Overview](./architecture.md) - System architecture, layers, and patterns
|
|
141
|
+
|
|
142
|
+
### Use Cases
|
|
143
|
+
- [Use Case 1](./use-cases/use-case-1.md) - [brief description]
|
|
144
|
+
- [Use Case 2](./use-cases/use-case-2.md) - [brief description]
|
|
145
|
+
- [Use Case N](./use-cases/use-case-n.md) - [brief description]
|
|
146
|
+
|
|
147
|
+
## Tech Stack
|
|
148
|
+
|
|
149
|
+
| Component | Technology |
|
|
150
|
+
|-----------|-----------|
|
|
151
|
+
| Language | [language] |
|
|
152
|
+
| Framework | [framework] |
|
|
153
|
+
| Database | [database] |
|
|
154
|
+
| Other | [key deps] |
|
|
155
|
+
|
|
156
|
+
## Quick Links
|
|
157
|
+
|
|
158
|
+
- [Business Overview](./business.md)
|
|
159
|
+
- [Architecture Diagram](./architecture.md#system-diagram)
|
|
160
|
+
- [Use Case Diagrams](./use-cases/)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 2.2 Generate `docs/business.md` (Business Overview)
|
|
164
|
+
|
|
165
|
+
File này viết hoàn toàn bằng ngôn ngữ nghiệp vụ. KHÔNG chứa code, KHÔNG chứa tên class/function, KHÔNG chứa thuật ngữ technical. Đối tượng đọc là stakeholder, product owner, business analyst - những người không cần biết code.
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
# [Project Name] - Tổng Quan Nghiệp Vụ
|
|
169
|
+
|
|
170
|
+
## Sản phẩm là gì?
|
|
171
|
+
|
|
172
|
+
[2-3 đoạn mô tả sản phẩm bằng ngôn ngữ thường ngày. Giải thích sản phẩm giải quyết vấn đề gì, cho ai, tại sao cần nó.]
|
|
173
|
+
|
|
174
|
+
## Đối tượng sử dụng
|
|
175
|
+
|
|
176
|
+
### [Vai trò 1] - ví dụ: Người dùng cuối
|
|
177
|
+
- **Là ai**: [mô tả]
|
|
178
|
+
- **Nhu cầu**: [họ cần gì từ sản phẩm]
|
|
179
|
+
- **Họ làm gì trên hệ thống**: [các hành động chính]
|
|
180
|
+
|
|
181
|
+
### [Vai trò 2] - ví dụ: Quản trị viên
|
|
182
|
+
- **Là ai**: [mô tả]
|
|
183
|
+
- **Nhu cầu**: [họ cần gì]
|
|
184
|
+
- **Họ làm gì trên hệ thống**: [các hành động chính]
|
|
185
|
+
|
|
186
|
+
## Quy trình nghiệp vụ chính
|
|
187
|
+
|
|
188
|
+
### [Quy trình 1] - ví dụ: Đăng ký và sử dụng lần đầu
|
|
189
|
+
[Mô tả từng bước quy trình từ góc nhìn người dùng. Không đề cập API, database hay bất kỳ chi tiết kỹ thuật nào.]
|
|
190
|
+
|
|
191
|
+
1. [Bước 1 - người dùng làm gì]
|
|
192
|
+
2. [Bước 2 - hệ thống phản hồi gì]
|
|
193
|
+
3. [Bước N]
|
|
194
|
+
|
|
195
|
+
### [Quy trình 2] - ví dụ: Đặt hàng
|
|
196
|
+
[Tương tự - mô tả từ góc nhìn nghiệp vụ]
|
|
197
|
+
|
|
198
|
+
## Các tính năng chính
|
|
199
|
+
|
|
200
|
+
| Tính năng | Mô tả | Ai sử dụng |
|
|
201
|
+
|-----------|--------|-------------|
|
|
202
|
+
| [Tính năng 1] | [giải thích bằng ngôn ngữ nghiệp vụ] | [vai trò] |
|
|
203
|
+
| [Tính năng 2] | [giải thích] | [vai trò] |
|
|
204
|
+
|
|
205
|
+
## Quy tắc nghiệp vụ
|
|
206
|
+
|
|
207
|
+
Các quy tắc quan trọng mà hệ thống tuân theo:
|
|
208
|
+
|
|
209
|
+
1. **[Quy tắc 1]**: [giải thích - ví dụ: "Mỗi đơn hàng phải có ít nhất 1 sản phẩm"]
|
|
210
|
+
2. **[Quy tắc 2]**: [giải thích - ví dụ: "Người dùng chỉ được hoàn trả trong vòng 7 ngày"]
|
|
211
|
+
3. **[Quy tắc N]**: [giải thích]
|
|
212
|
+
|
|
213
|
+
## Mối quan hệ giữa các đối tượng nghiệp vụ
|
|
214
|
+
|
|
215
|
+
[Mô tả bằng text các mối quan hệ chính, ví dụ:]
|
|
216
|
+
- Một **khách hàng** có thể tạo nhiều **đơn hàng**
|
|
217
|
+
- Một **đơn hàng** chứa nhiều **sản phẩm**
|
|
218
|
+
- Một **sản phẩm** thuộc về một **danh mục**
|
|
219
|
+
|
|
220
|
+
## Luồng giá trị (Value Flow)
|
|
221
|
+
|
|
222
|
+
[Mô tả cách sản phẩm tạo ra giá trị cho từng đối tượng:]
|
|
223
|
+
|
|
224
|
+
- **Đối với [vai trò 1]**: [giá trị họ nhận được]
|
|
225
|
+
- **Đối với [vai trò 2]**: [giá trị họ nhận được]
|
|
226
|
+
- **Đối với doanh nghiệp**: [giá trị business nhận được]
|
|
227
|
+
|
|
228
|
+
## Thuật ngữ nghiệp vụ (Glossary)
|
|
229
|
+
|
|
230
|
+
| Thuật ngữ | Định nghĩa |
|
|
231
|
+
|-----------|------------|
|
|
232
|
+
| [Thuật ngữ 1] | [giải thích trong ngữ cảnh sản phẩm] |
|
|
233
|
+
| [Thuật ngữ 2] | [giải thích] |
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**QUAN TRỌNG khi viết business.md**:
|
|
237
|
+
- KHÔNG dùng từ: API, endpoint, database, repository, controller, service, model, schema, query, migration, route, middleware, component, module, class, function, method, interface, type
|
|
238
|
+
- KHÔNG có code block nào
|
|
239
|
+
- KHÔNG reference file path hay tên file code
|
|
240
|
+
- Viết như đang giải thích cho người không biết lập trình
|
|
241
|
+
- Dùng ngôn ngữ business domain của project (ví dụ: "đơn hàng" thay vì "Order entity", "người dùng" thay vì "User model")
|
|
242
|
+
- Extract business rules từ code logic (validation, conditions, constraints) và diễn đạt bằng ngôn ngữ nghiệp vụ
|
|
243
|
+
|
|
244
|
+
### 2.3 Generate `docs/architecture.md` (Technical)
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
# Architecture Overview
|
|
248
|
+
|
|
249
|
+
## System Diagram
|
|
250
|
+
|
|
251
|
+
\`\`\`mermaid
|
|
252
|
+
graph TB
|
|
253
|
+
[Generate actual system architecture diagram based on codebase layers]
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
## Layers
|
|
257
|
+
|
|
258
|
+
### [Layer 1 Name]
|
|
259
|
+
- **Location**: `[directory path]`
|
|
260
|
+
- **Responsibility**: [what this layer does]
|
|
261
|
+
- **Key Files**: [list important files]
|
|
262
|
+
|
|
263
|
+
### [Layer 2 Name]
|
|
264
|
+
[same structure]
|
|
265
|
+
|
|
266
|
+
## Directory Structure
|
|
267
|
+
|
|
268
|
+
\`\`\`
|
|
269
|
+
[actual project directory tree with annotations]
|
|
270
|
+
\`\`\`
|
|
271
|
+
|
|
272
|
+
## Dependencies Between Layers
|
|
273
|
+
|
|
274
|
+
\`\`\`mermaid
|
|
275
|
+
graph LR
|
|
276
|
+
[Show dependency direction between layers]
|
|
277
|
+
\`\`\`
|
|
278
|
+
|
|
279
|
+
## Design Patterns Used
|
|
280
|
+
- [Pattern 1]: [where and why]
|
|
281
|
+
- [Pattern 2]: [where and why]
|
|
282
|
+
|
|
283
|
+
## Data Flow
|
|
284
|
+
|
|
285
|
+
\`\`\`mermaid
|
|
286
|
+
flowchart LR
|
|
287
|
+
[Show how data flows through the system]
|
|
288
|
+
\`\`\`
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 2.4 Generate Use Case Files (`docs/use-cases/[name].md`)
|
|
292
|
+
|
|
293
|
+
Generate ONE file per use case:
|
|
294
|
+
|
|
295
|
+
```markdown
|
|
296
|
+
# [Use Case Name]
|
|
297
|
+
|
|
298
|
+
## Overview
|
|
299
|
+
|
|
300
|
+
[Description of what this use case does from user perspective]
|
|
301
|
+
|
|
302
|
+
## Actors
|
|
303
|
+
- [Actor 1]: [role]
|
|
304
|
+
- [Actor 2]: [role]
|
|
305
|
+
|
|
306
|
+
## Flow
|
|
307
|
+
|
|
308
|
+
### Main Flow
|
|
309
|
+
|
|
310
|
+
1. [Step 1]
|
|
311
|
+
2. [Step 2]
|
|
312
|
+
3. [Step N]
|
|
313
|
+
|
|
314
|
+
### Sequence Diagram
|
|
315
|
+
|
|
316
|
+
\`\`\`mermaid
|
|
317
|
+
sequenceDiagram
|
|
318
|
+
participant [Actor]
|
|
319
|
+
participant [Component1]
|
|
320
|
+
participant [Component2]
|
|
321
|
+
participant [DataStore]
|
|
322
|
+
|
|
323
|
+
[Actor]->>[Component1]: [action]
|
|
324
|
+
[Component1]->>[Component2]: [action]
|
|
325
|
+
[Component2]->>[DataStore]: [action]
|
|
326
|
+
[DataStore]-->>[Component2]: [response]
|
|
327
|
+
[Component2]-->>[Component1]: [response]
|
|
328
|
+
[Component1]-->>[Actor]: [response]
|
|
329
|
+
\`\`\`
|
|
330
|
+
|
|
331
|
+
## Related Files
|
|
332
|
+
|
|
333
|
+
| File | Purpose |
|
|
334
|
+
|------|---------|
|
|
335
|
+
| `[path/to/file]` | [what it does in this use case] |
|
|
336
|
+
| `[path/to/file]` | [what it does in this use case] |
|
|
337
|
+
|
|
338
|
+
## Error Cases
|
|
339
|
+
|
|
340
|
+
| Error | Cause | Handling |
|
|
341
|
+
|-------|-------|----------|
|
|
342
|
+
| [Error 1] | [cause] | [how handled] |
|
|
343
|
+
|
|
344
|
+
## Notes
|
|
345
|
+
|
|
346
|
+
- [Any important implementation details]
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Generation Rules
|
|
350
|
+
|
|
351
|
+
1. **Diagrams MUST be mermaid** - embedded in markdown, not external files
|
|
352
|
+
2. **Every use case MUST have a sequence diagram** showing the actual flow through code
|
|
353
|
+
3. **Architecture MUST have a system diagram** showing layers/components
|
|
354
|
+
4. **README MUST link to every sub-file** with working relative links
|
|
355
|
+
5. **Use actual file paths** from codebase, not placeholders
|
|
356
|
+
6. **Use actual class/function names** from codebase
|
|
357
|
+
7. **If existing docs/ folder has content**, merge/update rather than overwrite useful information
|
|
358
|
+
|
|
359
|
+
### Gate
|
|
360
|
+
- [ ] docs/README.md generated with all links
|
|
361
|
+
- [ ] docs/business.md generated with pure business language (no technical terms)
|
|
362
|
+
- [ ] docs/architecture.md generated with system diagram
|
|
363
|
+
- [ ] All use case files generated with sequence diagrams
|
|
364
|
+
- [ ] All links are relative and correct
|
|
365
|
+
- [ ] All diagrams use mermaid syntax
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Phase 3: REVIEW (Automated Loop)
|
|
370
|
+
|
|
371
|
+
**Goal**: Verify generated docs are complete and accurate. Loop back to GENERATE if issues found.
|
|
372
|
+
|
|
373
|
+
### Review Checklist
|
|
374
|
+
|
|
375
|
+
Run through ALL checks below. If ANY check fails, fix and re-check.
|
|
376
|
+
|
|
377
|
+
#### 3.1 Structure Check
|
|
378
|
+
- [ ] `docs/README.md` exists and has all links
|
|
379
|
+
- [ ] `docs/business.md` exists
|
|
380
|
+
- [ ] `docs/architecture.md` exists with system diagram
|
|
381
|
+
- [ ] Each identified use case has its own file in `docs/use-cases/`
|
|
382
|
+
- [ ] All relative links in README.md point to existing files
|
|
383
|
+
|
|
384
|
+
#### 3.2 Business Check
|
|
385
|
+
- [ ] `docs/business.md` chứa KHÔNG có thuật ngữ technical (API, endpoint, database, repository, controller, service, model, schema, query, migration, route, middleware, component, module, class, function, method, interface, type)
|
|
386
|
+
- [ ] `docs/business.md` KHÔNG có code block nào
|
|
387
|
+
- [ ] `docs/business.md` KHÔNG reference file path
|
|
388
|
+
- [ ] Quy trình nghiệp vụ được mô tả đầy đủ từ góc nhìn người dùng
|
|
389
|
+
- [ ] Quy tắc nghiệp vụ được extract đúng từ logic trong code
|
|
390
|
+
- [ ] Glossary có đầy đủ thuật ngữ domain
|
|
391
|
+
|
|
392
|
+
#### 3.3 Content Check
|
|
393
|
+
- [ ] Architecture diagram reflects actual codebase layers
|
|
394
|
+
- [ ] Each use case sequence diagram matches actual code flow
|
|
395
|
+
- [ ] File paths referenced in docs actually exist in codebase
|
|
396
|
+
- [ ] Class/function names in diagrams match actual code
|
|
397
|
+
- [ ] No placeholder text like `[TODO]`, `[TBD]`, `[placeholder]`
|
|
398
|
+
- [ ] No template markers like `{name}`, `[name]` left unfilled
|
|
399
|
+
|
|
400
|
+
#### 3.4 Completeness Check
|
|
401
|
+
- [ ] Every major feature/flow has a use case doc
|
|
402
|
+
- [ ] Architecture doc covers all layers found in codebase
|
|
403
|
+
- [ ] README links to ALL generated sub-files
|
|
404
|
+
- [ ] Diagrams are syntactically valid mermaid
|
|
405
|
+
|
|
406
|
+
#### 3.5 Consistency Check
|
|
407
|
+
- [ ] Naming is consistent across all docs
|
|
408
|
+
- [ ] Same component uses same name everywhere
|
|
409
|
+
- [ ] File naming convention is consistent (kebab-case)
|
|
410
|
+
|
|
411
|
+
### Review Process
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
FOR each check in checklist:
|
|
415
|
+
IF check FAILS:
|
|
416
|
+
1. Note the issue
|
|
417
|
+
2. Fix it (go back to relevant GENERATE sub-step)
|
|
418
|
+
3. Re-run ALL checks from the beginning
|
|
419
|
+
IF all checks PASS:
|
|
420
|
+
Proceed to Phase 4
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Review Output
|
|
424
|
+
```markdown
|
|
425
|
+
## Review Results - Iteration [N]
|
|
426
|
+
|
|
427
|
+
### Checks Passed: [X/total]
|
|
428
|
+
### Checks Failed: [Y/total]
|
|
429
|
+
|
|
430
|
+
### Issues Found
|
|
431
|
+
1. [issue] → [fix applied]
|
|
432
|
+
2. [issue] → [fix applied]
|
|
433
|
+
|
|
434
|
+
### Status: [PASS - proceed to Phase 4 / FAIL - re-running Phase 2]
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**IMPORTANT**: Do NOT proceed to Phase 4 until ALL checks pass. Maximum 3 iterations - if still failing after 3 loops, report remaining issues and proceed.
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Phase 4: COMPLETE
|
|
442
|
+
|
|
443
|
+
**Goal**: Final output and summary
|
|
444
|
+
|
|
445
|
+
### Actions
|
|
446
|
+
|
|
447
|
+
1. **List all generated files**:
|
|
448
|
+
```bash
|
|
449
|
+
find docs/ -name "*.md" | sort
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
2. **Print summary**:
|
|
453
|
+
```markdown
|
|
454
|
+
## Sync Docs Complete
|
|
455
|
+
|
|
456
|
+
### Generated Files
|
|
457
|
+
- docs/README.md (index)
|
|
458
|
+
- docs/business.md (business overview)
|
|
459
|
+
- docs/architecture.md
|
|
460
|
+
- docs/use-cases/[list all]
|
|
461
|
+
|
|
462
|
+
### Use Cases Documented: [count]
|
|
463
|
+
### Diagrams Generated: [count]
|
|
464
|
+
### Review Iterations: [count]
|
|
465
|
+
|
|
466
|
+
### How to Use
|
|
467
|
+
Start at `docs/README.md` - it links to everything.
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
3. **Read the docs/ folder one final time** to confirm everything is in order
|
|
471
|
+
|
|
472
|
+
### Gate
|
|
473
|
+
- [ ] All files verified
|
|
474
|
+
- [ ] Summary provided
|
|
475
|
+
- [ ] User informed of output location
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## Recommended Agents
|
|
480
|
+
|
|
481
|
+
| Phase | Agent | Purpose |
|
|
482
|
+
|-------|-------|---------|
|
|
483
|
+
| SCAN | `@clean-architect` | Identify architecture patterns |
|
|
484
|
+
| SCAN | `@code-reviewer` | Understand code structure |
|
|
485
|
+
| GENERATE | `@docs-writer` | Write documentation |
|
|
486
|
+
| REVIEW | `@code-reviewer` | Verify accuracy |
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Quick Reference
|
|
491
|
+
|
|
492
|
+
### Trigger Phrases
|
|
493
|
+
- "sync docs"
|
|
494
|
+
- "sync documentation"
|
|
495
|
+
- "generate structured docs"
|
|
496
|
+
- "update docs sync"
|
|
497
|
+
- "create docs from codebase"
|
|
498
|
+
- "doc sync"
|
|
499
|
+
|
|
500
|
+
### Output Structure
|
|
501
|
+
```
|
|
502
|
+
docs/
|
|
503
|
+
├── README.md # Index with links
|
|
504
|
+
├── business.md # Business overview (non-technical)
|
|
505
|
+
├── architecture.md # System overview + diagram
|
|
506
|
+
└── use-cases/
|
|
507
|
+
└── *.md # One per use case + sequence diagram
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Diagram Types Used
|
|
511
|
+
| Where | Diagram Type | Purpose |
|
|
512
|
+
|-------|-------------|---------|
|
|
513
|
+
| architecture.md | `graph TB` | System architecture |
|
|
514
|
+
| architecture.md | `graph LR` | Layer dependencies |
|
|
515
|
+
| architecture.md | `flowchart LR` | Data flow |
|
|
516
|
+
| use-cases/*.md | `sequenceDiagram` | Use case flow |
|
|
517
|
+
|
|
518
|
+
### Review Loop
|
|
519
|
+
```
|
|
520
|
+
Generate → Review → Pass? → Complete
|
|
521
|
+
→ Fail? → Fix → Review again (max 3x)
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
## Success Criteria
|
|
525
|
+
|
|
526
|
+
Documentation sync is complete when:
|
|
527
|
+
1. Business overview viết hoàn toàn bằng ngôn ngữ nghiệp vụ, không technical
|
|
528
|
+
2. All codebase features are documented as use cases
|
|
529
|
+
3. Architecture accurately reflects codebase
|
|
530
|
+
4. Every use case has a sequence diagram
|
|
531
|
+
5. README.md links to all sub-files
|
|
532
|
+
6. All file paths and names match actual codebase
|
|
533
|
+
7. All mermaid diagrams are valid
|
|
534
|
+
8. Review loop passed all checks
|