# Project Memory with CLAUDE.md — Advanced Agent Workflows and Skills

Source: https://www.geekswithgeeks.com/en/agent-workflows/ctx-claude-md

> Write a short project memory file with the commands, conventions and rules an agent must always know.

## Always-on instructions

Claude Code reads a `CLAUDE.md` file at the start of a session. It is the right place for facts the agent cannot infer: how to build and test, naming conventions, and things never to do. Keep it short, because every line costs context in every session.

## A useful CLAUDE.md

Commands and rules, not a tutorial. Do not repeat what the code already makes obvious.

```markdown
# Shop API

## Commands
- Test: `npm test`
- Lint: `npm run lint`
- Dev server: `npm run dev`

## Rules
- Use TypeScript strict mode; no `any`.
- Database changes go through migrations in `db/migrations`.
- Never edit generated files in `src/gen/`.
```

## Review it like code

Stale or contradictory instructions confuse the agent. Update the file when conventions change, and delete rules that the agent follows without being told.

**Quiz:** What belongs in CLAUDE.md?

- [ ] Passwords and API keys
- [x] Build and test commands and project rules
- [ ] The entire source code
- [ ] Random jokes

*Answer:* Build and test commands and project rules. It holds stable facts and rules the agent cannot infer. Secrets never belong there.
