New to Claude Skills? Learn how to install them →

Palirezarezvani on GitHub

Promote Learnings to Rules

Free

Make learned behaviors permanent in Claude.

Get this skill

Free · Opens the source repo

What Promote Learnings to Rules does

The Promote Learnings to Rules skill allows you to transition proven patterns from Claude's auto-memory into a more permanent rule system. This is particularly useful for developers and teams who want to enforce consistent behaviors across their projects. By running the command /si:promote, you can easily convert informal notes into structured rules that Claude will follow in future interactions, ensuring that important conventions are not forgotten.

When using this skill, you can specify the target for the promoted rule, whether it be the main CLAUDE.md file for global project rules or specific files within the .claude/rules/ directory for more targeted instructions. The skill intelligently determines the best target for the rule based on the scope of the behavior you want to enforce, whether it applies to all files or just specific types.

The workflow is straightforward: you describe the pattern, the skill searches the auto-memory for related entries, and then it distills the information into a concise rule format. This transformation is essential for maintaining clarity and brevity in your project's documentation. Once the rule is written to the appropriate target, the original entry in auto-memory is marked or removed, making space for new learnings while keeping the system organized.

This skill is ideal for teams looking to maintain high standards in their coding practices by ensuring that important behaviors are documented and enforced. It helps prevent recurring mistakes and promotes a consistent approach to development across all contributors.

When to use it

Use this skill when a pattern has been observed multiple times and needs to be enforced as a rule.

When not to use it

Avoid using it for one-off notes or temporary context that may change frequently.

What you can build with it

Enforcing Coding Standards

Use the promote skill to ensure that all team members adhere to specific coding standards by converting frequently mentioned best practices into enforced rules.

Documenting Project Conventions

When a project convention emerges from team discussions, promote it to make sure every contributor is aware and follows the same guidelines.

Preventing Recurring Mistakes

If you find yourself correcting Claude on the same issue repeatedly, promote that behavior to eliminate the need for constant reminders.

How to install Promote Learnings to Rules

View source

1. Install with the skills CLI

npx skills add alirezarezvani/claude-skills/promote --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by alirezarezvani

/si:promote — Graduate Learnings to Rules

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.

Usage

/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

Workflow

Step 1: Understand the pattern

Parse the user's description. If vague, ask one clarifying question:

  • "What specific behavior should Claude follow?"
  • "Does this apply to all files or specific paths?"

Step 2: Find the pattern in auto-memory

# 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.

Step 3: Determine the right target

Pattern scopeTargetExample
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.

Step 4: Distill into a concise rule

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:

  • One line per rule when possible
  • Imperative voice ("Use X", "Always Y", "Never Z")
  • Include the command or example, not just the concept
  • No backstory — just the instruction

Step 5: Write to target

For CLAUDE.md:

  1. Read existing CLAUDE.md
  2. Find the appropriate section (or create one)
  3. Append the new rule under the right heading
  4. If file would exceed 200 lines, suggest using .claude/rules/ instead

For .claude/rules/:

  1. Create the file if it doesn't exist
  2. Add YAML frontmatter with paths if scoped
  3. Write the rule content
---
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

Step 6: Clean up auto-memory

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.

Step 7: Confirm

✅ 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.

Promotion Decision Guide

Promote when:

  • Pattern appeared 3+ times in auto-memory
  • You corrected Claude about it more than once
  • It's a project convention that any contributor should know
  • It prevents a recurring mistake

Don't promote when:

  • It's a one-time debugging note (leave in auto-memory)
  • It's session-specific context (session memory handles this)
  • It might change soon (e.g., during a migration)
  • It's already covered by existing rules

CLAUDE.md vs .claude/rules/

Use CLAUDE.md forUse .claude/rules/ for
Global project rulesFile-type-specific patterns
Build commandsTesting conventions
Architecture decisionsAPI design rules
Team conventionsFramework-specific gotchas

Tips

  • Keep CLAUDE.md under 200 lines — use rules/ for overflow
  • One rule per line is easier to maintain than paragraphs
  • Include the concrete command, not just the concept
  • Review promoted rules quarterly — remove what's no longer relevant

Frequently asked questions about Promote Learnings to Rules

Similar skills