create-vibe-workflow 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.
- package/README.md +104 -0
- package/dist/adapters/nestjs-nextjs/skills.recommend.json +22 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +49 -0
- package/dist/cli.js.map +1 -0
- package/dist/generator.d.ts +10 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +242 -0
- package/dist/generator.js.map +1 -0
- package/dist/questions.d.ts +11 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +59 -0
- package/dist/questions.js.map +1 -0
- package/dist/templates/claude-md/CLAUDE.zh-CN.md +46 -0
- package/dist/templates/hooks/check-deps.mjs +65 -0
- package/dist/templates/hooks/post-commit-check.js +31 -0
- package/dist/templates/rules/agents.md +49 -0
- package/dist/templates/rules/coding-style.md +117 -0
- package/dist/templates/rules/development-workflow.md +122 -0
- package/dist/templates/rules/git-workflow.md +47 -0
- package/dist/templates/rules/patterns.md +48 -0
- package/dist/templates/rules/security.md +37 -0
- package/dist/templates/rules/testing.md +30 -0
- package/dist/templates/settings/settings.template.json +14 -0
- package/package.json +49 -0
- package/templates/claude-md/CLAUDE.zh-CN.md +46 -0
- package/templates/hooks/check-deps.mjs +65 -0
- package/templates/hooks/post-commit-check.js +31 -0
- package/templates/rules/agents.md +49 -0
- package/templates/rules/coding-style.md +117 -0
- package/templates/rules/development-workflow.md +122 -0
- package/templates/rules/git-workflow.md +47 -0
- package/templates/rules/patterns.md +48 -0
- package/templates/rules/security.md +37 -0
- package/templates/rules/testing.md +30 -0
- package/templates/settings/settings.template.json +14 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// 依赖检测 — Claude Code PreToolUse hook
|
|
4
|
+
// 检查外部依赖组件是否已安装,缺失时打印中文安装指引
|
|
5
|
+
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const homeDir = homedir();
|
|
11
|
+
const skillsDir = join(homeDir, '.claude', 'skills');
|
|
12
|
+
|
|
13
|
+
const REQUIRED = [
|
|
14
|
+
{ name: 'gstack', dir: 'gstack', install: 'cd ~/.claude/skills && git clone https://github.com/garrytan/gstack.git gstack' },
|
|
15
|
+
{ name: 'superpowers', dir: 'superpowers', install: 'https://github.com/anthropics/claude-code-superpowers' },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const OPTIONAL = [
|
|
19
|
+
{ name: 'openspec', dir: 'openspec', install: 'npm install -g @anthropic/openspec' },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const missing = [];
|
|
23
|
+
const missingOptional = [];
|
|
24
|
+
|
|
25
|
+
for (const dep of REQUIRED) {
|
|
26
|
+
if (!existsSync(join(skillsDir, dep.dir))) {
|
|
27
|
+
missing.push(dep);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
for (const dep of OPTIONAL) {
|
|
32
|
+
if (!existsSync(join(skillsDir, dep.dir))) {
|
|
33
|
+
missingOptional.push(dep);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (missing.length === 0 && missingOptional.length === 0) {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log('══════════════════════════════════════════');
|
|
43
|
+
console.log(' ⚠️ 工作流依赖检查');
|
|
44
|
+
console.log('══════════════════════════════════════════');
|
|
45
|
+
|
|
46
|
+
if (missing.length > 0) {
|
|
47
|
+
console.log('');
|
|
48
|
+
console.log('❌ 缺少必要组件(工作流核心功能将不可用):');
|
|
49
|
+
for (const dep of missing) {
|
|
50
|
+
console.log(` • ${dep.name} — 安装: ${dep.install}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (missingOptional.length > 0) {
|
|
55
|
+
console.log('');
|
|
56
|
+
console.log('⚠️ 缺少可选组件(部分高级功能不可用):');
|
|
57
|
+
for (const dep of missingOptional) {
|
|
58
|
+
console.log(` • ${dep.name} — 安装: ${dep.install}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log('安装后可重启 Claude Code 以启用完整工作流。');
|
|
64
|
+
console.log('══════════════════════════════════════════');
|
|
65
|
+
console.log('');
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Post-commit 文档反写检查
|
|
4
|
+
// 通过 Claude Code PostToolUse hook 触发
|
|
5
|
+
|
|
6
|
+
const input = process.argv[2] || '{}';
|
|
7
|
+
let toolCall;
|
|
8
|
+
try {
|
|
9
|
+
toolCall = JSON.parse(input);
|
|
10
|
+
} catch {
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (toolCall.tool_name !== 'Bash') process.exit(0);
|
|
15
|
+
|
|
16
|
+
const commandInput = typeof toolCall.input === 'string'
|
|
17
|
+
? toolCall.input
|
|
18
|
+
: JSON.stringify(toolCall.input || '');
|
|
19
|
+
|
|
20
|
+
if (!commandInput.includes('git commit')) process.exit(0);
|
|
21
|
+
|
|
22
|
+
console.log('⚠️ 【第⑧步 文档反写检查】commit 完成,请逐条检查:');
|
|
23
|
+
console.log(' □ DB schema 变更? → docs/database-schema.md');
|
|
24
|
+
console.log(' □ API 端点变更? → docs/api-design.md');
|
|
25
|
+
console.log(' □ 权限变更? → docs/security.md');
|
|
26
|
+
console.log(' □ 新功能不在 PRD 中? → docs/PRD.md');
|
|
27
|
+
console.log(' □ 新增/修改模块? → docs/modules/{module}.md');
|
|
28
|
+
console.log(' □ 模块依赖变化? → docs/architecture.md');
|
|
29
|
+
console.log(' □ 模块状态变化? → CLAUDE.md + PROGRESS.md');
|
|
30
|
+
console.log(' □ todolist 任务完成? → todolist.md 删除/勾选');
|
|
31
|
+
console.log(' □ 里程碑完成? → memory/MEMORY.md');
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Agent Orchestration
|
|
2
|
+
|
|
3
|
+
## Available Agents
|
|
4
|
+
|
|
5
|
+
Located in `~/.claude/agents/`:
|
|
6
|
+
|
|
7
|
+
| Agent | Purpose | When to Use |
|
|
8
|
+
|-------|---------|-------------|
|
|
9
|
+
| planner | Implementation planning | Complex features, refactoring |
|
|
10
|
+
| architect | System design | Architectural decisions |
|
|
11
|
+
| tdd-guide | Test-driven development | New features, bug fixes |
|
|
12
|
+
| code-reviewer | Code review | After writing code |
|
|
13
|
+
| security-reviewer | Security analysis | Before commits |
|
|
14
|
+
| build-error-resolver | Fix build errors | When build fails |
|
|
15
|
+
| e2e-runner | E2E testing | Critical user flows |
|
|
16
|
+
| refactor-cleaner | Dead code cleanup | Code maintenance |
|
|
17
|
+
| doc-updater | Documentation | Updating docs |
|
|
18
|
+
|
|
19
|
+
## Immediate Agent Usage
|
|
20
|
+
|
|
21
|
+
No user prompt needed:
|
|
22
|
+
1. Complex feature requests - Use **planner** agent
|
|
23
|
+
2. Code just written/modified - Use **code-reviewer** agent
|
|
24
|
+
3. Bug fix or new feature - Use **tdd-guide** agent
|
|
25
|
+
4. Architectural decision - Use **architect** agent
|
|
26
|
+
|
|
27
|
+
## Parallel Task Execution
|
|
28
|
+
|
|
29
|
+
ALWAYS use parallel Task execution for independent operations:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# GOOD: Parallel execution
|
|
33
|
+
Launch 3 agents in parallel:
|
|
34
|
+
1. Agent 1: Security analysis of auth module
|
|
35
|
+
2. Agent 2: Performance review of cache system
|
|
36
|
+
3. Agent 3: Type checking of utilities
|
|
37
|
+
|
|
38
|
+
# BAD: Sequential when unnecessary
|
|
39
|
+
First agent 1, then agent 2, then agent 3
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Multi-Perspective Analysis
|
|
43
|
+
|
|
44
|
+
For complex problems, use split role sub-agents:
|
|
45
|
+
- Factual reviewer
|
|
46
|
+
- Senior engineer
|
|
47
|
+
- Security expert
|
|
48
|
+
- Consistency reviewer
|
|
49
|
+
- Redundancy checker
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
# TypeScript/JavaScript Coding Style
|
|
9
|
+
|
|
10
|
+
> 本文件是 TypeScript/JavaScript 项目的代码风格规范。
|
|
11
|
+
|
|
12
|
+
## Types and Interfaces
|
|
13
|
+
|
|
14
|
+
Use types to make public APIs, shared models, and component props explicit, readable, and reusable.
|
|
15
|
+
|
|
16
|
+
### Public APIs
|
|
17
|
+
|
|
18
|
+
- Add parameter and return types to exported functions, shared utilities, and public class methods
|
|
19
|
+
- Let TypeScript infer obvious local variable types
|
|
20
|
+
- Extract repeated inline object shapes into named types or interfaces
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// WRONG: Exported function without explicit types
|
|
24
|
+
export function formatUser(user) {
|
|
25
|
+
return `${user.firstName} ${user.lastName}`
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// CORRECT: Explicit types on public APIs
|
|
29
|
+
interface User {
|
|
30
|
+
firstName: string
|
|
31
|
+
lastName: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function formatUser(user: User): string {
|
|
35
|
+
return `${user.firstName} ${user.lastName}`
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Interfaces vs. Type Aliases
|
|
40
|
+
|
|
41
|
+
- Use `interface` for object shapes that may be extended or implemented
|
|
42
|
+
- Use `type` for unions, intersections, tuples, mapped types, and utility types
|
|
43
|
+
- Prefer string literal unions over `enum` unless an `enum` is required for interoperability
|
|
44
|
+
|
|
45
|
+
### Avoid `any`
|
|
46
|
+
|
|
47
|
+
- Avoid `any` in application code
|
|
48
|
+
- Use `unknown` for external or untrusted input, then narrow it safely
|
|
49
|
+
- Use generics when a value's type depends on the caller
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// WRONG: any removes type safety
|
|
53
|
+
function getErrorMessage(error: any) {
|
|
54
|
+
return error.message
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// CORRECT: unknown forces safe narrowing
|
|
58
|
+
function getErrorMessage(error: unknown): string {
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
return error.message
|
|
61
|
+
}
|
|
62
|
+
return 'Unexpected error'
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Immutability
|
|
67
|
+
|
|
68
|
+
Use spread operator for immutable updates:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// WRONG: Mutation
|
|
72
|
+
function updateUser(user: User, name: string): User {
|
|
73
|
+
user.name = name // MUTATION!
|
|
74
|
+
return user
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// CORRECT: Immutability
|
|
78
|
+
function updateUser(user: Readonly<User>, name: string): User {
|
|
79
|
+
return { ...user, name }
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Error Handling
|
|
84
|
+
|
|
85
|
+
Use async/await with try-catch and narrow unknown errors safely:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
async function loadUser(userId: string): Promise<User> {
|
|
89
|
+
try {
|
|
90
|
+
return await riskyOperation(userId)
|
|
91
|
+
} catch (error: unknown) {
|
|
92
|
+
logger.error('Operation failed', error)
|
|
93
|
+
throw new Error(getErrorMessage(error))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Input Validation
|
|
99
|
+
|
|
100
|
+
Use Zod for schema-based validation and infer types from the schema:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { z } from 'zod'
|
|
104
|
+
|
|
105
|
+
const userSchema = z.object({
|
|
106
|
+
email: z.string().email(),
|
|
107
|
+
age: z.number().int().min(0).max(150)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
type UserInput = z.infer<typeof userSchema>
|
|
111
|
+
const validated: UserInput = userSchema.parse(input)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Console.log
|
|
115
|
+
|
|
116
|
+
- No `console.log` statements in production code
|
|
117
|
+
- Use proper logging libraries instead
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Development Workflow(9 环节完整流程)
|
|
2
|
+
|
|
3
|
+
> 每个环节都必须执行(除非标注了跳过条件)。
|
|
4
|
+
> 完成标志 = 该环节产出的可验证产物,没有产物 = 没做完。
|
|
5
|
+
|
|
6
|
+
## 完整链路
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
① 需求澄清 ──── OpenSpec /opsx:propose
|
|
10
|
+
② 计划拆分 ──── gstack /plan-ceo-review /plan-eng-review(可选)
|
|
11
|
+
③ 研究复用
|
|
12
|
+
④ TodoList编写
|
|
13
|
+
⑤ TDD开发 ──── Superpowers 强制执行 TDD 纪律
|
|
14
|
+
⑥ 代码审查 ──── code-reviewer agent(自动)
|
|
15
|
+
⑦ 安全审查 ──── gstack /cso(可选)+ security-reviewer(自动)
|
|
16
|
+
⑧ 文档反写
|
|
17
|
+
⑨ 提交归档 ──── gstack /ship(跑测试+生成PR)→ OpenSpec /opsx:archive
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> 工具说明详见 `CLAUDE.md` § AI 协作工具链
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 开发前必读文档
|
|
25
|
+
|
|
26
|
+
| 顺序 | 文档 | 提取什么 |
|
|
27
|
+
|------|------|----------|
|
|
28
|
+
| 1 | `docs/PRD.md` | 用户故事 + 验收标准 + P0/P1 划分 |
|
|
29
|
+
| 2 | `docs/database-schema.md` | 表结构 + FK + 枚举 + 约束(有数据库时) |
|
|
30
|
+
| 3 | `docs/api-design.md` | 端点 + 请求/响应格式 + 权限(有 API 时) |
|
|
31
|
+
| 4 | `docs/security.md` | 权限矩阵(有认证时) |
|
|
32
|
+
| 5 | `docs/ui-ux-spec.md` | 页面线框图 + 组件规范(有前端时) |
|
|
33
|
+
| 6 | 相邻已完成模块代码 | 复用实现模式 |
|
|
34
|
+
|
|
35
|
+
缺少信息?先补设计文档,再写代码。
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 各环节
|
|
40
|
+
|
|
41
|
+
### ① 需求澄清
|
|
42
|
+
- 动作: 对照 PRD 确认功能边界和优先级
|
|
43
|
+
- **新功能必须先用 OpenSpec**: `/opsx:propose 你的需求描述` → 生成结构化规格 + 任务清单
|
|
44
|
+
- **复杂需求可选 gstack**: `/office-hours` 验证想法,`/plan-ceo-review` 挑战假设
|
|
45
|
+
- ✅ 完成标志: OpenSpec 任务清单已生成 + 明确了做什么、不做什么、P0/P1 划分
|
|
46
|
+
- 跳过条件: 纯技术任务(重构、升级依赖等)
|
|
47
|
+
|
|
48
|
+
### ② 计划拆分
|
|
49
|
+
- 动作: 拆分为可独立提交的子任务(每个 50-300 行)
|
|
50
|
+
- 复杂功能使用 **planner** agent
|
|
51
|
+
- **P0 优先策略**:新模块只先实现 P0,P1 完整列出放待开发区
|
|
52
|
+
- ✅ 完成标志: 有明确的子任务列表,每个子任务对应一个 commit
|
|
53
|
+
- 跳过条件: 单文件小修改(<50 行)
|
|
54
|
+
|
|
55
|
+
### ③ 研究复用
|
|
56
|
+
- 动作: GitHub code search → Context7 → npm → 相邻模块代码
|
|
57
|
+
- ✅ 完成标志: 确认了实现模式(复用现有 or 新写)
|
|
58
|
+
- 跳过条件: 已有明确模式可复用
|
|
59
|
+
|
|
60
|
+
### ④ TodoList 编写
|
|
61
|
+
- 动作: 将子任务写入 `todolist.md`
|
|
62
|
+
- 粒度: 一个子任务 = 一个可独立 commit 的变更
|
|
63
|
+
- ✅ 完成标志: `todolist.md` 已更新,包含所有 P0 + P1 任务
|
|
64
|
+
- **不可跳过**
|
|
65
|
+
|
|
66
|
+
### ⑤ TDD 开发
|
|
67
|
+
- 动作: RED → GREEN → REFACTOR,覆盖率 ≥80%
|
|
68
|
+
- **Superpowers 强制执行**: `tdd-workflow` skill 确保先写测试再写代码,禁止跳过
|
|
69
|
+
- **按 OpenSpec 任务清单逐项实现**,每完成一项标记 done
|
|
70
|
+
- ✅ 完成标志: 测试通过 + 编译通过
|
|
71
|
+
- **不可跳过**
|
|
72
|
+
|
|
73
|
+
### ⑥ 代码审查
|
|
74
|
+
- 动作: 使用 **code-reviewer** agent
|
|
75
|
+
- ✅ 完成标志: CRITICAL/HIGH 问题已修复
|
|
76
|
+
- **不可跳过**(纯文档/配置变更除外)
|
|
77
|
+
|
|
78
|
+
### ⑦ 安全审查
|
|
79
|
+
- 动作: 使用 **security-reviewer** agent
|
|
80
|
+
- ✅ 完成标志: 无 CRITICAL 安全问题
|
|
81
|
+
- 触发: 仅 auth / finance / system 模块
|
|
82
|
+
- 跳过条件: 非安全敏感模块
|
|
83
|
+
|
|
84
|
+
### ⑧ 文档反写(每个 commit 后立即执行,不可跳过)
|
|
85
|
+
|
|
86
|
+
> 这是最容易遗漏的环节。代码改了但文档没同步 = 技术债。
|
|
87
|
+
> 小功能/临时需求可能不在 PRD 中,反写是唯一让文档跟上代码的机会。
|
|
88
|
+
|
|
89
|
+
**逐条检查,改了哪个就同步哪个:**
|
|
90
|
+
|
|
91
|
+
| 改了什么 | 必须同步到 |
|
|
92
|
+
|----------|-----------|
|
|
93
|
+
| DB schema(新表/改字段) | `docs/database-schema.md` |
|
|
94
|
+
| API 端点(新增/修改) | `docs/api-design.md` |
|
|
95
|
+
| 权限(新角色/新资源) | `docs/security.md` |
|
|
96
|
+
| 新功能/新模块(不在 PRD 中) | `docs/PRD.md` |
|
|
97
|
+
| 新增/修改模块 | `docs/modules/{module}.md` |
|
|
98
|
+
| 模块间依赖变化 | `docs/architecture.md` |
|
|
99
|
+
| 业务模块状态变化 | `CLAUDE.md` 业务模块表 |
|
|
100
|
+
| 模块进度变化 | `PROGRESS.md` |
|
|
101
|
+
| 完成了 todolist 中的子任务 | `todolist.md` 删除/勾选 |
|
|
102
|
+
| 模块完成/里程碑 | `memory/MEMORY.md` |
|
|
103
|
+
|
|
104
|
+
✅ 完成标志: `git diff` 中包含对应的文档文件变更
|
|
105
|
+
|
|
106
|
+
### ⑨ 提交归档
|
|
107
|
+
- 动作: `/ship` → 自动跑全量测试 + 检查覆盖率 + 生成 PR 描述 + push + 创建 PR
|
|
108
|
+
- PR merge 后执行 `/opsx:archive` 将变更移至 archive
|
|
109
|
+
- 小改动(<50行)可直接 `git commit`(遵循 `git-workflow.md` 格式和粒度规范)
|
|
110
|
+
- ✅ 完成标志: PR 已创建(或 commit 成功)+ OpenSpec 已归档
|
|
111
|
+
- **不可跳过**
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 经验反写触发规则
|
|
116
|
+
|
|
117
|
+
| 触发条件 | 写入位置 |
|
|
118
|
+
|----------|----------|
|
|
119
|
+
| 遇到报错并解决 | `memory/troubleshooting.md` |
|
|
120
|
+
| 发现项目特有模式 | `memory/dev-notes.md` |
|
|
121
|
+
| 用户确认"功能正确了" | `.claude/skills/{project}-{topic}/SKILL.md` |
|
|
122
|
+
| 技术决策变更 | `memory/MEMORY.md` 已决策事项 |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Git Workflow
|
|
2
|
+
|
|
3
|
+
## Commit Message Format
|
|
4
|
+
```
|
|
5
|
+
<type>: <description>
|
|
6
|
+
|
|
7
|
+
<optional body>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
11
|
+
|
|
12
|
+
## Commit 粒度规范
|
|
13
|
+
|
|
14
|
+
一个 commit = todolist.md 中的一个子任务,满足:
|
|
15
|
+
- 代码可编译通过
|
|
16
|
+
- 相关测试通过
|
|
17
|
+
- 变更文件 1-8 个,行数 50-300 行
|
|
18
|
+
- 超过 500 行应继续拆分
|
|
19
|
+
|
|
20
|
+
### 典型 commit 序列(后端模块)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
feat: 添加{模块}Zod schema # shared schema
|
|
24
|
+
feat: 实现 {Module}Service # service 层
|
|
25
|
+
test: 添加 {Module}Service 单元测试 # 测试
|
|
26
|
+
feat: 实现 {Module}Controller # controller
|
|
27
|
+
feat: 注册 {Module}Module # module
|
|
28
|
+
docs: 同步{模块}治理文档 # 文档反写
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 典型 commit 序列(前端页面)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
feat: 实现{模块}列表页 # 列表
|
|
35
|
+
feat: 实现{模块}详情页 # 详情
|
|
36
|
+
feat: 实现{模块}表单 # 表单
|
|
37
|
+
docs: 同步{模块}治理文档 # 文档反写
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Pull Request Workflow
|
|
41
|
+
|
|
42
|
+
When creating PRs:
|
|
43
|
+
1. Analyze full commit history (not just latest commit)
|
|
44
|
+
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
45
|
+
3. Draft comprehensive PR summary
|
|
46
|
+
4. Include test plan with TODOs
|
|
47
|
+
5. Push with `-u` flag if new branch
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
# TypeScript/JavaScript Patterns
|
|
9
|
+
|
|
10
|
+
## API Response Format
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
interface ApiResponse<T> {
|
|
14
|
+
success: boolean
|
|
15
|
+
data?: T
|
|
16
|
+
error?: string
|
|
17
|
+
meta?: {
|
|
18
|
+
total: number
|
|
19
|
+
page: number
|
|
20
|
+
limit: number
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Custom Hooks Pattern
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
export function useDebounce<T>(value: T, delay: number): T {
|
|
29
|
+
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay)
|
|
32
|
+
return () => clearTimeout(handler)
|
|
33
|
+
}, [value, delay])
|
|
34
|
+
return debouncedValue
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Repository Pattern
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
interface Repository<T> {
|
|
42
|
+
findAll(filters?: Filters): Promise<T[]>
|
|
43
|
+
findById(id: string): Promise<T | null>
|
|
44
|
+
create(data: CreateDto): Promise<T>
|
|
45
|
+
update(id: string, data: UpdateDto): Promise<T>
|
|
46
|
+
delete(id: string): Promise<void>
|
|
47
|
+
}
|
|
48
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
# TypeScript/JavaScript Security
|
|
9
|
+
|
|
10
|
+
## Secret Management
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
// NEVER: Hardcoded secrets
|
|
14
|
+
const apiKey = "sk-proj-xxxxx"
|
|
15
|
+
|
|
16
|
+
// ALWAYS: Environment variables
|
|
17
|
+
const apiKey = process.env.OPENAI_API_KEY
|
|
18
|
+
if (!apiKey) {
|
|
19
|
+
throw new Error('OPENAI_API_KEY not configured')
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Mandatory Security Checks
|
|
24
|
+
|
|
25
|
+
Before ANY commit:
|
|
26
|
+
- [ ] No hardcoded secrets (API keys, passwords, tokens)
|
|
27
|
+
- [ ] All user inputs validated
|
|
28
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
29
|
+
- [ ] XSS prevention (sanitized HTML)
|
|
30
|
+
- [ ] CSRF protection enabled
|
|
31
|
+
- [ ] Authentication/authorization verified
|
|
32
|
+
- [ ] Rate limiting on all endpoints
|
|
33
|
+
- [ ] Error messages don't leak sensitive data
|
|
34
|
+
|
|
35
|
+
## Agent Support
|
|
36
|
+
|
|
37
|
+
- Use **security-reviewer** agent for comprehensive security audits
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.ts"
|
|
4
|
+
- "**/*.tsx"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.jsx"
|
|
7
|
+
---
|
|
8
|
+
# TypeScript/JavaScript Testing
|
|
9
|
+
|
|
10
|
+
## Minimum Test Coverage: 80%
|
|
11
|
+
|
|
12
|
+
Test Types (ALL required):
|
|
13
|
+
1. **Unit Tests** — Individual functions, utilities, components
|
|
14
|
+
2. **Integration Tests** — API endpoints, database operations
|
|
15
|
+
3. **E2E Tests** — Critical user flows (Playwright recommended)
|
|
16
|
+
|
|
17
|
+
## Test-Driven Development
|
|
18
|
+
|
|
19
|
+
MANDATORY workflow:
|
|
20
|
+
1. Write test first (RED)
|
|
21
|
+
2. Run test — it should FAIL
|
|
22
|
+
3. Write minimal implementation (GREEN)
|
|
23
|
+
4. Run test — it should PASS
|
|
24
|
+
5. Refactor (IMPROVE)
|
|
25
|
+
6. Verify coverage (80%+)
|
|
26
|
+
|
|
27
|
+
## Agent Support
|
|
28
|
+
|
|
29
|
+
- **e2e-runner** — Playwright E2E testing specialist
|
|
30
|
+
- **tdd-guide** — TDD workflow enforcement
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"generatedBy": "create-vibe-workflow@0.1.0",
|
|
4
|
+
"generatedAt": "<%= GENERATED_AT %>"
|
|
5
|
+
},
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"required": ["gstack", "superpowers"],
|
|
8
|
+
"optional": ["openspec"]
|
|
9
|
+
},
|
|
10
|
+
"workflow": {
|
|
11
|
+
"version": "9-step-v1",
|
|
12
|
+
"language": "<%= LANGUAGE %>"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-vibe-workflow",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "一键安装 Claude Code 开发工作流 — 面向非专业编程人员的 Vibe Coding 编排插件",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"claude-code",
|
|
8
|
+
"vibe-coding",
|
|
9
|
+
"workflow",
|
|
10
|
+
"ai-assisted-development",
|
|
11
|
+
"chinese"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "VictorStacker",
|
|
15
|
+
"bin": {
|
|
16
|
+
"create-vibe-workflow": "dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/",
|
|
20
|
+
"templates/"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc && node scripts/copy-assets.js",
|
|
24
|
+
"dev": "tsx src/cli.ts",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"chalk": "^5.4.1",
|
|
31
|
+
"ejs": "^3.1.10",
|
|
32
|
+
"inquirer": "^12.5.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/ejs": "^3.1.5",
|
|
36
|
+
"@types/inquirer": "^9.0.7",
|
|
37
|
+
"@types/node": "^22.13.0",
|
|
38
|
+
"tsx": "^4.19.0",
|
|
39
|
+
"typescript": "^5.7.0",
|
|
40
|
+
"vitest": "^4.1.0"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/VictorStacker/create-vibe-workflow"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!-- WORKFLOW-START -->
|
|
2
|
+
<!-- 此区域由 create-vibe-workflow 自动生成,重跑 CLI 时会更新 -->
|
|
3
|
+
|
|
4
|
+
## AI 协作工具链
|
|
5
|
+
|
|
6
|
+
本项目使用多层 AI 工具协作体系:
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
你的业务需求
|
|
10
|
+
↓
|
|
11
|
+
① OpenSpec ─── 把想法变成结构化的需求规格和任务清单
|
|
12
|
+
↓
|
|
13
|
+
② gstack ───── 虚拟团队角色审查(CEO审查/设计审查/工程审查)
|
|
14
|
+
↓
|
|
15
|
+
③ Superpowers ─ 强制执行正确的开发流程(TDD/系统调试/验证)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 标准开发流程
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
① 需求澄清(OpenSpec)→ ② 计划拆分 → ③ 研究复用
|
|
22
|
+
→ ④ TodoList编写 → ⑤ TDD开发 → ⑥ 代码审查
|
|
23
|
+
→ ⑦ 安全审查 → ⑧ 文档反写 → ⑨ 提交归档
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 常用命令
|
|
27
|
+
|
|
28
|
+
| 场景 | 命令 |
|
|
29
|
+
|------|------|
|
|
30
|
+
| 开发新功能 | `/opsx:propose` 开始 |
|
|
31
|
+
| 修 Bug | 自动触发 `systematic-debugging` |
|
|
32
|
+
| 审查代码 | `/review` |
|
|
33
|
+
| 验收功能 | `/qa` |
|
|
34
|
+
| 准备发布 | `/ship` |
|
|
35
|
+
| 安全审查 | `/cso` |
|
|
36
|
+
|
|
37
|
+
## 技术栈
|
|
38
|
+
|
|
39
|
+
- 语言: TypeScript 5.x (strict mode)
|
|
40
|
+
- 前端: Next.js 15 (App Router) + shadcn/ui + Tailwind CSS
|
|
41
|
+
- 后端: NestJS 11 (REST API)
|
|
42
|
+
- 数据库: PostgreSQL 16+ + Drizzle ORM
|
|
43
|
+
- 校验: Zod(前后端共享 schema)
|
|
44
|
+
- 测试: Vitest (单元) + Playwright (E2E)
|
|
45
|
+
|
|
46
|
+
<!-- WORKFLOW-END -->
|