[{"data":1,"prerenderedAt":53},["ShallowReactive",2],{"blog-claude-code-prompting-tips":3,"blog-related-claude-code-prompting-tips":36},{"slug":4,"title":5,"description":6,"category":7,"categoryId":8,"keyword":9,"date":10,"minutes":11,"body":12,"html":13,"headings":14},"claude-code-prompting-tips","How to prompt Claude Code: habits that get better results","Seven prompting habits for Claude Code with before and after examples: name the files, give it a check to run, plan first, and correct course early.","Getting started","getting-started","claude code prompting tips","2026-11-17",5,"Most bad Claude Code sessions have one of two causes: Claude did not know something it could not see in the code, or it had no way to check its own work. Good prompts fix both. Here are the habits that matter, with prompts you can adapt, drawn from what works in practice and from Anthropic's own best-practices page.\n\n## How specific should a Claude Code prompt be?\n\nSpecific about what only you know. Claude reads your repository very well, so don't explain the file layout. Do tell it the symptom, the place to look, and what \"done\" means.\n\n| Instead of | Try |\n| --- | --- |\n| `fix the login bug` | `users report login fails after the session times out. look at token refresh in src\u002Fauth\u002F, write a failing test that reproduces it, then fix it` |\n| `add a calendar widget` | `follow the pattern in HotDogWidget.php and build a calendar widget that lets you pick a month and page between years. no new libraries` |\n\nThe second row also names a preference between two reasonable approaches (\"no new libraries\"). Claude cannot read that from the code, so say it up front. When you are only exploring, a loose prompt like `what would you improve in this file?` is fine; you will just correct a bit more as you go.\n\n## How do you give Claude the context it can't find itself?\n\nHand it the thing instead of describing it.\n\n- **A file:** type `@` and the path to include its contents in your message.\n- **A screenshot:** paste the image of the design or the error.\n- **Output:** pipe it from your shell, for example `cat error.log | claude -p \"what's going on here\"`.\n\nKeep the standing facts in `CLAUDE.md`, and keep that short: the exact test, typecheck and lint commands, the places where the code is misleading, decisions that are not in the repo, and anything you had to correct twice. [How to write a CLAUDE.md](\u002Fblog\u002Fclaude-md-guide) goes through it. If a line in it is ignored even when you shout, it probably belongs in a [hook](\u002Fblog\u002Fclaude-code-hooks) instead.\n\n## Why should you give Claude a check to run?\n\nClaude stops when the work looks done. If it has nothing to run that says whether the work is done, \"looks done\" is all it has, and you become the test suite. Give it something that returns pass or fail: a test file, a build's exit code, a linter, a script that diffs output against a fixture.\n\n```text\nimplement the CSV export, then run the tests in tests\u002Fexport and keep going until they pass. show me the command you ran and its output.\n```\n\nTwo parts of that prompt matter. The check closes the loop, and asking for the command and its output gives you evidence instead of a bare \"all tests pass\". For a stricter version, Claude Code has `\u002Fgoal` to set a condition that is checked after every turn, and a `Stop` hook that refuses to let the turn end until a script passes. See [test-driven development with Claude Code](\u002Fblog\u002Fclaude-code-test-driven-development) for the pattern at its best: write the failing test first, then the code.\n\n## When should you plan before coding?\n\nWhen the change touches several files, or you are not sure about the approach. [Plan mode](\u002Fblog\u002Fclaude-code-plan-mode) makes Claude read and propose without editing anything, so you can fix the plan, which costs a sentence, before it becomes a diff, which costs a review. For a small change you could describe in one sentence, skip it.\n\nWhen you do not yet know what you want, let Claude interview you:\n\n```text\nI want to add rate limiting to the public API but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md.\n```\n\nIt comes back with multiple-choice questions about the parts you have not pinned down: per user or per key, what happens over the limit, what is out of scope. Once `SPEC.md` exists, start a fresh session to build from it, so the build begins with a clean context and a written definition of done.\n\n### How do you ask for more than the minimum?\n\nClaude tends to read a request conservatively and build the smallest thing that satisfies it. If you want the fuller version, say so, and say what \"fuller\" means:\n\n```text\nbuild the settings page from the mockup. be ambitious: empty and error states, the save flow wired up, keyboard navigation, not just the layout\n```\n\nThat is information about scope, which only you have. Phrases like \"think step by step\" or \"be thorough\" are ordinary text, not switches; how hard Claude thinks is controlled by the effort level, not by wording.\n\n## How do you correct course without wasting the session?\n\nWatch the first minute. Most wrong turns are visible early.\n\n- `Esc` stops Claude mid-action and keeps everything so far, so you can redirect without losing work.\n- `\u002Frewind`, or `Esc` twice on an empty prompt, opens a menu to roll the code, the conversation, or both back to an earlier prompt. That makes it cheap to try the bolder approach first.\n- `\u002Fclear` starts over. If you have corrected the same thing twice and it is still wrong, a third correction adds to a conversation that already contains two failed attempts. Clear, and write one new prompt that folds in what you learned.\n\nUse `\u002Fclear` between unrelated tasks too. A focused context gives better answers and costs less; [why the context fills up](\u002Fblog\u002Fclaude-code-context-window) explains the mechanics.\n\n## What should you stop doing?\n\nSome old advice has aged out with newer models:\n\n- Don't describe your architecture and file layout in `CLAUDE.md`. Claude reads the repo itself.\n- Don't add \"loop until done\" or \"don't be lazy\". Giving a check to pass is different, and still worth it.\n- Don't pile on IMPORTANT and capitals. A rule that truly cannot have exceptions is a hook or a deny rule.\n- Don't paste whole files you could reference with `@`.\n\n### Which prompts are worth saving?\n\nIf you type the same prompt every week, save it. A [slash command or a skill](\u002Fblog\u002Fclaude-code-skills) turns \"review the diff against SPEC.md, report correctness gaps and skip style\" into `\u002Freview-spec`. And keep one more line in your habits: when you ask for a review, add `skip style`. A reviewer asked to find problems always finds something, and fixing every finding ends in extra layers and tests for cases that cannot happen.\n\n## In Relais\n\nSeveral of these habits have a button in Relais. The Answers panel shows one line per turn beside the conversation, with the Markdown files Claude wrote under each, so a long session stays readable. Quick ask (`⌘J`) lets you put a side question to the session while Claude works, without adding it to the conversation. Edits come with their diff and plans with their own card, inside the chat. See the [features page](\u002Ffeatures).","\u003Cp>Most bad Claude Code sessions have one of two causes: Claude did not know something it could not see in the code, or it had no way to check its own work. Good prompts fix both. Here are the habits that matter, with prompts you can adapt, drawn from what works in practice and from Anthropic&#39;s own best-practices page.\u003C\u002Fp>\n\u003Ch2 id=\"how-specific-should-a-claude-code-prompt-be\">\u003Ca class=\"anchor\" href=\"#how-specific-should-a-claude-code-prompt-be\" aria-label=\"Link to this section\">#\u003C\u002Fa>How specific should a Claude Code prompt be?\u003C\u002Fh2>\n\u003Cp>Specific about what only you know. Claude reads your repository very well, so don&#39;t explain the file layout. Do tell it the symptom, the place to look, and what &quot;done&quot; means.\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Instead of\u003C\u002Fth>\u003Cth>Try\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Ccode>fix the login bug\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>\u003Ccode>users report login fails after the session times out. look at token refresh in src\u002Fauth\u002F, write a failing test that reproduces it, then fix it\u003C\u002Fcode>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>\u003Ccode>add a calendar widget\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>\u003Ccode>follow the pattern in HotDogWidget.php and build a calendar widget that lets you pick a month and page between years. no new libraries\u003C\u002Fcode>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>The second row also names a preference between two reasonable approaches (&quot;no new libraries&quot;). Claude cannot read that from the code, so say it up front. When you are only exploring, a loose prompt like \u003Ccode>what would you improve in this file?\u003C\u002Fcode> is fine; you will just correct a bit more as you go.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-you-give-claude-the-context-it-can-39-t-find-itself\">\u003Ca class=\"anchor\" href=\"#how-do-you-give-claude-the-context-it-can-39-t-find-itself\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do you give Claude the context it can&#39;t find itself?\u003C\u002Fh2>\n\u003Cp>Hand it the thing instead of describing it.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>A file:\u003C\u002Fstrong> type \u003Ccode>@\u003C\u002Fcode> and the path to include its contents in your message.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A screenshot:\u003C\u002Fstrong> paste the image of the design or the error.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Output:\u003C\u002Fstrong> pipe it from your shell, for example \u003Ccode>cat error.log | claude -p &quot;what&#39;s going on here&quot;\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Keep the standing facts in \u003Ccode>CLAUDE.md\u003C\u002Fcode>, and keep that short: the exact test, typecheck and lint commands, the places where the code is misleading, decisions that are not in the repo, and anything you had to correct twice. \u003Ca href=\"\u002Fblog\u002Fclaude-md-guide\">How to write a CLAUDE.md\u003C\u002Fa> goes through it. If a line in it is ignored even when you shout, it probably belongs in a \u003Ca href=\"\u002Fblog\u002Fclaude-code-hooks\">hook\u003C\u002Fa> instead.\u003C\u002Fp>\n\u003Ch2 id=\"why-should-you-give-claude-a-check-to-run\">\u003Ca class=\"anchor\" href=\"#why-should-you-give-claude-a-check-to-run\" aria-label=\"Link to this section\">#\u003C\u002Fa>Why should you give Claude a check to run?\u003C\u002Fh2>\n\u003Cp>Claude stops when the work looks done. If it has nothing to run that says whether the work is done, &quot;looks done&quot; is all it has, and you become the test suite. Give it something that returns pass or fail: a test file, a build&#39;s exit code, a linter, a script that diffs output against a fixture.\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>implement the CSV export, then run the tests in tests\u002Fexport and keep going until they pass. show me the command you ran and its output.\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Two parts of that prompt matter. The check closes the loop, and asking for the command and its output gives you evidence instead of a bare &quot;all tests pass&quot;. For a stricter version, Claude Code has \u003Ccode>\u002Fgoal\u003C\u002Fcode> to set a condition that is checked after every turn, and a \u003Ccode>Stop\u003C\u002Fcode> hook that refuses to let the turn end until a script passes. See \u003Ca href=\"\u002Fblog\u002Fclaude-code-test-driven-development\">test-driven development with Claude Code\u003C\u002Fa> for the pattern at its best: write the failing test first, then the code.\u003C\u002Fp>\n\u003Ch2 id=\"when-should-you-plan-before-coding\">\u003Ca class=\"anchor\" href=\"#when-should-you-plan-before-coding\" aria-label=\"Link to this section\">#\u003C\u002Fa>When should you plan before coding?\u003C\u002Fh2>\n\u003Cp>When the change touches several files, or you are not sure about the approach. \u003Ca href=\"\u002Fblog\u002Fclaude-code-plan-mode\">Plan mode\u003C\u002Fa> makes Claude read and propose without editing anything, so you can fix the plan, which costs a sentence, before it becomes a diff, which costs a review. For a small change you could describe in one sentence, skip it.\u003C\u002Fp>\n\u003Cp>When you do not yet know what you want, let Claude interview you:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>I want to add rate limiting to the public API but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md.\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>It comes back with multiple-choice questions about the parts you have not pinned down: per user or per key, what happens over the limit, what is out of scope. Once \u003Ccode>SPEC.md\u003C\u002Fcode> exists, start a fresh session to build from it, so the build begins with a clean context and a written definition of done.\u003C\u002Fp>\n\u003Ch3 id=\"how-do-you-ask-for-more-than-the-minimum\">\u003Ca class=\"anchor\" href=\"#how-do-you-ask-for-more-than-the-minimum\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do you ask for more than the minimum?\u003C\u002Fh3>\n\u003Cp>Claude tends to read a request conservatively and build the smallest thing that satisfies it. If you want the fuller version, say so, and say what &quot;fuller&quot; means:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>build the settings page from the mockup. be ambitious: empty and error states, the save flow wired up, keyboard navigation, not just the layout\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>That is information about scope, which only you have. Phrases like &quot;think step by step&quot; or &quot;be thorough&quot; are ordinary text, not switches; how hard Claude thinks is controlled by the effort level, not by wording.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-you-correct-course-without-wasting-the-session\">\u003Ca class=\"anchor\" href=\"#how-do-you-correct-course-without-wasting-the-session\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do you correct course without wasting the session?\u003C\u002Fh2>\n\u003Cp>Watch the first minute. Most wrong turns are visible early.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Ccode>Esc\u003C\u002Fcode> stops Claude mid-action and keeps everything so far, so you can redirect without losing work.\u003C\u002Fli>\n\u003Cli>\u003Ccode>\u002Frewind\u003C\u002Fcode>, or \u003Ccode>Esc\u003C\u002Fcode> twice on an empty prompt, opens a menu to roll the code, the conversation, or both back to an earlier prompt. That makes it cheap to try the bolder approach first.\u003C\u002Fli>\n\u003Cli>\u003Ccode>\u002Fclear\u003C\u002Fcode> starts over. If you have corrected the same thing twice and it is still wrong, a third correction adds to a conversation that already contains two failed attempts. Clear, and write one new prompt that folds in what you learned.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Use \u003Ccode>\u002Fclear\u003C\u002Fcode> between unrelated tasks too. A focused context gives better answers and costs less; \u003Ca href=\"\u002Fblog\u002Fclaude-code-context-window\">why the context fills up\u003C\u002Fa> explains the mechanics.\u003C\u002Fp>\n\u003Ch2 id=\"what-should-you-stop-doing\">\u003Ca class=\"anchor\" href=\"#what-should-you-stop-doing\" aria-label=\"Link to this section\">#\u003C\u002Fa>What should you stop doing?\u003C\u002Fh2>\n\u003Cp>Some old advice has aged out with newer models:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Don&#39;t describe your architecture and file layout in \u003Ccode>CLAUDE.md\u003C\u002Fcode>. Claude reads the repo itself.\u003C\u002Fli>\n\u003Cli>Don&#39;t add &quot;loop until done&quot; or &quot;don&#39;t be lazy&quot;. Giving a check to pass is different, and still worth it.\u003C\u002Fli>\n\u003Cli>Don&#39;t pile on IMPORTANT and capitals. A rule that truly cannot have exceptions is a hook or a deny rule.\u003C\u002Fli>\n\u003Cli>Don&#39;t paste whole files you could reference with \u003Ccode>@\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3 id=\"which-prompts-are-worth-saving\">\u003Ca class=\"anchor\" href=\"#which-prompts-are-worth-saving\" aria-label=\"Link to this section\">#\u003C\u002Fa>Which prompts are worth saving?\u003C\u002Fh3>\n\u003Cp>If you type the same prompt every week, save it. A \u003Ca href=\"\u002Fblog\u002Fclaude-code-skills\">slash command or a skill\u003C\u002Fa> turns &quot;review the diff against SPEC.md, report correctness gaps and skip style&quot; into \u003Ccode>\u002Freview-spec\u003C\u002Fcode>. And keep one more line in your habits: when you ask for a review, add \u003Ccode>skip style\u003C\u002Fcode>. A reviewer asked to find problems always finds something, and fixing every finding ends in extra layers and tests for cases that cannot happen.\u003C\u002Fp>\n\u003Ch2 id=\"in-relais\">\u003Ca class=\"anchor\" href=\"#in-relais\" aria-label=\"Link to this section\">#\u003C\u002Fa>In Relais\u003C\u002Fh2>\n\u003Cp>Several of these habits have a button in Relais. The Answers panel shows one line per turn beside the conversation, with the Markdown files Claude wrote under each, so a long session stays readable. Quick ask (\u003Ccode>⌘J\u003C\u002Fcode>) lets you put a side question to the session while Claude works, without adding it to the conversation. Edits come with their diff and plans with their own card, inside the chat. See the \u003Ca href=\"\u002Ffeatures\">features page\u003C\u002Fa>.\u003C\u002Fp>\n",[15,18,21,24,27,30,33],{"id":16,"text":17},"how-specific-should-a-claude-code-prompt-be","How specific should a Claude Code prompt be?",{"id":19,"text":20},"how-do-you-give-claude-the-context-it-can-39-t-find-itself","How do you give Claude the context it can&#39;t find itself?",{"id":22,"text":23},"why-should-you-give-claude-a-check-to-run","Why should you give Claude a check to run?",{"id":25,"text":26},"when-should-you-plan-before-coding","When should you plan before coding?",{"id":28,"text":29},"how-do-you-correct-course-without-wasting-the-session","How do you correct course without wasting the session?",{"id":31,"text":32},"what-should-you-stop-doing","What should you stop doing?",{"id":34,"text":35},"in-relais","In Relais",[37,42,48],{"slug":38,"title":39,"description":40,"category":7,"categoryId":8,"keyword":41,"date":10,"minutes":11},"claude-code-beginners-guide","Claude Code for beginners: install, first session, habits","Install Claude Code, run your first session and learn the habits that matter: specific prompts, plan before edit, CLAUDE.md, small commits, a clean context.","claude code for beginners",{"slug":43,"title":44,"description":45,"category":7,"categoryId":8,"keyword":46,"date":10,"minutes":47},"claude-code-hooks","Claude Code hooks: run a script on every tool call","Claude Code hooks run your own script before or after a tool call. Learn the config format, exit codes and three working examples you can paste today.","claude code hooks",6,{"slug":49,"title":50,"description":51,"category":7,"categoryId":8,"keyword":52,"date":10,"minutes":11},"claude-code-permission-modes","Claude Code permission modes explained (and when to use each)","Default, acceptEdits, plan, auto, dontAsk and bypassPermissions: what each Claude Code permission mode allows, how to switch, and which one fits which job.","claude code permission modes",1794931098788]