lessons
Capture and review lessons learned from coding sessions. Use to record insights, read past lessons, and improve over time.
What this skill does
# Lessons Learned
Capture insights and learn from past experiences.
## Capture Patterns
### Quick Lesson Capture
When you learn something valuable during a session:
```bash
# Write to lessons file
cat >> ~/.claude/lessons.md << 'EOF'
## [Date] - [Topic]
**Context:** What were you doing?
**Lesson:** What did you learn?
**Application:** When to apply this?
EOF
```
### Structured Lesson
```markdown
## 2024-01-15 - TypeScript Generic Constraints
**Context:**
Building a type-safe form library, struggled with generic types.
**Problem:**
Generic function wasn't narrowing types correctly.
**Solution:**
Use `extends` constraints to narrow:
```typescript
function getValue<T extends { value: unknown }>(obj: T): T['value'] {
return obj.value;
}
```
**Lesson:**
TypeScript generics need explicit constraints for type narrowing.
**Tags:** #typescript #generics #types
```
## Lesson Categories
### Bug Lessons
```markdown
## Bug: [Brief description]
**Symptom:** What happened
**Root Cause:** Why it happened
**Fix:** How to fix
**Prevention:** How to avoid in future
**Time Cost:** How long to debug (motivation to remember!)
```
### Pattern Lessons
```markdown
## Pattern: [Name]
**When to use:** Situations where this applies
**How to implement:** Basic structure
**Gotchas:** Common mistakes
**Example:** Working code
```
### Tool Lessons
```markdown
## Tool: [Name]
**What it does:** Brief description
**Key commands:** Most useful commands
**Gotchas:** Things that trip people up
**Alternatives:** Other options
```
## Review Practices
### Daily Review
```bash
# Review recent lessons
tail -100 ~/.claude/lessons.md
# Search for topic
grep -A 10 "typescript" ~/.claude/lessons.md
```
### Weekly Audit
```bash
gemini -m pro -o text -e "" "Review these lessons from the past week:
$(tail -500 ~/.claude/lessons.md)
1. What patterns emerge?
2. What mistakes keep recurring?
3. What should be turned into automation?
4. What needs deeper study?"
```
### Before Starting Work
```bash
# Get relevant lessons
TOPIC="authentication"
grep -B 2 -A 10 -i "$TOPIC" ~/.claude/lessons.md
```
## Automation from Lessons
When a lesson appears multiple times, automate it:
### Create Git Hook
```bash
# Lesson: Always run tests before commit
# → Create pre-commit hook
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
npm test || exit 1
EOF
chmod +x .git/hooks/pre-commit
```
### Create Snippet
```bash
# Lesson: This pattern is useful
# → Save as snippet
cat > ~/.claude/snippets/async-error-handling.ts << 'EOF'
async function safeAsync<T>(promise: Promise<T>): Promise<[T, null] | [null, Error]> {
try {
const result = await promise;
return [result, null];
} catch (error) {
return [null, error as Error];
}
}
EOF
```
### Create Checklist
```bash
# Lesson: Keep forgetting these steps
# → Create checklist
cat > ~/.claude/checklists/pr-review.md << 'EOF'
# PR Review Checklist
- [ ] Tests pass
- [ ] No console.logs
- [ ] Types are explicit
- [ ] Error handling present
- [ ] Documentation updated
EOF
```
## AI-Assisted Learning
### Extract Lessons from Session
```bash
gemini -m pro -o text -e "" "Extract lessons learned from this coding session:
[Paste conversation or summary]
For each lesson:
1. What was learned
2. When it applies
3. How to remember it"
```
### Connect Lessons
```bash
gemini -m pro -o text -e "" "Find connections between these lessons:
$(cat ~/.claude/lessons.md)
1. What themes emerge?
2. What knowledge gaps exist?
3. What should be studied next?"
```
### Generate Quiz
```bash
gemini -m pro -o text -e "" "Create a quiz from these lessons:
$(tail -1000 ~/.claude/lessons.md)
Generate 5 questions that test understanding of key concepts."
```
## Storage Options
### File-based
```bash
# Single file
~/.claude/lessons.md
# By date
~/.claude/lessons/2024-01.md
# By topic
~/.claude/lessons/typescript.md
~/.claude/lessons/git.md
```
### Memory Integration
```bash
# Save to basic-memory
basic-memory tool write-note \
--title "Lesson: TypeScript Generics" \
--folder "lessons" \
--content "$(cat lesson.md)" \
--tags "lesson,typescript"
```
## Best Practices
1. **Capture immediately** - Don't wait, you'll forget
2. **Be specific** - Include code examples
3. **Note the cost** - Time spent motivates remembering
4. **Review regularly** - Lessons fade without review
5. **Automate repeated** - Turn lessons into tools
6. **Tag consistently** - Makes searching easier
7. **Connect to context** - When does this apply?
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.