/superclaude-plusplus:learnfrom superclaude-plusplus
Extracts reusable patterns from sessions and saves them as skills. Use after solving complex problems or discovering useful workarounds to preserve knowledge for future sessions.
Ships in superclaude-plusplus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze problem-solving patterns, debugging techniques, and workarounds from sessions to save them as reusable skills.
Core Principle: Recurring problem-solving → Pattern extraction → Skill creation → Reuse in future sessions
/learn, remember this, save patternGate question: Would a future session, starting cold, save real time because this was written down? If the answer is "it would have figured this out from the code or from general knowledge in under a minute", do not save it. Every saved line is prompt context; it has to earn its place.
| Category | Examples | Why it earns its place |
|---|---|---|
| Commands/workflows discovered | The build variant that actually works, the test invocation with the required flag (--runInBand for shared DB state) | Saves re-discovery on every session |
| Error Resolution Patterns | TypeScript type error fixes, build failure repairs | Prevents repeating a debugging session |
| Debugging Techniques | Specific tool combinations, log analysis methods | Not derivable from code |
| Library Quirks | Undocumented behaviors, version-specific differences | Invisible in the codebase |
| API / Config Quirks | Rate-limit workarounds, NEXT_PUBLIC_* must be set at build time, Redis needs ?family=0 for IPv6 | Environment knowledge that costs an outage to learn |
| Module Relationships | "auth needs crypto initialized first; import order in bootstrap.ts matters" | Architecture knowledge the code does not state |
| Testing approaches that worked | Which helper/factory to use instead of inline mocks | Establishes a pattern others will follow |
| Project Conventions | Naming rules, file structure, code style beyond what CONVENTIONS.md already says | Only the project-specific delta |
| Architecture Decisions | Pattern selection rationale, trade-offs | The "why" is never in the code |
| Category | Reason | Bad example |
|---|---|---|
| Obvious from code | The name or signature already says it | "UserService handles user operations" |
| Generic best practice | Universal advice, not project-specific; the model already knows it | "Always write tests", "use meaningful names" |
| One-off fixes | Will not recur; clutters the file | "Fixed login button bug in commit abc123" |
| Verbose explanations | A one-liner carries the same information | A paragraph on what JWT is → Auth: JWT HS256, Bearer header |
| Simple typo / syntax fixes | No reuse value | — |
| Transient external issues | Service outage, flaky network | — |
| Machine-specific paths/secrets | Not generalizable; secrets never | /Users/me/..., tokens |
| Already in CLAUDE.md / RULES.md / CONVENTIONS.md | Duplicate context is pure cost | — |
| Learning type | Destination |
|---|---|
| Reusable across projects (library quirk, debugging technique) | ~/.claude/skills/<name>/SKILL.md (this skill) |
| Project-specific command, gotcha, module relationship | Project CLAUDE.md (team) or CLAUDE.local.md (personal, gitignored) — one line per concept, <command or pattern> - <why> |
| Must survive compaction in this session only | Built-in auto memory (~/.claude/projects/<slug>/memory/) |
/learn
🔍 Analyzing session...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Messages: 47
Tool calls: 89
Errors resolved: 3 cases
Main task: Auth system implementation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Extractable patterns found
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. [HIGH VALUE] NextAuth + Prisma Session Type Extension
- Problem: userId missing in Session type
- Solution: Type extension in next-auth.d.ts
- Reusability: ⭐⭐⭐⭐⭐
2. [MEDIUM VALUE] Supabase RLS Debugging Pattern
- Problem: Empty results due to RLS policy
- Solution: Test with service_role key, then fix policy
- Reusability: ⭐⭐⭐⭐
3. [LOW VALUE] ESLint Rule Disable
- Problem: unused-vars warning
- Solution: .eslintrc modification
- Reusability: ⭐⭐ (project-specific)
Select patterns to save [1,2,3 or all]:
📝 Generating skill document...
File: ~/.claude/skills/nextauth-prisma-session-type/SKILL.md
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# NextAuth + Prisma Session Type Extension
## Problem
Type error when accessing userId in NextAuth session
`Property 'userId' does not exist on type 'Session'`
## Solution
Create `types/next-auth.d.ts`:
\`\`\`typescript
import { DefaultSession } from "next-auth"
declare module "next-auth" {
interface Session {
user: {
id: string
} & DefaultSession["user"]
}
}
\`\`\`
## When to Apply
- When using NextAuth + Prisma combination
- When adding custom fields to session
## Related
- NextAuth official docs: TypeScript section
- Prisma adapter configuration
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Skill saved
View saved skill? [y/N]
One directory per learned skill, so the harness discovers it like any other
skill (a flat .md under a shared folder is never loaded):
~/.claude/skills/
├── nextauth-prisma-session-type/SKILL.md
├── supabase-rls-debugging/SKILL.md
├── react-hydration-mismatch-fix/SKILL.md
└── vercel-edge-function-timeout/SKILL.md
---
name: pattern-name
description: Brief description
source: learn
learned_at: 2025-01-26
source_project: project-name
tags: [nextauth, prisma, typescript]
---
# Pattern Name
## Problem
Problem situation description
## Cause
Root cause analysis
## Solution
Resolution method (with code examples)
## When to Apply
Situations where this pattern applies
## Caveats
Warnings, edge cases
## Related
Related documentation, resource links
.claude/settings.json:
{
"hooks": {
"Stop": [
{
"type": "command",
"command": "~/.claude/scripts/evaluate-session.sh"
}
]
}
}
.claude/learn.config.json:
{
"auto_learn": {
"enabled": true,
"min_session_length": 10,
"extraction_threshold": "medium",
"auto_approve": false
},
"storage": {
"path": "~/.claude/skills/",
"max_skills": 100
},
"filters": {
"ignore_patterns": [
"typo",
"syntax_error",
"one_time_fix"
],
"focus_patterns": [
"error_resolution",
"debugging_technique",
"workaround",
"architecture_decision"
]
}
}
Integration with PM Agent's self-improvement layer:
Session complete
│
├─→ /learn (pattern extraction)
│
└─→ PM Agent (documentation, knowledge base update)
/checkpoint/checkpoint create "before-experiment"
... experimental resolution attempts ...
... success! ...
/learn # Save successful pattern
Saved skills auto-referenced when similar problems occur:
🔍 Similar pattern detected
━━━━━━━━━━━━━━━━━━━━━━━━━━
Previously learned pattern available:
- nextauth-prisma-session-type
Apply? [y/N]
| Criterion | Weight |
|---|---|
| Reusability potential | 40% |
| Resolution complexity | 30% |
| Time-saving impact | 20% |
| Documentation value | 10% |
| Command | Description |
|---|---|
/learn | Analyze current session and extract patterns |
/learn list | List saved skills |
/learn show <name> | View specific skill content |
/learn delete <name> | Delete skill |
/learn search <keyword> | Search skills |
# React Server Component Data Fetching
## Problem
Waterfall issue when fetching server data
in client components
## Solution
Fetch data in server component, pass as props
or use Suspense + parallel fetch
## Code Example
\`\`\`tsx
// ✅ Good: Server Component
async function Page() {
const data = await fetchData()
return <ClientComponent data={data} />
}
\`\`\`
# Fix Typo in Config ❌
## Problem
Build failure due to typo
## Solution
Fix typo
→ No reuse value, do not save
# UserService ❌
The `UserService` class handles user operations.
→ Obvious from the code, do not save
# JWT Authentication ❌
JWT (JSON Web Tokens) are an open standard (RFC 7519) that defines a compact
and self-contained way for securely transmitting information ... (12 lines)
→ Verbose; the useful residue is one line: `Auth: JWT HS256, Bearer header`
Include/Exclude criteria and the bad examples above are adapted from Anthropic's
claude-md-management plugin (update-guidelines.md, Apache 2.0) — see NOTICE.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub excatt/superclaude-plusplus --plugin superclaude-plusplus44 skills in this plugin
/adaptAdapt designs to work across different screen sizes, devices, contexts, or platforms. Implements breakpoints, fluid layouts, and touch targets. Use when the user mentions responsive design, mobile layouts, breakpoints, viewport adaptation, or cross-device compatibility./animateReview a feature and enhance it with purposeful animations, micro-interactions, and motion effects that improve usability and delight. Use when the user mentions adding animation, transitions, micro-interactions, motion design, hover effects, or making the UI feel more alive./auditRun project-specific verification rules (business logic, architecture patterns, naming) that linters cannot catch; bootstraps rules if none exist. Not for build/lint/test (/verify)./bolderAmplify safe or boring designs to make them more visually interesting and stimulating. Increases impact while maintaining usability. Use when the user says the design looks bland, generic, too safe, lacks personality, or wants more visual impact and character./brainstormInteractive requirements discovery through Socratic dialogue and systematic exploration/build-fixExpert skill for resolving build errors with minimal change principle. Use for build failures, type errors, compile errors. Keywords: build, fix, error, compile, typescript, type, resolve.Other plugins' skills for the same job