Claude Code Instructions

How to write Claude Code
CLAUDE.md instructions

Claude Code is an agentic coding tool that can write code, run tests, and make autonomous multi-file changes. CLAUDE.md files configure exactly how it behaves - learn how to write instructions that keep it safe and effective.

⏱ 10 min read Updated 2026 Works with Claude Code CLI
Quick start

How to add instructions to Claude Code

Claude Code reads CLAUDE.md from your project root. Here is the fastest path.

1
Create CLAUDE.md in your project root - this is your project system prompt
2
Add your tech stack, architecture context, coding standards, and safety rules in markdown
3
Create ~/.claude/CLAUDE.md in your home directory for global preferences
4
Use @filename syntax to import existing docs as additional context without duplicating content
Build your Claude Code prompt free →
12
AI tools covered
3
Prompt types built
5min
To your first prompt
$0
To start
CLAUDE.md file locations — project root and global user level
Claude Code — CLAUDE.md (project root) + ~/.claude/CLAUDE.md (global)Use TypeScript. Prefer functional components. Never modify files outside scope.Write tests for all new functions. Ask before adding dependencies.Architecture context: [describe your stack and patterns here]...

What makes Claude Code different from other AI coding tools

Claude Code is an agentic command-line tool that reads CLAUDE.md files as its system prompt - giving it context about your project before it begins any autonomous coding, testing, or terminal task. Unlike Cursor or Windsurf which are IDEs with AI integrated, Claude Code operates from the terminal and can autonomously execute multi-step workflows: writing code, running tests, checking the output, fixing failures, and committing changes - all without manual intervention.

This agentic nature makes CLAUDE.md instructions especially important. Claude Code can make changes across many files in a single session. Without clear scope control and safety rules, it can make sweeping changes you did not intend.

Claude Code is agentic - safety rules matter more here
Claude Code can execute terminal commands, run tests, modify multiple files, and make autonomous decisions. Always include explicit instructions about when to ask for confirmation before making significant changes, adding dependencies, or modifying files outside the specified scope.

What to include in CLAUDE.md

# Project: [Name]
Brief description of what this project does.

## Tech Stack
- TypeScript, Node.js 22
- Express for API routes
- PostgreSQL via Drizzle ORM
- Vitest for testing

## Architecture
- API routes in src/routes/ follow REST conventions
- Database access only through src/db/ layer
- Auth handled by src/middleware/auth.ts
- Types in src/types/ - check before creating new ones

## Coding Standards
- Named exports, no default exports
- Async/await throughout
- Write tests for all new functions
- Add JSDoc to all exported functions

## Safety Rules
- Only modify files in src/ and tests/
- Never modify package.json without noting the change
- Ask before making changes that affect more than 3 files
- Run npm test after every significant change

## Additional context
@docs/api-conventions.md
@src/components/README.md
💡
Use @imports for existing docs
Reference existing documentation files directly with @filename. Claude Code reads these as part of its context without you duplicating content in CLAUDE.md. Great for architecture docs, API conventions, and component READMEs.

System prompt vs master prompt vs user prompt in Claude Code

LayerWhere in Claude CodeWhat it controlsScope
Global CLAUDE.md~/.claude/CLAUDE.mdPersonal preferences across all projectsAll projects
Project CLAUDE.md./CLAUDE.md in project rootProject architecture, standards, safety rulesThis project
User promptTerminal task descriptionThe specific autonomous task to completeThis session

Common questions

How does Claude Code handle global vs project CLAUDE.md?

Claude Code reads both. The global ~/.claude/CLAUDE.md provides personal preferences. The project CLAUDE.md provides project-specific context. When they conflict, project CLAUDE.md takes precedence.

How is Claude Code different from Claude on claude.ai?

Claude Code is a terminal tool with autonomous capabilities. Claude on claude.ai is a chat interface. CLAUDE.md is only read by Claude Code. See our Claude guide for the claude.ai approach.

Can CLAUDE.md include shell commands?

You can include instructions about what commands to run (for example, "run npm test after every significant change"), but CLAUDE.md is not executable. It is a markdown document that Claude Code reads as context and then decides to run those commands based on your instructions.

Build your Claude Code system prompt now

Answer a short set of questions and get a master prompt engineered specifically for Claude Code. Free, no account needed.

Build free with Claude Code →

Claude Code prompts free · 3 builds/month · Pro is $19/month for unlimited builds and Advanced mode

System prompts optimized for
understandingAI · free newsletter
Get more from your AI tools
Practical tips on system prompts, prompt engineering, and getting real results from AI. No fluff.

No spam. Unsubscribe anytime.