ClaudeDetails
UpdatesGuidesModelsMCPToolsLearning PathsFAQ
UpdatesGuidesModelsMCPToolsLearning PathsFAQ

On this page

How do I get an overview of a new codebase?How do I find code related to a specific feature?How do I fix a bug with Claude Code?How do I refactor legacy code safely?How do I add tests for uncovered code?How do I create a pull request with Claude Code?How do I generate documentation for my code?What other workflows does this docs page cover?FAQ
Home/Guides/Claude Code
Claude CodeBEGINNER

Common Claude Code Workflows: Exploring Code, Fixing Bugs, Testing, and PRs

Needs reviewLast verified August 12, 2026·4 min read

This guide walks through the everyday prompt patterns Anthropic documents for Claude Code: getting an overview of an unfamiliar codebase, locating relevant files, fixing bugs from error messages, refactoring legacy code safely, adding tests for uncovered code, creating pull requests, and generating documentation. It also notes related workflows the docs cover, such as resuming sessions, running parallel sessions with worktrees, planning before edits, delegating research to subagents, and piping Claude into scripts.

Claude Code's official documentation collects short recipes for everyday development tasks. The prompt patterns below work in any Claude Code surface — adapt the wording to your own project. The docs also point to a separate Best practices page for higher-level guidance on prompting and context management.

How do I get an overview of a new codebase?

If you've just joined a project, start by navigating to the project root and launching Claude Code:

bash
cd /path/to/project 
bash
claude 

Then ask for a high-level overview:

text
give me an overview of this codebase

From there, dive deeper into specific components:

text
explain the main architecture patterns used here
text
what are the key data models?
text
how is authentication handled?

The docs suggest starting with broad questions, then narrowing down to specific areas. You can also ask about coding conventions used in the project or request a glossary of project-specific terms. For monorepos and large codebases, there's a dedicated docs page on configuration.

How do I find code related to a specific feature?

Ask Claude to locate relevant files, then build context step by step:

text
find the files that handle user authentication
text
how do these authentication files work together?
text
trace the login process from front-end to database

Be specific about what you're looking for and use domain language from the project. The docs also recommend installing a code intelligence plugin for your language to give Claude precise "go to definition" and "find references" navigation.

How do I fix a bug with Claude Code?

When you hit an error, share it with Claude, ask for fix recommendations, then apply the fix:

text
I'm seeing an error when I run npm test
text
suggest a few ways to fix the @ts-ignore in user.ts
text
update user.ts to add the null check you suggested

Tips from the docs: tell Claude the command to reproduce the issue so it can get a stack trace, mention any reproduction steps, and say whether the error is intermittent or consistent.

How do I refactor legacy code safely?

The documented flow moves from identification to verification:

text
find deprecated API usage in our codebase
text
suggest how to refactor utils.js to use modern JavaScript features
text
refactor utils.js to use ES2024 features while maintaining the same behavior
text
run tests for the refactored code

The docs advise doing refactoring in small, testable increments, asking Claude to explain the benefits of the modern approach, and requesting backward compatibility when needed. For porting an entire codebase to a new language, Anthropic has a blog post on running large-scale code migrations with Claude Code.

How do I add tests for uncovered code?

Start by identifying gaps, then generate and verify tests:

text
find functions in NotificationsService.swift that are not covered by tests
text
add tests for the notification service
text
add test cases for edge conditions in the notification service
text
run the new tests and fix any failures

Claude examines your existing test files to match the style, frameworks, and assertion patterns already in use, so be specific about what behavior you want to verify. For broader coverage, ask Claude to identify edge cases you might have missed — it can suggest tests for error conditions, boundary values, and unexpected inputs.

How do I create a pull request with Claude Code?

You can simply ask Claude directly ("create a pr for my changes"), or guide it step-by-step:

text
summarize the changes I've made to the authentication module
text
create a pr
text
enhance the PR description with more context about the security improvements

