feat: 添加项目规则、环境配置示例及开发文档

This commit is contained in:
锦麟 王
2026-02-04 18:49:38 +08:00
commit df76882178
88 changed files with 13150 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
name: analyze-project
description: 分析当前项目
model: opus
---
请分析当前项目的架构、功能、技术栈和代码结构

View File

@@ -0,0 +1,6 @@
---
name: backend-unit-testing
description: 对后端模块执行单元测试
model: sonnet
---
在所有定义的模块上执行单元测试。验证每个模块通过所有测试且逻辑符合预期行为。

View File

@@ -0,0 +1,6 @@
---
name: compare-requirements
description: 需求比对分析
model: opus
---
对比分析当前项目与需求的差异,识别需要修改的地方

View File

@@ -0,0 +1,6 @@
---
name: develop-step-1
description: 开发当前步骤
model: sonnet
---
根据要求开发当前步骤。专注于实现本步骤描述的核心功能。

View File

@@ -0,0 +1,6 @@
---
name: error-no-docs
description: 处理缺少步骤文档的情况
model: sonnet
---
错误:未找到步骤文档。此工作流需要步骤文档才能继续。请创建一个包含开发步骤的 step_documentation.md 文件。

View File

@@ -0,0 +1,6 @@
---
name: extract-steps-1
description: 从文档中提取开发步骤
model: sonnet
---
从步骤文档中提取并列出所有开发步骤。对于每个步骤,识别任务描述、要求和验收标准。以编号列表格式输出步骤。

View File

@@ -0,0 +1,6 @@
---
name: fix-bugs-1
description: 修复错误或完成开发
model: sonnet
---
修复验证过程中发现的任何错误或问题。继续在此步骤上工作,直到验证通过为止。

View File

@@ -0,0 +1,6 @@
---
name: fix-issues
description: 修复编译和语法问题
model: sonnet
---
修复所有已识别的编译和语法问题。修复后返回检查问题是否已解决。

View File

@@ -0,0 +1,6 @@
---
name: foreach-loop-start
description: 初始化foreach循环处理步骤
model: sonnet
---
初始化foreach循环以按顺序处理每个开发步骤。跟踪当前步骤索引和总步骤数。

View File

@@ -0,0 +1,6 @@
---
name: loop-back
description: 返回开发阶段
model: sonnet
---
返回开发阶段以继续修复当前步骤。循环返回直到验证通过。

View File

@@ -0,0 +1,6 @@
---
name: modify-direct
description: 直接修改
model: opus
---
直接进行修改并验证结果

View File

@@ -0,0 +1,6 @@
---
name: module-division
description: 将代码划分为测试模块
model: sonnet
---
分析代码库并将其划分为单元测试的逻辑模块。定义清晰的模块边界和职责。

View File

@@ -0,0 +1,6 @@
---
name: plan-steps
description: 步骤规划
model: opus
---
规划可验证的修改步骤,确保每个步骤都可验证,并形成步骤文档

View File

@@ -0,0 +1,6 @@
---
name: step-complete
description: 移动到下一步
model: sonnet
---
当前步骤成功完成。移动到序列中的下一步。如果这是最后一步,则标记工作流为完成。

View File

@@ -0,0 +1,6 @@
---
name: syntax-check
description: 检查编译和语法问题
model: sonnet
---
分析代码库中的编译错误和语法问题。识别所有需要在测试前修复的问题。

View File

@@ -0,0 +1,6 @@
---
name: unit-test-planning
description: 为前端规划单元测试
model: sonnet
---
为前端模块规划全面的单元测试。定义测试用例和预期行为。

View File

@@ -0,0 +1,6 @@
---
name: verify-step-1
description: 验证完成的步骤
model: sonnet
---
验证当前步骤是否已成功完成。检查是否满足所有要求,功能是否按预期工作。

93
.claude/commands/ceshi.md Normal file
View File

