Claude Code is a deep tool with a wide surface area. You can interact with it conversationally, but knowing the specific commands and patterns that unlock its full potential makes a significant difference in how productive you are. If you are just getting started, these are the ten commands and techniques that I reach for most often. Each one addresses a common development need and will save you time from day one.
1. The Single Prompt Flag
The -p flag runs a single prompt without entering the interactive session. This is invaluable for quick tasks and scripting.
claude -p "What does the handleAuth function in src/auth.ts do?"
This reads the file, analyzes the function, and prints the answer to stdout. You can pipe this into other tools or use it in shell scripts. It turns Claude Code into a command-line utility for code analysis.
A practical use case is generating commit messages:
claude -p "Write a conventional commit message for the current staged changes"
2. Resume Your Last Session
Context is expensive to rebuild. When you need to continue where you left off, the --continue flag resumes your most recent conversation with all context intact.
claude --continue
This is particularly useful after taking a break or switching between tasks. Your previous conversation, including all the files Claude Code read and the decisions made, is preserved.
3. Codebase Exploration
When working with an unfamiliar project or a part of the codebase you rarely touch, start with exploration prompts. These are not commands in the traditional sense but patterns that leverage Claude Code’s ability to search and analyze.
> Explain the architecture of this project. What are the main modules and how do they interact?
> Find all places where the UserService is instantiated and show me the dependency chain
> What database migrations have been added in the last month?
Claude Code will search through files, read relevant code, and synthesize an answer. This is dramatically faster than manually exploring a codebase.
4. The Fix Command Pattern
When you encounter an error, paste it directly into Claude Code. This is one of the most common and highest-value interactions.
> I'm getting this error when running the app:
> TypeError: Cannot read properties of undefined (reading 'map')
> at UserList.vue:42
Claude Code will read the file, understand the context, identify the root cause, and implement a fix. For build errors, test failures, and runtime exceptions, this pattern handles the full cycle from diagnosis to resolution. Learn more about debugging strategies for complex issues.
5. Git Operations
Claude Code integrates deeply with git. You can manage your entire git workflow without leaving the session.
> Commit the current changes with an appropriate message
> Create a new branch called feature/user-settings and switch to it
> Show me what changed in the last 3 commits and whether any of those changes could cause issues
The git integration is context-aware. When you ask for a commit message, Claude Code examines the actual diff and writes a message that describes the changes accurately, not just a generic summary.
6. Test Generation
Generating tests is one of Claude Code’s strongest capabilities. The key is being specific about what you want tested.
> Write unit tests for the PaymentService class covering all public methods, edge cases, and error conditions
> Add integration tests for the /api/orders endpoint testing authentication, validation, and response formats
Claude Code will read the source code, understand the behavior, identify edge cases, and generate tests using whatever testing framework your project uses. It handles imports, mocking, and assertions correctly because it can see your existing test patterns.
7. Code Review Requests
Before opening a pull request, ask Claude Code to review your changes. This catches issues that would otherwise waste your reviewer’s time. Explore comprehensive code review patterns for production environments.
> Review all changes in the current branch compared to main. Check for bugs, security issues, performance problems, and style inconsistencies
Claude Code runs a diff, reads every changed file, and provides a detailed review. It flags real issues, not just style nitpicks. Security vulnerabilities, missing error handling, potential null pointer exceptions, and logic errors are all caught.
8. Refactoring Operations
Refactoring is where Claude Code saves the most time relative to manual effort. Describe the desired end state and let it handle the mechanics.
> Extract the validation logic from the UserController into a separate ValidationService class
> Convert all callback-based async operations in the data layer to use async/await
> Split this 500-line component into smaller, focused components while maintaining all functionality
Claude Code handles file creation, import updates, and ensures all references are updated correctly. It runs across the entire codebase, not just the file you are looking at.
9. Documentation Generation
Writing documentation is tedious. Claude Code generates it accurately because it reads the actual code rather than guessing at behavior.
> Generate JSDoc comments for all exported functions in the utils directory
> Create a README for this project that explains setup, development, and deployment
> Document the API endpoints in server/api/ with request/response examples
The generated documentation reflects your actual implementation, including parameter types, return values, and error conditions.
10. Multi-Step Workflows
For complex tasks, describe the full workflow and let Claude Code execute each step in sequence.
> Create a new API endpoint for user preferences:
> 1. Add the database migration for a preferences table
> 2. Create the model with TypeScript types
> 3. Implement GET and PUT endpoints with validation
> 4. Write tests for both endpoints
> 5. Update the API documentation
Claude Code executes each step in order, maintaining context throughout. The migration references the correct table, the model matches the migration, the endpoints use the model correctly, and the tests cover the actual implementation. Everything stays consistent because it is all done in one contextual session.
Putting It All Together
These commands and patterns cover the core of what makes Claude Code effective. The documentation goes deeper into advanced features, but mastering these ten patterns gives you a foundation that handles the majority of daily development tasks. The common thread across all of them is that Claude Code works best when you give it clear, specific instructions and trust it to handle the implementation details. The more context you provide, the better the results.