compound-learnings by parcadei/continuous-claude-v3
npx skills add https://github.com/parcadei/continuous-claude-v3 --skill compound-learnings将短暂的会话学习转化为永久、可复合的能力。
# 列出学习成果(最近优先)
ls -t $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | head -20
# 统计总数
ls $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | wc -l
读取最近的 5-10 个文件(或指定日期范围)。
对于每个学习成果文件,从以下特定部分提取条目:
| 章节标题 | 提取内容 |
|---|---|
## Patterns 或 Reusable techniques | 规则的直接候选 |
**Takeaway:** 或 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
**Actionable takeaway:**| 决策启发式 |
## What Worked | 成功模式 |
## What Failed | 反模式(反转成规则) |
## Key Decisions | 设计原则 |
在处理过程中构建频率表:
| 模式 | 会话 | 类别 |
|---|---|---|
| "Check artifacts before editing" | abc, def, ghi | debugging |
| "Pass IDs explicitly" | abc, def, ghi, jkl | reliability |
在计数之前,合并表达相同原则的模式:
合并示例:
使用最通用的表述。更新频率表。
关键步骤: 观察学习成果围绕哪些主题聚集。
如果超过 50% 的模式与一个主题相关(例如,"hooks"、"tracing"、"async"): → 该主题可能需要一个专用技能,而不是多条规则 → 一个技能比五条规则更能实现复合效应
问自己:“是否存在一种技能,可以让所有这些规则变得不必要?”
对于每个模式,确定工件类型:
Is it a sequence of commands/steps?
→ YES → SKILL (executable > declarative)
→ NO ↓
Should it run automatically on an event (SessionEnd, PostToolUse, etc.)?
→ YES → HOOK (automatic > manual)
→ NO ↓
Is it "when X, do Y" or "never do X"?
→ YES → RULE
→ NO ↓
Does it enhance an existing agent workflow?
→ YES → AGENT UPDATE
→ NO → Skip (not worth capturing)
工件类型示例:
| 模式 | 类型 | 原因 |
|---|---|---|
| "Run linting before commit" | Hook (PreToolUse) | 自动门控 |
| "Extract learnings on session end" | Hook (SessionEnd) | 自动触发 |
| "Debug hooks step by step" | Skill | 手动序列 |
| "Always pass IDs explicitly" | Rule | 启发式 |
| 出现次数 | 操作 |
|---|---|
| 1 | 记录但跳过(除非是关键性失败) |
| 2 | 考虑 - 呈现给用户 |
| 3+ | 强信号 - 建议创建 |
| 4+ | 肯定创建 |
以以下格式呈现每个提案:
---
## Pattern: [Generalized Name]
**Signal:** [N] sessions ([list session IDs])
**Category:** [debugging / reliability / workflow / etc.]
**Artifact Type:** Rule / Skill / Agent Update
**Rationale:** [Why this artifact type, why worth creating]
**Draft Content:**
```markdown
[Actual content that would be written to file]
File: .claude/rules/[name].md or .claude/skills/[name]/SKILL.md
使用 `AskUserQuestion` 获取对每个工件(或批量)的批准。
### 步骤 7:创建已批准的工件
#### 对于规则:
```bash
# 写入规则目录
cat > $CLAUDE_PROJECT_DIR/.claude/rules/<name>.md << 'EOF'
# Rule Name
[Context: why this rule exists, based on N sessions]
## Pattern
[The reusable principle]
## DO
- [Concrete action]
## DON'T
- [Anti-pattern]
## Source Sessions
- [session-id-1]: [what happened]
- [session-id-2]: [what happened]
EOF
创建 .claude/skills/<name>/SKILL.md,包含:
如果合适,将触发器添加到 skill-rules.json。
创建 Shell 包装器 + TypeScript 处理器:
# Shell 包装器
cat > $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh << 'EOF'
#!/bin/bash
set -e
cd "$CLAUDE_PROJECT_DIR/.claude/hooks"
cat | node dist/<name>.mjs
EOF
chmod +x $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh
然后创建 src/<name>.ts,用 esbuild 构建,并在 settings.json 中注册:
{
"hooks": {
"EventName": [{
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh"
}]
}]
}
}
编辑 .claude/agents/<name>.md 中的现有代理以添加学习到的能力。
## Compounding Complete
**Learnings Analyzed:** [N] sessions
**Patterns Found:** [M]
**Artifacts Created:** [K]
### Created:
- Rule: `explicit-identity.md` - Pass IDs explicitly across boundaries
- Skill: `debug-hooks` - Hook debugging workflow
### Skipped (insufficient signal):
- "Pattern X" (1 occurrence)
**Your setup is now permanently improved.**
在创建任何工件之前:
.claude/rules/ 和 .claude/skills/.claude/cache/learnings/*.md.claude/skills/<name>/SKILL.md.claude/rules/<name>.md.claude/hooks/<name>.sh + src/<name>.ts + dist/<name>.mjs.claude/agents/<name>.md.claude/skills/skill-rules.json.claude/settings.json → hooks 部分每周安装
211
仓库
GitHub 星标
3.6K
首次出现
2026年1月22日
安全审计
安装于
opencode201
codex200
gemini-cli199
github-copilot195
cursor194
amp190
Transform ephemeral session learnings into permanent, compounding capabilities.
# List learnings (most recent first)
ls -t $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | head -20
# Count total
ls $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | wc -l
Read the most recent 5-10 files (or specify a date range).
For each learnings file, extract entries from these specific sections:
| Section Header | What to Extract |
|---|---|
## Patterns or Reusable techniques | Direct candidates for rules |
**Takeaway:** or **Actionable takeaway:** | Decision heuristics |
## What Worked | Success patterns |
## What Failed | Anti-patterns (invert to rules) |
## Key Decisions | Design principles |
Build a frequency table as you go:
| Pattern | Sessions | Category |
|---------|----------|----------|
| "Check artifacts before editing" | abc, def, ghi | debugging |
| "Pass IDs explicitly" | abc, def, ghi, jkl | reliability |
Before counting, merge patterns that express the same principle:
Example consolidation:
Use the most general formulation. Update the frequency table.
Critical step: Look at what the learnings cluster around.
If >50% of patterns relate to one topic (e.g., "hooks", "tracing", "async"): → That topic may need a dedicated skill rather than multiple rules → One skill compounds better than five rules
Ask yourself: "Is there a skill that would make all these rules unnecessary?"
For each pattern, determine artifact type:
Is it a sequence of commands/steps?
→ YES → SKILL (executable > declarative)
→ NO ↓
Should it run automatically on an event (SessionEnd, PostToolUse, etc.)?
→ YES → HOOK (automatic > manual)
→ NO ↓
Is it "when X, do Y" or "never do X"?
→ YES → RULE
→ NO ↓
Does it enhance an existing agent workflow?
→ YES → AGENT UPDATE
→ NO → Skip (not worth capturing)
Artifact Type Examples:
| Pattern | Type | Why |
|---|---|---|
| "Run linting before commit" | Hook (PreToolUse) | Automatic gate |
| "Extract learnings on session end" | Hook (SessionEnd) | Automatic trigger |
| "Debug hooks step by step" | Skill | Manual sequence |
| "Always pass IDs explicitly" | Rule | Heuristic |
| Occurrences | Action |
|---|---|
| 1 | Note but skip (unless critical failure) |
| 2 | Consider - present to user |
| 3+ | Strong signal - recommend creation |
| 4+ | Definitely create |
Present each proposal in this format:
---
## Pattern: [Generalized Name]
**Signal:** [N] sessions ([list session IDs])
**Category:** [debugging / reliability / workflow / etc.]
**Artifact Type:** Rule / Skill / Agent Update
**Rationale:** [Why this artifact type, why worth creating]
**Draft Content:**
\`\`\`markdown
[Actual content that would be written to file]
\`\`\`
**File:** `.claude/rules/[name].md` or `.claude/skills/[name]/SKILL.md`
---
Use AskUserQuestion to get approval for each artifact (or batch approval).
# Write to rules directory
cat > $CLAUDE_PROJECT_DIR/.claude/rules/<name>.md << 'EOF'
# Rule Name
[Context: why this rule exists, based on N sessions]
## Pattern
[The reusable principle]
## DO
- [Concrete action]
## DON'T
- [Anti-pattern]
## Source Sessions
- [session-id-1]: [what happened]
- [session-id-2]: [what happened]
EOF
Create .claude/skills/<name>/SKILL.md with:
Add triggers to skill-rules.json if appropriate.
Create shell wrapper + TypeScript handler:
# Shell wrapper
cat > $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh << 'EOF'
#!/bin/bash
set -e
cd "$CLAUDE_PROJECT_DIR/.claude/hooks"
cat | node dist/<name>.mjs
EOF
chmod +x $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh
Then create src/<name>.ts, build with esbuild, and register in settings.json:
{
"hooks": {
"EventName": [{
"hooks": [{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh"
}]
}]
}
}
Edit existing agent in .claude/agents/<name>.md to add the learned capability.
## Compounding Complete
**Learnings Analyzed:** [N] sessions
**Patterns Found:** [M]
**Artifacts Created:** [K]
### Created:
- Rule: `explicit-identity.md` - Pass IDs explicitly across boundaries
- Skill: `debug-hooks` - Hook debugging workflow
### Skipped (insufficient signal):
- "Pattern X" (1 occurrence)
**Your setup is now permanently improved.**
Before creating any artifact:
.claude/rules/ and .claude/skills/ first.claude/cache/learnings/*.md.claude/skills/<name>/SKILL.md.claude/rules/<name>.md.claude/hooks/<name>.sh + src/<name>.ts + dist/<name>.mjs.claude/agents/<name>.md.claude/skills/skill-rules.json.claude/settings.json → hooks sectionWeekly Installs
211
Repository
GitHub Stars
3.6K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode201
codex200
gemini-cli199
github-copilot195
cursor194
amp190
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
60,400 周安装