# The /add-mistake Command: Teaching Claude Not to Repeat Itself

- **Category:** AI
- **Date:** 2026-02-25
- **Read time:** 5 min

Claude Code is good at writing code. It's less good at remembering what went wrong last time. I built a slash command called /add-mistake — about 50 lines of markdown — that logs mistakes to a CLAUDE.md file so they never happen again.

## The problem

Claude Code doesn't have persistent memory across conversations. Every new session starts fresh. On a real project you accumulate context: "don't use that deprecated API," "always await that database call." Without a system to capture these lessons, you repeat the same corrections over and over.

## The solution: CLAUDE.md as institutional memory

Claude Code reads CLAUDE.md from your project root at the start of every conversation. The insight — borrowed from Boris Cherny's workflow — is simple: use CLAUDE.md as a running log of mistakes. Every time Claude does something wrong, add it to the file. Claude reads it next session. The mistake doesn't happen again.

## Why this works

1. **It compounds.** After a few weeks, your CLAUDE.md has 15-20 specific mistakes logged. The error rate drops noticeably.
2. **It's zero-friction.** Type /add-mistake [what happened] and move on. No context switching.
3. **It benefits the whole team.** CLAUDE.md lives in the repo. Teammates get all accumulated lessons automatically.

The broader pattern: making AI tools learn from their mistakes the same way teams do. CLAUDE.md is that system for AI-assisted development.
