claude-reflect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClaude Reflect Skill
Claude Reflect Skill
Automated daily reflection analyzing git history across all workspace-hub submodules, extracting patterns via RAGS loop, and auto-creating skills from recurring patterns.
每日自动化复盘,分析workspace-hub所有子模块的Git历史,通过RAGS循环提取模式,并从重复模式中自动创建Skill。
Quick Start
快速开始
bash
undefinedbash
undefinedRun full RAGS loop manually
手动运行完整RAGS循环
/reflect
/reflect
Quick 7-day reflection
快速7天复盘
/reflect --days 7
/reflect --days 7
Preview patterns without creating skills
预览模式但不创建Skill
DRY_RUN=true /reflect
DRY_RUN=true /reflect
Force weekly report generation
强制生成周报
WEEKLY_REPORT=true /reflect
undefinedWEEKLY_REPORT=true /reflect
undefinedAutomated Execution
自动执行
Cron Schedule: Daily at 5:00 AM
- Runs full RAGS loop automatically
- Generates weekly reports on Sundays
- Auto-creates skills when pattern score >= 0.8
Cron调度: 每日凌晨5点
- 自动运行完整RAGS循环
- 周日自动生成周报
- 当模式评分≥0.8时自动创建Skill
When to Use
使用场景
- Automated: Runs daily via cron - no manual intervention needed
- Manual: Run to trigger immediate analysis
/reflect - Before planning new features to identify reusable patterns
- After major releases to capture learnings
- 自动执行:通过Cron每日运行,无需人工干预
- 手动触发:运行立即启动分析
/reflect - 规划新功能前,识别可复用模式
- 重大版本发布后,总结经验
Distinction from Similar Skills
与同类Skill的区别
| Skill | Trigger | Scope | Data Source |
|---|---|---|---|
| Post-commit | Single repo | Last commit |
| Auto/session | User interactions | Conversation |
| Manual/scheduled | All 26 repos | 30-day git history |
| Skill | 触发方式 | 范围 | 数据源 |
|---|---|---|---|
| 提交后触发 | 单一仓库 | 最后一次提交 |
| 自动/会话触发 | 用户交互 | 对话内容 |
| 手动/定时触发 | 全部26个仓库 | 30天Git历史 |
Prerequisites
前置条件
- Git access to all workspace-hub submodules
- directory for state persistence
~/.claude/state/ - directory for global patterns
~/.claude/memory/
- 拥有所有workspace-hub子模块的Git访问权限
- 用于状态持久化的目录
~/.claude/state/ - 用于存储全局模式的目录
~/.claude/memory/
Overview
概述
This skill analyzes git history across all 26+ workspace-hub submodules to extract development patterns and automatically enhance or create skills based on findings.
该Skill会分析所有26+个workspace-hub子模块的Git历史,提取开发模式,并基于分析结果自动优化或创建Skill。
Quick Reference
快速参考
Commands
命令
| Command | Description |
|---|---|
| Run reflection with default 30-day window |
| Quick 7-day reflection |
| Extended quarterly reflection |
| Single repository reflection |
| Preview patterns without creating skills |
| 命令 | 描述 |
|---|---|
| 使用默认30天窗口运行复盘 |
| 快速7天复盘 |
| 扩展季度复盘 |
| 单一仓库复盘 |
| 预览模式但不创建Skill |
Core Workflow: RAGS Loop
核心工作流:RAGS循环
1. REFLECT - Collect Git History
1. REFLECT - 收集Git历史
Enumerate and analyze git activity across all submodules:
bash
undefined枚举并分析所有子模块的Git活动:
bash
undefinedEnumerate submodules
枚举子模块
git submodule foreach --quiet 'echo $name'
git submodule foreach --quiet 'echo $name'
Extract 30-day commits per repo
提取每个仓库30天内的提交
git log --since="30 days ago" --pretty=format:"%H|%s|%an|%ad" --date=short
**Data Collected:**
- Commit hash, message, author, date
- Files changed per commit
- Diff summaries
- Commit frequency patternsgit log --since="30 days ago" --pretty=format:"%H|%s|%an|%ad" --date=short
**收集的数据:**
- 提交哈希、提交信息、作者、日期
- 每次提交变更的文件
- Diff摘要
- 提交频率模式2. ABSTRACT - Identify Patterns
2. ABSTRACT - 识别模式
Analyze collected data to identify recurring patterns:
Pattern Types:
- Code Patterns: Import conventions, code structures, techniques
- Workflow Patterns: TDD adoption, config-before-code, test-with-feature
- Commit Patterns: Message conventions, prefixes (feat, fix, chore)
- Correction Patterns: Fix commits, "actually" messages, immediate follow-ups
- Tool Patterns: Framework usage, library adoption, tooling preferences
Pattern Detection Heuristics:
- Frequency: Pattern appears in 3+ commits
- Consistency: Same pattern used by multiple authors
- Spread: Pattern appears across multiple repositories
分析收集的数据以识别重复出现的模式:
模式类型:
- 代码模式:导入规范、代码结构、技术实现
- 工作流模式:TDD实践、先配置后编码、随功能写测试
- 提交模式:提交信息规范、前缀(feat, fix, chore)
- 修正模式:修复提交、包含"actually"的提交信息、即时后续提交
- 工具模式:框架使用、库选型、工具偏好
模式检测规则:
- 频率:模式出现在3次以上提交中
- 一致性:多个作者使用相同模式
- 覆盖范围:模式出现在多个仓库中
3. GENERALIZE - Determine Scope
3. GENERALIZE - 确定范围
Categorize patterns by their applicability:
| Scope | Criteria | Storage Location |
|---|---|---|
| Global | 5+ repos | |
| Domain | 2-4 repos, same domain | |
| Project | Single repo | |
根据适用性对模式进行分类:
| 范围 | 判定标准 | 存储位置 |
|---|---|---|
| 全局 | 5个以上仓库使用 | |
| 领域 | 2-4个仓库使用,同属一个领域 | |
| 项目 | 单一仓库使用 | |
4. STORE - Persist and Act
4. STORE - 持久化并执行操作
Score patterns and take appropriate action:
Scoring Criteria:
- Frequency (0.0-1.0): How often the pattern appears
- Cross-repo Impact (0.0-1.0): How many repos use it
- Complexity (0.0-1.0): Pattern sophistication
- Time Savings (0.0-1.0): Estimated automation benefit
Weighted Score Calculation:
score = (frequency * 0.3) + (cross_repo * 0.3) + (complexity * 0.2) + (time_savings * 0.2)Actions by Score:
| Score Range | Action |
|---|---|
| >= 0.8 | Create new skill automatically |
| 0.6 - 0.79 | Enhance existing skill |
| < 0.6 | Log for future reference |
为模式评分并执行相应操作:
评分标准:
- 频率(0.0-1.0):模式出现的频次
- 跨仓库影响(0.0-1.0):使用该模式的仓库数量
- 复杂度(0.0-1.0):模式的复杂程度
- 时间节省(0.0-1.0):自动化带来的预估时间收益
加权分数计算:
score = (frequency * 0.3) + (cross_repo * 0.3) + (complexity * 0.2) + (time_savings * 0.2)分数对应的操作:
| 分数范围 | 操作 |
|---|---|
| >= 0.8 | 自动创建新Skill |
| 0.6 - 0.79 | 优化现有Skill |
| < 0.6 | 记录以便后续参考 |
State Management
状态管理
State File:
~/.claude/state/reflect-state.yamlyaml
version: "1.0"
last_run: 2026-01-21T10:30:00Z
analysis_window_days: 30
repos_analyzed: 26
patterns_extracted: 45
actions_taken:
skills_enhanced: 5
skills_created: 2
learnings_stored: 23
next_scheduled: 2026-02-21
history:
- date: 2026-01-21
patterns: 45
skills_created: 2
skills_enhanced: 5状态文件:
~/.claude/state/reflect-state.yamlyaml
version: "1.0"
last_run: 2026-01-21T10:30:00Z
analysis_window_days: 30
repos_analyzed: 26
patterns_extracted: 45
actions_taken:
skills_enhanced: 5
skills_created: 2
learnings_stored: 23
next_scheduled: 2026-02-21
history:
- date: 2026-01-21
patterns: 45
skills_created: 2
skills_enhanced: 5Pattern Output Format
模式输出格式
yaml
patterns:
- id: "pattern-001"
type: "workflow"
name: "TDD Test-First Pattern"
description: "Tests created before implementation"
evidence:
- repo: "aceengineer-admin"
commits: ["abc123", "def456"]
- repo: "digitalmodel"
commits: ["ghi789"]
frequency: 0.85
cross_repo_score: 0.9
complexity_score: 0.7
time_savings_score: 0.8
final_score: 0.83
recommended_action: "create_skill"yaml
patterns:
- id: "pattern-001"
type: "workflow"
name: "TDD测试先行模式"
description: "在实现功能前先编写测试"
evidence:
- repo: "aceengineer-admin"
commits: ["abc123", "def456"]
- repo: "digitalmodel"
commits: ["ghi789"]
frequency: 0.85
cross_repo_score: 0.9
complexity_score: 0.7
time_savings_score: 0.8
final_score: 0.83
recommended_action: "create_skill"Integration Points
集成点
With skill-learner
与skill-learner集成
- Shares pattern extraction logic
- Extended for multi-repo analysis
- Complementary triggers (post-commit vs periodic)
- 共享模式提取逻辑
- 扩展为多仓库分析
- 互补触发方式(提交后 vs 周期性)
With repo-sync
与repo-sync集成
- Uses parallel git operations
- Leverages submodule enumeration
- 使用并行Git操作
- 利用子模块枚举功能
With skill-creator
与skill-creator集成
- Invoked when score >= 0.8
- Passes pattern data for skill generation
- 当分数≥0.8时触发
- 传递模式数据用于Skill生成
State Files Updated
更新的状态文件
- : Reflection history
~/.claude/state/reflect-state.yaml - : Skill updates
~/.claude/state/skills-progress.yaml - : New skill entries
.claude/skill-registry.yaml
- :复盘历史
~/.claude/state/reflect-state.yaml - :Skill更新记录
~/.claude/state/skills-progress.yaml - :新Skill条目
.claude/skill-registry.yaml
Execution Checklist
执行检查清单
- Verify git access to all submodules ()
git submodule status - Ensure state directory exists ()
~/.claude/state/ - Run with first to preview patterns
--dry-run - Review extracted patterns before skill creation
- Verify created/enhanced skills work correctly
- Check state file for accurate tracking
- 验证所有子模块的Git访问权限()
git submodule status - 确保状态目录存在()
~/.claude/state/ - 先使用预览模式
--dry-run - 在创建Skill前检查提取的模式
- 验证创建/优化后的Skill可正常工作
- 检查状态文件的跟踪是否准确
Error Handling
错误处理
Submodule Access Issues
子模块访问问题
bash
undefinedbash
undefinedCheck submodule status
检查子模块状态
git submodule status
git submodule status
Update submodules
更新子模块
git submodule update --init --recursive
undefinedgit submodule update --init --recursive
undefinedEmpty History
无历史记录
If no commits found in window, reflection completes with warning:
Warning: No commits found in the last 30 days
Consider running with --days 90 for a larger window如果在指定窗口内未找到任何提交,复盘会带着警告完成:
Warning: No commits found in the last 30 days
Consider running with --days 90 for a larger windowPattern Scoring Issues
模式评分问题
If pattern scores seem incorrect:
- Check evidence commit counts
- Verify cross-repo detection
- Review pattern categorization
如果模式分数看起来不准确:
- 检查提交证据的数量
- 验证跨仓库检测结果
- 检查模式分类是否正确
Workflows
工作流
Weekly Reflection
每周复盘
bash
undefinedbash
undefinedQuick weekly review
快速每周回顾
/reflect --days 7
/reflect --days 7
Review patterns
查看模式
cat ~/.claude/state/reflect-state.yaml
undefinedcat ~/.claude/state/reflect-state.yaml
undefinedMonthly Deep Reflection
月度深度复盘
bash
undefinedbash
undefinedFull 30-day analysis
完整30天分析
/reflect
/reflect
Extended with skill creation
扩展分析并创建Skill
/reflect --days 30
undefined/reflect --days 30
undefinedQuarterly Review
季度回顾
bash
undefinedbash
undefinedExtended quarterly analysis
扩展季度分析
/reflect --days 90
/reflect --days 90
Review all created skills
查看所有创建的Skill
ls .claude/skills/
undefinedls .claude/skills/
undefinedMetrics & Success Criteria
指标与成功标准
- Analysis Coverage: 100% of active submodules analyzed
- Pattern Detection Rate: >= 5 patterns per reflection
- Skill Creation Quality: Created skills rated useful by user
- State Persistence: All runs tracked in state file
- Performance: Full reflection completes in < 10 minutes
- 分析覆盖率:100%活跃子模块被分析
- 模式检测率:每次复盘至少检测到5个模式
- Skill创建质量:创建的Skill被用户评为实用
- 状态持久化:所有运行记录都保存在状态文件中
- 性能:完整复盘在10分钟内完成
Best Practices
最佳实践
Run Frequency
运行频率
- Weekly: for quick insights
--days 7 - Monthly: Default 30-day for comprehensive analysis
- Quarterly: for strategic patterns
--days 90
- 每周:使用获取快速洞察
--days 7 - 每月:默认30天窗口进行全面分析
- 每季度:使用识别战略模式
--days 90
Pattern Review
模式审查
- Always use before creating skills
--dry-run - Review high-scoring patterns manually
- Verify cross-repo patterns are genuine
- 在创建Skill前始终使用
--dry-run - 手动审查高分模式
- 验证跨仓库模式是否真实有效
Skill Creation
Skill创建
- Check created skills compile/work
- Add examples from actual commits
- Link to source evidence
- 检查创建的Skill是否可编译/运行
- 添加来自实际提交的示例
- 链接到源证据
Scripts Architecture
脚本架构
The skill uses a modular pipeline of scripts:
daily-reflect.sh (orchestrator)
├── analyze-history.sh # REFLECT: Extract git commits
├── extract-patterns.sh # ABSTRACT: Identify patterns
├── analyze-trends.sh # GENERALIZE: Cross-day trends
├── create-skills.sh # STORE: Auto-create skills
└── generate-report.sh # Weekly digest reports该Skill使用模块化的脚本管道:
daily-reflect.sh (编排器)
├── analyze-history.sh # REFLECT: 提取Git提交
├── extract-patterns.sh # ABSTRACT: 识别模式
├── analyze-trends.sh # GENERALIZE: 跨时间趋势分析
├── create-skills.sh # STORE: 自动创建Skill
└── generate-report.sh # 每周摘要报告生成Script Details
脚本详情
| Script | Phase | Input | Output |
|---|---|---|---|
| REFLECT | Git repos | |
| ABSTRACT | Analysis JSON | |
| GENERALIZE | Multiple patterns | |
| STORE | Patterns | Skills + learnings |
| Report | All data | |
| 脚本 | 阶段 | 输入 | 输出 |
|---|---|---|---|
| REFLECT | Git仓库 | |
| ABSTRACT | 分析JSON文件 | |
| GENERALIZE | 多个模式文件 | |
| STORE | 模式文件 | Skill + 学习成果 |
| 报告生成 | 所有数据 | |
Output Locations
输出位置
~/.claude/state/
├── reflect-state.yaml # Current state
├── reflect-history/ # Raw analysis files
│ └── analysis_*.json
├── patterns/ # Extracted patterns
│ └── patterns_*.json
├── trends/ # Trend analysis
│ └── trends_*.json
└── reports/ # Weekly digests
└── weekly_digest_*.md
~/.claude/memory/patterns/
└── learnings.yaml # Low-score patterns for reference
.claude/skills/workspace-hub/auto-generated/
└── <skill-name>/ # Auto-created skills
└── SKILL.md~/.claude/state/
├── reflect-state.yaml # 当前状态
├── reflect-history/ # 原始分析文件
│ └── analysis_*.json
├── patterns/ # 提取的模式
│ └── patterns_*.json
├── trends/ # 趋势分析
│ └── trends_*.json
└── reports/ # 每周摘要
└── weekly_digest_*.md
~/.claude/memory/patterns/
└── learnings.yaml # 低分模式参考
.claude/skills/workspace-hub/auto-generated/
└── <skill-name>/ # 自动创建的Skill
└── SKILL.mdReferences
参考链接
- Skill Learner - Post-commit pattern extraction
- Repo Sync - Multi-repo operations
- Skill Creator - Skill generation
- Skill Learner - 提交后模式提取
- Repo Sync - 多仓库操作
- Skill Creator - Skill生成
Version History
版本历史
- 2.0.0 (2026-01-21): Full RAGS loop implementation
- Added pattern extraction engine ()
extract-patterns.sh - Added cross-daily trend analysis ()
analyze-trends.sh - Added actionable reports generator ()
generate-report.sh - Added auto-skill creation module ()
create-skills.sh - Updated to orchestrate all phases
daily-reflect.sh - Weekly reports auto-generated on Sundays
- Added pattern extraction engine (
- 1.0.0 (2026-01-21): Initial release with basic RAGS spec
- 2.0.0 (2026-01-21): 完整RAGS循环实现
- 新增模式提取引擎()
extract-patterns.sh - 新增跨时间趋势分析()
analyze-trends.sh - 新增可执行报告生成器()
generate-report.sh - 新增自动Skill创建模块()
create-skills.sh - 更新以编排所有阶段
daily-reflect.sh - 周日自动生成周报
- 新增模式提取引擎(
- 1.0.0 (2026-01-21): 初始版本,包含基础RAGS规范