AI & TOOLS

How to Use Claude for Software Development: Coding, Debugging, Docs and Code Review

Claude is most useful when you treat it like a fast, capable colleague who knows nothing about your project until you tell it. Practical workflows for coding, debugging, docs and review.

Mohamed Isak8 min read

Illustration of a terminal prompt with response lines on a near-black background with the title How to Use Claude for Software Development
On this page
  1. Two ways to work with Claude
  2. Give it context, not just a question
  3. Coding: small steps you can verify
  4. Debugging: hypotheses before fixes
  5. Documentation: drafts from the code
  6. Code review: a useful first pass
  7. Where human judgement is still essential
  8. Habits that make the biggest difference
  9. Further reading

The quickest way to get poor results from Claude is to treat it like a search engine: paste in an error, ask "why?", and accept the first answer. The quickest way to get good results is to treat it like a capable new colleague: fast, well read, and completely unaware of your project until you explain it.

This guide covers practical ways to use Claude in everyday development work: writing code, debugging, documentation and code review. It also covers the places where you shouldn't hand over the decision, however good the output looks. If you're interested in the wider picture of how AI is changing the craft, start with our article on AI in software development; this one is deliberately hands-on.

Two ways to work with Claude

There are two main ways developers use Claude, and they suit different jobs.

AspectClaude in a chat (claude.ai or the desktop app)Claude Code (terminal, IDE, desktop)
What it seesWhat you paste or uploadYour repository: it reads files and runs commands
What it doesExplains, discusses, draftsEdits files, runs tests, makes commits, with your permission
Best forThinking through a design, understanding a concept, drafting a documentChanges across several files, debugging with real output, repetitive edits
Main riskAnswers based on incomplete contextChanges you didn't review carefully

Claude Code is an agentic tool: you describe a task, and it reads the relevant code, proposes or makes changes, and runs commands such as your test suite. By default it asks before editing files or running shell commands, and you can adjust which actions it may take without asking.

A reasonable rule: use chat when the output is an idea or a document, and Claude Code when the output is a change to the codebase.

Give it context, not just a question

Almost every disappointing result comes down to missing context. Claude doesn't know your conventions, your constraints or what you've already tried unless you say so.

Diagram of four layers of context for Claude: project memory in CLAUDE.md, the task, the evidence such as files and error output, and a way to check the result such as tests
The four layers of context behind a good result

Compare these two requests:

Add caching to the products endpoint.

The GET /api/products endpoint in src/routes/products.ts is slow because it queries the database on every request. Product data changes a few times a day, when an admin edits a product. Add an in-memory cache with a 5-minute TTL, and clear it from the existing updateProduct and deleteProduct handlers. We don't use Redis. Add tests for cache hits and for invalidation after an update. Don't change the response shape.

The second takes thirty seconds longer to write and removes most of the guesswork: where the code is, why the change is needed, what "done" means, and what's off limits.

Write the project context down once

For context that applies to every task, Claude Code reads a CLAUDE.md file from your project automatically. Running /init generates a starting version by looking at your codebase. It's worth editing by hand to add what Claude couldn't work out alone:

markdown
# Project notes

## Commands
- `npm run dev`: start the dev server on port 5173
- `npm test`: run unit tests (Vitest)
- `npm run build`: production build; run this before saying a change is done

## Conventions
- Prices are stored as integers in minor units (cents). Never use floats for money.
- API handlers live in src/routes; validation schemas in src/schemas.
- Every database query that returns customer data must filter by the current customer's ID.

## Gotchas
- The orders table is append-only. Corrections are new rows, never updates.
- src/legacy is scheduled for removal; don't add new code there.

Keep it short and specific. A long file of general advice ("write clean code") is ignored by people and adds noise for Claude. The rules that matter are the ones a new teammate would get wrong in their first week. As a side effect, the file is just as useful for onboarding human developers.

Coding: small steps you can verify

For anything larger than a quick fix, ask for a plan before any code is written. Claude Code has a plan mode for exactly this: it reads files and proposes an approach, but makes no edits until you approve. You can switch to it mid-session with Shift+Tab.

Reviewing a plan is much faster than reviewing a large diff, and it's the cheapest moment to catch a misunderstanding. A good plan names the files it will touch, the approach, and how the result will be tested.

