plugins/plugin-creator/skills/memory-and-rules/SKILL.md
Configure and manage Claude Code persistent memory (CLAUDE.md, auto memory, rules) across sessions. Use when setting up project memory, organizing .claude/rules/, managing auto memory files, creating CLAUDE.md with imports, debugging memory loading, or advising on memory hierarchy and best practices.
npx skillsauth add jamie-bitflight/claude_skills memory-and-rulesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Claude Code has two kinds of persistent memory:
~/.claude/projects/<project>/memory/Both load into context at session start. More specific instructions take precedence over broader ones.
Memory locations load in priority order (highest priority first):
/Library/Application Support/ClaudeCode/CLAUDE.md/etc/claude-code/CLAUDE.md~/.claude/CLAUDE.md~/.claude/rules/*.md./CLAUDE.md or ./.claude/CLAUDE.md./.claude/rules/*.md./CLAUDE.local.md (auto-gitignored)~/.claude/projects/<project>/memory/MEMORY.md (first 200 lines).claude/CLAUDE.md files load on demand when Claude reads files in those directoriesLoading behavior: Files in the directory hierarchy above the working directory load in full at launch. Files in child directories load on demand. Auto memory loads only the first 200 lines of MEMORY.md.
flowchart TD
Start([Where should this instruction go?]) --> Q1{Who needs it?}
Q1 -->|Everyone in org| Managed["Managed policy<br>/etc/claude-code/CLAUDE.md"]
Q1 -->|Just me, all projects| User["User memory<br>~/.claude/CLAUDE.md"]
Q1 -->|My team on this project| Q2{Single file or modular?}
Q1 -->|Just me on this project| Local["Project local<br>./CLAUDE.local.md"]
Q2 -->|Single file| Project["Project memory<br>./CLAUDE.md or ./.claude/CLAUDE.md"]
Q2 -->|Separate topics| Rules["Project rules<br>./.claude/rules/*.md"]
/init
Generates a starter CLAUDE.md for the current project.
CLAUDE.md files can import additional files using @path/to/import syntax:
See @README for project overview and @package.json for npm commands.
# Additional Instructions
- git workflow @docs/git-instructions.md
Import rules:
~ paths supportedCross-worktree sharing: Use home-directory import so all worktrees share personal instructions:
# Individual Preferences
- @~/.claude/my-project-instructions.md
Use /memory during a session to open any memory file in your system editor. This includes CLAUDE.md files, rules, and auto memory.
For larger projects, organize instructions into separate focused files instead of one large CLAUDE.md.
.claude/
├── CLAUDE.md # Main project instructions
└── rules/
├── code-style.md # Code style guidelines
├── testing.md # Testing conventions
├── security.md # Security requirements
└── frontend/
├── react.md # React-specific rules
└── styles.md # CSS/styling rules
All .md files in .claude/rules/ are automatically loaded as project memory. Files are discovered recursively through subdirectories. Symlinks are resolved (circular symlinks handled gracefully).
Scope rules to specific files using YAML frontmatter with the paths field:
---
paths:
- "src/api/**/*.ts"
---
# API Development Rules
- All API endpoints must include input validation
- Use the standard error response format
Rules without a paths field load unconditionally.
Supported glob patterns:
**/*.ts — All TypeScript files in any directorysrc/**/* — All files under src/*.md — Markdown files in project root onlysrc/components/*.tsx — React components in specific directorysrc/**/*.{ts,tsx} — Brace expansion for multiple extensions{src,lib}/**/*.ts — Brace expansion for multiple directoriesMultiple patterns:
---
paths:
- "src/**/*.ts"
- "lib/**/*.ts"
- "tests/**/*.test.ts"
---
Personal rules at ~/.claude/rules/ apply to all projects. Project rules have higher priority than user rules.
Claude's self-written notes that persist across sessions. Unlike CLAUDE.md (instructions you write for Claude), auto memory contains notes Claude writes for itself.
Each project gets its own memory directory at ~/.claude/projects/<project>/memory/. The <project> path derives from the git repository root. Git worktrees get separate memory directories. Outside git repos, the working directory is used.
~/.claude/projects/<project>/memory/
├── MEMORY.md # Index file — first 200 lines loaded at session start
├── debugging.md # Topic file — loaded on demand
├── api-conventions.md # Topic file — loaded on demand
└── ...
MEMORY.md load into system prompt at session startdebugging.md) load on demand when Claude needs themMEMORY.md concise — move detailed notes to topic files/memory to open the file selectorexport CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 # Force off
export CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 # Force on
# When unset: follows gradual rollout
The --add-dir flag gives Claude access to additional directories. By default, CLAUDE.md files from those directories are NOT loaded. To also load their memory:
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude --add-dir ../shared-config
/init to bootstrap CLAUDE.md.claude/CLAUDE.md in subdirectoriesWhen a single CLAUDE.md becomes unwieldy:
.claude/rules/ directorycode-style.md, testing.md, api-design.mdpaths frontmatter for language/directory-specific rulesCLAUDE.md for high-level project overviewSymlink shared rules:
# Symlink a shared rules directory
ln -s ~/shared-claude-rules .claude/rules/shared
# Symlink individual rule files
ln -s ~/company-standards/security.md .claude/rules/security.md
/memory to see which files are loadedpaths frontmatter glob patterns match target files@ references resolve correctly (relative to containing file)MEMORY.md is under 200 lines for guaranteed loadingFor comprehensive details on all memory types, import behavior, glob patterns, and configuration options, see references/memory-reference.md.
SOURCE: Claude Code Memory Documentation (accessed 2026-02-17)
development
When an application needs to store config, data, cache, or state files. When designing where user-specific files should live. When code writes to ~/.appname or hardcoded home paths. When implementing cross-platform file storage with platformdirs.
testing
Enforce mandatory pre-action verification checkpoints to prevent pattern-matching from overriding explicit reasoning. Use this skill when about to execute implementation actions (Bash, Write, Edit) to verify hypothesis-action alignment. Blocks execution when hypothesis unverified or action targets different system than hypothesis identified. Critical for preventing cognitive dissonance where correct diagnosis leads to wrong implementation.
tools
Reference guide for the Twelve-Factor App methodology — 15 principles (12 original + 3 modern extensions) for building portable, resilient, cloud-native applications. Use when evaluating application architecture, designing cloud-native services, reviewing codebases for methodology compliance, advising on configuration, scaling, observability, security, and deployment patterns. Incorporates the 2025 open-source community evolution and cloud-native reinterpretations of each factor.
tools
Converts user-facing documentation (how-to guides, tutorials, API references, examples) in any format — Markdown, PDF, DOCX, PPTX, XLSX, AsciiDoc, RST, HTML, Jupyter notebooks, man pages, TOML/YAML/JSON configs, and plain text — into Claude Code skill directories with SKILL.md plus thematically grouped references/*.md files. Use when given a docs directory or mixed-format documentation to transform into an AI skill. Uses MCP file-reader server for binary formats.