Files · Working With Files
Code in the chat — when it helps, when it hurts
Claude Desktop is not Claude Code. Using the wrong tool for code work costs time and produces results that are harder to trust. This lesson draws the line so you do not waste a morning debugging something the wrong tool generated.
What Claude Desktop can do with code
Claude Desktop reads code, explains it, reviews it for logic errors, suggests refactors, and writes new functions. It does this entirely in text. It cannot run the code, it cannot browse your file system (unless you have added an MCP server that gives it access), and it cannot open a terminal. What you see in the response is a suggestion, not an execution.
This is useful for: code review, quick explanations, writing a function you will paste somewhere else, understanding an error message, or checking a regex before you ship it.
What Claude Code does differently
Claude Code runs in your terminal. It can read and write files, execute commands, run tests, and iterate on failures. If you need the AI to actually modify a file on disk and verify the change worked, that is Claude Code territory.
The test: ask yourself whether the task requires the file to change on disk. If yes, use Claude Code. If you only need text output that you will then act on yourself, Claude Desktop is fine.
Walk-through
Pick a function from a recent project — something under 50 lines. Paste it into Claude Desktop chat and ask two questions in the same message:
Review this function for correctness and readability.
Then suggest one refactor that would make it easier to test.
Read the response. Notice that Claude gives you a suggestion with an explanation, not a modified file. That is the right output from this tool. Now copy the suggested refactor and paste it back into your editor manually.
That sequence — ask, receive, decide, apply — is the correct workflow for Claude Desktop + code.
If you get stuck
- "Claude's suggestion broke something" — That is the expected risk of copy-pasting generated code. Always run your test suite after applying a suggestion. If there is no test suite, run the function manually with one known input before committing.
- "I need Claude to edit the file directly" — Install Claude Code (
npm install -g @anthropic-ai/claude-codein your terminal, then runclaudein the project directory). Claude Desktop cannot do this. - "The response is too long and I lose track of the explanation" — Ask for a shorter response: "Review this function in under 100 words, then show the refactored version."
Deliverable
You have pasted a real function into chat, received a review with at least one specific suggestion, and applied that suggestion to the actual code in your editor. The success criterion: the modified function is in your editor and you can explain in one sentence what changed and why.
Try these prompts
- Paste a function from any recent project here and ask Claude to review it for correctness and suggest one refactor that would make it easier to test.
- I need Claude to actually edit a file on disk and run the tests. Should I use Claude Desktop or Claude Code? Explain which tool to use and why.
- Ask Claude to explain what this code does and identify any edge case it does not handle. Then paste a short function.
Sign in to keep your place and tick off lessons. Reading stays open either way.