In partnership with

Introducing the first AI-native CRM
Connect your email, and you’ll instantly get a CRM with enriched customer insights and a platform that grows with your business.
With AI at the core, Attio lets you:
Prospect and route leads with research agents
Get real-time insights during customer calls
Build powerful automations for your complex workflows
Join industry leaders like Granola, Taskrabbit, Flatfile and more.
Claude Code Prompt Engineering
|
RESEARCH AUDIO
|
Claude Code Prompt Engineering
Four techniques from Anthropic's engineering team that actually matter
|
|
Claude Code is different from other AI coding tools. Where Cursor and Copilot guide you through opinionated workflows, Claude Code gives you raw model access and gets out of your way.
This flexibility is powerful, but it means the difference between mediocre and excellent results comes down to how you prompt it. After reading through Anthropic's official best practices (the same techniques their engineers use internally), four patterns stood out as the ones that actually move the needle.
|
1. CLAUDE.md: Give Claude a Memory
Every time you start a conversation with Claude Code, it looks for a file called CLAUDE.md in your project. Whatever's in that file becomes part of Claude's system prompt—persistent context that travels with your codebase.
Without it, you're re-explaining your project setup, coding conventions, and testing approach every session. With it, Claude already knows.
What belongs in CLAUDE.md:
- Build and test commands (
npm run build, pytest -x)
- Code style rules (ES modules over CommonJS, destructured imports)
- Project-specific quirks ("The auth module uses a custom JWT implementation")
- Git conventions (branch naming, squash vs merge)
- Environment setup notes (Python version, required env vars)
|
Example CLAUDE.md
# Commands
- npm run dev: Start development server
- npm run test: Run test suite
- npm run test:single : Run single test file
# Code Style
- TypeScript strict mode, no `any` types
- Use ES modules (import/export), never CommonJS
- Prefer named exports over default exports
- Error handling: always use custom AppError class
# Workflow
- Run typecheck before committing
- Keep PRs under 400 lines when possible
- Update CHANGELOG.md for user-facing changes
|
Where to put it: The root of your repo is the most common location. Check it into git so your whole team benefits. For personal settings you don't want to share, name it CLAUDE.local.md and add it to .gitignore.
Quick start: Run /init in any project and Claude will analyze your codebase and generate a starter file automatically.
|
Anthropic's tip: Press the # key during any session to give Claude an instruction it will automatically save to CLAUDE.md. Many engineers use this constantly—documenting conventions as they code, then committing the updated file.
|
|
2. Thinking Levels: The Feature Most People Miss
Claude Code has a built-in feature that allocates more computational budget for complex problems. It's triggered by specific phrases in your prompt—and it's not subtle. The difference between "think" and "ultrathink" is 4,000 tokens versus 32,000 tokens of reasoning capacity.
This isn't speculation. Simon Willison found the exact implementation in Claude Code's source:
|
From Claude Code's source
if (prompt.includes("ultrathink"))
return 31999; // Maximum budget
if (prompt.includes("think hard"))
return 10000; // Medium budget
if (prompt.includes("think"))
return 4000; // Basic budget
|
| Level |
Trigger Phrases |
Budget |
| Basic |
"think" |
4K tokens |
| Medium |
"think hard", "think deeply", "megathink" |
10K tokens |
| Maximum |
"think harder", "ultrathink" |
32K tokens |
When to use each level:
| No keyword |
Quick fixes, simple edits, prototyping |
| "think" |
Routine refactoring, straightforward features |
| "think hard" |
Multi-file changes, design decisions, new features |
| "ultrathink" |
Architecture, migrations, debugging loops, complex planning |
|
Important: These triggers only work in Claude Code CLI. They have no effect in the web interface or API. Also: don't ultrathink everything. It costs more and adds latency. Save it for problems that genuinely need deep reasoning.
|
|
3. The Workflow That Changes Everything
Left to its own devices, Claude will jump straight to writing code. Sometimes that's fine. But for anything non-trivial, this habit produces worse results than a simple four-phase workflow: Explore → Plan → Code → Commit.
The key is being explicit about which phase you're in. Here's how Anthropic's engineers do it:
|
Phase 1: Explore
"Read the authentication module and the user service.
I want to understand how sessions work before we
make changes. Don't write any code yet."
|
The phrase "don't write any code yet" is critical. It keeps Claude in research mode. For complex problems, tell Claude to spawn subagents to investigate specific questions—this preserves context in your main conversation.
|
Phase 2: Plan
"Think hard about how to add OAuth2 support without
breaking existing session handling. Create a detailed
plan. Don't implement anything yet."
|
This is where thinking levels matter most. Use "think hard" or "ultrathink" here. If you like the plan, have Claude save it to a markdown file or GitHub issue—that way you can reset to this point if the implementation goes sideways.
|
Phase 3: Code
"Implement step 1 of the plan. Run the tests after
to make sure nothing broke. Then move to step 2."
|
Breaking implementation into explicit steps gives you checkpoints. If something goes wrong at step 3, you don't lose steps 1 and 2.
|
Phase 4: Commit
"Commit these changes and create a PR. Update the
README with the new OAuth2 configuration steps."
|
Claude understands "PR" as shorthand and will generate appropriate commit messages based on the diff and surrounding context. Many Anthropic engineers use Claude for 90%+ of their git interactions.
|
4. Slash Commands: Automate Your Patterns
If you find yourself typing the same kind of prompt repeatedly—"fix this GitHub issue", "review this PR", "run the full test suite and fix failures"—slash commands let you save those patterns as reusable templates.
Create a markdown file in .claude/commands/ and it becomes available as a /command-name in your sessions. Use $ARGUMENTS to pass in parameters.
|
.claude/commands/fix-issue.md
Analyze and fix GitHub issue #$ARGUMENTS.
1. Run `gh issue view $ARGUMENTS` to get details
2. Search the codebase for relevant files
3. Think hard about the root cause
4. Implement a fix
5. Write a test that would have caught this
6. Run the test suite to verify nothing broke
7. Commit with a descriptive message
8. Create a PR linking to the issue
|
Usage: /fix-issue 1234
|
.claude/commands/review.md
Review the code changes in my current branch.
Check for:
- Logic errors and edge cases
- Security issues (auth, injection, validation)
- Performance problems (N+1 queries, missing indexes)
- Missing error handling
- Code that violates our style guide
- Opportunities to simplify
Be direct about problems. Skip the praise.
|
Usage: /review
Two locations for commands:
.claude/commands/ — Project-specific. Check into git so your team can use them.
~/.claude/commands/ — Personal. Available in all your projects.
|
The Pattern Behind the Patterns
If there's one theme across all of these techniques, it's this: Claude Code rewards explicitness. Tell it what phase you're in. Tell it how hard to think. Tell it what conventions to follow. Tell it not to write code when you just want research.
The flexibility that makes Claude Code powerful is the same flexibility that requires you to be deliberate about how you use it.
Next week: Multi-Claude workflows, headless mode for CI/CD, and context management techniques.
|
|
Thanks for reading Research Audio.
Reply with your Claude Code workflows—I'll feature the best ones.
|
|