Agent skill
opi
Extract learnings from recent git commits and current conversation. Analyzes fixes, refactors, and corrections to propose entries for learnings files. Use when: - User says "/opi" or "opi" - "What did we learn?" - "Extract learnings" - "Update learnings" - End of session reflection Triggers: "opi", "learn", "oppia", "mitä opittiin", "extract learnings"
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/opi
SKILL.md
Opi - Learning Extractor
Automatically extract learnings from recent work to improve future Claude sessions.
Workflow
Step 1: Gather Sources
Run these commands to collect learning material:
# Recent commits (last 20)
git log --oneline -20
# Today's commits with details
git log --since="midnight" --format="%h %s"
# Commits with "fix", "korjaus", "refactor"
git log --oneline -50 | grep -iE "(fix|korja|refactor|bugfix)"
Step 2: Analyze Fix Commits
For each fix/refactor commit, examine what changed:
git show <commit-hash> --stat
git show <commit-hash> -- "*.tsx" "*.ts" # Code changes
Look for patterns:
- What was wrong? (the bug/issue)
- What fixed it? (the solution)
- Why? (root cause)
Step 3: Check Current Conversation
Review current conversation for:
- User corrections ("ei, tee näin..." / "no, do it this way...")
- Failed attempts that were fixed
- Non-obvious solutions discovered
- Repeated patterns
Step 4: Categorize Learnings
Determine where each learning belongs:
| Learning Type | Destination |
|---|---|
| React/TypeScript pattern | .claude/LEARNINGS.md |
| Supabase/DB pattern | .claude/LEARNINGS.md |
| CI/CD specific | ci-doctor/references/learnings.md |
| Lint specific | lint-fixer/references/learnings.md |
| Test specific | test-writer/references/learnings.md |
| Skill-specific | [skill]/references/learnings.md |
Step 5: Propose Learnings
Format each learning proposal:
## Proposed Learning
**Source:** commit abc123 / conversation
**Category:** [Global / Skill-specific]
**File:** [target file path]
### [Issue Title]
- **Pattern:** What triggers this
- **Wrong:** ❌ The incorrect approach
- **Right:** ✅ The correct approach
- **Why:** Root cause
Step 6: Get Approval & Write
- Present all proposed learnings to user
- User approves/rejects each
- Write approved learnings to appropriate files
- Commit changes
Learning Quality Criteria
Only propose learnings that are:
- Non-obvious - Claude wouldn't know this without being told
- Actionable - Can be applied in future situations
- Specific - Has concrete wrong/right examples
- Recurring - Likely to come up again
Skip:
- Typo fixes
- One-off configuration issues
- Project-specific constants
- Things Claude already knows
Example Session
User: /opi
Claude: Let me analyze recent commits...
Found 3 potential learnings:
1. **useCallback for useEffect deps** (commit a1b2c3)
- Source: AdminTranslationsPage infinite loop fix
- File: .claude/LEARNINGS.md
- Pattern: Functions in useEffect deps cause re-renders
2. **GitHub API dismiss format** (commit d4e5f6)
- Source: CodeQL alert dismissal
- File: ci-doctor/references/learnings.md
- Pattern: Use "false positive" not "false_positive"
3. **Controlled Tabs state** (conversation)
- Source: Feedback popup tab fix
- File: .claude/LEARNINGS.md
- Pattern: Radix Tabs need value+onValueChange for control
Add these learnings? [Y/n for each]
Commands Reference
# Commits since specific date
git log --since="2025-01-10" --oneline
# Commits by pattern
git log --all --oneline | grep -i "fix"
# Show specific commit
git show <hash> --name-only
# Diff for a commit
git diff <hash>^..<hash>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?