From majestic-tools
Extracts recurring patterns from git commits/PRs/handoffs/CLAUDE.md via bash/grep; recommends artifacts (skills/rules/hooks/agents) using frequency thresholds.
How this skill is triggered — by the user, by Claude, or both
Slash command
/majestic-tools:compound-learningsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Transform recurring patterns into durable artifacts. Use frequency-based thresholds to distinguish noise from signal.
Transform recurring patterns into durable artifacts. Use frequency-based thresholds to distinguish noise from signal.
Scan these locations for patterns:
| Source | Command/Path | What to Extract |
|---|---|---|
| Git commits | git log --oneline -100 | Repeated fix types, refactor patterns |
| Git commit bodies | git log -50 --format="%B---" | Lessons in commit descriptions |
| PR descriptions | gh pr list --state merged -L 20 | Decisions, learnings |
| Handoffs | $MAIN_WORKTREE/.agents/handoffs/*.md | Patterns, What Worked/Failed |
| Key Learnings | CLAUDE.md (Key Learnings section) | Existing encoded patterns |
Note: Session ledger (.agents/session_ledger.md) is for /reflect only - ephemeral per-session state.
# Git patterns (look for repeated prefixes/types)
git log --oneline -100 | cut -d' ' -f2- | sort | uniq -c | sort -rn
# Handoff patterns
grep -h "^- " .agents/handoffs/*.md 2>/dev/null | sort | uniq -c | sort -rn
Before counting, normalize patterns:
Group by semantic meaning, not exact wording.
| Occurrences | Action | Rationale |
|---|---|---|
| 1 | Skip | Could be noise, one-off incident |
| 2 | Note | Emerging pattern, watch for recurrence |
| 3+ | Recommend | Clear pattern, suggest artifact |
| 4+ | Strong recommend | Encode immediately |
Use this decision tree to determine artifact type:
Is it a sequential workflow with distinct phases?
YES → Consider COMMAND (user-invoked) or AGENT (autonomous)
Does it need user interaction during execution?
YES → COMMAND
NO → AGENT
NO ↓
Should it trigger automatically on file/context patterns?
YES → SKILL (probabilistic, Claude MAY follow)
Is enforcement critical (must happen every time)?
YES → Consider HOOK instead (deterministic)
NO ↓
Is it a simple rule or convention?
YES → RULE (add to CLAUDE.md or .agents/lessons/)
Project-specific? → .agents/lessons/ (with workflow_phase: review)
Universal? → CLAUDE.md
NO ↓
Does it enhance an existing agent's behavior?
YES → AGENT UPDATE (modify existing agent)
NO → Likely doesn't need encoding
| Artifact | When to Use | Example |
|---|---|---|
| Rule | Simple convention, always applies | "Use kebab-case for file names" |
| Skill | Knowledge/context for specific work | "Stimulus controller patterns" |
| Hook | Must enforce behavior deterministically | "Run linter before commit" |
| Command | User-invoked workflow with arguments | "/deploy --env staging" |
| Agent | Autonomous task, returns report | "security-review agent" |
Present findings as:
## Compound Learnings Analysis
### Strong Signal (4+ occurrences)
| Pattern | Count | Recommended Artifact | Rationale |
|---------|-------|---------------------|-----------|
| ... | ... | ... | ... |
### Emerging Patterns (2-3 occurrences)
| Pattern | Count | Potential Artifact | Notes |
|---------|-------|-------------------|-------|
| ... | ... | ... | ... |
### Recommended Actions
1. **[Artifact Type]**: `name` - description
- Draft: [brief template or content]
Before recommending an artifact, verify:
When invoked from /learn:
Note: /reflect is for single-session analysis. /learn is for cross-session compound learning.
npx claudepluginhub majesticlabs-dev/majestic-marketplace --plugin majestic-toolsExtracts reusable code style, workflow, architecture, and tool patterns from git history, diffs, and observations into confidence-scored instincts. Run after features, bugs, or sessions.
Distills patterns from Claude Code work history, git logs, lessons, and memory to suggest new agents/skills, review roster quality, prune redundancies, or consolidate feedback into rules.
Detects repeated workflow patterns from AI session transcripts and suggests reusable skills to automate them. Use when optimizing workflows.