From self-improving-agent
Promotes patterns from MEMORY.md to CLAUDE.md or .claude/rules/ for permanent enforcement via /si:promote. Supports auto-detection, scoped targets, and rule distillation.
npx claudepluginhub stillquietlyloud/claude_skills --plugin self-improving-agentThis skill uses the workspace's default tool permissions.
Moves a proven pattern from Claude's auto-memory into the project's rule system, where it becomes an enforced instruction rather than a background note.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Performs token-optimized structural code search using tree-sitter AST parsing to discover symbols, outline files, and unfold code without reading full files.
Moves a proven pattern from Claude's auto-memory into the project's rule system, where it becomes an enforced instruction rather than a background note.
/si:promote <pattern description> # Auto-detect best target
/si:promote <pattern> --target claude.md # Promote to CLAUDE.md
/si:promote <pattern> --target rules/testing.md # Promote to scoped rule
/si:promote <pattern> --target rules/api.md --paths "src/api/**/*.ts" # Scoped with paths
Parse the user's description. If vague, ask one clarifying question:
# Search MEMORY.md for related entries
MEMORY_DIR="$HOME/.claude/projects/$(pwd | sed 's|/|%2F|g; s|%2F|/|; s|^/||')/memory"
grep -ni "<keywords>" "$MEMORY_DIR/MEMORY.md"
Show the matching entries and confirm they're what the user means.
| Pattern scope | Target | Example |
|---|---|---|
| Applies to entire project | ./CLAUDE.md | "Use pnpm, not npm" |
| Applies to specific file types | .claude/rules/<topic>.md | "API handlers need validation" |
| Applies to all your projects | ~/.claude/CLAUDE.md | "Prefer explicit error handling" |
If the user didn't specify a target, recommend one based on scope.
Transform the learning from auto-memory's note format into CLAUDE.md's instruction format:
Before (MEMORY.md — descriptive):
The project uses pnpm workspaces. When I tried npm install it failed. The lock file is pnpm-lock.yaml. Must use pnpm install for dependencies.
After (CLAUDE.md — prescriptive):
## Build & Dependencies
- Package manager: pnpm (not npm). Use `pnpm install`.
Rules for distillation:
For CLAUDE.md:
.claude/rules/ insteadFor .claude/rules/:
paths if scoped---
paths:
- "src/api/**/*.ts"
- "tests/api/**/*"
---
# API Development Rules
- All endpoints must validate input with Zod schemas
- Use `ApiError` class for error responses (not raw Error)
- Include OpenAPI JSDoc comments on handler functions
After promoting, remove or mark the original entry in MEMORY.md:
# Show what will be removed
grep -n "<pattern>" "$MEMORY_DIR/MEMORY.md"
Ask the user to confirm removal. Then edit MEMORY.md to remove the promoted entry. This frees space for new learnings.
✅ Promoted to {{target}}
Rule: "{{distilled rule}}"
Source: MEMORY.md line {{n}} (removed)
MEMORY.md: {{lines}}/200 lines remaining
The pattern is now an enforced instruction. Claude will follow it in all future sessions.
| Use CLAUDE.md for | Use .claude/rules/ for |
|---|---|
| Global project rules | File-type-specific patterns |
| Build commands | Testing conventions |
| Architecture decisions | API design rules |
| Team conventions | Framework-specific gotchas |