Claude Code for Daily Software Engineering: A Practical Workflow Guide
You've probably pasted code into a chat window, waited for a response, then copied it back into your editor β and wondered why this feels so clunky. Claude Code skips that loop entirely. It runs as a CLI tool inside your terminal, reads your actual project files, and executes actions on your behalf without you leaving your workflow.
What you'll learn
- How to install and configure Claude Code in your terminal
- How to use it for code review, debugging, and refactoring
- How to write and run tests with Claude Code's help
- How to handle multi-file tasks and avoid common pitfalls
- Practical prompting patterns that produce reliable results
Prerequisites
You'll need Node.js (v18 or later) installed on your machine, an Anthropic API key, and a reasonably modern project to work with. Claude Code works across languages β Python, TypeScript, Go, Rust, and others β so your stack doesn't matter much here.
Getting Claude Code Installed
Claude Code is distributed as an npm package. Install it globally so you can invoke it from any project directory:
npm install -g @anthropic-ai/claude-code
Once installed, authenticate by exporting your API key. The simplest way is to add this to your shell profile (.zshrc, .bashrc, or equivalent):
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
Then verify the setup by running claude in your terminal. You should land in an interactive session. Type /help to see available slash commands.
Starting a Session the Right Way
Claude Code starts each session aware of your working directory, but it needs context to be useful fast. When you launch claude from the root of a project, it can read your file tree. You can then give it a project-level orientation in your first message:
This is a FastAPI project using PostgreSQL. The main app entry point is app/main.py.
There's a services layer under app/services/ and models under app/models/.
I want you to help me review and improve the code.
This first message pays dividends for the entire session. Claude Code will reference the right files without you having to repeat yourself.
Code Review Without the Copy-Paste Ritual
One of the most immediately useful tasks is asking Claude Code to review a specific file or a recent diff. You don't paste anything β you just tell it what to look at:
Review app/services/user_service.py. Focus on error handling,
any missing input validation, and anything that could cause a silent failure in production.
Claude Code will open the file, read it, and give you specific line-level feedback. If you want it to apply fixes rather than just describe them, follow up with:
Apply the fixes you suggested for the error handling.
Don't change any business logic, only the exception handling patterns.
The constraint in that second message matters. Without it, Claude Code may refactor more broadly than you intended. Be explicit about the blast radius you want.
Debugging with Full Codebase Context
Debugging is where Claude Code's file access genuinely outshines a chat interface. Paste an error message and tell it to trace the root cause:
I'm getting this traceback when I run the test suite:
AttributeError: 'NoneType' object has no attribute 'user_id'
File "app/services/order_service.py", line 47, in create_order
Find the root cause and suggest a fix.
Claude Code will read order_service.py, trace imports to related files, and identify where None is entering the call chain. This is much faster than hunting through files yourself when the bug lives across two or three layers.
If you need it to check a database model, a serializer, and a service layer together, just say so. It can hold all three files in context simultaneously and reason across them.
Writing Tests That Actually Cover Your Code
Asking an AI to "write tests" without constraints produces boilerplate. Ask it to write tests for a specific function, covering the edge cases you know about, and name the test file:
Write pytest tests for the `calculate_discount` function in app/services/pricing_service.py.
Cover: zero quantity, negative price, discount above 100%, and the happy path.
Write the tests to tests/test_pricing_service.py.
Claude Code will read the source function, understand its signature and current logic, and create a test file. It will also create the file on disk β you don't have to create it manually.
After it writes the tests, run them immediately:
pytest tests/test_pricing_service.py -v
If any tests fail because Claude misread the expected behavior, go back to the session and clarify. The iteration loop is tight because both you and Claude are looking at the same file.
Refactoring Across Multiple Files
Renaming a function or extracting a utility is tedious when it spans ten files. Claude Code handles this cleanly with a single instruction:
Rename `get_user_by_email` to `fetch_user_by_email` everywhere in the codebase.
Update all callers, imports, and any docstrings that reference the old name.
Before running a command like this, it's worth asking Claude Code to list the files it plans to change so you can sanity-check the scope:
Before making any changes, list every file that references `get_user_by_email`.
Treat that output like a pre-flight check. If you see a file that shouldn't be touched, tell Claude Code to exclude it before it starts editing.
Generating Boilerplate Without the Tedium
Creating a new API endpoint, a new database model, or a new service class involves a predictable amount of boilerplate. Give Claude Code the existing pattern and ask it to follow it:
Look at app/models/user.py and app/services/user_service.py as examples of the pattern we use.
Create a new model `Product` and a matching service file.
The Product has: name (string), price (decimal), stock_quantity (integer), is_active (boolean).
Claude Code reads your existing files first, infers your conventions (naming, import style, docstring format), and creates new files that match. This is far better than working from a generic template that doesn't match your codebase.
Writing and Updating Documentation
Documentation that lives in the code is documentation that might actually get read. Ask Claude Code to add or refresh docstrings for an entire module:
Add Google-style docstrings to all public functions in app/services/payment_service.py
that are currently missing them. Don't touch functions that already have docstrings.
You can also ask it to update a README.md section based on what it sees in your code β useful after a major refactor when the docs have drifted from reality.
Common Pitfalls to Watch Out For
Letting it edit too broadly. Claude Code can modify many files in one shot. Always scope your instructions tightly. Use phrases like "only in this file", "don't change any interfaces", or "make the minimal change needed".
Skipping the review step. Claude Code applies changes directly to your files. Treat it like a pair programmer, not an autonomous agent. Review diffs with git diff before you commit anything:
git diff
Long sessions losing coherence. After 30β40 back-and-forth turns in one session, context quality can degrade. If you notice answers getting vaguer or less accurate, start a fresh session and re-orient it. It costs nothing to restart.
Assuming it knows your hidden conventions. Claude Code learns from what it reads. If your conventions are buried in a wiki somewhere and not visible in the code, it won't know about them. Describe the important ones explicitly at the start of the session or keep a short CONVENTIONS.md file in your repo root that you point it to.
Not committing checkpoints. Before asking Claude Code to do a large refactor, make a git commit. That gives you a clean rollback point if the result isn't what you wanted.
Prompting Patterns That Produce Reliable Results
After using Claude Code for a while, a few patterns stand out as consistently effective:
- Role + constraint + scope: "Act as a code reviewer. Focus only on security issues. Review only this file."
- Show, then do: "Look at X as an example of our pattern. Now create Y following the same pattern."
- Dry run first: "Tell me what changes you would make before making them."
- Incremental steps: Break large tasks into smaller committed steps rather than one giant instruction.
- Explicit output location: Always tell it where to write a new file rather than letting it choose.
Wrapping Up
Claude Code's value isn't that it writes code instead of you β it's that it removes the mechanical friction from tasks you already know how to do. The best engineers using it still review every diff and direct every step. They're just spending that time on decisions rather than typing.
Here are concrete next steps to put this into practice:
- Install Claude Code and run a code review on one file in your current project today.
- Pick one missing test file and ask Claude Code to generate it β then run the tests and fix any failures together.
- Add a short
CONVENTIONS.mdto your repo root so Claude Code (and new teammates) can orient quickly. - Before your next refactor, try the dry-run pattern: ask Claude Code to list what it would change before it touches anything.
- Check the Anthropic documentation for the latest slash commands and model options β the tool is updated frequently.
π€ Share this article
Sign in to saveRelated Articles
Comments (0)
No comments yet. Be the first!