mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-10 11:23:32 +08:00
docs(zh-CN): translate code block(plain text) (#753)
Co-authored-by: neo <neo.dowithless@gmail.com>
This commit is contained in:
@@ -35,12 +35,12 @@ echo "$(date +%Y-%m-%d-%H:%M) | $CHECKPOINT_NAME | $(git rev-parse --short HEAD)
|
||||
3. 报告:
|
||||
|
||||
```
|
||||
CHECKPOINT COMPARISON: $NAME
|
||||
检查点对比:$NAME
|
||||
============================
|
||||
Files changed: X
|
||||
Tests: +Y passed / -Z failed
|
||||
Coverage: +X% / -Y%
|
||||
Build: [PASS/FAIL]
|
||||
文件更改数:X
|
||||
测试结果:通过数 +Y / 失败数 -Z
|
||||
覆盖率:+X% / -Y%
|
||||
构建状态:[通过/失败]
|
||||
```
|
||||
|
||||
## 列出检查点
|
||||
|
||||
@@ -29,18 +29,18 @@ npm run claw
|
||||
## REPL 命令
|
||||
|
||||
```text
|
||||
/help Show help
|
||||
/clear Clear current session history
|
||||
/history Print full conversation history
|
||||
/sessions List saved sessions
|
||||
/model [name] Show/set model
|
||||
/load <skill-name> Hot-load a skill into context
|
||||
/branch <session-name> Branch current session
|
||||
/search <query> Search query across sessions
|
||||
/compact Compact old turns, keep recent context
|
||||
/export <md|json|txt> [path] Export session
|
||||
/metrics Show session metrics
|
||||
exit Quit
|
||||
/help 显示帮助信息
|
||||
/clear 清除当前会话历史
|
||||
/history 打印完整对话历史
|
||||
/sessions 列出已保存的会话
|
||||
/model [name] 显示/设置模型
|
||||
/load <skill-name> 热加载技能到上下文
|
||||
/branch <session-name> 分支当前会话
|
||||
/search <query> 跨会话搜索查询
|
||||
/compact 压缩旧轮次,保留近期上下文
|
||||
/export <md|json|txt> [path] 导出会话
|
||||
/metrics 显示会话指标
|
||||
exit 退出
|
||||
```
|
||||
|
||||
## 说明
|
||||
|
||||
@@ -41,18 +41,16 @@ cppcheck --enable=all src/
|
||||
## 示例会话
|
||||
|
||||
````text
|
||||
User: /cpp-build
|
||||
# C++ 构建问题解决
|
||||
|
||||
Agent:
|
||||
# C++ Build Resolution
|
||||
|
||||
## Initial Diagnostics
|
||||
## 初始诊断
|
||||
|
||||
```bash
|
||||
$ cmake --build build
|
||||
src/service/user.cpp:25:15: error: use of undeclared identifier 'UserRepository'
|
||||
src/handler/api.cpp:42:9: error: no matching function for call to 'process'
|
||||
src/handler/api.cpp:58:1: error: non-void function does not return a value
|
||||
|
||||
````
|
||||
|
||||
发现的错误:3
|
||||
@@ -133,45 +131,43 @@ All tests passed.
|
||||
构建状态:✅ 成功
|
||||
|
||||
```
|
||||
## 常见错误修复
|
||||
|
||||
## Common Errors Fixed
|
||||
|
||||
| Error | Typical Fix |
|
||||
| 错误 | 典型修复方法 |
|
||||
|-------|-------------|
|
||||
| `undeclared identifier` | Add `#include` or fix typo |
|
||||
| `no matching function` | Fix argument types or add overload |
|
||||
| `undefined reference` | Link library or add implementation |
|
||||
| `multiple definition` | Use `inline` or move to .cpp |
|
||||
| `incomplete type` | Replace forward decl with `#include` |
|
||||
| `no member named X` | Fix member name or include |
|
||||
| `cannot convert X to Y` | Add appropriate cast |
|
||||
| `CMake Error` | Fix CMakeLists.txt configuration |
|
||||
| `undeclared identifier` | 添加 `#include` 或修正拼写错误 |
|
||||
| `no matching function` | 修正参数类型或添加重载函数 |
|
||||
| `undefined reference` | 链接库或添加实现 |
|
||||
| `multiple definition` | 使用 `inline` 或移至 .cpp 文件 |
|
||||
| `incomplete type` | 将前向声明替换为 `#include` |
|
||||
| `no member named X` | 修正成员名称或包含头文件 |
|
||||
| `cannot convert X to Y` | 添加适当的类型转换 |
|
||||
| `CMake Error` | 修正 CMakeLists.txt 配置 |
|
||||
|
||||
## Fix Strategy
|
||||
## 修复策略
|
||||
|
||||
1. **Compilation errors first** - Code must compile
|
||||
2. **Linker errors second** - Resolve undefined references
|
||||
3. **Warnings third** - Fix with `-Wall -Wextra`
|
||||
4. **One fix at a time** - Verify each change
|
||||
5. **Minimal changes** - Don't refactor, just fix
|
||||
1. **优先处理编译错误** - 代码必须能够编译
|
||||
2. **其次处理链接器错误** - 解决未定义引用
|
||||
3. **第三处理警告** - 使用 `-Wall -Wextra` 进行修复
|
||||
4. **一次只修复一个问题** - 验证每个更改
|
||||
5. **最小化改动** - 仅修复问题,不重构代码
|
||||
|
||||
## Stop Conditions
|
||||
## 停止条件
|
||||
|
||||
The agent will stop and report if:
|
||||
- Same error persists after 3 attempts
|
||||
- Fix introduces more errors
|
||||
- Requires architectural changes
|
||||
- Missing external dependencies
|
||||
在以下情况下,代理将停止并报告:
|
||||
- 同一错误经过 3 次尝试后仍然存在
|
||||
- 修复引入了更多错误
|
||||
- 需要架构性更改
|
||||
- 缺少外部依赖项
|
||||
|
||||
## Related Commands
|
||||
## 相关命令
|
||||
|
||||
- `/cpp-test` - Run tests after build succeeds
|
||||
- `/cpp-review` - Review code quality
|
||||
- `/verify` - Full verification loop
|
||||
- `/cpp-test` - 构建成功后运行测试
|
||||
- `/cpp-review` - 审查代码质量
|
||||
- `/verify` - 完整验证循环
|
||||
|
||||
## Related
|
||||
|
||||
- Agent: `agents/cpp-build-resolver.md`
|
||||
- Skill: `skills/cpp-coding-standards/`
|
||||
## 相关
|
||||
|
||||
- 代理: `agents/cpp-build-resolver.md`
|
||||
- 技能: `skills/cpp-coding-standards/`
|
||||
```
|
||||
|
||||
@@ -68,26 +68,23 @@ cmake --build build -- -Wall -Wextra -Wpedantic
|
||||
## 使用示例
|
||||
|
||||
````text
|
||||
User: /cpp-review
|
||||
# C++ 代码审查报告
|
||||
|
||||
Agent:
|
||||
# C++ Code Review Report
|
||||
## 已审查文件
|
||||
- src/handler/user.cpp (已修改)
|
||||
- src/service/auth.cpp (已修改)
|
||||
|
||||
## Files Reviewed
|
||||
- src/handler/user.cpp (modified)
|
||||
- src/service/auth.cpp (modified)
|
||||
## 静态分析结果
|
||||
✓ clang-tidy: 2 个警告
|
||||
✓ cppcheck: 无问题
|
||||
|
||||
## Static Analysis Results
|
||||
✓ clang-tidy: 2 warnings
|
||||
✓ cppcheck: No issues
|
||||
## 发现的问题
|
||||
|
||||
## Issues Found
|
||||
|
||||
[CRITICAL] Memory Leak
|
||||
File: src/service/auth.cpp:45
|
||||
Issue: Raw `new` without matching `delete`
|
||||
[严重] 内存泄漏
|
||||
文件: src/service/auth.cpp:45
|
||||
问题: 使用了原始的 `new` 而没有匹配的 `delete`
|
||||
```cpp
|
||||
auto* session = new Session(userId); // Memory leak!
|
||||
auto* session = new Session(userId); // 内存泄漏!
|
||||
cache[userId] = session;
|
||||
````
|
||||
|
||||
@@ -121,25 +118,23 @@ void processUser(const User& user) {
|
||||
建议:❌ 在严重问题修复前阻止合并
|
||||
|
||||
```
|
||||
## 批准标准
|
||||
|
||||
## Approval Criteria
|
||||
|
||||
| Status | Condition |
|
||||
| 状态 | 条件 |
|
||||
|--------|-----------|
|
||||
| ✅ Approve | No CRITICAL or HIGH issues |
|
||||
| ⚠️ Warning | Only MEDIUM issues (merge with caution) |
|
||||
| ❌ Block | CRITICAL or HIGH issues found |
|
||||
| ✅ 批准 | 没有 CRITICAL 或 HIGH 级别的问题 |
|
||||
| ⚠️ 警告 | 仅有 MEDIUM 级别的问题(谨慎合并) |
|
||||
| ❌ 阻止 | 发现 CRITICAL 或 HIGH 级别的问题 |
|
||||
|
||||
## Integration with Other Commands
|
||||
## 与其他命令的集成
|
||||
|
||||
- Use `/cpp-test` first to ensure tests pass
|
||||
- Use `/cpp-build` if build errors occur
|
||||
- Use `/cpp-review` before committing
|
||||
- Use `/code-review` for non-C++ specific concerns
|
||||
- 首先使用 `/cpp-test` 确保测试通过
|
||||
- 如果出现构建错误,请使用 `/cpp-build`
|
||||
- 在提交前使用 `/cpp-review`
|
||||
- 对于非 C++ 特定的问题,请使用 `/code-review`
|
||||
|
||||
## Related
|
||||
|
||||
- Agent: `agents/cpp-reviewer.md`
|
||||
- Skills: `skills/cpp-coding-standards/`, `skills/cpp-testing/`
|
||||
## 相关
|
||||
|
||||
- 代理:`agents/cpp-reviewer.md`
|
||||
- 技能:`skills/cpp-coding-standards/`, `skills/cpp-testing/`
|
||||
```
|
||||
|
||||
@@ -28,10 +28,10 @@ description: 为 C++ 强制执行 TDD 工作流程。先编写 GoogleTest 测试
|
||||
## TDD 循环
|
||||
|
||||
```
|
||||
RED → Write failing GoogleTest test
|
||||
GREEN → Implement minimal code to pass
|
||||
REFACTOR → Improve code, tests stay green
|
||||
REPEAT → Next test case
|
||||
RED → 编写失败的 GoogleTest 测试
|
||||
GREEN → 实现最小化代码以通过测试
|
||||
REFACTOR → 改进代码,测试保持通过
|
||||
REPEAT → 下一个测试用例
|
||||
```
|
||||
|
||||
## 示例会话
|
||||
|
||||
@@ -11,14 +11,14 @@ description: 通过Claude DevFleet协调并行Claude Code代理——从自然
|
||||
## 流程
|
||||
|
||||
```
|
||||
User describes project
|
||||
→ plan_project(prompt) → mission DAG with dependencies
|
||||
→ Show plan, get approval
|
||||
→ dispatch_mission(M1) → Agent spawns in worktree
|
||||
→ M1 completes → auto-merge → M2 auto-dispatches (depends_on M1)
|
||||
→ M2 completes → auto-merge
|
||||
→ get_report(M2) → files_changed, what_done, errors, next_steps
|
||||
→ Report summary to user
|
||||
用户描述项目
|
||||
→ plan_project(prompt) → 任务DAG与依赖关系
|
||||
→ 展示计划,获取批准
|
||||
→ dispatch_mission(M1) → 代理在工作区中生成
|
||||
→ M1完成 → 自动合并 → M2自动调度(依赖于M1)
|
||||
→ M2完成 → 自动合并
|
||||
→ get_report(M2) → 文件变更、完成内容、错误、后续步骤
|
||||
→ 向用户报告总结
|
||||
```
|
||||
|
||||
## 工作流
|
||||
@@ -26,7 +26,7 @@ User describes project
|
||||
1. **根据用户描述规划项目**:
|
||||
|
||||
```
|
||||
mcp__devfleet__plan_project(prompt="<user's description>")
|
||||
mcp__devfleet__plan_project(prompt="<用户描述>")
|
||||
```
|
||||
|
||||
这将返回一个包含链式任务的项目。向用户展示:
|
||||
|
||||
@@ -38,24 +38,24 @@ e2e-runner 代理将:
|
||||
## 使用示例
|
||||
|
||||
````
|
||||
User: /e2e Test the market search and view flow
|
||||
用户:/e2e 测试市场搜索和查看流程
|
||||
|
||||
Agent (e2e-runner):
|
||||
# E2E Test Generation: Market Search and View Flow
|
||||
代理(e2e-runner):
|
||||
# E2E 测试生成:市场搜索和查看流程
|
||||
|
||||
## Test Scenario Identified
|
||||
## 已识别测试场景
|
||||
|
||||
**User Journey:** Market Search → View Results → Click Market → View Details
|
||||
**用户旅程:** 市场搜索 → 查看结果 → 点击市场 → 查看详情
|
||||
|
||||
**Test Coverage:**
|
||||
1. Navigate to markets page
|
||||
2. Perform semantic search
|
||||
3. Verify search results
|
||||
4. Click on first result
|
||||
5. Verify market details page loads
|
||||
6. Verify chart renders
|
||||
**测试覆盖范围:**
|
||||
1. 导航至市场页面
|
||||
2. 执行语义搜索
|
||||
3. 验证搜索结果
|
||||
4. 点击第一个结果
|
||||
5. 验证市场详情页面加载
|
||||
6. 验证图表渲染
|
||||
|
||||
## Generated Test Code
|
||||
## 生成的测试代码
|
||||
|
||||
```typescript
|
||||
// tests/e2e/markets/search-and-view.spec.ts
|
||||
@@ -155,6 +155,7 @@ test.describe('Market Search and View Flow', () => {
|
||||
expect(finalCount).toBe(initialCount)
|
||||
})
|
||||
})
|
||||
|
||||
````
|
||||
|
||||
## 运行测试
|
||||
@@ -181,55 +182,55 @@ Artifacts generated:
|
||||
|
||||
```
|
||||
╔══════════════════════════════════════════════════════════════╗
|
||||
║ E2E Test Results ║
|
||||
║ E2E 测试结果 ║
|
||||
╠══════════════════════════════════════════════════════════════╣
|
||||
║ Status: ✅ ALL TESTS PASSED ║
|
||||
║ Total: 3 tests ║
|
||||
║ Passed: 3 (100%) ║
|
||||
║ Failed: 0 ║
|
||||
║ Flaky: 0 ║
|
||||
║ Duration: 9.1s ║
|
||||
║ 状态: ✅ 所有测试通过 ║
|
||||
║ 总计: 3 项测试 ║
|
||||
║ 通过: 3 (100%) ║
|
||||
║ 失败: 0 ║
|
||||
║ 不稳定: 0 ║
|
||||
║ 耗时: 9.1s ║
|
||||
╚══════════════════════════════════════════════════════════════╝
|
||||
|
||||
Artifacts:
|
||||
📸 Screenshots: 2 files
|
||||
📹 Videos: 0 files (only on failure)
|
||||
🔍 Traces: 0 files (only on failure)
|
||||
📊 HTML Report: playwright-report/index.html
|
||||
产物:
|
||||
📸 截图: 2 个文件
|
||||
📹 视频: 0 个文件(仅在失败时生成)
|
||||
🔍 追踪文件: 0 个文件(仅在失败时生成)
|
||||
📊 HTML 报告: playwright-report/index.html
|
||||
|
||||
View report: npx playwright show-report
|
||||
查看报告: npx playwright show-report
|
||||
```
|
||||
|
||||
✅ E2E 测试套件已准备好进行 CI/CD 集成!
|
||||
|
||||
````
|
||||
## 测试产物
|
||||
|
||||
## Test Artifacts
|
||||
当测试运行时,会捕获以下产物:
|
||||
|
||||
When tests run, the following artifacts are captured:
|
||||
**所有测试:**
|
||||
- 包含时间线和结果的 HTML 报告
|
||||
- 用于 CI 集成的 JUnit XML 文件
|
||||
|
||||
**On All Tests:**
|
||||
- HTML Report with timeline and results
|
||||
- JUnit XML for CI integration
|
||||
**仅在失败时:**
|
||||
- 失败状态的截图
|
||||
- 测试的视频录制
|
||||
- 用于调试的追踪文件(逐步重放)
|
||||
- 网络日志
|
||||
- 控制台日志
|
||||
|
||||
**On Failure Only:**
|
||||
- Screenshot of the failing state
|
||||
- Video recording of the test
|
||||
- Trace file for debugging (step-by-step replay)
|
||||
- Network logs
|
||||
- Console logs
|
||||
|
||||
## Viewing Artifacts
|
||||
## 查看产物
|
||||
|
||||
```bash
|
||||
# View HTML report in browser
|
||||
# 在浏览器中查看 HTML 报告
|
||||
npx playwright show-report
|
||||
|
||||
# View specific trace file
|
||||
# 查看特定的追踪文件
|
||||
npx playwright show-trace artifacts/trace-abc123.zip
|
||||
|
||||
# Screenshots are saved in artifacts/ directory
|
||||
# 截图保存在 artifacts/ 目录中
|
||||
open artifacts/search-results.png
|
||||
|
||||
````
|
||||
|
||||
## 不稳定测试检测
|
||||
@@ -239,18 +240,18 @@ open artifacts/search-results.png
|
||||
```
|
||||
⚠️ FLAKY TEST DETECTED: tests/e2e/markets/trade.spec.ts
|
||||
|
||||
Test passed 7/10 runs (70% pass rate)
|
||||
测试通过了 7/10 次运行 (70% 通过率)
|
||||
|
||||
Common failure:
|
||||
"Timeout waiting for element '[data-testid="confirm-btn"]'"
|
||||
常见失败原因:
|
||||
"等待元素 '[data-testid="confirm-btn"]' 超时"
|
||||
|
||||
Recommended fixes:
|
||||
1. Add explicit wait: await page.waitForSelector('[data-testid="confirm-btn"]')
|
||||
2. Increase timeout: { timeout: 10000 }
|
||||
3. Check for race conditions in component
|
||||
4. Verify element is not hidden by animation
|
||||
推荐修复方法:
|
||||
1. 添加显式等待: await page.waitForSelector('[data-testid="confirm-btn"]')
|
||||
2. 增加超时时间: { timeout: 10000 }
|
||||
3. 检查组件中的竞争条件
|
||||
4. 确认元素未被动画遮挡
|
||||
|
||||
Quarantine recommendation: Mark as test.fixme() until fixed
|
||||
隔离建议: 在修复前标记为 test.fixme()
|
||||
```
|
||||
|
||||
## 浏览器配置
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
```
|
||||
EVAL CHECK: feature-name
|
||||
========================
|
||||
Capability: X/Y passing
|
||||
Regression: X/Y passing
|
||||
Status: IN PROGRESS / READY
|
||||
功能:X/Y 通过
|
||||
回归测试:X/Y 通过
|
||||
状态:进行中 / 就绪
|
||||
```
|
||||
|
||||
## 报告评估
|
||||
@@ -68,31 +68,31 @@ Status: IN PROGRESS / READY
|
||||
```
|
||||
EVAL REPORT: feature-name
|
||||
=========================
|
||||
Generated: $(date)
|
||||
生成时间: $(date)
|
||||
|
||||
CAPABILITY EVALS
|
||||
能力评估
|
||||
----------------
|
||||
[eval-1]: PASS (pass@1)
|
||||
[eval-2]: PASS (pass@2) - required retry
|
||||
[eval-3]: FAIL - see notes
|
||||
[eval-1]: 通过 (pass@1)
|
||||
[eval-2]: 通过 (pass@2) - 需要重试
|
||||
[eval-3]: 失败 - 参见备注
|
||||
|
||||
REGRESSION EVALS
|
||||
回归测试
|
||||
----------------
|
||||
[test-1]: PASS
|
||||
[test-2]: PASS
|
||||
[test-3]: PASS
|
||||
[test-1]: 通过
|
||||
[test-2]: 通过
|
||||
[test-3]: 通过
|
||||
|
||||
METRICS
|
||||
指标
|
||||
-------
|
||||
Capability pass@1: 67%
|
||||
Capability pass@3: 100%
|
||||
Regression pass^3: 100%
|
||||
能力 pass@1: 67%
|
||||
能力 pass@3: 100%
|
||||
回归 pass^3: 100%
|
||||
|
||||
NOTES
|
||||
备注
|
||||
-----
|
||||
[Any issues, edge cases, or observations]
|
||||
[任何问题、边界情况或观察结果]
|
||||
|
||||
RECOMMENDATION
|
||||
建议
|
||||
--------------
|
||||
[SHIP / NEEDS WORK / BLOCKED]
|
||||
```
|
||||
@@ -104,11 +104,11 @@ RECOMMENDATION
|
||||
显示所有评估定义:
|
||||
|
||||
```
|
||||
EVAL DEFINITIONS
|
||||
功能模块定义
|
||||
================
|
||||
feature-auth [3/5 passing] IN PROGRESS
|
||||
feature-search [5/5 passing] READY
|
||||
feature-export [0/4 passing] NOT STARTED
|
||||
feature-auth [3/5 通过] 进行中
|
||||
feature-search [5/5 通过] 就绪
|
||||
feature-export [0/4 通过] 未开始
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
@@ -29,8 +29,8 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [
|
||||
## 使用方法
|
||||
|
||||
```
|
||||
/evolve # Analyze all instincts and suggest evolutions
|
||||
/evolve --generate # Also generate files under evolved/{skills,commands,agents}
|
||||
/evolve # 分析所有本能并建议进化方向
|
||||
/evolve --generate # 同时在 evolved/{skills,commands,agents} 目录下生成文件
|
||||
```
|
||||
|
||||
## 演化规则
|
||||
@@ -102,29 +102,29 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [
|
||||
|
||||
```
|
||||
============================================================
|
||||
EVOLVE ANALYSIS - 12 instincts
|
||||
Project: my-app (a1b2c3d4e5f6)
|
||||
Project-scoped: 8 | Global: 4
|
||||
演进分析 - 12 种直觉
|
||||
项目:my-app (a1b2c3d4e5f6)
|
||||
项目范围:8 | 全局:4
|
||||
============================================================
|
||||
|
||||
High confidence instincts (>=80%): 5
|
||||
高置信度直觉 (>=80%):5
|
||||
|
||||
## SKILL CANDIDATES
|
||||
1. Cluster: "adding tests"
|
||||
Instincts: 3
|
||||
Avg confidence: 82%
|
||||
Domains: testing
|
||||
Scopes: project
|
||||
## 技能候选
|
||||
1. 聚类:"adding tests"
|
||||
直觉:3
|
||||
平均置信度:82%
|
||||
领域:testing
|
||||
范围:project
|
||||
|
||||
## COMMAND CANDIDATES (2)
|
||||
## 命令候选 (2)
|
||||
/adding-tests
|
||||
From: test-first-workflow [project]
|
||||
Confidence: 84%
|
||||
来源:test-first-workflow [project]
|
||||
置信度:84%
|
||||
|
||||
## AGENT CANDIDATES (1)
|
||||
## 代理候选 (1)
|
||||
adding-tests-agent
|
||||
Covers 3 instincts
|
||||
Avg confidence: 82%
|
||||
涵盖 3 种直觉
|
||||
平均置信度:82%
|
||||
```
|
||||
|
||||
## 标志
|
||||
|
||||
@@ -45,18 +45,16 @@ go mod tidy -v
|
||||
## 示例会话
|
||||
|
||||
````text
|
||||
User: /go-build
|
||||
# Go Build 解析
|
||||
|
||||
Agent:
|
||||
# Go Build Resolution
|
||||
|
||||
## Initial Diagnostics
|
||||
## 初始诊断
|
||||
|
||||
```bash
|
||||
$ go build ./...
|
||||
internal/service/user.go:25:15: undefined: UserRepository
|
||||
internal/handler/api.go:42:9: cannot use x (type string) as type int
|
||||
internal/handler/api.go:58:2: missing return at end of function
|
||||
|
||||
````
|
||||
|
||||
发现错误:3
|
||||
@@ -144,44 +142,42 @@ ok project/internal/handler 0.023s
|
||||
构建状态:✅ 成功
|
||||
|
||||
```
|
||||
## 常见错误修复
|
||||
|
||||
## Common Errors Fixed
|
||||
|
||||
| Error | Typical Fix |
|
||||
| 错误 | 典型修复 |
|
||||
|-------|-------------|
|
||||
| `undefined: X` | Add import or fix typo |
|
||||
| `cannot use X as Y` | Type conversion or fix assignment |
|
||||
| `missing return` | Add return statement |
|
||||
| `X does not implement Y` | Add missing method |
|
||||
| `import cycle` | Restructure packages |
|
||||
| `declared but not used` | Remove or use variable |
|
||||
| `cannot find package` | `go get` or `go mod tidy` |
|
||||
| `undefined: X` | 添加导入或修正拼写错误 |
|
||||
| `cannot use X as Y` | 类型转换或修正赋值 |
|
||||
| `missing return` | 添加返回语句 |
|
||||
| `X does not implement Y` | 添加缺失的方法 |
|
||||
| `import cycle` | 重构包结构 |
|
||||
| `declared but not used` | 移除或使用变量 |
|
||||
| `cannot find package` | `go get` 或 `go mod tidy` |
|
||||
|
||||
## Fix Strategy
|
||||
## 修复策略
|
||||
|
||||
1. **Build errors first** - Code must compile
|
||||
2. **Vet warnings second** - Fix suspicious constructs
|
||||
3. **Lint warnings third** - Style and best practices
|
||||
4. **One fix at a time** - Verify each change
|
||||
5. **Minimal changes** - Don't refactor, just fix
|
||||
1. **优先处理构建错误** - 代码必须能够编译
|
||||
2. **其次处理 vet 警告** - 修复可疑结构
|
||||
3. **再次处理 lint 警告** - 风格和最佳实践
|
||||
4. **一次修复一个问题** - 验证每个更改
|
||||
5. **最小化更改** - 不要重构,只修复
|
||||
|
||||
## Stop Conditions
|
||||
## 停止条件
|
||||
|
||||
The agent will stop and report if:
|
||||
- Same error persists after 3 attempts
|
||||
- Fix introduces more errors
|
||||
- Requires architectural changes
|
||||
- Missing external dependencies
|
||||
在以下情况下,代理将停止并报告:
|
||||
- 相同错误经过 3 次尝试后仍然存在
|
||||
- 修复引入了更多错误
|
||||
- 需要架构性更改
|
||||
- 缺少外部依赖
|
||||
|
||||
## Related Commands
|
||||
## 相关命令
|
||||
|
||||
- `/go-test` - Run tests after build succeeds
|
||||
- `/go-review` - Review code quality
|
||||
- `/verify` - Full verification loop
|
||||
- `/go-test` - 构建成功后运行测试
|
||||
- `/go-review` - 审查代码质量
|
||||
- `/verify` - 完整验证循环
|
||||
|
||||
## Related
|
||||
|
||||
- Agent: `agents/go-build-resolver.md`
|
||||
- Skill: `skills/golang-patterns/`
|
||||
## 相关
|
||||
|
||||
- 代理: `agents/go-build-resolver.md`
|
||||
- 技能: `skills/golang-patterns/`
|
||||
```
|
||||
|
||||
@@ -73,29 +73,26 @@ govulncheck ./...
|
||||
## 使用示例
|
||||
|
||||
````text
|
||||
User: /go-review
|
||||
# Go 代码审查报告
|
||||
|
||||
Agent:
|
||||
# Go Code Review Report
|
||||
## 已审查文件
|
||||
- internal/handler/user.go(已修改)
|
||||
- internal/service/auth.go(已修改)
|
||||
|
||||
## Files Reviewed
|
||||
- internal/handler/user.go (modified)
|
||||
- internal/service/auth.go (modified)
|
||||
## 静态分析结果
|
||||
✓ go vet: 无问题
|
||||
✓ staticcheck: 无问题
|
||||
|
||||
## Static Analysis Results
|
||||
✓ go vet: No issues
|
||||
✓ staticcheck: No issues
|
||||
## 发现的问题
|
||||
|
||||
## Issues Found
|
||||
|
||||
[CRITICAL] Race Condition
|
||||
File: internal/service/auth.go:45
|
||||
Issue: Shared map accessed without synchronization
|
||||
[严重] 竞态条件
|
||||
文件: internal/service/auth.go:45
|
||||
问题: 共享映射访问未同步
|
||||
```go
|
||||
var cache = map[string]*Session{} // Concurrent access!
|
||||
var cache = map[string]*Session{} // 并发访问!
|
||||
|
||||
func GetSession(id string) *Session {
|
||||
return cache[id] // Race condition
|
||||
return cache[id] // 竞态条件
|
||||
}
|
||||
````
|
||||
|
||||
@@ -137,25 +134,23 @@ return fmt.Errorf("get user %s: %w", userID, err)
|
||||
建议:❌ 在严重问题修复前阻止合并
|
||||
|
||||
```
|
||||
## 批准标准
|
||||
|
||||
## Approval Criteria
|
||||
|
||||
| Status | Condition |
|
||||
| 状态 | 条件 |
|
||||
|--------|-----------|
|
||||
| ✅ Approve | No CRITICAL or HIGH issues |
|
||||
| ⚠️ Warning | Only MEDIUM issues (merge with caution) |
|
||||
| ❌ Block | CRITICAL or HIGH issues found |
|
||||
| ✅ 批准 | 无 CRITICAL 或 HIGH 级别问题 |
|
||||
| ⚠️ 警告 | 仅有 MEDIUM 级别问题 (谨慎合并) |
|
||||
| ❌ 阻止 | 发现 CRITICAL 或 HIGH 级别问题 |
|
||||
|
||||
## Integration with Other Commands
|
||||
## 与其他命令的集成
|
||||
|
||||
- Use `/go-test` first to ensure tests pass
|
||||
- Use `/go-build` if build errors occur
|
||||
- Use `/go-review` before committing
|
||||
- Use `/code-review` for non-Go specific concerns
|
||||
- 首先使用 `/go-test` 确保测试通过
|
||||
- 如果出现构建错误,请使用 `/go-build`
|
||||
- 提交前使用 `/go-review`
|
||||
- 对于非 Go 语言特定问题,请使用 `/code-review`
|
||||
|
||||
## Related
|
||||
## 相关
|
||||
|
||||
- Agent: `agents/go-reviewer.md`
|
||||
- Skills: `skills/golang-patterns/`, `skills/golang-testing/`
|
||||
|
||||
```
|
||||
|
||||
@@ -28,34 +28,34 @@ description: 为Go强制执行TDD工作流程。首先编写表驱动测试,
|
||||
## TDD 循环
|
||||
|
||||
```
|
||||
RED → Write failing table-driven test
|
||||
GREEN → Implement minimal code to pass
|
||||
REFACTOR → Improve code, tests stay green
|
||||
REPEAT → Next test case
|
||||
RED → 编写失败的表格驱动测试
|
||||
GREEN → 实现最小化代码以通过测试
|
||||
REFACTOR → 改进代码,保持测试通过
|
||||
REPEAT → 下一个测试用例
|
||||
```
|
||||
|
||||
## 示例会话
|
||||
|
||||
````
|
||||
User: /go-test I need a function to validate email addresses
|
||||
用户: /go-test 我需要一个验证电子邮箱地址的函数
|
||||
|
||||
Agent:
|
||||
# TDD Session: Email Validator
|
||||
代理:
|
||||
# TDD 会话: 电子邮件验证器
|
||||
|
||||
## Step 1: Define Interface
|
||||
## 步骤 1: 定义接口
|
||||
|
||||
```go
|
||||
// validator/email.go
|
||||
package validator
|
||||
|
||||
// ValidateEmail checks if the given string is a valid email address.
|
||||
// Returns nil if valid, error describing the issue otherwise.
|
||||
// ValidateEmail 检查给定的字符串是否为有效的电子邮件地址。
|
||||
// 如果有效则返回 nil,否则返回描述问题的错误。
|
||||
func ValidateEmail(email string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
```
|
||||
|
||||
## Step 2: Write Table-Driven Tests (RED)
|
||||
## 步骤 2: 编写表驱动测试 (RED)
|
||||
|
||||
```go
|
||||
// validator/email_test.go
|
||||
@@ -71,13 +71,13 @@ func TestValidateEmail(t *testing.T) {
|
||||
email string
|
||||
wantErr bool
|
||||
}{
|
||||
// Valid emails
|
||||
// 有效邮箱
|
||||
{"simple email", "user@example.com", false},
|
||||
{"with subdomain", "user@mail.example.com", false},
|
||||
{"with plus", "user+tag@example.com", false},
|
||||
{"with dots", "first.last@example.com", false},
|
||||
|
||||
// Invalid emails
|
||||
// 无效邮箱
|
||||
{"empty string", "", true},
|
||||
{"no at sign", "userexample.com", true},
|
||||
{"no domain", "user@", true},
|
||||
@@ -101,7 +101,7 @@ func TestValidateEmail(t *testing.T) {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 3: Run Tests - Verify FAIL
|
||||
## 步骤 3: 运行测试 - 验证失败
|
||||
|
||||
```bash
|
||||
$ go test ./validator/...
|
||||
@@ -113,9 +113,9 @@ $ go test ./validator/...
|
||||
FAIL
|
||||
```
|
||||
|
||||
✓ Tests fail as expected (panic).
|
||||
✓ 测试按预期失败 (panic)。
|
||||
|
||||
## Step 4: Implement Minimal Code (GREEN)
|
||||
## 步骤 4: 实现最小化代码 (GREEN)
|
||||
|
||||
```go
|
||||
// validator/email.go
|
||||
@@ -144,7 +144,7 @@ func ValidateEmail(email string) error {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 5: Run Tests - Verify PASS
|
||||
## 步骤 5: 运行测试 - 验证通过
|
||||
|
||||
```bash
|
||||
$ go test ./validator/...
|
||||
@@ -153,9 +153,9 @@ PASS
|
||||
ok project/validator 0.003s
|
||||
```
|
||||
|
||||
✓ All tests passing!
|
||||
✓ 所有测试通过!
|
||||
|
||||
## Step 6: Check Coverage
|
||||
## 步骤 6: 检查覆盖率
|
||||
|
||||
```bash
|
||||
$ go test -cover ./validator/...
|
||||
@@ -165,9 +165,9 @@ coverage: 100.0% of statements
|
||||
ok project/validator 0.003s
|
||||
```
|
||||
|
||||
✓ Coverage: 100%
|
||||
✓ 覆盖率: 100%
|
||||
|
||||
## TDD Complete!
|
||||
## TDD 完成!
|
||||
````
|
||||
|
||||
## 测试模式
|
||||
|
||||
@@ -53,15 +53,15 @@ node scripts/harness-audit.js <scope> --format <text|json>
|
||||
## 结果示例
|
||||
|
||||
```text
|
||||
Harness Audit (repo): 66/70
|
||||
- Tool Coverage: 10/10 (10/10 pts)
|
||||
- Context Efficiency: 9/10 (9/10 pts)
|
||||
- Quality Gates: 10/10 (10/10 pts)
|
||||
Harness 审计 (代码库): 66/70
|
||||
- 工具覆盖率: 10/10 (10/10 分)
|
||||
- 上下文效率: 9/10 (9/10 分)
|
||||
- 质量门禁: 10/10 (10/10 分)
|
||||
|
||||
Top 3 Actions:
|
||||
1) [Security Guardrails] Add prompt/tool preflight security guards in hooks/hooks.json. (hooks/hooks.json)
|
||||
2) [Tool Coverage] Sync commands/harness-audit.md and .opencode/commands/harness-audit.md. (.opencode/commands/harness-audit.md)
|
||||
3) [Eval Coverage] Increase automated test coverage across scripts/hooks/lib. (tests/)
|
||||
首要三项行动:
|
||||
1) [安全防护] 在 hooks/hooks.json 中添加提示/工具预检安全防护。 (hooks/hooks.json)
|
||||
2) [工具覆盖率] 同步 commands/harness-audit.md 和 .opencode/commands/harness-audit.md。 (.opencode/commands/harness-audit.md)
|
||||
3) [评估覆盖率] 提升 scripts/hooks/lib 目录下的自动化测试覆盖率。 (tests/)
|
||||
```
|
||||
|
||||
## 参数
|
||||
|
||||
@@ -15,9 +15,9 @@ command: /instinct-export
|
||||
## 用法
|
||||
|
||||
```
|
||||
/instinct-export # Export all personal instincts
|
||||
/instinct-export --domain testing # Export only testing instincts
|
||||
/instinct-export --min-confidence 0.7 # Only export high-confidence instincts
|
||||
/instinct-export # 导出所有个人本能
|
||||
/instinct-export --domain testing # 仅导出测试相关本能
|
||||
/instinct-export --min-confidence 0.7 # 仅导出高置信度本能
|
||||
/instinct-export --output team-instincts.yaml
|
||||
/instinct-export --scope project --output project-instincts.yaml
|
||||
```
|
||||
|
||||
@@ -44,33 +44,33 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <
|
||||
## 导入过程
|
||||
|
||||
```
|
||||
📥 Importing instincts from: team-instincts.yaml
|
||||
📥 从 team-instincts.yaml 导入本能
|
||||
================================================
|
||||
|
||||
Found 12 instincts to import.
|
||||
发现 12 个待导入的本能。
|
||||
|
||||
Analyzing conflicts...
|
||||
正在分析冲突...
|
||||
|
||||
## New Instincts (8)
|
||||
These will be added:
|
||||
✓ use-zod-validation (confidence: 0.7)
|
||||
✓ prefer-named-exports (confidence: 0.65)
|
||||
✓ test-async-functions (confidence: 0.8)
|
||||
## 新本能 (8)
|
||||
这些将被添加:
|
||||
✓ use-zod-validation (置信度: 0.7)
|
||||
✓ prefer-named-exports (置信度: 0.65)
|
||||
✓ test-async-functions (置信度: 0.8)
|
||||
...
|
||||
|
||||
## Duplicate Instincts (3)
|
||||
Already have similar instincts:
|
||||
## 重复本能 (3)
|
||||
已存在类似本能:
|
||||
⚠️ prefer-functional-style
|
||||
Local: 0.8 confidence, 12 observations
|
||||
Import: 0.7 confidence
|
||||
→ Keep local (higher confidence)
|
||||
本地: 0.8 置信度, 12 次观察
|
||||
导入: 0.7 置信度
|
||||
→ 保留本地 (置信度更高)
|
||||
|
||||
⚠️ test-first-workflow
|
||||
Local: 0.75 confidence
|
||||
Import: 0.9 confidence
|
||||
→ Update to import (higher confidence)
|
||||
本地: 0.75 置信度
|
||||
导入: 0.9 置信度
|
||||
→ 更新为导入 (置信度更高)
|
||||
|
||||
Import 8 new, update 1?
|
||||
导入 8 个新的,更新 1 个?
|
||||
```
|
||||
|
||||
## 合并行为
|
||||
@@ -105,13 +105,13 @@ project_name: "my-project"
|
||||
导入后:
|
||||
|
||||
```
|
||||
✅ Import complete!
|
||||
✅ 导入完成!
|
||||
|
||||
Added: 8 instincts
|
||||
Updated: 1 instinct
|
||||
Skipped: 3 instincts (equal/higher confidence already exists)
|
||||
新增:8 项本能
|
||||
更新:1 项本能
|
||||
跳过:3 项本能(已存在同等或更高置信度的版本)
|
||||
|
||||
New instincts saved to: ~/.claude/homunculus/instincts/inherited/
|
||||
新本能已保存至:~/.claude/homunculus/instincts/inherited/
|
||||
|
||||
Run /instinct-status to see all instincts.
|
||||
运行 /instinct-status 以查看所有本能。
|
||||
```
|
||||
|
||||
@@ -40,20 +40,20 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
|
||||
|
||||
```
|
||||
============================================================
|
||||
INSTINCT STATUS - 12 total
|
||||
INSTINCT 状态 - 总计 12
|
||||
============================================================
|
||||
|
||||
Project: my-app (a1b2c3d4e5f6)
|
||||
Project instincts: 8
|
||||
Global instincts: 4
|
||||
项目: my-app (a1b2c3d4e5f6)
|
||||
项目 instincts: 8
|
||||
全局 instincts: 4
|
||||
|
||||
## PROJECT-SCOPED (my-app)
|
||||
### WORKFLOW (3)
|
||||
## 项目范围内 (my-app)
|
||||
### 工作流 (3)
|
||||
███████░░░ 70% grep-before-edit [project]
|
||||
trigger: when modifying code
|
||||
触发条件: 当修改代码时
|
||||
|
||||
## GLOBAL (apply to all projects)
|
||||
### SECURITY (2)
|
||||
## 全局 (适用于所有项目)
|
||||
### 安全 (2)
|
||||
█████████░ 85% validate-user-input [global]
|
||||
trigger: when handling user input
|
||||
触发条件: 当处理用户输入时
|
||||
```
|
||||
|
||||
@@ -28,21 +28,21 @@ description: 为Kotlin强制执行TDD工作流程。首先编写Kotest测试,
|
||||
## TDD 循环
|
||||
|
||||
```
|
||||
RED -> Write failing Kotest test
|
||||
GREEN -> Implement minimal code to pass
|
||||
REFACTOR -> Improve code, tests stay green
|
||||
REPEAT -> Next test case
|
||||
RED -> 编写失败的 Kotest 测试
|
||||
GREEN -> 实现最小化代码以通过测试
|
||||
REFACTOR -> 改进代码,测试保持通过状态
|
||||
REPEAT -> 进入下一个测试用例
|
||||
```
|
||||
|
||||
## 示例会话
|
||||
|
||||
````text
|
||||
User: /kotlin-test I need a function to validate user registration requests
|
||||
用户:/kotlin-test 我需要一个验证用户注册请求的函数
|
||||
|
||||
Agent:
|
||||
# TDD Session: Registration Validator
|
||||
代理:
|
||||
# TDD 会话:注册验证器
|
||||
|
||||
## Step 1: Define Interface
|
||||
## 第一步:定义接口
|
||||
|
||||
```kotlin
|
||||
// validator/RegistrationValidator.kt
|
||||
@@ -64,7 +64,7 @@ fun validateRegistration(request: RegistrationRequest): ValidationResult {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 2: Write Kotest Tests (RED)
|
||||
## 第二步:编写 Kotest 测试(RED)
|
||||
|
||||
```kotlin
|
||||
// validator/RegistrationValidatorTest.kt
|
||||
@@ -141,7 +141,7 @@ class RegistrationValidatorTest : FunSpec({
|
||||
})
|
||||
```
|
||||
|
||||
## Step 3: Run Tests - Verify FAIL
|
||||
## 第三步:运行测试 - 验证失败
|
||||
|
||||
```bash
|
||||
$ ./gradlew test
|
||||
@@ -152,9 +152,9 @@ RegistrationValidatorTest > valid registration returns Valid FAILED
|
||||
FAILED (5 tests, 0 passed, 5 failed)
|
||||
```
|
||||
|
||||
✓ Tests fail as expected (NotImplementedError).
|
||||
✓ 测试按预期失败(NotImplementedError)。
|
||||
|
||||
## Step 4: Implement Minimal Code (GREEN)
|
||||
## 第四步:实现最小代码(GREEN)
|
||||
|
||||
```kotlin
|
||||
// validator/RegistrationValidator.kt
|
||||
@@ -175,7 +175,7 @@ fun validateRegistration(request: RegistrationRequest): ValidationResult {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 5: Run Tests - Verify PASS
|
||||
## 第五步:运行测试 - 验证通过
|
||||
|
||||
```bash
|
||||
$ ./gradlew test
|
||||
@@ -189,9 +189,9 @@ RegistrationValidatorTest > multiple errors returns all errors PASSED
|
||||
PASSED (5 tests, 5 passed, 0 failed)
|
||||
```
|
||||
|
||||
✓ All tests passing!
|
||||
✓ 所有测试通过!
|
||||
|
||||
## Step 6: Check Coverage
|
||||
## 第六步:检查覆盖率
|
||||
|
||||
```bash
|
||||
$ ./gradlew koverHtmlReport
|
||||
@@ -199,9 +199,9 @@ $ ./gradlew koverHtmlReport
|
||||
Coverage: 100.0% of statements
|
||||
```
|
||||
|
||||
✓ Coverage: 100%
|
||||
✓ 覆盖率:100%
|
||||
|
||||
## TDD Complete!
|
||||
## TDD 完成!
|
||||
````
|
||||
|
||||
## 测试模式
|
||||
|
||||
@@ -93,15 +93,15 @@ origin: auto-extracted
|
||||
## 步骤 5 的输出格式
|
||||
|
||||
```
|
||||
### Checklist
|
||||
- [x] skills/ grep: no overlap (or: overlap found → details)
|
||||
- [x] MEMORY.md: no overlap (or: overlap found → details)
|
||||
- [x] Existing skill append: new file appropriate (or: should append to [X])
|
||||
- [x] Reusability: confirmed (or: one-off → Drop)
|
||||
### 检查清单
|
||||
- [x] skills/ grep: 无重叠 (或: 发现重叠 → 详情)
|
||||
- [x] MEMORY.md: 无重叠 (或: 发现重叠 → 详情)
|
||||
- [x] 现有技能追加: 新文件合适 (或: 应追加到 [X])
|
||||
- [x] 可复用性: 已确认 (或: 一次性 → 丢弃)
|
||||
|
||||
### Verdict: Save / Improve then Save / Absorb into [X] / Drop
|
||||
### 裁决: 保存 / 改进后保存 / 吸收到 [X] / 丢弃
|
||||
|
||||
**Rationale:** (1-2 sentences explaining the verdict)
|
||||
**理由:** (用 1-2 句话解释裁决)
|
||||
```
|
||||
|
||||
## 设计原理
|
||||
|
||||
@@ -31,34 +31,34 @@
|
||||
**调用语法**:
|
||||
|
||||
```
|
||||
# New session call
|
||||
# 新会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend codex - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(若未增强则为 $ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文与分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: false,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
|
||||
# Resume session call
|
||||
# 恢复会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend codex resume <SESSION_ID> - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(若未增强则为 $ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文与分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: false,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ $ARGUMENTS
|
||||
**调用语法**(并行:使用 `run_in_background: true`):
|
||||
|
||||
```
|
||||
# Resume session call (recommended) - Implementation Prototype
|
||||
# 恢复会话调用(推荐)- 实现原型
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> {{GEMINI_MODEL_FLAG}}resume <SESSION_ID> - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
@@ -33,10 +33,10 @@ OUTPUT: Unified Diff Patch ONLY. Strictly prohibit any actual modifications.
|
||||
EOF",
|
||||
run_in_background: true,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
|
||||
# New session call - Implementation Prototype
|
||||
# 新建会话调用 - 实现原型
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> {{GEMINI_MODEL_FLAG}}- \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
@@ -48,7 +48,7 @@ OUTPUT: Unified Diff Patch ONLY. Strictly prohibit any actual modifications.
|
||||
EOF",
|
||||
run_in_background: true,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
```
|
||||
|
||||
@@ -59,21 +59,21 @@ Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> {{GEMINI_MODEL_FLAG}}resume <SESSION_ID> - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
<TASK>
|
||||
Scope: Audit the final code changes.
|
||||
Scope: 审计最终的代码变更。
|
||||
Inputs:
|
||||
- The applied patch (git diff / final unified diff)
|
||||
- The touched files (relevant excerpts if needed)
|
||||
- 已应用的补丁 (git diff / final unified diff)
|
||||
- 涉及的文件 (必要时提供相关摘录)
|
||||
Constraints:
|
||||
- Do NOT modify any files.
|
||||
- Do NOT output tool commands that assume filesystem access.
|
||||
- 请勿修改任何文件。
|
||||
- 请勿输出假设有文件系统访问权限的工具命令。
|
||||
</TASK>
|
||||
OUTPUT:
|
||||
1) A prioritized list of issues (severity, file, rationale)
|
||||
2) Concrete fixes; if code changes are needed, include a Unified Diff Patch in a fenced code block.
|
||||
1) 一个按优先级排序的问题列表 (严重程度, 文件, 理由)
|
||||
2) 具体的修复方案;如果需要更改代码,请包含在一个用围栏代码块包裹的 Unified Diff Patch 中。
|
||||
EOF",
|
||||
run_in_background: true,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
```
|
||||
|
||||
@@ -144,7 +144,7 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
|
||||
|
||||
```
|
||||
mcp__ace-tool__search_context({
|
||||
query: "<semantic query based on plan content, including key files, modules, function names>",
|
||||
query: "<基于计划内容的语义查询,包括关键文件、模块、函数名>",
|
||||
project_root_path: "$PWD"
|
||||
})
|
||||
```
|
||||
|
||||
@@ -31,34 +31,34 @@
|
||||
**调用语法**:
|
||||
|
||||
```
|
||||
# New session call
|
||||
# 新会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend gemini --gemini-model gemini-3-pro-preview - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示文件路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(若未增强则为$ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文与分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: false,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
|
||||
# Resume session call
|
||||
# 恢复会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend gemini --gemini-model gemini-3-pro-preview resume <SESSION_ID> - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示文件路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(若未增强则为$ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文与分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: false,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ mcp__ace-tool__enhance_prompt({
|
||||
|
||||
```
|
||||
mcp__ace-tool__search_context({
|
||||
query: "<semantic query based on enhanced requirement>",
|
||||
query: "<基于增强需求的语义查询>",
|
||||
project_root_path: "$PWD"
|
||||
})
|
||||
```
|
||||
|
||||
@@ -35,34 +35,34 @@
|
||||
**调用语法**(并行:`run_in_background: true`,串行:`false`):
|
||||
|
||||
```
|
||||
# New session call
|
||||
# 新会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> {{GEMINI_MODEL_FLAG}}- \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示文件路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(如未增强则为$ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文和分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: true,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
|
||||
# Resume session call
|
||||
# 恢复会话调用
|
||||
Bash({
|
||||
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--backend <codex|gemini> {{GEMINI_MODEL_FLAG}}resume <SESSION_ID> - \"$PWD\" <<'EOF'
|
||||
ROLE_FILE: <role prompt path>
|
||||
ROLE_FILE: <角色提示文件路径>
|
||||
<TASK>
|
||||
Requirement: <enhanced requirement (or $ARGUMENTS if not enhanced)>
|
||||
Context: <project context and analysis from previous phases>
|
||||
需求: <增强后的需求(如未增强则为$ARGUMENTS)>
|
||||
上下文: <来自先前阶段的项目上下文和分析>
|
||||
</TASK>
|
||||
OUTPUT: Expected output format
|
||||
OUTPUT: 期望的输出格式
|
||||
EOF",
|
||||
run_in_background: true,
|
||||
timeout: 3600000,
|
||||
description: "Brief description"
|
||||
description: "简要描述"
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ description: 针对多智能体工作流程的顺序和tmux/worktree编排指南
|
||||
完整功能实现工作流:
|
||||
|
||||
```
|
||||
planner -> tdd-guide -> code-reviewer -> security-reviewer
|
||||
规划者 -> 测试驱动开发指南 -> 代码审查员 -> 安全审查员
|
||||
```
|
||||
|
||||
### bugfix
|
||||
@@ -33,7 +33,7 @@ planner -> tdd-guide -> code-reviewer
|
||||
安全重构工作流:
|
||||
|
||||
```
|
||||
architect -> code-reviewer -> tdd-guide
|
||||
架构师 -> 代码审查员 -> 测试驱动开发指南
|
||||
```
|
||||
|
||||
### security
|
||||
@@ -112,38 +112,38 @@ security-reviewer -> code-reviewer -> architect
|
||||
## 最终报告格式
|
||||
|
||||
```
|
||||
ORCHESTRATION REPORT
|
||||
编排报告
|
||||
====================
|
||||
Workflow: feature
|
||||
Task: Add user authentication
|
||||
Agents: planner -> tdd-guide -> code-reviewer -> security-reviewer
|
||||
工作流:功能
|
||||
任务:添加用户认证
|
||||
智能体:规划者 -> TDD指南 -> 代码审查员 -> 安全审查员
|
||||
|
||||
SUMMARY
|
||||
概要
|
||||
-------
|
||||
[One paragraph summary]
|
||||
[一段总结]
|
||||
|
||||
AGENT OUTPUTS
|
||||
智能体输出
|
||||
-------------
|
||||
Planner: [summary]
|
||||
TDD Guide: [summary]
|
||||
Code Reviewer: [summary]
|
||||
Security Reviewer: [summary]
|
||||
规划者:[总结]
|
||||
TDD指南:[总结]
|
||||
代码审查员:[总结]
|
||||
安全审查员:[总结]
|
||||
|
||||
FILES CHANGED
|
||||
已更改文件
|
||||
-------------
|
||||
[List all files modified]
|
||||
[列出所有修改的文件]
|
||||
|
||||
TEST RESULTS
|
||||
测试结果
|
||||
------------
|
||||
[Test pass/fail summary]
|
||||
[测试通过/失败总结]
|
||||
|
||||
SECURITY STATUS
|
||||
安全状态
|
||||
---------------
|
||||
[Security findings]
|
||||
[安全发现]
|
||||
|
||||
RECOMMENDATION
|
||||
建议
|
||||
--------------
|
||||
[SHIP / NEEDS WORK / BLOCKED]
|
||||
[可发布 / 需要改进 / 已阻止]
|
||||
```
|
||||
|
||||
## 并行执行
|
||||
@@ -230,7 +230,7 @@ $ARGUMENTS:
|
||||
## 自定义工作流示例
|
||||
|
||||
```
|
||||
/orchestrate custom "architect,tdd-guide,code-reviewer" "Redesign caching layer"
|
||||
/orchestrate 自定义 "architect,tdd-guide,code-reviewer" "重新设计缓存层"
|
||||
```
|
||||
|
||||
## 提示
|
||||
|
||||
@@ -37,59 +37,59 @@ planner 代理将:
|
||||
## 使用示例
|
||||
|
||||
```
|
||||
User: /plan I need to add real-time notifications when markets resolve
|
||||
User: /plan 我需要为市场结算时添加实时通知功能
|
||||
|
||||
Agent (planner):
|
||||
# Implementation Plan: Real-Time Market Resolution Notifications
|
||||
# 实施计划:实时市场结算通知
|
||||
|
||||
## Requirements Restatement
|
||||
- Send notifications to users when markets they're watching resolve
|
||||
- Support multiple notification channels (in-app, email, webhook)
|
||||
- Ensure notifications are delivered reliably
|
||||
- Include market outcome and user's position result
|
||||
## 需求重述
|
||||
- 当用户关注的市场结算时,向用户发送通知
|
||||
- 支持多种通知渠道(应用内、电子邮件、Webhook)
|
||||
- 确保通知可靠送达
|
||||
- 包含市场结果和用户持仓结果
|
||||
|
||||
## Implementation Phases
|
||||
## 实施阶段
|
||||
|
||||
### Phase 1: Database Schema
|
||||
- Add notifications table with columns: id, user_id, market_id, type, status, created_at
|
||||
- Add user_notification_preferences table for channel preferences
|
||||
- Create indexes on user_id and market_id for performance
|
||||
### 第一阶段:数据库架构
|
||||
- 添加 notifications 表,包含列:id, user_id, market_id, type, status, created_at
|
||||
- 添加 user_notification_preferences 表用于存储渠道偏好设置
|
||||
- 在 user_id 和 market_id 上创建索引以提升性能
|
||||
|
||||
### Phase 2: Notification Service
|
||||
- Create notification service in lib/notifications.ts
|
||||
- Implement notification queue using BullMQ/Redis
|
||||
- Add retry logic for failed deliveries
|
||||
- Create notification templates
|
||||
### 第二阶段:通知服务
|
||||
- 在 lib/notifications.ts 中创建通知服务
|
||||
- 使用 BullMQ/Redis 实现通知队列
|
||||
- 为发送失败的情况添加重试逻辑
|
||||
- 创建通知模板
|
||||
|
||||
### Phase 3: Integration Points
|
||||
- Hook into market resolution logic (when status changes to "resolved")
|
||||
- Query all users with positions in market
|
||||
- Enqueue notifications for each user
|
||||
### 第三阶段:集成点
|
||||
- 接入市场结算逻辑(当状态变为 "resolved" 时)
|
||||
- 查询在市场中有持仓的所有用户
|
||||
- 为每个用户将通知加入队列
|
||||
|
||||
### Phase 4: Frontend Components
|
||||
- Create NotificationBell component in header
|
||||
- Add NotificationList modal
|
||||
- Implement real-time updates via Supabase subscriptions
|
||||
- Add notification preferences page
|
||||
### 第四阶段:前端组件
|
||||
- 在头部创建 NotificationBell 组件
|
||||
- 添加 NotificationList 模态框
|
||||
- 通过 Supabase 订阅实现实时更新
|
||||
- 添加通知偏好设置页面
|
||||
|
||||
## Dependencies
|
||||
- Redis (for queue)
|
||||
- Email service (SendGrid/Resend)
|
||||
- Supabase real-time subscriptions
|
||||
## 依赖项
|
||||
- Redis(用于队列)
|
||||
- 电子邮件服务(SendGrid/Resend)
|
||||
- Supabase 实时订阅
|
||||
|
||||
## Risks
|
||||
- HIGH: Email deliverability (SPF/DKIM required)
|
||||
- MEDIUM: Performance with 1000+ users per market
|
||||
- MEDIUM: Notification spam if markets resolve frequently
|
||||
- LOW: Real-time subscription overhead
|
||||
## 风险
|
||||
- 高:电子邮件送达率(需要配置 SPF/DKIM)
|
||||
- 中:市场用户超过 1000+ 时的性能问题
|
||||
- 中:市场频繁结算可能导致通知泛滥
|
||||
- 低:实时订阅开销
|
||||
|
||||
## Estimated Complexity: MEDIUM
|
||||
- Backend: 4-6 hours
|
||||
- Frontend: 3-4 hours
|
||||
- Testing: 2-3 hours
|
||||
- Total: 9-13 hours
|
||||
## 预估复杂度:中
|
||||
- 后端:4-6 小时
|
||||
- 前端:3-4 小时
|
||||
- 测试:2-3 小时
|
||||
- 总计:9-13 小时
|
||||
|
||||
**WAITING FOR CONFIRMATION**: Proceed with this plan? (yes/no/modify)
|
||||
**等待确认**:是否按此计划进行?(是/否/修改)
|
||||
```
|
||||
|
||||
## 重要说明
|
||||
|
||||
@@ -34,21 +34,21 @@
|
||||
|
||||
```
|
||||
project/
|
||||
├── ecosystem.config.cjs # PM2 config
|
||||
├── {backend}/start.cjs # Python wrapper (if applicable)
|
||||
├── ecosystem.config.cjs # PM2 配置文件
|
||||
├── {backend}/start.cjs # Python 包装器(如适用)
|
||||
└── .claude/
|
||||
├── commands/
|
||||
│ ├── pm2-all.md # Start all + monit
|
||||
│ ├── pm2-all-stop.md # Stop all
|
||||
│ ├── pm2-all-restart.md # Restart all
|
||||
│ ├── pm2-{port}.md # Start single + logs
|
||||
│ ├── pm2-{port}-stop.md # Stop single
|
||||
│ ├── pm2-{port}-restart.md # Restart single
|
||||
│ ├── pm2-logs.md # View all logs
|
||||
│ └── pm2-status.md # View status
|
||||
│ ├── pm2-all.md # 启动所有 + 监控
|
||||
│ ├── pm2-all-stop.md # 停止所有
|
||||
│ ├── pm2-all-restart.md # 重启所有
|
||||
│ ├── pm2-{port}.md # 启动单个 + 日志
|
||||
│ ├── pm2-{port}-stop.md # 停止单个
|
||||
│ ├── pm2-{port}-restart.md # 重启单个
|
||||
│ ├── pm2-logs.md # 查看所有日志
|
||||
│ └── pm2-status.md # 查看状态
|
||||
└── scripts/
|
||||
├── pm2-logs-{port}.ps1 # Single service logs
|
||||
└── pm2-monit.ps1 # PM2 monitor
|
||||
├── pm2-logs-{port}.ps1 # 单个服务日志
|
||||
└── pm2-monit.ps1 # PM2 监控器
|
||||
```
|
||||
|
||||
***
|
||||
@@ -255,29 +255,29 @@ pm2 resurrect # Restore saved list
|
||||
所有文件生成后,输出:
|
||||
|
||||
```
|
||||
## PM2 Init Complete
|
||||
## PM2 初始化完成
|
||||
|
||||
**Services:**
|
||||
**服务列表:**
|
||||
|
||||
| Port | Name | Type |
|
||||
| 端口 | 名称 | 类型 |
|
||||
|------|------|------|
|
||||
| {port} | {name} | {type} |
|
||||
|
||||
**Claude Commands:** /pm2-all, /pm2-all-stop, /pm2-{port}, /pm2-{port}-stop, /pm2-logs, /pm2-status
|
||||
**Claude 指令:** /pm2-all, /pm2-all-stop, /pm2-{port}, /pm2-{port}-stop, /pm2-logs, /pm2-status
|
||||
|
||||
**Terminal Commands:**
|
||||
## First time (with config file)
|
||||
**终端命令:**
|
||||
## 首次运行(使用配置文件)
|
||||
pm2 start ecosystem.config.cjs && pm2 save
|
||||
|
||||
## After first time (simplified)
|
||||
pm2 start all # Start all
|
||||
pm2 stop all # Stop all
|
||||
pm2 restart all # Restart all
|
||||
pm2 start {name} # Start single
|
||||
pm2 stop {name} # Stop single
|
||||
pm2 logs # View logs
|
||||
pm2 monit # Monitor panel
|
||||
pm2 resurrect # Restore saved processes
|
||||
## 首次之后(简化命令)
|
||||
pm2 start all # 启动全部
|
||||
pm2 stop all # 停止全部
|
||||
pm2 restart all # 重启全部
|
||||
pm2 start {name} # 启动单个
|
||||
pm2 stop {name} # 停止单个
|
||||
pm2 logs # 查看日志
|
||||
pm2 monit # 监控面板
|
||||
pm2 resurrect # 恢复已保存进程
|
||||
|
||||
**Tip:** Run `pm2 save` after first start to enable simplified commands.
|
||||
**提示:** 首次启动后运行 `pm2 save` 以启用简化命令。
|
||||
```
|
||||
|
||||
@@ -178,54 +178,53 @@ with open("config.json") as f: # Good
|
||||
运行:`black app/routes/user.py app/services/auth.py`
|
||||
|
||||
````
|
||||
## 审批标准
|
||||
|
||||
## Approval Criteria
|
||||
|
||||
| Status | Condition |
|
||||
| 状态 | 条件 |
|
||||
|--------|-----------|
|
||||
| ✅ Approve | No CRITICAL or HIGH issues |
|
||||
| ⚠️ Warning | Only MEDIUM issues (merge with caution) |
|
||||
| ❌ Block | CRITICAL or HIGH issues found |
|
||||
| ✅ 批准 | 无 CRITICAL 或 HIGH 级别问题 |
|
||||
| ⚠️ 警告 | 仅存在 MEDIUM 级别问题(谨慎合并) |
|
||||
| ❌ 阻止 | 发现 CRITICAL 或 HIGH 级别问题 |
|
||||
|
||||
## Integration with Other Commands
|
||||
## 与其他命令的集成
|
||||
|
||||
- Use `/tdd` first to ensure tests pass
|
||||
- Use `/code-review` for non-Python specific concerns
|
||||
- Use `/python-review` before committing
|
||||
- Use `/build-fix` if static analysis tools fail
|
||||
- 首先使用 `/tdd` 确保测试通过
|
||||
- 使用 `/code-review` 处理非 Python 特定问题
|
||||
- 在提交前使用 `/python-review`
|
||||
- 如果静态分析工具失败,请使用 `/build-fix`
|
||||
|
||||
## Framework-Specific Reviews
|
||||
## 框架特定审查
|
||||
|
||||
### Django Projects
|
||||
The reviewer checks for:
|
||||
- N+1 query issues (use `select_related` and `prefetch_related`)
|
||||
- Missing migrations for model changes
|
||||
- Raw SQL usage when ORM could work
|
||||
- Missing `transaction.atomic()` for multi-step operations
|
||||
### Django 项目
|
||||
审查员检查:
|
||||
- N+1 查询问题(使用 `select_related` 和 `prefetch_related`)
|
||||
- 模型更改缺少迁移
|
||||
- 在 ORM 可用时使用原始 SQL
|
||||
- 多步骤操作缺少 `transaction.atomic()`
|
||||
|
||||
### FastAPI Projects
|
||||
The reviewer checks for:
|
||||
- CORS misconfiguration
|
||||
- Pydantic models for request validation
|
||||
- Response models correctness
|
||||
- Proper async/await usage
|
||||
- Dependency injection patterns
|
||||
### FastAPI 项目
|
||||
审查员检查:
|
||||
- CORS 配置错误
|
||||
- 用于请求验证的 Pydantic 模型
|
||||
- 响应模型的正确性
|
||||
- 正确的 async/await 使用
|
||||
- 依赖注入模式
|
||||
|
||||
### Flask Projects
|
||||
The reviewer checks for:
|
||||
- Context management (app context, request context)
|
||||
- Proper error handling
|
||||
- Blueprint organization
|
||||
- Configuration management
|
||||
### Flask 项目
|
||||
审查员检查:
|
||||
- 上下文管理(应用上下文、请求上下文)
|
||||
- 正确的错误处理
|
||||
- Blueprint 组织
|
||||
- 配置管理
|
||||
|
||||
## Related
|
||||
## 相关
|
||||
|
||||
- Agent: `agents/python-reviewer.md`
|
||||
- Skills: `skills/python-patterns/`, `skills/python-testing/`
|
||||
|
||||
## Common Fixes
|
||||
## 常见修复
|
||||
|
||||
### Add Type Hints
|
||||
### 添加类型提示
|
||||
```python
|
||||
# Before
|
||||
def calculate(x, y):
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
如果没有可用工具,使用 Grep 查找零次导入的导出:
|
||||
|
||||
```
|
||||
# Find exports, then check if they're imported anywhere
|
||||
# 查找导出项,然后检查是否有任何地方导入了它们
|
||||
```
|
||||
|
||||
## 步骤 2:分类发现结果
|
||||
@@ -64,15 +64,15 @@
|
||||
报告结果:
|
||||
|
||||
```
|
||||
Dead Code Cleanup
|
||||
无用代码清理
|
||||
──────────────────────────────
|
||||
Deleted: 12 unused functions
|
||||
3 unused files
|
||||
5 unused dependencies
|
||||
Skipped: 2 items (tests failed)
|
||||
Saved: ~450 lines removed
|
||||
已删除: 12 个未使用函数
|
||||
3 个未使用文件
|
||||
5 个未使用依赖项
|
||||
已跳过: 2 个项目(测试失败)
|
||||
已节省: ~450 行代码被移除
|
||||
──────────────────────────────
|
||||
All tests passing ✅
|
||||
所有测试通过 ✅
|
||||
```
|
||||
|
||||
## 规则
|
||||
|
||||
@@ -17,10 +17,10 @@ description: 从 ~/.claude/sessions/ 加载最新的会话文件,并从上次
|
||||
## 用法
|
||||
|
||||
```
|
||||
/resume-session # loads most recent file in ~/.claude/sessions/
|
||||
/resume-session 2024-01-15 # loads most recent session for that date
|
||||
/resume-session ~/.claude/sessions/2024-01-15-session.tmp # loads a specific legacy-format file
|
||||
/resume-session ~/.claude/sessions/2024-01-15-abc123de-session.tmp # loads a current short-id session file
|
||||
/resume-session # 加载 ~/.claude/sessions/ 目录下最新的文件
|
||||
/resume-session 2024-01-15 # 加载该日期最新的会话
|
||||
/resume-session ~/.claude/sessions/2024-01-15-session.tmp # 加载特定的旧格式文件
|
||||
/resume-session ~/.claude/sessions/2024-01-15-abc123de-session.tmp # 加载当前短ID格式的会话文件
|
||||
```
|
||||
|
||||
## 流程
|
||||
@@ -55,31 +55,31 @@ description: 从 ~/.claude/sessions/ 加载最新的会话文件,并从上次
|
||||
使用以下确切格式回复一份结构化简报:
|
||||
|
||||
```
|
||||
SESSION LOADED: [actual resolved path to the file]
|
||||
会话已加载:[文件的实际解析路径]
|
||||
════════════════════════════════════════════════
|
||||
|
||||
PROJECT: [project name / topic from file]
|
||||
项目:[文件中的项目名称/主题]
|
||||
|
||||
WHAT WE'RE BUILDING:
|
||||
[2-3 sentence summary in your own words]
|
||||
我们正在构建什么:
|
||||
[用你自己的话总结 2-3 句话]
|
||||
|
||||
CURRENT STATE:
|
||||
✅ Working: [count] items confirmed
|
||||
🔄 In Progress: [list files that are in progress]
|
||||
🗒️ Not Started: [list planned but untouched]
|
||||
当前状态:
|
||||
✅ 已完成:[数量] 项已确认
|
||||
🔄 进行中:[列出进行中的文件]
|
||||
🗒️ 未开始:[列出计划但未开始的文件]
|
||||
|
||||
WHAT NOT TO RETRY:
|
||||
[list every failed approach with its reason — this is critical]
|
||||
不应重试的内容:
|
||||
[列出每个失败的方法及其原因——此部分至关重要]
|
||||
|
||||
OPEN QUESTIONS / BLOCKERS:
|
||||
[list any blockers or unanswered questions]
|
||||
待解决问题/阻碍:
|
||||
[列出任何阻碍或未解答的问题]
|
||||
|
||||
NEXT STEP:
|
||||
[exact next step if defined in the file]
|
||||
[if not defined: "No next step defined — recommend reviewing 'What Has NOT Been Tried Yet' together before starting"]
|
||||
下一步:
|
||||
[如果文件中已定义,则列出确切下一步]
|
||||
[如果未定义:"未定义下一步——建议在开始前共同回顾'尚未尝试的方法'"]
|
||||
|
||||
════════════════════════════════════════════════
|
||||
Ready to continue. What would you like to do?
|
||||
准备就绪。您希望做什么?
|
||||
```
|
||||
|
||||
### 步骤 4:等待用户
|
||||
@@ -117,32 +117,31 @@ Ready to continue. What would you like to do?
|
||||
SESSION LOADED: /Users/you/.claude/sessions/2024-01-15-abc123de-session.tmp
|
||||
════════════════════════════════════════════════
|
||||
|
||||
PROJECT: my-app — JWT Authentication
|
||||
项目:my-app — JWT 认证
|
||||
|
||||
WHAT WE'RE BUILDING:
|
||||
User authentication with JWT tokens stored in httpOnly cookies.
|
||||
Register and login endpoints are partially done. Route protection
|
||||
via middleware hasn't been started yet.
|
||||
构建目标:
|
||||
使用存储在 httpOnly cookie 中的 JWT 令牌实现用户认证。
|
||||
注册和登录端点已部分完成。通过中间件进行路由保护尚未开始。
|
||||
|
||||
CURRENT STATE:
|
||||
✅ Working: 3 items (register endpoint, JWT generation, password hashing)
|
||||
🔄 In Progress: app/api/auth/login/route.ts (token works, cookie not set yet)
|
||||
🗒️ Not Started: middleware.ts, app/login/page.tsx
|
||||
当前状态:
|
||||
✅ 已完成:3 项(注册端点、JWT 生成、密码哈希)
|
||||
🔄 进行中:app/api/auth/login/route.ts(令牌有效,但 cookie 尚未设置)
|
||||
🗒️ 未开始:middleware.ts、app/login/page.tsx
|
||||
|
||||
WHAT NOT TO RETRY:
|
||||
❌ Next-Auth — conflicts with custom Prisma adapter, threw adapter error on every request
|
||||
❌ localStorage for JWT — causes SSR hydration mismatch, incompatible with Next.js
|
||||
需避免的事项:
|
||||
❌ Next-Auth — 与自定义 Prisma 适配器冲突,每次请求均抛出适配器错误
|
||||
❌ localStorage 存储 JWT — 导致 SSR 水合不匹配,与 Next.js 不兼容
|
||||
|
||||
OPEN QUESTIONS / BLOCKERS:
|
||||
- Does cookies().set() work inside a Route Handler or only Server Actions?
|
||||
待解决问题 / 阻碍:
|
||||
- cookies().set() 在路由处理器中是否有效,还是仅适用于服务器操作?
|
||||
|
||||
NEXT STEP:
|
||||
In app/api/auth/login/route.ts — set the JWT as an httpOnly cookie using
|
||||
下一步:
|
||||
在 app/api/auth/login/route.ts 中 — 使用以下方式将 JWT 设置为 httpOnly cookie:
|
||||
cookies().set('token', jwt, { httpOnly: true, secure: true, sameSite: 'strict' })
|
||||
then test with Postman for a Set-Cookie header in the response.
|
||||
随后使用 Postman 测试响应中是否包含 Set-Cookie 标头。
|
||||
|
||||
════════════════════════════════════════════════
|
||||
Ready to continue. What would you like to do?
|
||||
准备继续。您希望做什么?
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
@@ -28,10 +28,10 @@ description: 为Rust强制执行TDD工作流。先写测试,然后实现。使
|
||||
## TDD 循环
|
||||
|
||||
```
|
||||
RED -> Write failing test first
|
||||
GREEN -> Implement minimal code to pass
|
||||
REFACTOR -> Improve code, tests stay green
|
||||
REPEAT -> Next test case
|
||||
RED -> 先编写失败的测试
|
||||
GREEN -> 实现最小化代码以通过测试
|
||||
REFACTOR -> 改进代码,保持测试通过
|
||||
REPEAT -> 下一个测试用例
|
||||
```
|
||||
|
||||
## 示例会话
|
||||
|
||||
@@ -56,9 +56,9 @@ mkdir -p ~/.claude/sessions
|
||||
写入后,显示完整内容并询问:
|
||||
|
||||
```
|
||||
Session saved to [actual resolved path to the session file]
|
||||
会话已保存至 [实际解析的会话文件路径]
|
||||
|
||||
Does this look accurate? Anything to correct or add before we close?
|
||||
这看起来准确吗?在关闭之前,还有什么需要纠正或补充的吗?
|
||||
```
|
||||
|
||||
等待确认。如果用户要求,进行编辑。
|
||||
|
||||
@@ -138,24 +138,23 @@ src/
|
||||
└── services/ # API 和外部服务
|
||||
|
||||
```
|
||||
## 工作流
|
||||
|
||||
## Workflows
|
||||
### 添加新组件
|
||||
1. 创建 `src/components/ComponentName.tsx`
|
||||
2. 在 `src/components/__tests__/ComponentName.test.tsx` 中添加测试
|
||||
3. 从 `src/components/index.ts` 导出
|
||||
|
||||
### Adding a New Component
|
||||
1. Create `src/components/ComponentName.tsx`
|
||||
2. Add tests in `src/components/__tests__/ComponentName.test.tsx`
|
||||
3. Export from `src/components/index.ts`
|
||||
### 数据库迁移
|
||||
1. 修改 `src/db/schema.ts`
|
||||
2. 运行 `pnpm db:generate`
|
||||
3. 运行 `pnpm db:migrate`
|
||||
|
||||
### Database Migration
|
||||
1. Modify `src/db/schema.ts`
|
||||
2. Run `pnpm db:generate`
|
||||
3. Run `pnpm db:migrate`
|
||||
## 测试模式
|
||||
|
||||
## Testing Patterns
|
||||
|
||||
- Test files: `__tests__/` directories or `.test.ts` suffix
|
||||
- Coverage target: 80%+
|
||||
- Framework: Vitest
|
||||
- 测试文件:`__tests__/` 目录或 `.test.ts` 后缀
|
||||
- 覆盖率目标:80%+
|
||||
- 框架:Vitest
|
||||
```
|
||||
|
||||
## GitHub 应用集成
|
||||
|
||||
@@ -34,9 +34,9 @@ node "$ECC_ROOT/scripts/skills-health.js" --dashboard --json
|
||||
## 使用方法
|
||||
|
||||
```
|
||||
/skill-health # Full dashboard view
|
||||
/skill-health --panel failures # Only failure clustering panel
|
||||
/skill-health --json # Machine-readable JSON output
|
||||
/skill-health # 完整仪表盘视图
|
||||
/skill-health --panel failures # 仅故障聚类面板
|
||||
/skill-health --json # 机器可读的 JSON 输出
|
||||
```
|
||||
|
||||
## 操作步骤
|
||||
|
||||
@@ -41,10 +41,10 @@ tdd-guide 代理将:
|
||||
```
|
||||
RED → GREEN → REFACTOR → REPEAT
|
||||
|
||||
RED: Write a failing test
|
||||
GREEN: Write minimal code to pass
|
||||
REFACTOR: Improve code, keep tests passing
|
||||
REPEAT: Next feature/scenario
|
||||
RED: 编写一个失败测试
|
||||
GREEN: 编写通过测试的最简代码
|
||||
REFACTOR: 改进代码,保持测试通过
|
||||
REPEAT: 开始下一个功能/场景
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
@@ -254,79 +254,77 @@ Coverage: 100% ✅ (Target: 80%)
|
||||
✅ TDD 会话完成!
|
||||
|
||||
```
|
||||
## TDD 最佳实践
|
||||
|
||||
## TDD Best Practices
|
||||
**应做:**
|
||||
- ✅ 先写测试,再写实现
|
||||
- ✅ 运行测试并确认失败,再实现功能
|
||||
- ✅ 编写最少代码使测试通过
|
||||
- ✅ 仅在测试通过后进行重构
|
||||
- ✅ 添加边界情况和错误场景
|
||||
- ✅ 目标覆盖率 80% 以上(关键代码 100%)
|
||||
|
||||
**DO:**
|
||||
- ✅ Write the test FIRST, before any implementation
|
||||
- ✅ Run tests and verify they FAIL before implementing
|
||||
- ✅ Write minimal code to make tests pass
|
||||
- ✅ Refactor only after tests are green
|
||||
- ✅ Add edge cases and error scenarios
|
||||
- ✅ Aim for 80%+ coverage (100% for critical code)
|
||||
**不应做:**
|
||||
- ❌ 先写实现再写测试
|
||||
- ❌ 每次更改后跳过运行测试
|
||||
- ❌ 一次性编写过多代码
|
||||
- ❌ 忽略失败的测试
|
||||
- ❌ 测试实现细节(应测试行为)
|
||||
- ❌ 过度模拟(优先使用集成测试)
|
||||
|
||||
**DON'T:**
|
||||
- ❌ Write implementation before tests
|
||||
- ❌ Skip running tests after each change
|
||||
- ❌ Write too much code at once
|
||||
- ❌ Ignore failing tests
|
||||
- ❌ Test implementation details (test behavior)
|
||||
- ❌ Mock everything (prefer integration tests)
|
||||
## 应包含的测试类型
|
||||
|
||||
## Test Types to Include
|
||||
**单元测试**(函数级别):
|
||||
- 正常路径场景
|
||||
- 边界情况(空值、null、最大值)
|
||||
- 错误条件
|
||||
- 边界值
|
||||
|
||||
**Unit Tests** (Function-level):
|
||||
- Happy path scenarios
|
||||
- Edge cases (empty, null, max values)
|
||||
- Error conditions
|
||||
- Boundary values
|
||||
**集成测试**(组件级别):
|
||||
- API 端点
|
||||
- 数据库操作
|
||||
- 外部服务调用
|
||||
- 包含钩子的 React 组件
|
||||
|
||||
**Integration Tests** (Component-level):
|
||||
- API endpoints
|
||||
- Database operations
|
||||
- External service calls
|
||||
- React components with hooks
|
||||
**端到端测试**(使用 `/e2e` 命令):
|
||||
- 关键用户流程
|
||||
- 多步骤流程
|
||||
- 全栈集成
|
||||
|
||||
**E2E Tests** (use `/e2e` command):
|
||||
- Critical user flows
|
||||
- Multi-step processes
|
||||
- Full stack integration
|
||||
## 覆盖率要求
|
||||
|
||||
## Coverage Requirements
|
||||
- 所有代码**最低 80%**
|
||||
- **必须达到 100%** 的代码:
|
||||
- 财务计算
|
||||
- 认证逻辑
|
||||
- 安全关键代码
|
||||
- 核心业务逻辑
|
||||
|
||||
- **80% minimum** for all code
|
||||
- **100% required** for:
|
||||
- Financial calculations
|
||||
- Authentication logic
|
||||
- Security-critical code
|
||||
- Core business logic
|
||||
## 重要说明
|
||||
|
||||
## Important Notes
|
||||
**强制要求**:测试必须在实现之前编写。TDD 循环是:
|
||||
|
||||
**MANDATORY**: Tests must be written BEFORE implementation. The TDD cycle is:
|
||||
1. **红** - 编写失败的测试
|
||||
2. **绿** - 实现功能使测试通过
|
||||
3. **重构** - 改进代码
|
||||
|
||||
1. **RED** - Write failing test
|
||||
2. **GREEN** - Implement to pass
|
||||
3. **REFACTOR** - Improve code
|
||||
切勿跳过红阶段。切勿在测试之前编写代码。
|
||||
|
||||
Never skip the RED phase. Never write code before tests.
|
||||
## 与其他命令的集成
|
||||
|
||||
## Integration with Other Commands
|
||||
- 首先使用 `/plan` 来了解要构建什么
|
||||
- 使用 `/tdd` 进行带测试的实现
|
||||
- 如果出现构建错误,请使用 `/build-fix`
|
||||
- 使用 `/code-review` 审查实现
|
||||
- 使用 `/test-coverage` 验证覆盖率
|
||||
|
||||
- Use `/plan` first to understand what to build
|
||||
- Use `/tdd` to implement with tests
|
||||
- Use `/build-fix` if build errors occur
|
||||
- Use `/code-review` to review implementation
|
||||
- Use `/test-coverage` to verify coverage
|
||||
## 相关代理
|
||||
|
||||
## Related Agents
|
||||
此命令调用由 ECC 提供的 `tdd-guide` 代理。
|
||||
|
||||
This command invokes the `tdd-guide` agent provided by ECC.
|
||||
相关的 `tdd-workflow` 技能也随 ECC 捆绑提供。
|
||||
|
||||
The related `tdd-workflow` skill is also bundled with ECC.
|
||||
|
||||
For manual installs, the source files live at:
|
||||
对于手动安装,源文件位于:
|
||||
- `agents/tdd-guide.md`
|
||||
- `skills/tdd-workflow/SKILL.md`
|
||||
|
||||
```
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
显示前后对比:
|
||||
|
||||
```
|
||||
Coverage Report
|
||||
覆盖率报告
|
||||
──────────────────────────────
|
||||
File Before After
|
||||
文件 变更前 变更后
|
||||
src/services/auth.ts 45% 88%
|
||||
src/utils/validation.ts 32% 82%
|
||||
──────────────────────────────
|
||||
Overall: 67% 84% ✅
|
||||
总计: 67% 84% ✅
|
||||
```
|
||||
|
||||
## 重点关注领域
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
## 步骤 7:显示摘要
|
||||
|
||||
```
|
||||
Documentation Update
|
||||
文档更新
|
||||
──────────────────────────────
|
||||
Updated: docs/CONTRIBUTING.md (scripts table)
|
||||
Updated: docs/ENV.md (3 new variables)
|
||||
Flagged: docs/DEPLOY.md (142 days stale)
|
||||
Skipped: docs/API.md (no changes detected)
|
||||
已更新:docs/CONTRIBUTING.md(脚本表格)
|
||||
已更新:docs/ENV.md(新增3个变量)
|
||||
已标记:docs/DEPLOY.md(142天未更新)
|
||||
已跳过:docs/API.md(未检测到变更)
|
||||
──────────────────────────────
|
||||
```
|
||||
|
||||
|
||||
@@ -36,16 +36,16 @@
|
||||
生成一份简洁的验证报告:
|
||||
|
||||
```
|
||||
VERIFICATION: [PASS/FAIL]
|
||||
验证: [通过/失败]
|
||||
|
||||
Build: [OK/FAIL]
|
||||
Types: [OK/X errors]
|
||||
Lint: [OK/X issues]
|
||||
Tests: [X/Y passed, Z% coverage]
|
||||
Secrets: [OK/X found]
|
||||
Logs: [OK/X console.logs]
|
||||
构建: [成功/失败]
|
||||
类型: [成功/X 错误]
|
||||
代码检查: [成功/X 问题]
|
||||
测试: [X/Y 通过,Z% 覆盖率]
|
||||
密钥检查: [成功/X 发现]
|
||||
日志: [成功/X console.logs]
|
||||
|
||||
Ready for PR: [YES/NO]
|
||||
准备提交 PR: [是/否]
|
||||
```
|
||||
|
||||
如果存在任何关键问题,列出它们并提供修复建议。
|
||||
|
||||
Reference in New Issue
Block a user