Complete guide to CLAUDE.md, project instructions, auto-memory, and rules.
From claude-code-expertnpx claudepluginhub markus41/claude --plugin claude-code-expertThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agentic engineering workflows: eval-first loops, 15-min task decomposition, model routing (Haiku/Sonnet/Opus), AI code reviews, and cost tracking.
Complete guide to CLAUDE.md, project instructions, auto-memory, and rules.
CLAUDE.md files contain natural-language instructions that Claude Code loads as system context. They tell Claude about your project's conventions, build commands, architecture, and preferences.
Enterprise/Managed CLAUDE.md (highest priority, cannot be overridden)
└── User ~/.claude/CLAUDE.md (personal preferences, all projects)
└── Project ./CLAUDE.md (project conventions)
└── Project ./.claude/CLAUDE.md (additional project instructions)
└── Local ./CLAUDE.local.md (personal, gitignored)
└── Directory path/CLAUDE.md (scoped to that directory)
All levels are loaded and combined. Lower levels cannot override enterprise settings.
@path/file.md — Import additional files into CLAUDE.md context# Project Instructions
## Build & Test Commands
- Install: `pnpm install`
- Dev: `pnpm dev`
- Build: `pnpm build`
- Test: `pnpm test`
- Single test: `pnpm test -- path/to/test.ts`
- Lint: `pnpm lint`
- Type check: `pnpm typecheck`
## Code Conventions
- Language: TypeScript strict mode
- Style: Prettier + ESLint
- Imports: Use absolute paths from `@/`
- Components: Functional React with hooks
- State: Zustand for global, React Query for server
## Architecture
- Monorepo: Turborepo with packages in `packages/`
- API: Next.js API routes in `src/app/api/`
- Database: PostgreSQL with Prisma ORM
- Auth: NextAuth.js with Keycloak provider
- Deployment: Kubernetes on AWS EKS
## Key Files
- `prisma/schema.prisma` — Database schema
- `src/lib/auth.ts` — Auth configuration
- `src/lib/db.ts` — Database client
## Important Context
- We use pnpm, never npm or yarn
- Always run tests before committing
- Follow conventional commits format
- Never commit .env files
settings.local.json instead)Rules in .claude/rules/ are like scoped CLAUDE.md files.
# Git Rules
- Use conventional commits
- Never force push to main
---
paths:
- "**/*.ts"
- "**/*.tsx"
---
# TypeScript Rules
- Use strict mode
- Prefer interfaces over type aliases for objects
- Max function length: 50 lines
.claude/rules/
├── architecture.md # Global — project structure
├── code-style.md # Scoped — *.ts, *.tsx, *.js, *.jsx
├── docker-k8s.md # Scoped — Dockerfiles, *.yaml
├── git-workflow.md # Global — commit conventions
├── testing.md # Scoped — *.test.*, *.spec.*
├── research.md # Global — web research tools
├── self-healing.md # Global — error capture protocol
└── lessons-learned.md # Global — auto-growing error log
Claude Code automatically saves important discoveries and patterns to persistent memory files.
~/.claude/projects/<project-hash>/memory/
├── MEMORY.md # Auto-loaded into context (keep under 200 lines)
├── debugging.md # Topic-specific notes
├── patterns.md # Recurring patterns
└── architecture.md # Architecture decisions
# Project Memory
## Build System
- Uses pnpm workspaces with Turborepo
- `pnpm -w` for root-level operations
## Database
- PostgreSQL on port 5433 (non-standard)
- Run `pnpm db:migrate` after schema changes
## User Preferences
- Always use bun for running scripts
- Prefers functional style over OOP
# User says:
"Remember that we always use bun, not npm"
→ Claude saves to MEMORY.md
"Forget the instruction about yarn"
→ Claude removes from MEMORY.md
"Always run lint before committing"
→ Claude saves preference
# Slash commands:
/memory # View memories
/memory add <text> # Add entry
/memory clear # Clear all
export DISABLE_AUTOMEMORY=1
or in settings.json:
{ "autoMemory": false }
The lessons-learned system creates a continuously improving knowledge base:
Tool call fails
→ PostToolUse hook captures error
→ Appends to .claude/rules/lessons-learned.md
→ Claude fixes the issue
→ Claude updates entry: Status → RESOLVED, adds Fix + Prevention
→ Next session loads lessons-learned.md as a rule
→ Claude doesn't repeat the mistake
### Error: Git push rejected
- **Tool:** Bash
- **Status:** RESOLVED
- **Fix:** Use `git pull --rebase` before pushing
- **Prevention:** Always pull before push
Enterprise managed settings (cannot be overridden)
└── User settings (~/.claude/settings.json)
└── Project settings (.claude/settings.json)
└── Local overrides (.claude/settings.local.json)