Then work in steps you can check:

  1. One change at a time. "Add the cache and its tests" rather than "add caching, refactor the route and update the docs".
  2. Let the tests decide. Ask Claude to run the test suite and the build after each change. A passing test suite is evidence; a confident summary is not.
  3. Read the diff. Every line. Look especially for what's missing: error handling, an authorisation check, a timeout, a database index.
  4. Commit between steps. Small commits make it easy to roll back a step that went wrong without losing the ones that went right.

Debugging: hypotheses before fixes

When you ask an AI tool to "fix this error", you'll usually get a fix. The problem is that it may fix the symptom rather than the cause: wrapping code in a try/catch, raising a timeout, or skipping the test that fails. The error goes away and the bug stays.

A better approach is to ask for diagnosis first:

Users sometimes get logged out right after paying. I can't reproduce it locally. Here's the server log around one occurrence and our session middleware (src/middleware/session.ts). Give me your three most likely causes, ranked, and for each one, a specific check that would confirm or rule it out. Don't change any code yet.

This does three things. It gives Claude the real evidence (logs, the actual code, when it happens). It asks for several hypotheses instead of committing to the first. And it turns the output into experiments you can run, which keeps you in charge of the investigation.

Some habits that help:

  • Paste real output. The full stack trace, the exact error message, the failing test output. Paraphrased errors lose the detail that matters.
  • Say what you've ruled out. It saves Claude from suggesting it again.
  • Ask for a failing test first. If a bug can be reproduced in a test, the fix can be proven, and the bug can't quietly come back.
  • Be suspicious of fixes that remove a check. Disabling validation, catching and ignoring an exception, or deleting an assertion is rarely the right answer.

Documentation: drafts from the code

Documentation is where Claude saves the most time for the least risk, because the output is easy to check and easy to correct. Good uses include:

  • Explaining a module to a new developer: what it does, its main entry points, what calls it and what it depends on.
  • Drafting a README for a service, including how to run it locally.
  • Writing an architecture decision record from a discussion: the context, the options considered and why one was chosen.
  • Summarising a change for a pull request description or a changelog.

One caution: Claude describes what the code appears to do, which can differ from what it actually does in production or what it was meant to do. Check claims about behaviour against the code and tests, especially for error handling and edge cases.

Code review: a useful first pass

Claude can review a diff before a person does, catching the mechanical issues so human review can focus on design and intent. Generic requests produce generic reviews, so be specific about what to look for:

Review the diff on this branch against main. Focus on: missing authorisation checks on data access, unvalidated input, errors that are caught and ignored, database queries inside loops, and changed behaviour that has no test. List each finding with the file and line, why it matters, and a suggested fix. Skip style and formatting.

Claude Code can also run non-interactively with claude -p, which makes it possible to run a review like this in a script or CI job, for example on the files changed in a pull request.

Treat the findings as suggestions from a thorough reviewer, not as verdicts. There will be false positives, and some real issues will be missed. A clean AI review doesn't mean the change is correct; it means the obvious problems on that checklist probably aren't there.

Where human judgement is still essential

Claude can draft, explain, test and review. Some decisions should stay with people:

  • What to build. Requirements, priorities and trade-offs between what users want and what the business can support are product decisions.
  • Architecture. Claude can lay out options and their trade-offs very well. Choosing one depends on your team, your budget and where the product is going, which it can only partly know.
  • Security sign-off. Authentication, payments, permissions and anything touching personal data need review by someone accountable for it.
  • Anything irreversible. Database migrations on production, deleting data, deployments and messages to customers. Keep a human approval step on these, whatever tool is involved.
  • Noticing a wrong premise. If you ask a leading question, you may get an answer that agrees with you. When it matters, ask Claude to argue against your approach or to list what would make it fail.

The underlying principle is simple: you're responsible for what ships. Claude makes it faster to produce and check the work, but it doesn't take on that responsibility.

Habits that make the biggest difference

  • Start a fresh session for each separate task so old context doesn't leak into new work.
  • Keep CLAUDE.md short, specific and current. Delete rules that no longer apply.
  • Commit before a large change so you can always get back to a known good state.
  • Never paste secrets, credentials or customer data into a prompt.
  • Give Claude Code only the permissions the task needs.
  • At the end of a task, ask: "What didn't you check?" The answer is often the most useful part.

Used this way, Claude is less a code generator and more a fast, tireless collaborator for the parts of development that used to eat your afternoon. The judgement stays with you. For more on keeping a codebase healthy while you move faster, read our guide to building scalable, maintainable web applications.

Further reading

  • Claude
  • Claude Code
  • AI
  • Debugging
  • Code review

Share

XLinkedInEmail
Back to all articles