@tungvivas/angular-vibe-kit 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -12
- package/agents/angular-a11y-auditor.md +71 -0
- package/agents/angular-build-fixer.md +37 -0
- package/agents/angular-debugger.md +38 -0
- package/agents/angular-git-workflow.md +46 -0
- package/agents/angular-onboarding.md +56 -0
- package/agents/angular-reviewer.md +22 -0
- package/agents/angular-test-writer.md +26 -0
- package/agents/angular-ui-designer.md +55 -0
- package/bin/cli.js +131 -5
- package/commands/dev-cycle.md +44 -12
- package/commands/init.md +9 -3
- package/commands/new-feature.md +22 -43
- package/commands/plan.md +136 -0
- package/commands/review-pr.md +12 -71
- package/commands/write-tests.md +9 -107
- package/package.json +9 -3
- package/references/feature-structure.md +44 -0
- package/references/plan-spec.md +112 -0
- package/references/review-checklist.md +88 -0
- package/references/test-spec.md +92 -0
- package/skills/angular-practices/SKILL.md +34 -0
- package/skills/clarify-request/SKILL.md +100 -0
- package/skills/component-wrapper-priority/SKILL.md +38 -0
- package/skills/explain/SKILL.md +102 -0
- package/skills/explain/templates/vi.md +184 -0
- package/skills/git-commit/SKILL.md +107 -0
- package/skills/git-commit/references/conventions.md +100 -0
- package/templates/docs/srs/README.md +29 -0
- package/templates/rules/project-rules.md +8 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: component-wrapper-priority
|
|
3
|
+
description: Use before importing a raw UI-library component (p-dropdown, mat-select, nz-*, ng-bootstrap, etc.) when implementing or reviewing a feature — enforces using this project's shared wrapper components from docs/DESIGN_SYSTEM.md instead of bypassing them with a direct library import.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Component Wrapper Priority
|
|
7
|
+
|
|
8
|
+
Before you write a template or import that uses a UI-library component directly, check whether
|
|
9
|
+
the project already has a **shared wrapper** for that need. Bypassing an existing wrapper with a
|
|
10
|
+
raw library import is a defect, not a shortcut.
|
|
11
|
+
|
|
12
|
+
## Decision tree
|
|
13
|
+
|
|
14
|
+
1. **Open `docs/DESIGN_SYSTEM.md` → the Wrapped Components table.**
|
|
15
|
+
2. **A wrapper exists for the need? → USE IT.** Never bypass:
|
|
16
|
+
- Select / dropdown → use the project wrapper (e.g. `<app-select>`), not raw `p-dropdown` / `mat-select` / `nz-select`.
|
|
17
|
+
- Date input → use the wrapper (e.g. `<app-date-picker>`), not raw `p-calendar` / `mat-datepicker`.
|
|
18
|
+
- Dialog / modal, table, form field, button — use the wrapper if one is listed, not the raw library component.
|
|
19
|
+
- Shared UI states (spinner, empty, error) → use the shared component, don't re-implement inline.
|
|
20
|
+
3. **No wrapper exists? → use the library component directly AND log a warning:**
|
|
21
|
+
```
|
|
22
|
+
> ⚠️ No shared wrapper for <X> — using the library directly. Consider adding one to shared/components/.
|
|
23
|
+
```
|
|
24
|
+
4. **Unsure whether one exists? → ASK** the team before writing the code
|
|
25
|
+
(search the project's wrapper folder — `shared/components/`, `ui/`, `common/` — first).
|
|
26
|
+
|
|
27
|
+
## Priority order (must follow)
|
|
28
|
+
|
|
29
|
+
1. **Wrapper in `shared/components/`** (or the folder recorded in DESIGN_SYSTEM.md) — ALWAYS use it when one exists.
|
|
30
|
+
2. **Library component direct** — only when no wrapper exists; import the library type + log the warning above.
|
|
31
|
+
3. **Custom build from scratch** — only when the library has no equivalent.
|
|
32
|
+
|
|
33
|
+
## Enforcement
|
|
34
|
+
|
|
35
|
+
This rule is enforced by `/review-pr` and the `angular-reviewer` agent: a raw library import when a
|
|
36
|
+
wrapper exists, in **new code**, is a 🔴 BLOCKER. Legacy modules (see Coexistence Strategy in
|
|
37
|
+
`.claude/rules/project-rules.md`) are exempt — do not refactor them just to satisfy this rule.
|
|
38
|
+
Works for any UI library — PrimeNG, Angular Material, ng-zorro, ng-bootstrap, or custom.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explain
|
|
3
|
+
description: >
|
|
4
|
+
Explain Angular/TypeScript code, architecture, data flows, or technical decisions for THIS project.
|
|
5
|
+
Use when the user says "explain", "giải thích", "how does this work", "what is", "tại sao", "why",
|
|
6
|
+
"làm thế nào", "hoạt động ra sao", or wants to understand a file, component, service, module, pattern,
|
|
7
|
+
routing, state management, HTTP flow, or an architectural decision.
|
|
8
|
+
argument-hint: "[code|concept|flow|why] [target]"
|
|
9
|
+
allowed-tools:
|
|
10
|
+
- Read
|
|
11
|
+
- Glob
|
|
12
|
+
- Grep
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Explain Code — Angular
|
|
16
|
+
|
|
17
|
+
Explain code, architecture, and technical decisions for the Angular project you are in. This skill is
|
|
18
|
+
**project-agnostic**: it never assumes a version, UI library, state-management approach, or folder
|
|
19
|
+
layout — it reads those from the project's own docs and source before explaining.
|
|
20
|
+
|
|
21
|
+
> **Scope:** a specific file / concept / flow / decision, explained **in-thread**. To map a WHOLE
|
|
22
|
+
> unfamiliar repo (structure inventory, entry points, traced execution paths), use the
|
|
23
|
+
> `angular-onboarding` agent instead — it runs in an isolated context built for repo-wide mapping.
|
|
24
|
+
|
|
25
|
+
## Language
|
|
26
|
+
Explain in the project's configured language — read `language` from the `## Commit Convention` block in
|
|
27
|
+
`.claude/rules/project-rules.md`. **Default: Vietnamese** (technical terms kept in English), e.g.
|
|
28
|
+
"Component này dùng `@Input()` để nhận data từ parent".
|
|
29
|
+
|
|
30
|
+
## Load context first (never assume)
|
|
31
|
+
**Always read the project's docs before explaining** — they are the source of truth for how THIS
|
|
32
|
+
codebase works:
|
|
33
|
+
- `CLAUDE.md` — stack summary + entry points + links.
|
|
34
|
+
- `.claude/rules/project-rules.md` — folder structure, naming, conventions, Precedence.
|
|
35
|
+
- `docs/ARCHITECTURE.md` — layers, routing, state approach, HTTP/interceptor flow, auth.
|
|
36
|
+
- `docs/DESIGN_SYSTEM.md` — UI library + shared/wrapped components.
|
|
37
|
+
- `.claude/angular-practices/<version>.md` — the version-matched idioms.
|
|
38
|
+
|
|
39
|
+
Do NOT assume Angular version, UI library (Material/PrimeNG/ng-zorro/…), state management (NgRx/Signals/
|
|
40
|
+
BehaviorSubject/…), base-service patterns, routing strategy, or interceptors. Take them from the docs +
|
|
41
|
+
the actual code.
|
|
42
|
+
|
|
43
|
+
## Workflow
|
|
44
|
+
|
|
45
|
+
### 1. Determine mode
|
|
46
|
+
If the user didn't say, infer intent:
|
|
47
|
+
- Asks about a specific file → `code`
|
|
48
|
+
- Asks about a pattern/concept (lazy loading, a state pattern, a base service…) → `concept`
|
|
49
|
+
- Asks "how", "luồng", "flow" → `flow`
|
|
50
|
+
- Asks "why", "tại sao", "lý do" → `why`
|
|
51
|
+
|
|
52
|
+
If still unclear, ask: "Bạn muốn giải thích: code (file cụ thể), concept (khái niệm), flow (luồng xử lý),
|
|
53
|
+
hay why (lý do thiết kế)?"
|
|
54
|
+
|
|
55
|
+
### 2. Read order by mode
|
|
56
|
+
| Mode | Read in this order |
|
|
57
|
+
|------|--------------------|
|
|
58
|
+
| `code` | CLAUDE.md → project-rules (Folder Structure) → the target file → related files (service/model) |
|
|
59
|
+
| `concept` | CLAUDE.md + ARCHITECTURE.md → a **real example** of the concept from this codebase |
|
|
60
|
+
| `flow` | CLAUDE.md → ARCHITECTURE.md (HTTP/interceptor flow) → component → service → interceptor/state |
|
|
61
|
+
| `why` | ARCHITECTURE.md + project-rules → the relevant file → `docs/decisions/` (ADRs) if present |
|
|
62
|
+
|
|
63
|
+
### 3. Find the source file
|
|
64
|
+
If given only a name (no path), use `Glob` (e.g. `**/*{name}*`) to locate it. Use the Folder Structure
|
|
65
|
+
in `project-rules.md` / `docs/ARCHITECTURE.md` to navigate — do not rely on a memorized tree.
|
|
66
|
+
|
|
67
|
+
### 4. Use the templates
|
|
68
|
+
Read `./templates/vi.md` and pick the skeleton for the mode. The templates are structure-only —
|
|
69
|
+
fill every placeholder with facts read from THIS project's code (its UI library, its HTTP/service
|
|
70
|
+
pattern, its interceptors, its state approach), not assumptions.
|
|
71
|
+
|
|
72
|
+
## Rules
|
|
73
|
+
- **Read real files, never guess** — verify the code still exists and matches before explaining.
|
|
74
|
+
- **Docs are the source of truth** — patterns/conventions come from `project-rules.md` + `docs/`.
|
|
75
|
+
- **Detail level** — beginners: from basics with everyday analogies; intermediate (default): patterns +
|
|
76
|
+
best practices; advanced: trade-offs + architectural decisions. Adjust to the question.
|
|
77
|
+
- **Structure**: (1) short summary (1–2 sentences) → (2) detailed explanation with real code → (3) key
|
|
78
|
+
takeaways → (4) links to related parts of the system.
|
|
79
|
+
|
|
80
|
+
## Error handling
|
|
81
|
+
| Situation | Handling |
|
|
82
|
+
|-----------|----------|
|
|
83
|
+
| Mode unclear | Infer from the question; if still unclear, ask |
|
|
84
|
+
| File not found | `Glob` with `**/*{name}*` |
|
|
85
|
+
| File too large | Read in parts (offset/limit), focus on the relevant section |
|
|
86
|
+
| Need more context | CLAUDE.md → ARCHITECTURE.md → service → model → component, in order |
|
|
87
|
+
| Concept unclear | Find a real example in the codebase to illustrate |
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
```
|
|
91
|
+
User: "Giải thích user-list.component.ts"
|
|
92
|
+
→ Mode: code → read CLAUDE.md + project-rules → the component (+ its service/model) → explain structure, data flow
|
|
93
|
+
|
|
94
|
+
User: "State management pattern ở đây là gì?"
|
|
95
|
+
→ Mode: concept → read ARCHITECTURE.md (state approach) → a real store/service example → explain the pattern used HERE
|
|
96
|
+
|
|
97
|
+
User: "Luồng đăng nhập chạy thế nào?"
|
|
98
|
+
→ Mode: flow → ARCHITECTURE.md (HTTP/interceptor) → login component → auth service → interceptor → render
|
|
99
|
+
|
|
100
|
+
User: "Tại sao module này lazy-load?"
|
|
101
|
+
→ Mode: why → ARCHITECTURE.md (routing) + the route config → explain reasons + trade-offs
|
|
102
|
+
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Templates Tiếng Việt — Giải thích code Angular (project-agnostic)
|
|
2
|
+
|
|
3
|
+
> Đây là **khung cấu trúc**, không gắn với dự án cụ thể. Điền mọi `{{...}}` bằng thông tin đọc được
|
|
4
|
+
> từ code thật của dự án (version, UI library, state approach, HTTP/service pattern, interceptors...).
|
|
5
|
+
> KHÔNG giả định PrimeNG/Material, NgRx/Signals, hay BaseService — lấy từ `docs/ARCHITECTURE.md`,
|
|
6
|
+
> `docs/DESIGN_SYSTEM.md`, `.claude/rules/project-rules.md` và code.
|
|
7
|
+
|
|
8
|
+
## Giải thích Code
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
## 📁 File: {filename}
|
|
12
|
+
|
|
13
|
+
### Mục đích
|
|
14
|
+
[1-2 câu: component/service này dùng để làm gì trong hệ thống]
|
|
15
|
+
|
|
16
|
+
### Phân tích
|
|
17
|
+
|
|
18
|
+
**Decorator / Metadata**
|
|
19
|
+
- `@Component`: selector, templateUrl, styleUrls, `changeDetection` (nếu có)
|
|
20
|
+
- Standalone hay khai báo trong NgModule? → theo đúng cách dự án dùng ({{standalone|NgModule}})
|
|
21
|
+
- `@Injectable`: `providedIn: 'root'` hay scoped
|
|
22
|
+
|
|
23
|
+
**Module / Feature Context** *(nếu có)*
|
|
24
|
+
- Thuộc feature/module: [tên — theo Folder Structure trong project-rules.md]
|
|
25
|
+
- Lazy-loaded: [có/không, qua route nào]
|
|
26
|
+
- Route path: [nếu có]
|
|
27
|
+
|
|
28
|
+
**Inputs / Outputs** *(nếu có)*
|
|
29
|
+
- `@Input()` / `input()`: [ý nghĩa, kiểu, ai truyền vào]
|
|
30
|
+
- `@Output()` / `output()`: [event gì, emit khi nào, payload]
|
|
31
|
+
|
|
32
|
+
**Dependencies (DI)**
|
|
33
|
+
- [Liệt kê service/token được inject — theo đúng pattern DI dự án dùng: `inject()` hay constructor]
|
|
34
|
+
- [Nếu dự án có base-service/abstraction dùng chung → nêu tên thật đọc từ code, không giả định]
|
|
35
|
+
|
|
36
|
+
**Properties chính**
|
|
37
|
+
- `propertyX: Type`: [vai trò, khởi tạo]
|
|
38
|
+
|
|
39
|
+
**Lifecycle Hooks**
|
|
40
|
+
- `ngOnInit()` / `ngOnDestroy()` / khác: [làm gì; teardown subscription thế nào]
|
|
41
|
+
|
|
42
|
+
**Methods quan trọng**
|
|
43
|
+
- [Tên method → nhiệm vụ, luồng xử lý]
|
|
44
|
+
|
|
45
|
+
**Form Handling** *(nếu có)*
|
|
46
|
+
- [Reactive/Template-driven — theo dự án; validators; luồng submit]
|
|
47
|
+
|
|
48
|
+
**UI Components** *(nếu có)*
|
|
49
|
+
- [Component của {{UI library dự án đang dùng}} hoặc wrapper trong shared/ — đọc từ DESIGN_SYSTEM.md]
|
|
50
|
+
|
|
51
|
+
**State Management** *(nếu có)*
|
|
52
|
+
- [Cách quản lý state THẬT của dự án: {{Signals | NgRx | BehaviorSubject | service}} — không giả định]
|
|
53
|
+
|
|
54
|
+
### 💡 Điểm cần nhớ
|
|
55
|
+
- [Key point về business logic / technical / edge cases]
|
|
56
|
+
|
|
57
|
+
### 🔗 Liên kết
|
|
58
|
+
- **Gọi service**: [service + methods]
|
|
59
|
+
- **Được dùng bởi**: [parent component / route]
|
|
60
|
+
- **Related files**: [model, service, routing]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Giải thích Concept
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
## 🎯 {Tên Concept}
|
|
69
|
+
|
|
70
|
+
### Là gì?
|
|
71
|
+
[2-3 câu giải thích đơn giản]
|
|
72
|
+
|
|
73
|
+
### Ví dụ đời thường
|
|
74
|
+
[So sánh với thứ quen thuộc để dễ hiểu]
|
|
75
|
+
|
|
76
|
+
### Trong dự án này
|
|
77
|
+
**Vị trí**: `[đường dẫn file thật]`
|
|
78
|
+
```typescript
|
|
79
|
+
// Ví dụ code THẬT trích từ dự án (không bịa)
|
|
80
|
+
```
|
|
81
|
+
**Cách dùng**:
|
|
82
|
+
```typescript
|
|
83
|
+
// Ví dụ sử dụng trong component/service của dự án
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Tại sao dùng?
|
|
87
|
+
- **Lý do 1..n**: [giải thích]
|
|
88
|
+
|
|
89
|
+
### Không dùng thì sao?
|
|
90
|
+
- ❌ [Vấn đề sẽ gặp]
|
|
91
|
+
|
|
92
|
+
### So sánh với cách khác
|
|
93
|
+
| Cách này | Cách khác | Khi nào dùng |
|
|
94
|
+
|----------|-----------|--------------|
|
|
95
|
+
| … | … | … |
|
|
96
|
+
|
|
97
|
+
### 📚 Tìm hiểu thêm
|
|
98
|
+
- Angular docs / docs của {{UI library / state library dự án dùng}} / related concepts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Giải thích Flow
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
## 🔄 Flow: {Tên tính năng}
|
|
107
|
+
|
|
108
|
+
### Tổng quan
|
|
109
|
+
[1-2 câu: flow từ đâu đến đâu]
|
|
110
|
+
|
|
111
|
+
### Sơ đồ
|
|
112
|
+
```
|
|
113
|
+
[User thao tác]
|
|
114
|
+
│
|
|
115
|
+
▼
|
|
116
|
+
[Component] ──── bắt event, validate (nếu có), gọi service
|
|
117
|
+
│
|
|
118
|
+
▼
|
|
119
|
+
[Service / lớp gọi API của dự án] ── chuẩn bị payload, gọi HTTP
|
|
120
|
+
│
|
|
121
|
+
▼
|
|
122
|
+
[HTTP Interceptor chain của dự án] ── {{liệt kê interceptor THẬT: auth, error, loading...}}
|
|
123
|
+
│
|
|
124
|
+
▼
|
|
125
|
+
[Backend API]
|
|
126
|
+
│
|
|
127
|
+
▼
|
|
128
|
+
[Response] ──► [Service] ──► [Component] ── handle success/error
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
[Template re-render]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Chi tiết từng bước
|
|
135
|
+
**Bước 1: User thao tác** — [event handler]
|
|
136
|
+
**Bước 2: Component xử lý** — [validate, gọi service]
|
|
137
|
+
```typescript
|
|
138
|
+
// code thật/minh họa theo dự án
|
|
139
|
+
```
|
|
140
|
+
**Bước 3: Service gọi API** — [method, endpoint]
|
|
141
|
+
**Bước 4: Interceptors** — [đọc từ ARCHITECTURE.md: những interceptor dự án thực sự có]
|
|
142
|
+
**Bước 5: Nhận response** — [success/error handling]
|
|
143
|
+
**Bước 6: UI update** — [change detection / component cập nhật]
|
|
144
|
+
|
|
145
|
+
### 🔍 Mẹo debug
|
|
146
|
+
- Network tab: URL/headers/payload/status đúng không?
|
|
147
|
+
- Console: lỗi từ interceptor? token? validation?
|
|
148
|
+
- Environment/config: đọc từ nơi dự án lưu config (theo ARCHITECTURE.md)
|
|
149
|
+
|
|
150
|
+
### Common issues
|
|
151
|
+
- ❌ [liệt kê theo pattern thật của dự án]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Giải thích Why
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
## ❓ Tại sao: {Câu hỏi}
|
|
160
|
+
|
|
161
|
+
### Trả lời ngắn
|
|
162
|
+
[1-2 câu trả lời trực tiếp]
|
|
163
|
+
|
|
164
|
+
### Giải thích chi tiết
|
|
165
|
+
- **Lý do 1..n**: [giải thích + ví dụ code nếu cần]
|
|
166
|
+
|
|
167
|
+
### Nếu không làm vậy?
|
|
168
|
+
- ❌ [Vấn đề + impact + mức độ]
|
|
169
|
+
|
|
170
|
+
### Đánh đổi (Trade-offs)
|
|
171
|
+
| Ưu điểm ✅ | Nhược điểm ❌ |
|
|
172
|
+
|-----------|--------------|
|
|
173
|
+
| … | … |
|
|
174
|
+
|
|
175
|
+
### Có cách khác không?
|
|
176
|
+
- **Cách 1..n**: [mô tả, khi nào dùng]
|
|
177
|
+
|
|
178
|
+
### Context trong dự án này
|
|
179
|
+
- [Đọc `docs/decisions/` (ADR) nếu có; nếu không, nêu rõ là suy luận từ code]
|
|
180
|
+
|
|
181
|
+
### 📌 Kết luận
|
|
182
|
+
**TL;DR**: [2-3 câu]
|
|
183
|
+
**Key takeaways**: 💡 [điểm quan trọng]
|
|
184
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-commit
|
|
3
|
+
description: >
|
|
4
|
+
Write conventional commit messages for this project.
|
|
5
|
+
Use when the user says "commit", "git commit", "save changes",
|
|
6
|
+
"tạo commit", "viết commit message", or finished a task and wants to commit.
|
|
7
|
+
argument-hint: "[type] [message]"
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Bash
|
|
10
|
+
- Read
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Commit Message Generator
|
|
14
|
+
|
|
15
|
+
Generates conventional commit messages that follow **this project's** convention. It is
|
|
16
|
+
project-agnostic: the prefix, language, and scope source are read at runtime from the project's
|
|
17
|
+
config — nothing is hardcoded.
|
|
18
|
+
|
|
19
|
+
## Read the project's convention first
|
|
20
|
+
Read the `## Commit Convention` block in `.claude/rules/project-rules.md` (filled by `/init`). It
|
|
21
|
+
defines:
|
|
22
|
+
- **Prefix** — an optional string prepended before `<type>` (e.g. `VIVAS_`). **Default: none.**
|
|
23
|
+
- **Language** — the language for subject/body. **Default: `vi` (Vietnamese).**
|
|
24
|
+
- **Scope source** — the folder level scope is derived from (see below).
|
|
25
|
+
|
|
26
|
+
If that block is missing, fall back to: no prefix, language `vi`, scope derived dynamically.
|
|
27
|
+
Full rules and type/subject conventions: `.claude/skills/git-commit/references/conventions.md`.
|
|
28
|
+
(The `angular-git-workflow` agent reads the same block — keep them consistent.)
|
|
29
|
+
|
|
30
|
+
## Format
|
|
31
|
+
```
|
|
32
|
+
<prefix><type>(<scope>): <subject>
|
|
33
|
+
```
|
|
34
|
+
- `<prefix>` from project-rules (default empty → standard conventional commit).
|
|
35
|
+
- `<type>`: feat, fix, refactor, docs, style, test, chore, perf, ci, build, revert.
|
|
36
|
+
- `<scope>`: derived from changed paths (see Scope Detection); omit if changes span multiple modules.
|
|
37
|
+
- `<subject>`: in the configured language, imperative, ≤50 chars, no trailing period.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
```
|
|
41
|
+
/commit → Auto-detect type + scope from staged changes
|
|
42
|
+
/commit feat add login → Quick commit with type + message
|
|
43
|
+
/commit --amend → Amend last commit message
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
1. **Stage** (if nothing staged): `git add .`
|
|
48
|
+
2. **Inspect**: `git diff --staged --stat` then `git diff --staged`.
|
|
49
|
+
3. **Read convention**: the `## Commit Convention` block (prefix/language/scope source) +
|
|
50
|
+
`references/conventions.md`.
|
|
51
|
+
4. **Detect type** from changed files/content (see conventions.md table).
|
|
52
|
+
5. **Derive scope** (see below).
|
|
53
|
+
6. **Generate message** → show a preview:
|
|
54
|
+
```
|
|
55
|
+
📝 COMMIT PREVIEW
|
|
56
|
+
|
|
57
|
+
<prefix><type>(<scope>): <subject in configured language>
|
|
58
|
+
|
|
59
|
+
- <body bullet 1>
|
|
60
|
+
- <body bullet 2>
|
|
61
|
+
|
|
62
|
+
Staged files (N):
|
|
63
|
+
M <path>
|
|
64
|
+
A <path>
|
|
65
|
+
|
|
66
|
+
Commit? (yes/no/edit)
|
|
67
|
+
```
|
|
68
|
+
7. **Execute after confirm**: `yes` → `git commit -m "..."`; `edit` → user tweaks then commit;
|
|
69
|
+
`no` → abort (keep staged).
|
|
70
|
+
|
|
71
|
+
## Scope Detection (dynamic — no hardcoded table)
|
|
72
|
+
Derive `<scope>` from the staged file paths + the project's **Folder Structure** in
|
|
73
|
+
`.claude/rules/project-rules.md` / `docs/ARCHITECTURE.md`:
|
|
74
|
+
- Scope = the top-level feature/module folder the changed files live in (e.g. under
|
|
75
|
+
`src/app/features/<scope>/…` or `src/app/modules/<scope>/…` — use the project's actual layout).
|
|
76
|
+
- Shared/cross-cutting folders map to their own scope (e.g. `shared`, `core`, `layout`).
|
|
77
|
+
- Changes spanning multiple modules → **omit the scope**.
|
|
78
|
+
|
|
79
|
+
## Quick Commit
|
|
80
|
+
Skip the preview for trivial changes:
|
|
81
|
+
```
|
|
82
|
+
/commit fix typo in readme
|
|
83
|
+
↓
|
|
84
|
+
git commit -m "<prefix>fix: typo in readme"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Rules
|
|
88
|
+
- **Follow the project's convention** — prefix, language, and scope come from project-rules; never
|
|
89
|
+
hardcode a company prefix or module list here.
|
|
90
|
+
- **Language** — subject/body in the configured language (default Vietnamese; imperative: "thêm",
|
|
91
|
+
"sửa", "cập nhật", "xóa").
|
|
92
|
+
- **Lowercase** type and scope. **No trailing period.** **50/72 rule** (subject ≤50, body wrap 72).
|
|
93
|
+
- **No Co-Authored-By** trailer.
|
|
94
|
+
|
|
95
|
+
## Amend Last Commit
|
|
96
|
+
```bash
|
|
97
|
+
git commit --amend -m "<prefix><type>(<scope>): new message"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Error Handling
|
|
101
|
+
| Issue | Action |
|
|
102
|
+
|-------|--------|
|
|
103
|
+
| No staged changes | Stage with `git add .` or ask the user what to stage |
|
|
104
|
+
| No changes at all | Report "nothing to commit" |
|
|
105
|
+
| User declines | Abort, keep staged |
|
|
106
|
+
| Convention block missing | Fall back to: no prefix, language vi, dynamic scope |
|
|
107
|
+
| Git error | Show error, suggest fix |
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Commit Conventions
|
|
2
|
+
|
|
3
|
+
> **This project's prefix, language, and scope source come from the `## Commit Convention` block in
|
|
4
|
+
> `.claude/rules/project-rules.md`** (filled by `/init`). This file defines the generic rules; the
|
|
5
|
+
> project block supplies the project-specific values. Defaults if the block is missing: no prefix,
|
|
6
|
+
> language `vi`, scope derived dynamically from changed paths.
|
|
7
|
+
|
|
8
|
+
## Format
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
<prefix><type>(<scope>): <subject>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
<footer>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- `<prefix>` — optional, from project-rules (e.g. `VIVAS_`). Default: empty.
|
|
19
|
+
- `<subject>`/`<body>`/`<footer>` — in the configured `language` (default Vietnamese).
|
|
20
|
+
|
|
21
|
+
## Types
|
|
22
|
+
|
|
23
|
+
| Type | When to use | Example change |
|
|
24
|
+
|------|-------------|----------------|
|
|
25
|
+
| `feat` | New feature | New component, endpoint, capability |
|
|
26
|
+
| `fix` | Bug fix | Crash, wrong logic, edge case |
|
|
27
|
+
| `refactor` | Restructure (no behavior change) | Rename, extract, reorganize |
|
|
28
|
+
| `docs` | Documentation | README, comments, CLAUDE.md |
|
|
29
|
+
| `style` | Formatting (no code change) | Lint fixes, whitespace |
|
|
30
|
+
| `test` | Add/update tests | `*.spec.ts` |
|
|
31
|
+
| `chore` | Maintenance | Dependencies, configs, scripts, environments |
|
|
32
|
+
| `perf` | Performance | Optimize query, reduce bundle size |
|
|
33
|
+
| `ci` | CI/CD | GitHub Actions, Docker |
|
|
34
|
+
| `build` | Build system | `angular.json`, `tsconfig`, webpack |
|
|
35
|
+
| `revert` | Revert a commit | Undo a previous commit |
|
|
36
|
+
|
|
37
|
+
## Auto-detect Type
|
|
38
|
+
|
|
39
|
+
| Changed files / content | Detected type |
|
|
40
|
+
|-------------------------|---------------|
|
|
41
|
+
| `*.spec.ts` only | `test` |
|
|
42
|
+
| `*.md` only | `docs` |
|
|
43
|
+
| `package.json`, `tsconfig*.json`, `.eslintrc*` only | `chore` |
|
|
44
|
+
| `src/environments/*.ts` only | `chore` |
|
|
45
|
+
| `angular.json`, `webpack*.js` | `build` |
|
|
46
|
+
| New files + new exports | `feat` |
|
|
47
|
+
| Fixed logic / error handling in existing files | `fix` |
|
|
48
|
+
| Renamed / moved files, no logic change | `refactor` |
|
|
49
|
+
|
|
50
|
+
## Scope Detection (dynamic — derive, don't hardcode)
|
|
51
|
+
|
|
52
|
+
Derive `<scope>` from the staged file paths + the project's **Folder Structure** in
|
|
53
|
+
`.claude/rules/project-rules.md` / `docs/ARCHITECTURE.md`:
|
|
54
|
+
|
|
55
|
+
- Scope = the top-level feature/module folder the changed files live in — e.g. under
|
|
56
|
+
`src/app/features/<scope>/…` or `src/app/modules/<scope>/…` (use the project's actual layout).
|
|
57
|
+
- Shared / cross-cutting folders map to their own scope name (e.g. `shared`, `core`, `layout`).
|
|
58
|
+
- Changes spanning multiple modules → **omit the scope**.
|
|
59
|
+
|
|
60
|
+
## Subject Rules
|
|
61
|
+
- Prepend the configured prefix (if any) before `<type>`.
|
|
62
|
+
- Configured language, concise and clear.
|
|
63
|
+
- No trailing period.
|
|
64
|
+
- ≤ 50 characters.
|
|
65
|
+
- Imperative mood (VI: "thêm", "sửa", "cập nhật", "xóa" / EN: "add", "fix", "update", "remove").
|
|
66
|
+
|
|
67
|
+
## Body Rules
|
|
68
|
+
- Separate from subject with a blank line.
|
|
69
|
+
- Explain WHAT and WHY, not HOW.
|
|
70
|
+
- Bullet points for multiple changes.
|
|
71
|
+
- Wrap at 72 characters.
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
> These show the *shape*. The prefix depends on the project's config — shown both ways.
|
|
76
|
+
|
|
77
|
+
### No prefix (default conventional commit)
|
|
78
|
+
```
|
|
79
|
+
fix(users): sửa lỗi null khi load danh sách người dùng
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### With a configured prefix (e.g. project sets Prefix: VIVAS_)
|
|
83
|
+
```
|
|
84
|
+
VIVAS_feat(reports): thêm chức năng xuất báo cáo PDF
|
|
85
|
+
|
|
86
|
+
- Thêm report-export component
|
|
87
|
+
- Hỗ trợ filter theo thời gian và khu vực
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Multiple modules → omit scope
|
|
91
|
+
```
|
|
92
|
+
fix: sửa giao diện và validate ở nhiều module
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Breaking change
|
|
96
|
+
```
|
|
97
|
+
feat(api)!: thay đổi cấu trúc response
|
|
98
|
+
|
|
99
|
+
BREAKING CHANGE: Response được bọc trong { success, data, error }.
|
|
100
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# SRS (source requirements)
|
|
2
|
+
|
|
3
|
+
Drop your **already-split** SRS excerpts here — one file per module/feature, not the whole
|
|
4
|
+
multi-module document. If your SRS is a Word doc converted via `pandoc` into one large Markdown
|
|
5
|
+
file with an images folder, extract just the section you're about to build and save it here,
|
|
6
|
+
keeping any image references relative and valid.
|
|
7
|
+
|
|
8
|
+
## Convention
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
docs/srs/
|
|
12
|
+
├── module-5-order-management.md
|
|
13
|
+
├── module-6-invoicing.md
|
|
14
|
+
└── images/ # keep paths relative to match what pandoc generated
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
This folder is **not** auto-read — `/plan` doesn't scan it on its own. Point to the file
|
|
20
|
+
explicitly when you start planning:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/plan
|
|
24
|
+
|
|
25
|
+
Đọc yêu cầu từ docs/srs/module-5-order-management.md
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Keep these files committed — they're the record of what was actually asked for each module,
|
|
29
|
+
useful when a later module needs to know how an earlier one was scoped.
|
|
@@ -63,6 +63,14 @@ When guidance conflicts, follow this order top to bottom:
|
|
|
63
63
|
- Do NOT hardcode the backend URL
|
|
64
64
|
- Do NOT import UI library components directly in features when a wrapper exists in `shared/components/`
|
|
65
65
|
|
|
66
|
+
## Commit Convention
|
|
67
|
+
> Read by the `git-commit` skill and the `angular-git-workflow` agent. /init fills this from `git log`.
|
|
68
|
+
- **Prefix**: {{none}} <!-- prepended before <type>, e.g. "VIVAS_"; default: none -->
|
|
69
|
+
- **Language**: {{vi}} <!-- subject/body language for commits AND /explain output; default: vi -->
|
|
70
|
+
- **Format**: `<prefix><type>(<scope>): <subject>`
|
|
71
|
+
- **Scope source**: top-level folder under {{src/app/features | src/app/modules | ...}} of the changed files; multiple modules → omit scope
|
|
72
|
+
- **Types**: feat, fix, refactor, docs, style, test, chore, perf, ci, build, revert
|
|
73
|
+
|
|
66
74
|
## Reference Examples
|
|
67
75
|
> /init fills this with the best existing files to copy patterns from.
|
|
68
76
|
> `/new-feature` opens these and mirrors their style.
|