procedure-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/.claude/settings.local.json +23 -0
  2. package/.env.example +2 -0
  3. package/AGENTS.md +113 -0
  4. package/CLAUDE.md +136 -0
  5. package/CODE-FIXED.md +124 -0
  6. package/CODE-REVIEW.md +253 -0
  7. package/README.md +130 -0
  8. package/config/defaults.json +8 -0
  9. package/config/powerline-config.json +52 -0
  10. package/config/stacks/typescript-node.json +15 -0
  11. package/dist/app.d.ts +1 -0
  12. package/dist/app.js +131 -0
  13. package/dist/app.js.map +1 -0
  14. package/dist/cli.d.ts +2 -0
  15. package/dist/cli.js +6 -0
  16. package/dist/cli.js.map +1 -0
  17. package/dist/components/banner.d.ts +1 -0
  18. package/dist/components/banner.js +11 -0
  19. package/dist/components/banner.js.map +1 -0
  20. package/dist/components/gutter-line.d.ts +5 -0
  21. package/dist/components/gutter-line.js +9 -0
  22. package/dist/components/gutter-line.js.map +1 -0
  23. package/dist/components/guttered-select.d.ts +25 -0
  24. package/dist/components/guttered-select.js +68 -0
  25. package/dist/components/guttered-select.js.map +1 -0
  26. package/dist/components/step-indicator.d.ts +7 -0
  27. package/dist/components/step-indicator.js +12 -0
  28. package/dist/components/step-indicator.js.map +1 -0
  29. package/dist/components/timeline.d.ts +13 -0
  30. package/dist/components/timeline.js +26 -0
  31. package/dist/components/timeline.js.map +1 -0
  32. package/dist/lib/fs.d.ts +3 -0
  33. package/dist/lib/fs.js +15 -0
  34. package/dist/lib/fs.js.map +1 -0
  35. package/dist/lib/git.d.ts +4 -0
  36. package/dist/lib/git.js +37 -0
  37. package/dist/lib/git.js.map +1 -0
  38. package/dist/lib/powerline.d.ts +1 -0
  39. package/dist/lib/powerline.js +30 -0
  40. package/dist/lib/powerline.js.map +1 -0
  41. package/dist/lib/template.d.ts +9 -0
  42. package/dist/lib/template.js +46 -0
  43. package/dist/lib/template.js.map +1 -0
  44. package/dist/lib/types.d.ts +44 -0
  45. package/dist/lib/types.js +2 -0
  46. package/dist/lib/types.js.map +1 -0
  47. package/dist/providers/openai.d.ts +1 -0
  48. package/dist/providers/openai.js +5 -0
  49. package/dist/providers/openai.js.map +1 -0
  50. package/dist/providers/zai.d.ts +1 -0
  51. package/dist/providers/zai.js +7 -0
  52. package/dist/providers/zai.js.map +1 -0
  53. package/dist/steps/architecture.d.ts +6 -0
  54. package/dist/steps/architecture.js +39 -0
  55. package/dist/steps/architecture.js.map +1 -0
  56. package/dist/steps/build-test.d.ts +7 -0
  57. package/dist/steps/build-test.js +38 -0
  58. package/dist/steps/build-test.js.map +1 -0
  59. package/dist/steps/generation.d.ts +7 -0
  60. package/dist/steps/generation.js +60 -0
  61. package/dist/steps/generation.js.map +1 -0
  62. package/dist/steps/powerline.d.ts +7 -0
  63. package/dist/steps/powerline.js +62 -0
  64. package/dist/steps/powerline.js.map +1 -0
  65. package/dist/steps/product-context.d.ts +7 -0
  66. package/dist/steps/product-context.js +90 -0
  67. package/dist/steps/product-context.js.map +1 -0
  68. package/dist/steps/project-info.d.ts +6 -0
  69. package/dist/steps/project-info.js +61 -0
  70. package/dist/steps/project-info.js.map +1 -0
  71. package/dist/steps/stack-style.d.ts +6 -0
  72. package/dist/steps/stack-style.js +67 -0
  73. package/dist/steps/stack-style.js.map +1 -0
  74. package/docs/GIAI-THICH-CLAUDE-MD.md +206 -0
  75. package/docs/PRD.md +130 -0
  76. package/docs/USER-STORIES.md +181 -0
  77. package/package.json +38 -0
  78. package/src/app.tsx +201 -0
  79. package/src/cli.tsx +6 -0
  80. package/src/components/banner.tsx +23 -0
  81. package/src/components/gutter-line.tsx +10 -0
  82. package/src/components/guttered-select.tsx +137 -0
  83. package/src/components/step-indicator.tsx +19 -0
  84. package/src/components/timeline.tsx +49 -0
  85. package/src/lib/fs.ts +18 -0
  86. package/src/lib/git.ts +41 -0
  87. package/src/lib/powerline.ts +48 -0
  88. package/src/lib/template.ts +59 -0
  89. package/src/lib/types.ts +68 -0
  90. package/src/providers/openai.ts +5 -0
  91. package/src/providers/zai.ts +7 -0
  92. package/src/steps/architecture.tsx +71 -0
  93. package/src/steps/build-test.tsx +78 -0
  94. package/src/steps/generation.tsx +146 -0
  95. package/src/steps/powerline.tsx +149 -0
  96. package/src/steps/product-context.tsx +182 -0
  97. package/src/steps/project-info.tsx +135 -0
  98. package/src/steps/stack-style.tsx +117 -0
  99. package/templates/.env.example.hbs +6 -0
  100. package/templates/CLAUDE.md.hbs +105 -0
  101. package/templates/README.md.hbs +26 -0
  102. package/templates/docs/PRD.md.hbs +29 -0
  103. package/templates/docs/USER-STORIES.md.hbs +46 -0
  104. package/tsconfig.json +17 -0