@@ -0,0 +1,93 @@
---
description: ceshi
---
```mermaid
flowchart TD
start_node_default([Start])
syntax_check[syntax-check]
issues_check{If/Else:<br/>Conditional Branch}
fix_issues[fix-issues]
module_division[module-division]
frontend_check{AskUserQuestion:<br/>这是前端项目吗?}
unit_test_planning[unit-test-planning]
playwright_testing[[MCP: playwright_navigate]]
backend_unit_testing[backend-unit-testing]
test_verification{If/Else:<br/>Conditional Branch}
end_node_default([End])
start_node_default --> syntax_check
syntax_check --> issues_check
issues_check -->|发现问题| fix_issues
fix_issues --> syntax_check
issues_check -->|未发现问题| module_division
module_division --> frontend_check
frontend_check -->|是| unit_test_planning
unit_test_planning --> playwright_testing
playwright_testing --> test_verification
frontend_check -->|否| backend_unit_testing
backend_unit_testing --> test_verification
test_verification -->|测试通过| end_node_default
```
## Workflow Execution Guide
Follow the Mermaid flowchart above to execute the workflow. Each node type has specific execution methods as described below.
### Execution Methods by Node Type
- **Rectangle nodes**: Execute Sub-Agents using the Task tool
- **Diamond nodes (AskUserQuestion:...)**: Use the AskUserQuestion tool to prompt the user and branch based on their response
- **Diamond nodes (Branch/Switch:...)**: Automatically branch based on the results of previous processing (see details section)
- **Rectangle nodes (Prompt nodes)**: Execute the prompts described in the details section below
## MCP Tool Nodes
#### playwright_testing(playwright_navigate)
**Description**: 导航到URL进行前端测试
**MCP Server**: playwright
**Tool Name**: playwright_navigate
**Validation Status**: valid
**Configured Parameters**:
- `url` (string): http://localhost:3000
**Available Parameters**:
- `url` (string) (required): 要导航到的测试URL
This node invokes an MCP (Model Context Protocol) tool. When executing this workflow, use the configured parameters to call the tool via the MCP server.
### AskUserQuestion Node Details
Ask the user and proceed based on their choice.
#### frontend_check(这是前端项目吗?)
**Selection mode:** Single Select (branches based on the selected option)
**Options:**
- **是**: 需要浏览器测试的前端项目
- **否**: 只需要单元测试的后端项目
### If/Else Node Details
#### issues_check(Binary Branch (True/False))
**Branch conditions:**
- **未发现问题**: 未检测到编译或语法问题
- **发现问题**: 检测到编译或语法问题
**Execution method**: Evaluate the results of the previous processing and automatically select the appropriate branch based on the conditions above.
#### test_verification(Binary Branch (True/False))
**Branch conditions:**
- **测试通过**: 所有单元测试通过且逻辑符合预期
- **测试失败**: 部分单元测试失败或逻辑不符合预期
**Execution method**: Evaluate the results of the previous processing and automatically select the appropriate branch based on the conditions above.

90
.claude/commands/code.md Normal file
View File

