Chapter 10
Pro Tips and Shortcuts
You've reached the chapter that closes the core track. You already know how to install, ask, build, fix, save to Git and deploy. This chapter is about the next layer: the small habits that separate someone who uses Claude Code from someone who works with it like a pro.
Part 1: Saving tokens and costs
How it works: why a long conversation is "expensive"
A token is the unit of measurement for language models: roughly a piece of a word. Everything Claude reads or writes is measured in tokens, and that's what determines the cost (on a Console account) or how fast you reach your usage limit (on a subscription).
The key point: with every message, Claude Code sends the model the whole conversation from the start, including every file read and every command output. A short question in a conversation that's been open for three hours "costs" much more than the same question in a new conversation. Claude Code uses a caching mechanism (prompt caching) that makes repeating the same content cheaper, but still: a short, focused conversation is a cheap conversation.
See where the tokens go
| Command | What it shows |
|---|---|
/usage | Your usage: on a subscription, how much of your usage limit is used. On Console, an estimated cost for the session. It also includes saving tips |
/context | What's filling the context window right now: the conversation, CLAUDE.md, tools, files |
/insights | A report on how you work: where there's friction, and what you can improve |
Ten habits that save
/clearbetween unrelated tasks. It's free, and it's the biggest saving. Done with the design and moving on to a bug? New conversation./renamebefore/clear. Give the conversation a name, for example/rename home-page-design, and you can find it later with/resume./compactwith an instruction, in the middle of a long task. Instead of waiting for the automatic summary, compact at a natural stopping point, and say what to keep:
/compact keep the plan, the list of files we changed, and the bug we haven't solved yet- Specific requests. "Improve the project" makes Claude scan everything. "Add validation to the email field in ContactForm.tsx" reads one file.
@fileinstead of "find where". A direct reference saves searching the whole project.- Plan mode for big tasks. A wrong plan discovered at the planning stage costs a few messages. A wrong plan discovered after execution costs everything twice.
- An early
Esc. See a wrong direction? Stop immediately, instead of waiting for it to finish and then fixing. - The right model for the task. With
/modelyou can choose a model. A stronger model is good for complex decisions, and a lighter model is enough for simple tasks and costs less. With/effortyou can also lower the effort level (how much it "thinks") for simple tasks. - Subagents for "noisy" work. Running tests, reading long logs or searching many files: "Use a subagent to..." keeps the long output out of the main conversation.
/btwfor side questions. A small question unrelated to the task, like "wait, what's useEffect?", doesn't need to stay in the conversation. The answer to/btwdoesn't enter the history.
What about .claudeignore?
Online you can find advice to create a .claudeignore file so Claude "won't see" certain files, like .gitignore.
Here's the right way. This file blocks Claude from reading secret files and large folders there's no reason to read:
{
"permissions": {
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Read(./data/backups/**)"
]
}
}Saving habits
0 of 5
Part 2: CLAUDE.md at a pro level
In chapter 4 we learned the basics: CLAUDE.md loads in every conversation, should be short and specific, and is created with /init. Now let's upgrade.
Hierarchy: which CLAUDE.md loads when
| File | Applies to | Loaded |
|---|---|---|
~/.claude/CLAUDE.md | You, in all projects | In every conversation |
CLAUDE.md at the project root | The project, and everyone working on it | In every conversation in the project |
CLAUDE.local.md at the project root | Only you, only in this project (add it to .gitignore) | In every conversation in the project |
CLAUDE.md in a subfolder, e.g. app/admin/ | Only that part of the project | When Claude works on files in that folder |
.claude/rules/*.md | One topic, or a certain kind of file | Always, or only when matching files are touched |
Rule 1: personal preferences once, for all projects
Things that are true for all your projects go in ~/.claude/CLAUDE.md, and you can forget about them:
# Personal preferences
- Answer in plain, simple language. Explain technical terms briefly the first time.
- Before a change that touches more than three files, show a plan and wait for approval.
- Git messages: a short first line describing what and why.
- Never git push --force, and never push directly to main.Rule 2: rules by file type (.claude/rules/)
In a large project, some rules are relevant only to some files. Instead of bloating CLAUDE.md, put them in separate files in the .claude/rules/ folder. With the paths field, the rule loads only when Claude works on matching files, saving space the rest of the time:
---
paths:
- "components/**/*.tsx"
---
# Component rules
- Each component in its own file, with the file name matching the component name (RecipeCard.tsx).
- Buttons always have text, not just an icon.
- Minimum text size: 18 pixels.
- User-facing text: plain language, no jargon.---
paths:
- "lib/recipes.ts"
- "data/**"
---
# Recipe data rules
- Each ingredient: quantity (a number), unit and name, in separate fields.
- Don't delete existing recipes. If needed, ask.Rule 3: importing files with @
Instead of copying documents into CLAUDE.md, reference them. Claude Code loads them together with CLAUDE.md:
# The family recipe site
## Background material
@sources/references.md
@docs/design-guidelines.mdRule 4: compaction instructions
When Claude Code summarizes a conversation, with /compact or automatically, some details get lost. You can tell it in advance what's important to keep:
# Compaction instructions
When you summarize the conversation, always keep:
- The list of all files we changed
- The commands for checking (npm run build and any other check we ran)
- Any bug that hasn't been solved yetRule 5: emphasis, sparingly
If Claude keeps missing one important rule, you can emphasize that one only:
- IMPORTANT: Don't delete files from the data folder without explicit approval.If you emphasize ten rules, none of them stands out. And if Claude misses many rules, the problem is probably the file's size: it's too long, and the important rules get lost.
Rule 6: long processes are skills, not rules
CLAUDE.md always loads. A ten-step process you need once a week, like "add a new recipe", takes up space in every conversation, even when you don't need it. That's what skills are for: instructions that load only when needed.
---
name: new-recipe
description: Add a new recipe to the site from free text or a photo of a recipe
---
1. Break the recipe into name, category, prep time, servings, ingredients (quantity, unit, name) and steps.
2. Show me the parsed recipe and wait for approval.
3. Add it to lib/recipes.ts, with a slug.
4. Run npm run build and make sure it passes.
5. Commit to git with the message "Add recipe: <recipe name>".Now, every time you paste a recipe and write "add this recipe", Claude recognizes that the skill is relevant and follows it. You can also invoke it directly: /new-recipe. In chapter 11 we'll dive deep into skills: arguments, injecting live data, permissions and community skills.
Rule 7: ongoing maintenance
/memory: opens the CLAUDE.md files for editing, and also shows auto memory: notes Claude keeps for itself from your corrections and preferences./doctor prompt-audit: Claude goes through all the instruction files and looks for outdated rules, contradictions and references to files that no longer exist. It shows findings and changes nothing until you ask.- The line test: for each line ask, "if I delete it, will Claude make a mistake?". If not, delete it. The official recommendation is under 200 lines.
Upgrading CLAUDE.md
0 of 6
Part 3: MCP, connecting Claude to the world
What is MCP?
MCP (Model Context Protocol) is an open standard that lets you connect Claude Code to external tools and data sources: Notion, Google Drive, databases, task management systems and more. Think of it as a USB-C port for AI: one standard connection that lots of different tools can plug into.
Each such tool is called an MCP server. Once you connect a server, Claude can use it in the conversation, for example to read a page from Notion or ask the database a question.
Before connecting: maybe you don't need to
Connecting a server: a Notion example
Say grandma wrote all her recipes on a page in Notion. Instead of copying them one by one, we'll connect Claude to Notion.
1. Add the server, in a regular terminal:
claude mcp add --transport http notion https://mcp.notion.com/mcp2. Sign in. Inside Claude Code run /mcp, choose notion, and follow the instructions in the browser to grant access:
/mcp3. Use it:
Read the “Grandma's Recipes” page in Notion, and add every recipe there that we don't have yet to lib/recipes.ts, following the rules in CLAUDE.md. Before adding, show me a list of what you found
Two kinds of servers
| Kind | How to add | Example |
|---|---|---|
| Remote (HTTP): a cloud service | claude mcp add --transport http <name> <url> | Notion, Sentry, GitHub |
| Local (stdio): a program running on your machine | claude mcp add <name> -- <command> | A connection to a local database |
For a local server, everything after -- is the command that starts the server. Environment variables, like keys, are passed with --env:
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-serverManaging servers
claude mcp list # all servers, and whether they're connected
claude mcp get notion # details about one server
claude mcp remove notion # remove a serverScope: who is the server available to?
| Scope | The flag | For whom | Where it's saved |
|---|---|---|---|
| Local (default) | --scope local | Only you, only in this project | In your personal settings |
| Project | --scope project | Everyone working on the project | .mcp.json at the project root, saved in Git |
| User | --scope user | Only you, in all projects | In your personal settings |
MCP
0 of 5
Part 4: Pro shortcuts
| Shortcut | What it does |
|---|---|
claude -c | Continues the last conversation in the folder |
claude -r or /resume | Pick an earlier conversation from a list |
/rename <name> | Give the conversation a name, to find it later |
Shift + Tab | Switch permission mode: manual, accept edits, plan, auto |
/plan <task> | Go straight into plan mode with a task |
@file | Attach a file to the request |
!command | Run a terminal command, and the output goes into the conversation |
Esc / Esc twice | Stop / go back to an earlier point |
↑ | Earlier messages you wrote |
Ctrl + V (on Windows: Alt + V) | Paste an image |
/btw <question> | A side question that doesn't stay in the conversation |
/diff | All changes in the folder |
/code-review | A code review of the changes |
/model and /effort | Choose a model and effort level |
/usage and /context | Usage, costs, and what's taking up space |
/ | A list of all commands. Type letters to filter |
Part 5: Course recap
What we learned, chapter by chapter
- 1Meet Claude CodeClaude Code is an agent that acts, not just recommends. You're the manager, it's the hands.
- 2Installation & SetupOne install command, sign in with a subscription, and fixing PATH and execution policy issues.
- 3Your First Session & Basic CommandsGo into the folder and run claude. Read every approval prompt, and know /clear, /compact and /rewind.
- 4How to Ask WellThe golden rule: specificity, context, step by step and verification. Standing rules go in CLAUDE.md.
- 5Joining Forces: Cursor + Claude CodeCursor is the eyes, Claude the hands. Save before you send, and select instead of describing.
- 6First Hands-On Project: A Site From ScratchA complete project in four steps: set up, build in layers, improve from feedback, check.
- 7Finding & Fixing BugsInvestigate first, then fix the root cause, no cover-ups. Esc, /rewind and git revert to go back.
- 8Version Control, Git & GitHubA branch per feature, a PR with review, and four layers of protection against force push.
- 9Going Live on VercelGitHub connected to Vercel: every push to main deploys. Environment variables, domain, and rollback.
- 10Pro Tips & Shortcuts/clear between tasks, a short CLAUDE.md with rules and skills, and MCP only from known sources.
The big checklist
Check off what you've already done yourself. Whatever isn't checked is exactly what to practice:
From Zero to Hero
0 of 12
Where to go from here
The next project: a database for the recipe site
Remember the add-recipe form from chapter 6, which only worked on your computer? The natural upgrade is a real database, so the whole family can add recipes directly from the live site. It's a great project for practicing everything you learned: planning, a branch, building in layers, review, and a Vercel preview before merging.
/plan I want the site's recipes to be saved in a real database instead of a file, so the add form also works on the live site on Vercel. Suggest two or three database options that connect easily to Vercel and suit a small project, with pros, cons and costs in plain language. After I choose, prepare a plan in small steps: each step in its own branch, with a way to check it
More project ideas
- A landing page for a family member's business, with a contact form.
- A family photo album with search by year and event.
- A small tool that saves manual work: organizing files, merging spreadsheets, renaming photos.
- A personal portfolio, with the projects you built in the course.
Further resources
| Resource | Why |
|---|---|
| The official Claude Code docs | The most accurate, up-to-date source for every command and capability |
| Claude Academy | Free self-paced courses, including Claude Code 101 |
/powerup inside Claude Code | Interactive lessons with demos |
| claudehero.com, zero2claude.dev | Community guides and exercises |
| The claude-world complete guide | A comprehensive overview of advanced techniques |
Thanks for learning with us
You started without knowing what a terminal is. Now you have a live site, a project on GitHub, and the tools to build almost any idea that comes to mind.
From Zero to Hero. 🎉
Check yourself
1. What does .claudeignore do?
2. What's the biggest token saving?
Answering every quiz question marks the chapter as done automatically.