@@ -0,0 +1,61 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Text } from "ink";
4
+ import { TextInput } from "@inkjs/ui";
5
+ import { GutterLine } from "../components/gutter-line.js";
6
+ import { GutteredSelect } from "../components/guttered-select.js";
7
+ const STEP_ORDER = [
8
+ "projectName",
9
+ "description",
10
+ "packageManager",
11
+ "license",
12
+ ];
13
+ const PACKAGE_MANAGER_OPTIONS = [
14
+ { label: "npm", value: "npm" },
15
+ { label: "pnpm", value: "pnpm" },
16
+ { label: "bun", value: "bun" },
17
+ { label: "yarn", value: "yarn" },
18
+ ];
19
+ const LICENSE_OPTIONS = [
20
+ { label: "MIT — Permissive, allows commercial use", value: "MIT" },
21
+ { label: "ISC — Simplified MIT, minimal restrictions", value: "ISC" },
22
+ { label: "Apache-2.0 — Permissive with patent protection", value: "Apache-2.0" },
23
+ { label: "GPL-3.0 — Copyleft, requires source disclosure", value: "GPL-3.0" },
24
+ { label: "Unlicense — Public domain, no restrictions", value: "Unlicense" },
25
+ ];
26
+ export default function ProjectInfo({ onComplete }) {
27
+ const [stepIndex, setStepIndex] = useState(0);
28
+ const [answers, setAnswers] = useState({});
29
+ const [error, setError] = useState("");
30
+ const currentStep = STEP_ORDER[stepIndex];
31
+ function advance(key, value) {
32
+ const next = { ...answers, [key]: value };
33
+ setAnswers(next);
34
+ setError("");
35
+ if (stepIndex < STEP_ORDER.length - 1) {
36
+ setStepIndex(stepIndex + 1);
37
+ }
38
+ else {
39
+ onComplete(next);
40
+ }
41
+ }
42
+ function handleTextSubmit(value) {
43
+ const val = value.trim();
44
+ if (!val) {
45
+ setError(currentStep === "projectName"
46
+ ? "Project name is required"
47
+ : "Description is required");
48
+ return;
49
+ }
50
+ advance(currentStep, val);
51
+ }
52
+ function handleSelectChange(key) {
53
+ return (value) => {
54
+ advance(key, value);
55
+ };
56
+ }
57
+ // Render completed fields
58
+ const completed = STEP_ORDER.slice(0, stepIndex).map((key) => (_jsx(GutterLine, { children: _jsxs(Text, { dimColor: true, children: [key === "projectName" && `Project name: ${answers[key]}`, key === "description" && `Description: ${answers[key]}`, key === "packageManager" && `Package manager: ${answers[key]}`, key === "license" && `License: ${answers[key]}`] }) }, key)));
59
+ return (_jsxs(_Fragment, { children: [completed, currentStep === "projectName" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "Project name: " }), _jsx(TextInput, { placeholder: "...", onSubmit: handleTextSubmit })] })), currentStep === "description" && (_jsxs(GutterLine, { children: [_jsx(Text, { bold: true, children: "One-line description: " }), _jsx(TextInput, { placeholder: "...", onSubmit: handleTextSubmit })] })), currentStep === "packageManager" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Package manager:" }) }), _jsx(GutteredSelect, { options: PACKAGE_MANAGER_OPTIONS, onChange: handleSelectChange("packageManager") })] })), currentStep === "license" && (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "License:" }) }), _jsx(GutteredSelect, { options: LICENSE_OPTIONS, onChange: handleSelectChange("license") })] })), error && (_jsx(GutterLine, { children: _jsx(Text, { color: "red", children: error }) }))] }));
60
+ }
61
+ //# sourceMappingURL=project-info.js.map
@@ -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 +1,6 @@
1
+ import type { WizardAnswers } from "../lib/types.js";
2
+ interface Props {
3
+ onComplete: (answers: Partial<WizardAnswers>) => void;
4
+ }
5
+ export default function StackStyle({ onComplete }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Text } from "ink";
4
+ import { TextInput } from "@inkjs/ui";
5
+ import { GutterLine } from "../components/gutter-line.js";
6
+ import { GutteredSelect } from "../components/guttered-select.js";
7
+ const PRESET_OPTIONS = [
8
+ { label: "TypeScript + Node.js", value: "typescript-node" },
9
+ ];
10
+ const ADVANCED_FIELDS = [
11
+ { key: "language", label: "Language" },
12
+ { key: "framework", label: "Framework" },
13
+ { key: "codeStyle", label: "Code style conventions (comma-separated)" },
14
+ ];
15
+ const PRESETS = {
16
+ "typescript-node": {
17
+ language: "TypeScript",
18
+ framework: "Node.js",
19
+ codeStyle: [
20
+ "TypeScript strict mode, ESM imports",
21
+ "camelCase for variables, PascalCase for types",
22
+ "stdlib -> external -> internal import ordering",
23
+ "Return errors, don't throw",
24
+ ],
25
+ buildCommand: "npm run build",
26
+ testCommand: "npm run test",
27
+ typecheckCommand: "npm run typecheck",
28
+ lintCommand: "npm run lint",
29
+ },
30
+ };
31
+ export default function StackStyle({ onComplete }) {
32
+ const [mode, setMode] = useState("choosing");
33
+ const [advancedIndex, setAdvancedIndex] = useState(0);
34
+ const [answers, setAnswers] = useState({});
35
+ if (mode === "choosing") {
36
+ return (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Setup mode:" }) }), _jsx(GutteredSelect, { options: [
37
+ { label: "QuickStart (use a preset)", value: "quickstart" },
38
+ { label: "Advanced (manual config)", value: "advanced" },
39
+ ], onChange: (val) => setMode(val) })] }));
40
+ }
41
+ if (mode === "quickstart") {
42
+ return (_jsxs(_Fragment, { children: [_jsx(GutterLine, { children: _jsx(Text, { bold: true, children: "Select a stack preset:" }) }), _jsx(GutteredSelect, { options: PRESET_OPTIONS, onChange: (val) => {
43
+ const preset = PRESETS[val];
44
+ if (preset) {
45
+ onComplete(preset);
46
+ }
47
+ } })] }));
48
+ }
49
+ // Advanced mode
50
+ const current = ADVANCED_FIELDS[advancedIndex];
51
+ function handleSubmit(value) {
52
+ const next = { ...answers, [current.key]: value };
53
+ setAnswers(next);
54
+ if (advancedIndex < ADVANCED_FIELDS.length - 1) {
55
+ setAdvancedIndex(advancedIndex + 1);
56
+ }
57
+ else {
58
+ onComplete({
59
+ language: next.language,
60
+ framework: next.framework,
61
+ codeStyle: (next.codeStyle || "").split(",").map((s) => s.trim()),
62
+ });
63
+ }
64
+ }
65
+ return (_jsxs(_Fragment, { children: [ADVANCED_FIELDS.slice(0, advancedIndex).map((f) => (_jsx(GutterLine, { children: _jsxs(Text, { dimColor: true, children: [f.label, ": ", answers[f.key]] }) }, f.key))), _jsxs(GutterLine, { children: [_jsxs(Text, { bold: true, children: [current.label, ": "] }), _jsx(TextInput, { placeholder: "...", onSubmit: handleSubmit })] })] }));
66
+ }
67
+ //# sourceMappingURL=stack-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack-style.js","sourceRoot":"","sources":["../../src/steps/stack-style.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAUlE,MAAM,cAAc,GAAG;IACrB,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,iBAAiB,EAAE;CAC5D,CAAC;AAEF,MAAM,eAAe,GAA4C;IAC/D,EAAE,GAAG,EAAE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G,CAAC,IACrB,IAHQ,CAAC,CAAC,GAAG,CAIT,CACd,CAAC,EAEF,MAAC,UAAU,eACT,MAAC,IAAI,IAAC,IAAI,mBAAE,OAAQ,CAAC,KAAK,UAAU,EACpC,KAAC,SAAS,IAAC,WAAW,EAAC,KAAK,EAAC,QAAQ,EAAE,YAAY,GAAI,IAC5C,IACZ,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,206 @@
1
+ ---
2
+ type: explainer
3
+ project: claude-code-best-practices
4
+ lang: vi
5
+ created: 2026-02-20
6
+ updated: 2026-02-20
7
+ ---
8
+
9
+ # CLAUDE.md — File "Luật Chơi" Cho AI
10
+
11
+ > Tài liệu giải thích bằng tiếng Việt, dùng ngôn ngữ đơn giản, để đọc lại khi cần.
12
+ > Xem template mẫu tại [[SUGGESTED-CLAUDE-MD]].
13
+
14
+ ---
15
+
16
+ ## CLAUDE.md Là Gì?
17
+
18
+ Hãy tưởng tượng bạn thuê một lập trình viên mới vào team. Ngày đầu tiên, bạn sẽ nói gì với họ?
19
+
20
+ - "Dự án này dùng TypeScript, build bằng `npm run build`"
21
+ - "Luôn chạy test trước khi tạo PR"
22
+ - "Đừng dùng `any` type — team mình không chấp nhận"
23
+ - "Khi gặp bug, tự tìm root cause, đừng fix tạm"
24
+
25
+ **CLAUDE.md chính là tập hợp những lời dặn dò đó**, nhưng dành cho AI (Claude). Nó là một file text đặt trong thư mục gốc của dự án, và Claude đọc nó mỗi khi bắt đầu làm việc.
26
+
27
+ Boris Cherny — người tạo ra Claude Code — và team của anh ấy ở Anthropic dùng file này mỗi ngày. File của họ chỉ khoảng **2.500 từ** nhưng cực kỳ hiệu quả.
28
+
29
+ ---
30
+
31
+ ## Tại Sao Cần CLAUDE.md?
32
+
33
+ Không có CLAUDE.md, Claude sẽ:
34
+ - **Đoán mò** lệnh build (có thể dùng `npm` thay vì `bun`)
35
+ - **Tự nghĩ ra** convention đặt tên (có thể khác với team bạn)
36
+ - **Làm xong rồi nói "done"** mà không chạy test
37
+ - **Lặp lại sai lầm cũ** vì không nhớ lần trước bị sửa
38
+
39
+ Có CLAUDE.md, Claude sẽ:
40
+ - Chạy đúng lệnh build/test
41
+ - Tuân theo convention của team
42
+ - Tự kiểm tra trước khi nói "xong"
43
+ - Không lặp lại lỗi đã ghi trong Lessons
44
+
45
+ ---
46
+
47
+ ## Cấu Trúc 4 Tầng
48
+
49
+ Phát hiện quan trọng nhất từ nghiên cứu: **hầu hết mọi người chỉ viết 1-2 trong 4 tầng cần thiết**, nên kết quả không ổn định.
50
+
51
+ Ngoài 4 tầng trong CLAUDE.md, phương pháp procedure còn tạo thêm **PRD** (docs/PRD.md) và **User Stories** (docs/USER-STORIES.md) — giúp AI hiểu không chỉ cách code, mà còn sản phẩm là gì và cần xây cái gì.
52
+
53
+ ### Tầng 1: Kiến Thức Dự Án — "Codebase này trông như thế nào?"
54
+
55
+ Phần **cụ thể, máy móc**: lệnh build/test, convention code, kiến trúc, file quan trọng.
56
+
57
+ Trong template: `Build & Test`, `Code Style`, `Architecture`
58
+
59
+ **Nếu thiếu:** Claude đoán lệnh, tự nghĩ ra convention, phá vỡ kiến trúc.
60
+
61
+ ### Tầng 2: Hợp Đồng Hành Vi — "Claude nên làm việc như thế nào?"
62
+
63
+ Phần **quy tắc tư duy**, bao gồm 5 quy tắc:
64
+
65
+ | Quy tắc | Ý nghĩa đơn giản | Ví dụ dễ hiểu |
66
+ |---------|-------------------|----------------|
67
+ | **Planning** | Task phức tạp → lên plan trước, rồi mới code | Không xây nhà mà không có bản vẽ |
68
+ | **Verification** | Không nói "xong" mà chưa chứng minh nó chạy | Đầu bếp nếm thử trước khi bưng ra cho khách |
69
+ | **Self-Improvement** | Mỗi lần bị sửa → ghi bài học → không lặp lại | Sau mỗi trận thua, ghi lại lý do |
70
+ | **Bug Fixing** | Nhận bug report → tự tìm, tự sửa | Thợ ống nước giỏi không cần bạn chỉ ống nào rò |
71
+ | **Elegance** | Task lớn → hỏi "có cách nào đẹp hơn?" | Nấu ăn ngon nhưng không cần trang trí cho bữa cơm gia đình |
72
+
73
+ Trong template: `Workflow` section
74
+
75
+ **Nếu thiếu:** Claude biết codebase nhưng làm việc cẩu thả — bỏ qua verification, không plan, không tự cải thiện.
76
+
77
+ **Tip quan trọng nhất** theo Boris: Verification — tăng chất lượng lên 2-3 lần.
78
+
79
+ ### Tầng 3: Hợp Đồng Phối Hợp — "Claude phối hợp nhiều agent như thế nào?"
80
+
81
+ Phần **quản lý đội** (mới từ tháng 2/2026 với Agent Teams). 3 quy tắc vàng:
82
+
83
+ 1. **Mỗi người sở hữu file riêng** — KHÔNG BAO GIỜ để 2 người sửa cùng 1 file
84
+ - Ví dụ: thợ điện chỉ đi dây điện, thợ nước chỉ đi ống nước. 2 người cùng đục 1 bức tường → hỏng!
85
+
86
+ 2. **Mô tả task phải đầy đủ** — teammate không biết context trước đó
87
+ - Ví dụ: đừng nói "sửa cái lỗi hồi nãy" → hãy nói "sửa lỗi null pointer ở file src/auth.ts dòng 42"
88
+
89
+ 3. **Nhắn riêng, không broadcast** — chỉ gửi tin nhắn chung khi thật sự cấp bách
90
+
91
+ Trong template: `Task Management` section
92
+
93
+ **Nếu thiếu:** Nhiều agent đụng nhau (sửa cùng file), thiếu context, task chạy loạn.
94
+
95
+ **Giống như:** Nếu Tầng 2 là "luật chơi cho 1 người", thì Tầng 3 là "luật chơi cho cả đội".
96
+
97
+ **3 cách chia việc song song:**
98
+
99
+ | Cách | Khi nào dùng | Ví dụ |
100
+ |------|-------------|-------|
101
+ | **Subagent** | Việc nhỏ, một chiều | Sai người đi photocopy |
102
+ | **Agent Team** | Nhiều người phối hợp | Dự án xây nhà |
103
+ | **Git Worktree** | Việc hoàn toàn độc lập | 3 nhà hàng khác nhau |
104
+
105
+ ### Tầng 4: Bộ Nhớ Sống — "Claude không được lặp lại sai lầm gì?"
106
+
107
+ Phần **tích lũy theo thời gian**:
108
+
109
+ ```
110
+ ## Lessons
111
+ - Không dùng `any` type — luôn định nghĩa interface rõ ràng
112
+ - Container `--rm` flag không đáng tin — luôn thêm explicit `container rm`
113
+ ```
114
+
115
+ **Cách hoạt động:**
116
+ 1. Claude mắc lỗi
117
+ 2. Bạn sửa Claude
118
+ 3. Bạn nói: *"Cập nhật CLAUDE.md để lần sau không mắc lại lỗi này"*
119
+ 4. Claude tự viết rule cho chính nó
120
+ 5. Rule được commit vào git → cả team hưởng lợi
121
+
122
+ Trong template: `Lessons` section
123
+
124
+ Boris gọi đây là **"chi phí của một sai lầm sinh lời mãi mãi"** — mỗi lần sửa lỗi là một khoản đầu tư.
125
+
126
+ ---
127
+
128
+ ## PRD và User Stories — Tại Sao AI Cần Biết "Sản Phẩm Là Gì"?
129
+
130
+ 4 tầng CLAUDE.md giúp Claude biết **cách làm việc** — lệnh build gì, convention gì, phối hợp thế nào. Nhưng vẫn thiếu một thứ quan trọng: **Claude không biết sản phẩm là gì**.
131
+
132
+ Hãy tưởng tượng bạn thuê một thợ mộc giỏi. Anh ta biết cách cưa gỗ, đóng đinh, đánh bóng (= CLAUDE.md). Nhưng nếu bạn không nói "tôi cần một cái tủ sách, cho phòng khách, cao 1m8" — anh ta sẽ làm gì? Đoán mò? Hỏi liên tục?
133
+
134
+ **PRD (Product Requirements Document)** chính là bản mô tả "cái tủ sách" đó:
135
+ - **Vấn đề** — tại sao cần sản phẩm này?
136
+ - **Người dùng** — ai sẽ dùng?
137
+ - **Tính năng** — cần làm gì?
138
+ - **Không làm** — ranh giới ở đâu?
139
+
140
+ **User Stories** là danh sách "việc cần làm" cụ thể:
141
+ - "Là người dùng, tôi muốn đăng nhập bằng email, để không cần nhớ mật khẩu"
142
+ - Kèm theo **tiêu chí chấp nhận** (Gherkin) — giống như checklist để biết việc đã xong chưa
143
+
144
+ ### Tại Sao Không Chỉ CLAUDE.md Là Đủ?
145
+
146
+ | Chỉ có CLAUDE.md | CLAUDE.md + PRD + User Stories |
147
+ |---|---|
148
+ | Claude biết cách code | Claude biết cách code **và** biết đang code cái gì |
149
+ | Hỏi "feature này để làm gì?" | Tự đọc PRD, hiểu bối cảnh |
150
+ | Viết code đúng convention nhưng sai mục đích | Viết code đúng convention **và** đúng mục đích |
151
+ | Không biết khi nào nên nói "không, cái này out of scope" | Đọc Non-Goals, tự biết ranh giới |
152
+
153
+ ### Cách Procedure Tạo PRD và User Stories
154
+
155
+ Trong bước **Product Context** (bước 5 của wizard), bạn trả lời 4 câu hỏi:
156
+ 1. Sản phẩm giải quyết vấn đề gì?
157
+ 2. Ai là người dùng?
158
+ 3. Tính năng chính là gì?
159
+ 4. Cái gì KHÔNG làm?
160
+
161
+ Procedure dùng câu trả lời để tạo `docs/PRD.md` và `docs/USER-STORIES.md`. Sau đó CLAUDE.md tham chiếu đến 2 file này — tạo thành bộ 3 hoàn chỉnh:
162
+
163
+ - **CLAUDE.md** = luật chơi (HOW — làm thế nào)
164
+ - **PRD** = bối cảnh sản phẩm (WHAT + WHY — cái gì và tại sao)
165
+ - **User Stories** = việc cần làm (WHAT to build — xây cái gì, kiểm tra thế nào)
166
+
167
+ Giống như xây nhà: CLAUDE.md là "quy tắc xây dựng", PRD là "bản vẽ kiến trúc", User Stories là "danh sách phòng cần xây".
168
+
169
+ ---
170
+
171
+ ## 3 Nguyên Tắc Cốt Lõi
172
+
173
+ | Nguyên tắc | Giải thích |
174
+ |-----------|-----------|
175
+ | **Đơn giản là nhất** | Mỗi thay đổi phải đơn giản nhất có thể. Ít code = ít bug. |
176
+ | **Không lười biếng** | Tìm nguyên nhân gốc. Không fix tạm. Chuẩn senior developer. |
177
+ | **Ảnh hưởng tối thiểu** | Chỉ sửa những gì cần sửa. Đừng "tiện tay" sửa thêm thứ khác. |
178
+
179
+ ---
180
+
181
+ ## Cách Bắt Đầu (Ngày 1)
182
+
183
+ Bắt đầu với 3 thứ:
184
+
185
+ 1. **Lệnh build/test** — copy paste đúng lệnh của dự án
186
+ 2. **Một convention** — quy tắc quan trọng nhất
187
+ 3. **Một bài học** — lỗi gần nhất mà Claude mắc phải
188
+
189
+ Sau đó, mỗi lần sửa Claude, nói: *"Cập nhật CLAUDE.md để lần sau không mắc lại."*
190
+
191
+ File sẽ tự lớn lên theo thời gian — và đó chính là sức mạnh của nó.
192
+
193
+ ---
194
+
195
+ ## Cách Team (Con Người) Dùng CLAUDE.md
196
+
197
+ - **Commit vào git** — cả team cùng hưởng lợi
198
+ - **Review PR → cập nhật CLAUDE.md** — dùng `@.claude` để thêm bài học từ mỗi PR
199
+ - **Prune thường xuyên** — xóa rule mà Claude không vi phạm nữa, gộp rule trùng lặp
200
+ - **Giữ dưới 3.000 từ** — file ngắn và tập trung hiệu quả hơn file dài
201
+
202
+ ---
203
+
204
+ ## Tóm Tắt Một Câu
205
+
206
+ > CLAUDE.md = luật chơi (HOW) + PRD = bối cảnh sản phẩm (WHAT + WHY) + User Stories = việc cần làm (WHAT to build) — ba thứ này cùng nhau giúp AI không chỉ code đúng, mà còn code đúng thứ.
package/docs/PRD.md ADDED
@@ -0,0 +1,130 @@
1
+ # Procedure CLI — Product Requirements Document
2
+
3
+ ## Vision
4
+
5
+ Empower developers to start projects with production-ready documentation and architecture decisions from day one, reducing onboarding time and ensuring best practices are baked in.
6
+
7
+ ## Problem
8
+
9
+ 1. **Boilerplate burden** — New projects lack consistent structure for CLAUDE.md, PRD, and user stories
10
+ 2. **Documentation debt** — Teams postpone critical docs (architecture, requirements, acceptance criteria)
11
+ 3. **Inconsistent onboarding** — Each project has different documentation standards and styles
12
+ 4. **Time waste** — Developers manually create skeletal docs instead of focusing on code
13
+ 5. **Missing context** — New contributors lack centralized product and technical context
14
+
15
+ ## Users
16
+
17
+ | User | Needs | Value |
18
+ |------|-------|-------|
19
+ | **Solo Developer** | Quick project setup with minimal config | Skip boilerplate, start coding faster |
20
+ | **Team Lead** | Enforce documentation standards across projects | Consistency, faster onboarding, better reviews |
21
+ | **New Contributor** | Understand project decisions and tech stack | Self-serve context, reduced onboarding calls |
22
+ | **Product Manager** | Validate feature set and non-goals early | Clearer scope, better planning |
23
+
24
+ ## Core Features
25
+
26
+ **F-001: Interactive Project Wizard**
27
+ - 7-step guided setup with timeline progress view
28
+ - Validates input, provides sensible defaults
29
+ - Timeline preview shows estimated completion time
30
+
31
+ **F-002: CLAUDE.md Generation**
32
+ - Code style and import conventions
33
+ - Build & test commands
34
+ - Architecture decisions and rationale
35
+ - Workflow guidance (planning, verification, bug fixing)
36
+ - Lessons learned section (AI-updatable)
37
+
38
+ **F-003: PRD.md Generation**
39
+ - Vision, problem statement, target users
40
+ - Core features (F-001 through F-006 format)
41
+ - Non-goals and success metrics
42
+ - Tech stack table
43
+ - Open questions placeholder
44
+
45
+ **F-004: USER-STORIES.md Generation**
46
+ - Gherkin-formatted acceptance criteria
47
+ - "As a / I want / So that" narrative format
48
+ - Feature scenarios with Given/When/Then
49
+ - Supports 9+ standard scenarios (full scaffolding, quick start, powerline, etc.)
50
+
51
+ **F-005: Environment & Config Files**
52
+ - `.env.example` template with user-specified variables
53
+ - `.gitignore` with language/framework-specific rules
54
+
55
+ **F-006: Powerline Integration (Optional)**
56
+ - Shell prompt styling and configuration
57
+ - Powerline font detection and fallbacks
58
+ - Theme color selection during setup
59
+
60
+ ### Visual Style
61
+
62
+ - **Banner:** ASCII header with "Procedure CLI" branding
63
+ - **Timeline:** Vertical step indicators (pending → active → completed)
64
+ - **Colors:** Cyan for highlights, green for success, dim gray for secondary info
65
+ - **Icons:** ✔ (completed), ► (active), ○ (pending)
66
+ - **Spacing:** Single-line padding, clean box layouts via Ink
67
+
68
+ ## Non-Goals
69
+
70
+ - IDE/editor integration (intentionally CLI-first)
71
+ - Runtime code generation or plugins
72
+ - Database schema generation
73
+ - Frontend component scaffolding
74
+ - Package template marketplace
75
+
76
+ ## Tech Stack
77
+
78
+ | Component | Technology | Purpose |
79
+ |-----------|-----------|---------|
80
+ | **Runtime** | Node.js + TypeScript | Type-safe CLI |
81
+ | **UI** | Ink + React | Interactive CLI rendering |
82
+ | **Templating** | Handlebars | Dynamic file generation |
83
+ | **AI** | ai-sdk + OpenAI | Future: GPT-assisted prompts (optional) |
84
+ | **Build** | tsc | Minimal, fast compilation |
85
+
86
+ ## 7 Wizard Steps (Detailed)
87
+
88
+ ### Step 1: Project Info
89
+ - Inputs: Project name, description, package manager preference, license
90
+ - Output: Basic project metadata
91
+
92
+ ### Step 2: Stack & Style
93
+ - Inputs: Language, framework, code style (strict mode, imports, naming, error handling)
94
+ - Output: Stack summary and style guide anchors
95
+
96
+ ### Step 3: Build & Test
97
+ - Inputs: Build, test, typecheck, lint, PR check commands
98
+ - Output: Development commands for CLAUDE.md
99
+
100
+ ### Step 4: Architecture
101
+ - Inputs: Architecture pattern, architectural decisions, detailed notes
102
+ - Output: Architecture section for CLAUDE.md
103
+
104
+ ### Step 5: Product Context
105
+ - Inputs: Problem statement (5 bullets), target users table, core features, non-goals, tech stack, user stories
106
+ - Output: PRD.md and USER-STORIES.md data
107
+
108
+ ### Step 6: Generation
109
+ - Automatic: Compile answers into CLAUDE.md, PRD.md, USER-STORIES.md, .env.example, .gitignore
110
+ - Output: Files written to project directory with timestamps
111
+
112
+ ### Step 7: Powerline (Optional)
113
+ - Inputs: Enable powerline, font selection, theme colors
114
+ - Output: Shell configuration and setup instructions
115
+
116
+ ## Success Metrics
117
+
118
+ - **Adoption:** 100+ monthly runs within 3 months
119
+ - **Time saved:** Average 10+ minutes per project setup
120
+ - **User satisfaction:** 80%+ would recommend to teammates
121
+ - **Documentation quality:** PRDs generated have 90%+ completeness
122
+ - **Consistency:** 95%+ projects follow standard section format
123
+
124
+ ## Open Questions
125
+
126
+ - Should we support multiple AI models (Claude, GPT-4, local LLMs)?
127
+ - Auto-generate user stories from feature descriptions?
128
+ - Integration with GitHub Actions for CI/CD template generation?
129
+ - Support for monorepo scaffolding (workspaces)?
130
+ - Interactive feature validation via AI (e.g., "Validate that F-001 and F-002 don't overlap")?
@@ -0,0 +1,181 @@
1
+ # Procedure CLI — User Stories
2
+
3
+ ## US-001: Full Project Scaffolding
4
+
5
+ **As a** new project owner
6
+ **I want** to run a single command and answer guided questions
7
+ **So that** I have a complete project with CLAUDE.md, PRD.md, and USER-STORIES.md
8
+
9
+ ### Feature: Complete Wizard Execution
10
+
11
+ ```gherkin
12
+ Scenario: User completes full 7-step wizard
13
+ Given a developer runs `npx procedure-cli`
14
+ When they answer all wizard questions (project info, stack, build, architecture, product context)
15
+ Then CLAUDE.md, PRD.md, USER-STORIES.md, .env.example, and .gitignore are created
16
+ And a success message displays with project name and generated files
17
+ ```
18
+
19
+ ```gherkin
20
+ Scenario: Wizard validates required inputs
21
+ Given the user is on Step 1 (Project Info)
22
+ When they leave the project name empty and try to continue
23
+ Then validation error shows and they must re-enter
24
+ And "Next" button remains disabled until valid
25
+ ```
26
+
27
+ ## US-002: Quick Start Mode
28
+
29
+ **As a** developer in a hurry
30
+ **I want** to scaffold a project with minimal questions
31
+ **So that** I can start coding in under 2 minutes
32
+
33
+ ### Feature: QuickStart Shortcuts
34
+
35
+ ```gherkin
36
+ Scenario: Quick mode with sensible defaults
37
+ Given the developer runs `npx procedure-cli --quick`
38
+ When they provide only project name and description
39
+ Then defaults are used for tech stack, build commands, architecture
40
+ And files are generated immediately
41
+ ```
42
+
43
+ ## US-003: Advanced Configuration
44
+
45
+ **As a** team lead defining standards
46
+ **I want** to customize every section of the generated docs
47
+ **So that** the output matches our team's coding standards and practices
48
+
49
+ ### Feature: Detailed Customization
50
+
51
+ ```gherkin
52
+ Scenario: Full control over architecture and style
53
+ Given the user is on Step 4 (Architecture)
54
+ When they describe architecture decisions and code style details
55
+ Then CLAUDE.md includes the exact text in the Architecture and Code Style sections
56
+ And next steps reference these decisions
57
+ ```
58
+
59
+ ## US-004: Powerline Setup Integration
60
+
61
+ **As a** shell enthusiast
62
+ **I want** to configure powerline font and prompt styling during setup
63
+ **So that** my terminal matches my project's branding
64
+
65
+ ### Feature: Shell Prompt Customization
66
+
67
+ ```gherkin
68
+ Scenario: User enables powerline during Step 7
69
+ Given the wizard is on Step 7 (Powerline)
70
+ When they select "Yes, set up powerline"
71
+ Then they choose fonts (Noto Sans Mono, Fira Code, custom)
72
+ And pick a theme color (blue, green, purple)
73
+ And setup instructions are displayed
74
+ ```
75
+
76
+ ## US-005: PRD Generation with Features
77
+
78
+ **As a** product manager
79
+ **I want** the PRD to capture vision, problem, users, and core features
80
+ **So that** stakeholders understand scope without separate meetings
81
+
82
+ ### Feature: Comprehensive PRD Output
83
+
84
+ ```gherkin
85
+ Scenario: PRD includes all required sections
86
+ Given the user completes Step 5 (Product Context)
87
+ When they provide vision, problem statement, user table, and core features
88
+ Then PRD.md contains:
89
+ | Section | Content |
90
+ | Vision | User's description |
91
+ | Problem | 5 bullet points |
92
+ | Users | Table with roles and value |
93
+ | Core Features | F-001 through F-006 format |
94
+ | Non-Goals | Explicit out-of-scope items |
95
+ | Tech Stack | Table with technologies |
96
+ | Success Metrics | Measurable outcomes |
97
+ ```
98
+
99
+ ## US-006: User Stories with Gherkin Format
100
+
101
+ **As a** QA engineer
102
+ **I want** user stories with Gherkin acceptance criteria
103
+ **So that** I can write automated tests and track feature completion
104
+
105
+ ### Feature: Structured User Stories
106
+
107
+ ```gherkin
108
+ Scenario: User stories include Given/When/Then
109
+ Given the user provides core features in Step 5
110
+ When files are generated in Step 6
111
+ Then USER-STORIES.md contains:
112
+ - US-001 through US-009 headers
113
+ - "As a / I want / So that" format
114
+ - Feature: [name] sections
115
+ - Multiple Scenario: blocks with Gherkin syntax
116
+ ```
117
+
118
+ ## US-007: Git Initialization
119
+
120
+ **As a** developer starting fresh
121
+ **I want** the wizard to optionally initialize git with a sensible .gitignore
122
+ **So that** I don't accidentally commit build artifacts or secrets
123
+
124
+ ### Feature: Git Setup
125
+
126
+ ```gherkin
127
+ Scenario: Git repo is initialized with language-specific ignores
128
+ Given the user completes the wizard
129
+ When they select "Initialize git repo" (optional prompt)
130
+ Then `git init` runs automatically
131
+ And .gitignore is committed with language/framework rules
132
+ And initial commit message is "chore: initialize project with Procedure CLI"
133
+ ```
134
+
135
+ ## US-008: Partial Scaffolding & Regeneration
136
+
137
+ **As a** developer iterating on docs
138
+ **I want** to re-run the wizard and update only certain files
139
+ **So that** I can refine PRD and user stories without re-answering all questions
140
+
141
+ ### Feature: Selective Regeneration
142
+
143
+ ```gherkin
144
+ Scenario: User reruns wizard to update PRD only
145
+ Given a project was scaffolded previously
146
+ When they run `npx procedure-cli --update prd`
147
+ Then only Step 5 (Product Context) runs
148
+ And PRD.md and USER-STORIES.md are regenerated
149
+ And CLAUDE.md remains unchanged
150
+ ```
151
+
152
+ ## US-009: Visual Timeline with Estimated Completion
153
+
154
+ **As a** new user
155
+ **I want** to see a visual timeline of remaining steps with time estimate
156
+ **So that** I know how long the setup will take
157
+
158
+ ### Feature: Timeline Progress Indicator
159
+
160
+ ```gherkin
161
+ Scenario: Timeline shows current step and estimated completion
162
+ Given the user is on Step 3 of 7
163
+ When they view the sidebar
164
+ Then they see:
165
+ - ✔ Step 1: Project Info (completed)
166
+ - ✔ Step 2: Stack & Style (completed)
167
+ - ► Step 3: Build & Test (active)
168
+ - ○ Step 4: Architecture (pending)
169
+ - ○ Step 5: Product Context (pending)
170
+ - ○ Step 6: Generation (pending)
171
+ - ○ Step 7: Powerline (pending)
172
+ And "Est. time remaining: 8 minutes" is displayed
173
+ ```
174
+
175
+ ```gherkin
176
+ Scenario: Step completion summary is shown in timeline
177
+ Given the user completes Step 1
178
+ When they move to Step 2
179
+ Then the timeline shows "Project Info — my-project — my description"
180
+ And a checkmark indicates completion
181
+ ```