← Back to Claude Code
Claude Code / Lesson 03

Give your project lasting instructions

Keep build commands, conventions, and task context close to the code.

Before you begin

Open a practice repository with a README and a known test command. CLAUDE.md supplies context; it is not a security boundary or a substitute for permissions.

1. Identify the useful facts

Ask Claude to inspect package scripts, tests, and existing patterns. Verify any commands it proposes by checking the actual project. Keep instructions short enough to review. Do not include credentials, access tokens, or an entire copied documentation site.

2. Create and review CLAUDE.md

Inside Claude Code, /init can help draft project instructions. Review the generated file and keep only confirmed facts. A repository-root CLAUDE.md can be shared with the team; user-level instructions live at ~/.claude/CLAUDE.md. Scoped rules belong near the code they describe.

markdown
# Project instructions
- Read README.md before changing build behavior.
- Follow the existing component patterns.
- Find the real test command in the project scripts.
- Explain behavior changes and report checks run.
- Never include secrets in generated examples.

3. Resume with enough context

Use claude -c to continue the most recent conversation in this directory, or claude -r to choose a session. When a conversation becomes crowded, /compact creates a shorter context. Keep a brief task note with decisions, changed files, verification, and next actions; a compressed history can omit details.

shell
claude -c
claude -r

Practice & self-check

YOUR TURN / PRACTICE

Write a short CLAUDE.md using real project commands. Start a new session and ask Claude to summarize the relevant instructions.

When you’re done, take a moment to check:

Read the official sources

CLI instructions checked against official documentation; API examples tested with simulated responses. Product-account walkthroughs were not performed.

Start with a question