@@ -0,0 +1,90 @@
---
description: code
---
```mermaid
flowchart TD
start_node_default([Start])
check_docs_1[[MCP: read_file]]
if_docs_exist{If/Else:<br/>Conditional Branch}
error_no_docs[error-no-docs]
end_error([End])
extract_steps_1[extract-steps-1]
foreach_loop_start[foreach-loop-start]
develop_step_1[develop-step-1]
verify_step_1[verify-step-1]
if_step_passed{If/Else:<br/>Conditional Branch}
step_complete[step-complete]
fix_bugs_1[fix-bugs-1]
loop_back[loop-back]
end_success([End])
start_node_default --> check_docs_1
check_docs_1 --> if_docs_exist
if_docs_exist -->|无文档| error_no_docs
if_docs_exist -->|存在文档| extract_steps_1
error_no_docs --> end_error
extract_steps_1 --> foreach_loop_start
foreach_loop_start --> develop_step_1
develop_step_1 --> verify_step_1
verify_step_1 --> if_step_passed
if_step_passed -->|通过| step_complete
if_step_passed -->|失败| fix_bugs_1
step_complete --> end_success
fix_bugs_1 --> loop_back
loop_back --> develop_step_1
```
## Workflow Execution Guide
Follow the Mermaid flowchart above to execute the workflow. Each node type has specific execution methods as described below.
### Execution Methods by Node Type
- **Rectangle nodes**: Execute Sub-Agents using the Task tool
- **Diamond nodes (AskUserQuestion:...)**: Use the AskUserQuestion tool to prompt the user and branch based on their response
- **Diamond nodes (Branch/Switch:...)**: Automatically branch based on the results of previous processing (see details section)
- **Rectangle nodes (Prompt nodes)**: Execute the prompts described in the details section below
## MCP Tool Nodes
#### check_docs_1(read_file)
**Description**: 读取步骤文档文件
**MCP Server**: filesystem
**Tool Name**: read_file
**Validation Status**: valid
**Configured Parameters**:
- `file_path` (string): ./step_documentation.md
**Available Parameters**:
- `file_path` (string) (required): 步骤文档文件路径
This node invokes an MCP (Model Context Protocol) tool. When executing this workflow, use the configured parameters to call the tool via the MCP server.
### If/Else Node Details
#### if_docs_exist(Binary Branch (True/False))
**Evaluation Target**: file_content
**Branch conditions:**
- **存在文档**: 文件存在且包含内容
- **无文档**: 文件不存在或为空
**Execution method**: Evaluate the results of the previous processing and automatically select the appropriate branch based on the conditions above.
#### if_step_passed(Binary Branch (True/False))
**Evaluation Target**: verification_result
**Branch conditions:**
- **通过**: 验证成功
- **失败**: 验证失败
**Execution method**: Evaluate the results of the previous processing and automatically select the appropriate branch based on the conditions above.

85
.claude/commands/req.md Normal file
View File

@@ -0,0 +1,85 @@
---
description: req
---
```mermaid
flowchart TD
start_node_default([Start])
prompt_requirements[请描述您的需求细节]
analyze_project[analyze-project]
compare_requirements[compare-requirements]
confirm_details{AskUserQuestion:<br/>是否需要确认细节?}
confirm_questions[提出需要确认的问题清单]
check_complexity{If/Else:<br/>Conditional Branch}
plan_steps[plan-steps]
create_doc[生成步骤文档,包含所有可验证的修改步骤]
modify_direct[modify-direct]
end_node_default([End])
start_node_default --> prompt_requirements
prompt_requirements --> analyze_project
analyze_project --> compare_requirements
compare_requirements --> confirm_details
confirm_details -->|是| confirm_questions
confirm_questions --> check_complexity
confirm_details -->|否| check_complexity
check_complexity -->|复杂| plan_steps
plan_steps --> create_doc
check_complexity -->|简单| modify_direct
modify_direct --> end_node_default
create_doc --> end_node_default
```
## Workflow Execution Guide
Follow the Mermaid flowchart above to execute the workflow. Each node type has specific execution methods as described below.
### Execution Methods by Node Type
- **Rectangle nodes**: Execute Sub-Agents using the Task tool
- **Diamond nodes (AskUserQuestion:...)**: Use the AskUserQuestion tool to prompt the user and branch based on their response
- **Diamond nodes (Branch/Switch:...)**: Automatically branch based on the results of previous processing (see details section)
- **Rectangle nodes (Prompt nodes)**: Execute the prompts described in the details section below
### Prompt Node Details
#### prompt_requirements(请描述您的需求细节)
```
请描述您的需求细节
```
#### confirm_questions(提出需要确认的问题清单)
```
提出需要确认的问题清单
```
#### create_doc(生成步骤文档,包含所有可验证的修改步骤)
```
生成步骤文档,包含所有可验证的修改步骤
```
### AskUserQuestion Node Details
Ask the user and proceed based on their choice.
#### confirm_details(是否需要确认细节?)
**Selection mode:** Single Select (branches based on the selected option)
**Options:**
- **是**: 需要确认细节后再继续
- **否**: 不需要确认,直接进行比对
### If/Else Node Details
#### check_complexity(Binary Branch (True/False))
**Evaluation Target**: modificationComplexity
**Branch conditions:**
- **复杂**: 修改复杂度高,需要多步骤
- **简单**: 修改相对简单,可直接进行
**Execution method**: Evaluate the results of the previous processing and automatically select the appropriate branch based on the conditions above.

View File

@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"Bash(dir:*)",
"Bash(tree:*)"
]
}
}