25 Claude Code Tips, Tricks and Hidden Features Every Developer Should Know
TL;DR: Twenty five specific, actionable Claude Code techniques covering CLAUDE.md project files, custom slash commands, MCP server setup, multi file editing patterns, git integration, cost optimization, and context management. These are the features most developers miss entirely.
How to Actually Get Value From Claude Code
Claude Code is not a chatbot you use for advice. It is a terminal based agent that reads your codebase, writes code, runs tests, commits changes, and iterates based on results. The developers who get the most from it treat it that way: they configure it properly, learn the commands, and build workflows around it. Use the AI Readiness Assessment to identify which parts of your workflow are good candidates for Claude Code before reconfiguring your entire development setup.
These 25 tips cover the features that have the biggest impact on daily productivity. Some are in the official documentation but easy to miss. Others are patterns that emerge only after extended use. All of them are specific enough to implement today. If you want to combine these tips with structured plugin capabilities for MVP development, the Claude Code TDD workflow guide shows how to layer discipline on top of these efficiency patterns.
For background on what Claude Code is and how it compares to other AI coding tools, see the complete Claude Code guide first. For use in building full products, the Claude Code for MVP development guide covers end to end workflows.
CLAUDE.md Project Files
Tip 1: Write a Project CLAUDE.md on Day One
Create a CLAUDE.md file in the root of every project you use Claude Code on. This file is injected as the system prompt for every session in that directory. If you skip it, Claude Code has to rediscover your project conventions with every new conversation.
A minimal but effective CLAUDE.md:
# Project: MyApp API
## Stack
- Runtime: Node.js 22, TypeScript 5.4
- Framework: Hono
- Database: PostgreSQL + Drizzle ORM
- Package manager: pnpm
## Conventions
- All files use named exports, no default exports
- Error handling: throw typed errors, never return null for failures
- Tests: Vitest, files in __tests__ adjacent to source
- Migrations: run `pnpm db:generate` then `pnpm db:migrate`
## Commands
- Dev server: pnpm dev
- Tests: pnpm test
- Type check: pnpm typecheck
- Build: pnpm build
Tip 2: Use @file References in CLAUDE.md
CLAUDE.md supports @filename includes. Reference your schema file, API types, or any file that gives critical context:
## Database Schema
@src/db/schema.ts
## API Types
@src/types/api.ts
The referenced files are injected at session start. Use this sparingly for files that change rarely and are genuinely needed for most tasks. Do not reference your entire codebase or you will blow the context budget before writing a single line.
Tip 3: Override CLAUDE.md Behavior Inline
You can override CLAUDE.md instructions in the chat without editing the file. Useful for one-off exceptions: "For this task only, use JavaScript instead of TypeScript." The override applies only to the current session.
Tip 4: Maintain a Global CLAUDE.md
The file at ~/.claude/CLAUDE.md applies to every project. Use it for cross-project preferences: your name, preferred code style, tools you always have available, things you never want Claude Code to do.
# Global Preferences
- Author: HouseofMVPs
- Git commits: always use conventional commit format (feat:, fix:, chore:, etc.)
- Never use default exports
- Always add JSDoc to public functions
- Never run git push without asking first
Custom Slash Commands
Tip 5: Build a /review Command
Custom slash commands live in .claude/commands/. Each is a markdown file containing a prompt template. Create .claude/commands/review.md:
Review the changes I have staged in git. For each changed file:
1. Check for potential bugs or edge cases I missed
2. Flag any security issues (injection, auth bypass, data exposure)
3. Note any obvious performance problems
4. Check that error paths are handled
5. Confirm the changes match the task I described
Do not nitpick style unless it violates our CLAUDE.md conventions. Focus on correctness and security.
Run it with /review. It will execute the staged diff analysis every time.
Tip 6: Create a /ship Command for Common Workflows
# .claude/commands/ship.md
Run the full pre-ship checklist:
1. pnpm typecheck — fix any type errors before continuing
2. pnpm test — fix any failing tests before continuing
3. pnpm build — confirm the build succeeds
4. Show me a summary of what changed (git diff --stat HEAD)
5. If all checks pass, create a conventional commit with an appropriate message
Tip 7: Use $ARGUMENTS in Command Templates
Slash commands support $ARGUMENTS to pass dynamic input:
# .claude/commands/explain.md
Explain the file or function: $ARGUMENTS
Cover:
- What it does
- What inputs it expects and what it returns
- Any side effects or external dependencies
- Potential failure modes
Use it as /explain src/lib/auth.ts or /explain the handleWebhook function.
MCP Server Setup
Tip 8: Connect Your Database With MCP
The Postgres MCP server lets Claude Code query your database schema and run read only queries during development:
// .claude/mcp.json
{
"mcpServers": {
"postgres": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
}
}
}
Now you can ask Claude Code to "look at the users table and write a query for all users who signed up in the last 30 days" without pasting the schema manually.
Tip 9: Add a GitHub MCP Server for Issue Context
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
With this connected, you can say "look at issue #42 and implement the requested changes" and Claude Code will fetch the issue description directly.
Tip 10: Use the Filesystem MCP Server for Scoped Access
The filesystem MCP server lets you grant Claude Code access to specific directories outside your current project, while keeping other paths off limits. Useful for monorepos where you want access to shared packages:
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/you/myapp/packages/shared",
"/Users/you/myapp/packages/types"
]
}
}
}
For more on MCP architecture, see the MCP model context protocol guide.
Multi File Editing Patterns
Tip 11: Describe the Goal, Not the Files
New Claude Code users tend to say "edit auth.ts to add the refresh token logic." Experienced users say "implement refresh token support end to end." The second prompt lets Claude Code decide which files need changing (auth.ts, the route handler, the type definitions, the tests) without you having to enumerate them.
Tip 12: Use "Do Not Touch" Constraints
When you want Claude Code to stay focused, add explicit scope constraints: "Implement the new user invitation flow. Do not modify any existing tests. Do not change the database schema." This prevents well-intentioned refactoring that breaks things outside your current change.
Tip 13: Ask for a Plan Before Execution on Complex Tasks
For any task touching more than five files, ask for a plan first: "What files will you need to change and why? List them before making any edits." Review the list, adjust if needed, then say "go ahead." This catches misunderstandings before they create a messy diff.
Tip 14: Work in Feature Branches
Before starting any significant change with Claude Code, create a feature branch. If the result is not what you wanted, git checkout . gets you back to clean state instantly. Claude Code working in main directly is a pattern that will eventually cost you real work.
Git Integration Tricks
Tip 15: Let Claude Code Write Commit Messages
Claude Code writes better conventional commit messages than most developers do in a hurry. After completing a feature, just say "commit this with an appropriate message." It reads the diff, understands what changed, and writes a commit message that actually describes the change.
Tip 16: Use git stash as a Checkpoint System
When exploring multiple approaches with Claude Code, use git stash as cheap checkpoints. Ask Claude Code to implement approach A, stash it, implement approach B, then compare the two stashes before deciding which to keep. Claude Code handles the stash commands if you ask it to.
Tip 17: Ask Claude Code to Explain the Diff Before Committing
Before any commit, run: "Show me git diff --staged and explain in plain English what these changes do." This serves as a forced review step and often catches things that look right syntactically but miss the actual intent.
Cost Optimization
Tip 18: Use /compact Aggressively
When a session is running long, /compact compresses the conversation history to a dense summary and frees up context window space. It preserves the important context (what you built, decisions made, current state) while discarding the back and forth dialogue. Most developers wait too long to use this. Run it proactively after finishing each logical chunk of a session.
Tip 19: Create a .claudeignore File
By default, Claude Code indexes your entire project directory. For most projects this includes node_modules, build outputs, and generated files that add zero value to the context.
# .claudeignore
node_modules/
dist/
.next/
coverage/
*.log
*.lock
Excluding these reduces the tokens spent on directory traversal and makes codebase search results more relevant.
Tip 20: Batch Related Changes Into Single Prompts
"Add input validation to the user registration endpoint, add matching tests, and update the API documentation" costs roughly the same as three separate prompts but gives Claude Code the full picture to make coherent decisions. Fragmented prompts lead to fragmented code.
Tip 21: Use Haiku for Simple Tasks
Claude Code lets you switch models mid session. For simple tasks (renaming variables, adding comments, generating boilerplate), switch to Haiku: it is an order of magnitude cheaper and faster than Sonnet for tasks that do not require reasoning.
/model claude-haiku-4-5
Switch back to Sonnet for complex logic.
Context Management
Tip 22: Start Sessions With a Context Primer
At the beginning of a new session, give Claude Code a one paragraph context dump: what project you are working on, what you were doing last time, what you are trying to accomplish today. This takes 30 seconds and prevents the first few exchanges from being purely orientation.
Tip 23: Pin Important Facts With "Remember That"
Claude Code tracks information you explicitly flag during a session. Saying "remember that the production database uses UTC timestamps but the frontend displays in Pacific time" adds this to session context and means you do not have to repeat it. These session level memories persist for the duration of the conversation.
Tip 24: Use /clear When Switching Tasks Completely
Residual context from a previous task can confuse Claude Code when you start something new. If you finished implementing authentication and now want to build the billing integration, /clear starts fresh. The alternative is Claude Code making decisions based on context from the previous task that is no longer relevant.
Tip 25: Ask Claude Code to Summarize Its Own Understanding
At the start of a complex task or after giving detailed requirements, ask: "Summarize your understanding of what I want you to build before you start." This is the single most reliable way to catch misunderstandings before they become wrong code. If the summary is off, correct it. If it is right, you have both confirmed alignment and created useful documentation.
Building Better Habits
These tips compound. The developers who consistently get the most from Claude Code are not the ones using the most advanced features. They are the ones who have good CLAUDE.md files, run /compact before context fills up, batch related changes together, and check Claude Code's understanding before it writes anything complex.
Start with tips 1, 8, 14, and 25. Get those habits locked in before layering on the rest. The return on each individual tip is modest. The return on all 25 working together is significant. Understanding what MCP is before configuring Tip 8 saves significant trial and error in the server setup process.
For workflows that go beyond individual tips into full product development pipelines, see building AI agents with OpenClaw and the multi agent systems practical guide.
Build With an AI-Native Agency
Free: 14-Day AI MVP Checklist
The exact checklist we use to ship production-ready MVPs in 2 weeks. Enter your email to download.
Claude Code Shortcuts and Commands Reference
A printable one page reference covering all slash commands, keyboard shortcuts, and CLAUDE.md directives.
Frequently Asked Questions
Frequently Asked Questions
Free Estimate in 2 Minutes
Already know your scope? Book a Fixed-Price Scope Review