When a PR is created using gh pr create, the session is automatically linked to that PR. To find it later, run claude --from-pr 1234 with your own PR number — this opens the session picker filtered to sessions linked to that PR. You can also paste the PR URL into the /resume picker search. The docs recommend reviewing Claude's generated PR before submitting and asking Claude to highlight potential risks or considerations.

How do I generate documentation for my code?

Start by finding what's undocumented, then generate docs:

text
find functions without proper JSDoc comments in the auth module
text
add JSDoc comments to the undocumented functions in auth.js

What other workflows does this docs page cover?

Beyond prompt recipes, the same documentation page covers several session-level workflows:

  • Resume previous conversations so a task can span multiple sittings
  • Run parallel sessions with worktrees so concurrent edits don't collide
  • Plan before editing to review changes before they touch disk
  • Delegate research to subagents to keep your main context clean
  • Pipe Claude into scripts for CI and batch processing

See the full page at Anthropic's documentation for details on each of these.

claudedetails.com is an independent publication and is not affiliated with or endorsed by Anthropic.


claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.

FAQ

How do I find the Claude Code session linked to a pull request?

When you create a PR using `gh pr create`, the session is automatically linked to that PR. Run `claude --from-pr 1234` with your PR number to open the session picker filtered to sessions linked to that PR, or paste the PR URL into the /resume picker search.

Will Claude Code match my project's existing test style?

Yes. According to the docs, Claude examines your existing test files to match the style, frameworks, and assertion patterns already in use. Being specific about what behavior you want to verify helps it generate more useful tests.

What should I tell Claude Code when reporting a bug?

The docs recommend telling Claude the command to reproduce the issue so it can get a stack trace, mentioning any steps to reproduce the error, and letting it know whether the error is intermittent or consistent.

What's the best way to start exploring an unfamiliar codebase with Claude Code?

Navigate to the project root, run `claude`, and ask for a high-level overview with a prompt like "give me an overview of this codebase." Start with broad questions, then narrow down to specific areas like architecture patterns, key data models, or how authentication is handled.

More in Claude Code

Claude CodeINTERMEDIATE
Aug 11, 2026

Using Claude Code on a React Project: CLAUDE.md, Permissions, and Workflow Tips

Claude Code has no React-specific mode — what actually makes it effective on a React codebase is the same CLAUDE.md and permissions setup that works on any project, applied deliberately. This guide walks through what to put in CLAUDE.md for a React app, which commands to allow, and how to structure a component or test-fixing session.

Read guide →
Claude CodeBEGINNER
Aug 11, 2026

How to Create Your First Claude Code Plugin: Manifest, Skills, and Local Testing

This guide explains how to create a custom Claude Code plugin from scratch. It covers when to use a plugin versus standalone configuration in the .claude directory, how to structure a plugin directory with a .claude-plugin/plugin.json manifest, how to add a skill using a SKILL.md file, how to test the plugin locally with the --plugin-dir flag, and how to make skills accept user input with the $ARGUMENTS placeholder. It is based on Anthropic's documentation for Claude Code plugins.

Read guide →
Claude CodeINTERMEDIATE
Aug 10, 2026

Connecting Claude Code to External Tools with MCP: Servers, Transports, and Configuration

This guide explains how to connect Claude Code to external tools and data sources using the Model Context Protocol (MCP). It covers what MCP connections enable, such as working with issue trackers, databases, and monitoring tools; where to find reviewed connectors; how to scaffold your own server with the official mcp-server-dev plugin; and how to install remote HTTP, remote SSE, and local stdio servers, including transport-specific flags, JSON configuration pitfalls, and environment variables like CLAUDE_PROJECT_DIR.

Read guide →
ClaudeDetails
UpdatesGuidesModelsMCPToolsLearning PathsFAQRSS
Get new guides and Claude updates by email

Occasional, no spam. Unsubscribe anytime.

claudedetails.com is an independent publication and is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" is a trademark of Anthropic, PBC, used here for identification purposes only. Product details can change — always confirm specifics on Anthropic's own site before making decisions based on this post.