Claude Code Usage Guide: Commands, Configuration, and Practical Workflows

A practical guide to using Claude Code — basic commands, configuration through CLAUDE.md, CLI tips, and real-world workflows — drawn from hands-on experience adopting agentic coding as a standard development approach.
代表 / エンジニア
You've installed Claude Code, but aren't quite sure how to actually use it — or you've been overwhelmed by the number of commands. That's a common place to be.
Claude Code is conceptually simple: give it natural-language instructions and it runs. But knowing the tricks of how to use it makes a huge difference in productivity. This article lays out what you need to know — from basic commands to CLAUDE.md configuration to real workflows — to use Claude Code effectively.
I myself use Claude Code every day, having adopted agentic coding (a development style that hands primary authorship to the AI) as my standard approach. What follows is the practical know-how, with concrete examples.
For an overview of Claude Code and installation, see What Is Claude Code? The Complete Guide.
Claude Code Commands at a Glance
Launching and Exiting
# Launch from the project root
cd my-project
claude
# Resume the most recent conversation
claude --continue
# Pick from past conversations to resume
claude --resume
# Non-interactive mode (for scripts and CI/CD)
claude -p "Explain the structure of this project"Claude Code recognizes the current directory as the project root. Always launch from the project root. Launching from a subdirectory prevents it from understanding the whole project structure.
Slash Commands Reference
Slash commands available after launch, organized by function.
Session management
| Command | Function | Frequency |
|---|---|---|
/clear | Reset the conversation and start a new session | High |
/compact | Summarize the conversation to compress context | High |
/compact <instruction> | Compress focused on the specified content | Medium |
/rewind | Roll back the conversation and code to an earlier point | Medium |
/btw <question> | Side question (doesn't persist in context) | Medium |
Information and configuration
| Command | Function | Frequency |
|---|---|---|
/help | Display help | Low |
/config | Open settings | Low |
/cost | Show the current session's token usage | Medium |
/doctor | Detect environment configuration issues | Low |
/model | Switch the model being used | Medium |
/permissions | Manage permission settings | Low |
Workflow
| Command | Function | Frequency |
|---|---|---|
/exit | Exit Claude Code (Ctrl+C also works) | High |
/rename <name> | Name the session | Medium |
/init | Auto-generate CLAUDE.md | Low |
/hooks | List configured Hooks | Low |
/sandbox | Configure the sandbox (isolated environment) | Low |
Examples of model switching:
/model sonnet → Switch to Sonnet 4.6 (day-to-day coding)
/model opus → Switch to Opus 4.6 (complex reasoning, design decisions)
/model haiku → Switch to Haiku 4.5 (simple, high-volume tasks)How I choose: Sonnet for normal implementation work, Opus for architectural decisions or security reviews, Haiku for mechanical operations like bulk formatting.
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Esc | Interrupt Claude's execution (context preserved) |
Esc × 2 | Open the rewind menu |
Ctrl+C | Exit Claude Code |
Ctrl+G | Open the Plan Mode plan in an editor |
The Esc key is the single most important shortcut. When Claude is clearly heading in the wrong direction, interrupting immediately and giving feedback prevents wasted context.
Configuring Development Rules with CLAUDE.md
CLAUDE.md is a configuration file Claude Code automatically loads at session start. Writing project-specific rules here eliminates the need to re-explain them each time.
Where CLAUDE.md Lives
| Location | Scope | Use |
|---|---|---|
~/.claude/CLAUDE.md | All projects | Language settings, common coding rules |
./CLAUDE.md | Current project (recommended for git) | Project-specific rules |
./CLAUDE.local.md | Current project (recommended for .gitignore) | Personal notes and settings |
| Parent directories | Shared rules across a monorepo | Both root/CLAUDE.md and root/app/CLAUDE.md apply |
Writing an Effective CLAUDE.md
Good example (specific, covers what Claude can't infer):
# CLAUDE.md
## Build and Test
- Run tests: npm test (Vitest)
- Type check: npx tsc --noEmit
- Linter: npm run lint
## Coding Rules
- Respond in English
- Commit using Conventional Commits format
- Write tests with Vitest. Do not use Jest
- Style with Tailwind CSS. No inline style
## Prohibitions
- Do not run next build (use next dev for dev verification)
- Do not read .env file contents
- Do not run supabase db resetBad example (self-evident, things Claude already knows):
# These are unnecessary
- Write clean code (← self-evident)
- Use meaningful variable names (← standard practice)
- Don't forget error handling (← too general)
- src/components/Header.tsx is the header component (← obvious from the code)An important rule: An overly long CLAUDE.md causes Claude to miss important rules. For each line, ask yourself "If I removed this, would Claude make a mistake?" — and delete lines that don't pass that test.
Auto-Generate with /init
When introducing CLAUDE.md to an existing project for the first time, /init is handy.
> /init
It analyzes your package.json, config files, and directory structure to auto-detect build commands, test frameworks, and coding patterns, generating a starting CLAUDE.md. The most efficient approach is to treat that as a base, then add what's missing and remove what's not needed.
For global CLAUDE.md usage, see How to Unify Your Dev Experience with a Global CLAUDE.md.
Using Slash Commands
/clear — The Most Important Command
/clear is the single most important command for using Claude Code well.
Claude Code's performance is proportional to the amount of context window remaining. In long conversations, old file contents and failed approaches accumulate in context, degrading response quality.
Run /clear whenever the task changes — this alone dramatically improves your experience.
> Bug fix complete. Next, let's write tests.
> /clear
> Write tests for the login function in src/auth.ts. Include edge cases./compact — The Lifesaver for Long Sessions
When you've had a long conversation focused on a single task, /compact summarizes the conversation and reclaims context.
> /compact Focus on the API change portion
Adding an instruction lets you control what's retained. In my CLAUDE.md I include: "when compacting, always preserve the list of changed files and the test commands."
/rewind — The Undo Card
If Claude has implemented something but gone in the wrong direction, /rewind rolls back both the code and the conversation.
> /rewind
# → A list of checkpoints is displayed
# → Pick the point to revert to
# → Choose: conversation only / code only / bothPressing Esc twice opens the same menu. Knowing "I can go back if it doesn't work out" makes it easier to try bolder approaches.
/btw — Side Questions That Don't Pollute Context
When a small question comes up mid-work, asking it as a normal prompt leaves it in context. /btw displays the answer in an overlay that doesn't persist in conversation history.
> /btw What's the difference between TypeScript's Record and Map types?
Using Claude Code in English (or Any Language)
Claude Code handles prompts in any language. That said, a few settings make the experience smoother.
Adding Language Settings to Global CLAUDE.md
# ~/.claude/CLAUDE.md
## Response
- Respond in English
## Commit Messages
- Write commit messages in EnglishWithout this, Claude may respond in English for some requests and Japanese for others, or mix the two languages.
Tips for Writing Prompts
Instructions to Claude Code work in any language, but a few principles improve accuracy.
Keep technical terms in their original form:
✓ "Add rate limiting to the login function in src/auth.ts"
✗ "Add request throttling to the sign-in method somewhere in auth"Keep file paths, function names, and technical concepts in their canonical form — it helps Claude search and understand the codebase accurately.
Avoid vague language:
✓ "Add an email duplication check to the createUser method on UserService class.
Throw ConflictError (409) on duplicates. Write tests as well."
✗ "Make the user registration part work better"Proceed in stages:
Stepping through design → implementation → tests → review produces better results than one mega-instruction.
> Read the auth-related code in this project and explain the current state (Plan Mode)
> Draft a plan for adding Google OAuth login (Plan Mode)
> Implement per the plan. Write tests too. (Normal Mode)
> Run the tests and fix any that fail.Writing Effective Prompts
Convey the Validation Method Alongside
The single most impactful technique for raising Claude Code's output quality: include the validation method in the instruction.
✓ "Implement the validateEmail function. Test cases:
user@example.com → true, invalid → false, user@.com → false.
After implementation, run the tests to confirm."
✗ "Write a function that validates email addresses"Give Claude a way to check its own work (tests, screenshots, build commands), and it autonomously runs the feedback loop and improves quality.
Point at Existing Patterns
Referencing patterns that already exist in the codebase produces consistent implementations.
> Following the implementation pattern of HotDogWidget.php, create a new CalendarWidget.
> Include month selection and pagination (prev/next month).
> Do not add external libraries. Build it using only existing dependencies.Separate Investigation from Implementation Using Plan Mode
In Plan Mode (Ctrl+G opens the plan in an editor), Claude reads files and builds a plan without making code changes.
# Plan Mode
> Read the code under src/auth/ and explain how session management works.
> What needs to change to add Google OAuth? Draft a plan.
# Normal Mode (toggle with Ctrl+G)
> Implement per the plan above. Write tests too.When Plan Mode is useful:
- Working in an unfamiliar codebase
- Changes spanning multiple files
- When the approach is uncertain
When Plan Mode is unnecessary:
- The change is obvious (typo fixes, adding logging)
- Simple changes whose diff can be described in one sentence
Delegate Investigation to Subagents
Investigating a codebase consumes a lot of context. Delegating to a subagent lets investigation happen in a separate context window, leaving your main conversation clean.
> Use a subagent to investigate the token refresh mechanism in the auth system,
> and whether any existing OAuth utilities are available.Real-World Workflow Examples
Workflow 1: Bug Fix (15 minutes)
cd my-project
claude> Production is throwing this error:
> [paste error log]
> Find the cause and fix it. Write a test that verifies the fix.Claude analyzes the error log → explores related code → identifies the cause → fixes it → writes tests → runs tests — autonomously.
> /cost
# → Check token usage
> Commit the changes. Use Conventional Commits format.Workflow 2: New Feature Implementation (1-2 hours)
# Investigation phase (Plan Mode)
> Look up Issue #42's spec. Use gh issue view 42.
> Read the existing code and draft an implementation plan.
# Implementation phase (Normal Mode)
> Implement per the plan. Write tests too.
# Verification phase
> Run all tests. Fix any failures.
> Run the linter and type checker too.
# Commit
> Commit the changes and open a PR.Workflow 3: Large-Scale Refactor (half day)
# Session 1: Investigation
> List the JavaScript files under src/legacy/.
> Propose a priority order for TypeScript conversion, starting with those that have fewest dependencies.
> /clear
# Sessions 2-N: Implementation, one file at a time
> Convert src/legacy/utils.js to TypeScript. Use strict mode.
> Update tests if they exist, or create them if not.
> /clear
# Final session: Integration check
> Run type-check against all converted files.
> Run all tests.For large work, the trick is to break sessions up finely with /clear. Keeping to the one-task-per-session principle prevents context bloat.
Workflow 4: Code Review
> Review git diff main...HEAD from these perspectives:
> - Logical correctness
> - Edge-case handling
> - Security concerns
> - Performance impact
> - Consistency with existing codeAs a Writer/Reviewer pattern, running review in a different session from implementation removes the implementer's bias and yields more objective reviews.
Workflow 5: Non-Interactive Mode (CI/CD)
# Auto code-review comments on PRs
claude -p "Review git diff main...HEAD. List issues if any." \
--output-format json
# Bulk process many files
for file in $(cat migration-list.txt); do
claude -p "Convert $file from React to Vue." \
--allowedTools "Edit,Bash(git commit *)"
doneThe -p flag enables non-interactive mode, which embeds cleanly in scripts or CI/CD pipelines.
Common Failure Patterns and Countermeasures
Over-Consumed Context
Symptoms: Response quality declines late in a long session, instructions get forgotten
Countermeasure: /clear every time the task changes. If you've iterated on a fix more than twice, /clear and start over.
Vague Instructions
Symptoms: Claude produces off-target implementations
Countermeasure: Provide specific file paths, function names, and expected behaviors. Reference existing patterns with @.
CLAUDE.md Bloat
Symptoms: Claude ignores rules you've written in CLAUDE.md
Countermeasure: Periodically review CLAUDE.md and remove unnecessary lines. Emphasize important rules with "IMPORTANT."
Implementation Without Verification
Symptoms: Code that looks right but breaks on edge cases
Countermeasure: Always include validation methods in your instructions — running tests, checking builds, comparing screenshots.
Summary
The most important points of using Claude Code:
| Category | Key takeaway |
|---|---|
| Context management | Run /clear between tasks. Context hygiene determines quality |
| CLAUDE.md | Write only "what Claude would get wrong without this." Keep it short |
| Prompts | Always include the validation method. Reference existing patterns |
| Language | Set "respond in [language]" in global CLAUDE.md |
| Workflow | Make Plan Mode → implementation → tests → commit your default flow |
| Failure response | After two failed correction attempts, /clear and start fresh |
With Claude Code, "how to collaborate with the AI" matters more than "how to use the tool." Get the instruction style, context management, and verification mechanisms right, and Claude Code becomes a partner that multiplies development productivity.
For more advanced usage, see VSCode integration, MCP integration, and Automating Dev Workflows with Skills.
At aduce Inc., we offer comprehensive IT advisory support — from Claude Code training to building out development processes that leverage agentic coding. If you're planning to adopt Claude Code in your team but worried about getting the usage to stick, feel free to reach out via Contact.