<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alex Cloudstar</title>
    <description>The latest articles on DEV Community by Alex Cloudstar (@alexcloudstar).</description>
    <link>https://dev.to/alexcloudstar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1190670%2F18910089-3a37-4072-9b4c-289211f053eb.JPG</url>
      <title>DEV Community: Alex Cloudstar</title>
      <link>https://dev.to/alexcloudstar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexcloudstar"/>
    <language>en</language>
    <item>
      <title>Claude Code GitHub Actions: Setup, @claude Mentions and Automatic PR Review</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 29 Oct 2026 16:59:43 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-github-actions-setup-claude-mentions-and-automatic-pr-review-5cgk</link>
      <guid>https://dev.to/alexcloudstar/claude-code-github-actions-setup-claude-mentions-and-automatic-pr-review-5cgk</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code GitHub Actions: Setup, &lt;a class="mentioned-user" href="https://dev.to/claude"&gt;@claude&lt;/a&gt; Mentions and Automatic PR Review
&lt;/h1&gt;

&lt;p&gt;The first time you tag &lt;code&gt;@claude&lt;/code&gt; on a GitHub issue and watch a pull request show up twenty minutes later, it feels a little like cheating. You wrote two sentences. Something read the repo, made a branch, ran the checks and left a comment explaining what it did.&lt;/p&gt;

&lt;p&gt;Then the second feeling arrives. Who exactly is allowed to trigger that? What is it allowed to touch? And what does each of those twenty minutes cost?&lt;/p&gt;

&lt;p&gt;This guide covers the Claude Code GitHub integration end to end: the one-command setup, the manual setup, the &lt;code&gt;@claude&lt;/code&gt; workflow, an automatic pull request review workflow, the difference between the open-source action and the managed Code Review product, how to cap the bill, and the security settings I would not skip. I checked it against Anthropic's documentation on October 29, 2026. The action and the app change fast, so where this page and the docs disagree, trust the docs. Sources are at the bottom.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "Claude Code GitHub" Actually Means
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Claude Code GitHub Actions is a GitHub Action, &lt;code&gt;anthropics/claude-code-action&lt;/code&gt;, that runs Claude Code inside your repository's workflows. It responds to &lt;code&gt;@claude&lt;/code&gt; mentions and can also run a prompt automatically on any GitHub event.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The confusing part is that several things share the Claude Code name on GitHub. The docs say this outright, and it is worth getting straight before you configure anything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The GitHub Action&lt;/strong&gt; (this guide). You add workflow files to the repo, and the job runs on your GitHub runners with your credentials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Review.&lt;/strong&gt; A managed service that reviews every pull request on Anthropic infrastructure. No workflow file. It is for Team and Enterprise plans.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;/code-review&lt;/code&gt; command.&lt;/strong&gt; You run it inside a local Claude Code session on your own branch. Any plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code in the cloud.&lt;/strong&gt; Sessions that run on cloud infrastructure instead of your laptop, including auto-fix for pull requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Agent SDK.&lt;/strong&gt; The action is built on it. You use it directly when you want automation outside GitHub.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your goal is "tag Claude in an issue and get a PR", you want the action. If your goal is "every PR gets a review without anyone maintaining YAML", look at Code Review, which I cover further down. If you only want a review of your own branch before you push, the local command is enough.&lt;/p&gt;

&lt;p&gt;Everything below is the action unless I say otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Setup With /install-github-app
&lt;/h2&gt;

&lt;p&gt;The fastest path is one slash command. You need admin access to the repository, and the GitHub CLI installed and authenticated with &lt;code&gt;gh auth login&lt;/code&gt;. Claude Code checks for &lt;code&gt;gh&lt;/code&gt; and warns you if it is missing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-repo
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then inside the session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/install-github-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts. Claude Code does four things for you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Installs the Claude GitHub App on the repository.&lt;/li&gt;
&lt;li&gt;Sets up an authentication secret. If Claude Code already has an API key it reuses it and offers to keep an existing &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; secret. Otherwise you pick between creating a long-lived token tied to your Claude subscription or pasting an API key.&lt;/li&gt;
&lt;li&gt;Saves the credential as a repository secret, named &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; for a key or &lt;code&gt;CLAUDE_CODE_OAUTH_TOKEN&lt;/code&gt; for a subscription token.&lt;/li&gt;
&lt;li&gt;Pushes a branch with the workflow files you selected, already wired to that secret, and opens GitHub in your browser with a pull request ready to create.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Merge that pull request and &lt;code&gt;@claude&lt;/code&gt; works in the repo. That is the whole setup.&lt;/p&gt;

&lt;p&gt;A few details from the docs that save you time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;github.com only.&lt;/strong&gt; If your remote is on GitLab or Bitbucket, the command prints a notice and exits. GitLab has its own CI/CD integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You can bail out.&lt;/strong&gt; Press &lt;code&gt;Esc&lt;/code&gt; to stop partway. A step already running finishes, nothing later starts, and the closing message lists what already happened, such as a pushed branch or a saved secret.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You can install the app now and finish later.&lt;/strong&gt; Choose "Skip for now" after the app install, then run &lt;code&gt;/install-github-app&lt;/code&gt; again when you are ready for the workflow and secret.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It can update old workflows.&lt;/strong&gt; If the repo already has a &lt;code&gt;claude.yml&lt;/code&gt;, rerun the command and choose "Update workflow file with latest version". It opens a fresh PR with the new files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The review workflow is optional.&lt;/strong&gt; If you select it during setup, Claude posts each review on the PR as inline comments, or one summary comment when it finds nothing. Before v2.1.229 it wrote reviews only to the workflow run log, so if your review workflow was generated earlier, update it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick setup works with the Claude API and Claude subscriptions. If you run Claude Code through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, the setup is different and covered in the cloud providers section below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Manual Setup: App, Secret, Workflow File
&lt;/h2&gt;

&lt;p&gt;Use the manual path when you do not run Claude Code locally, when the command fails, or when you want full control of the files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install the Claude GitHub App.&lt;/strong&gt; Install it on the repository. The action relies on three of its permissions: Contents (read and write), Issues (read and write) and Pull requests (read and write).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Add a secret.&lt;/strong&gt; Add one of these as a repository secret:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;: a key from the Claude Console.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE_CODE_OAUTH_TOKEN&lt;/code&gt;: a token that authenticates with your subscription, available on Pro, Max, Team and Enterprise. Generate it by running &lt;code&gt;claude setup-token&lt;/code&gt; locally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In workflow files, the API key goes to the &lt;code&gt;anthropic_api_key&lt;/code&gt; input and the token goes to &lt;code&gt;claude_code_oauth_token&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Copy the workflow.&lt;/strong&gt; Take &lt;code&gt;examples/claude.yml&lt;/code&gt; from the action's repository into &lt;code&gt;.github/workflows/&lt;/code&gt;. As committed it responds to &lt;code&gt;@claude&lt;/code&gt; mentions using &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;. If you use the OAuth token instead, change that one line to &lt;code&gt;claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Test it by tagging &lt;code&gt;@claude&lt;/code&gt; in an issue or PR comment.&lt;/p&gt;

&lt;h3&gt;
  
  
  API Key or Subscription Token?
&lt;/h3&gt;

&lt;p&gt;This is the choice people get wrong, so here is how I would decide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solo repo, personal project:&lt;/strong&gt; the subscription token is fine. Runs use your subscription instead of API billing, which means they also count against your allowance. If you have ever hit the wall, read &lt;a href="https://dev.to/blog/claude-code-usage-limits-2026/"&gt;how Claude Code usage limits work&lt;/a&gt; before you let a bot spend it for you on every PR.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Team repo or organization:&lt;/strong&gt; use an API key. The docs make the point directly: an OAuth token is tied to the subscription of the person who ran &lt;code&gt;claude setup-token&lt;/code&gt;. When that person leaves or changes plan, every repo using their token breaks, and their personal allowance is what is paying for the team's reviews.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No long-lived secret at all:&lt;/strong&gt; use workload identity federation. The action exchanges the workflow's GitHub OIDC token for API access through a Claude Console service account. You set &lt;code&gt;anthropic_federation_rule_id&lt;/code&gt; and &lt;code&gt;anthropic_organization_id&lt;/code&gt;, optionally the service account and workspace IDs, and grant the job &lt;code&gt;id-token: write&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The &lt;a class="mentioned-user" href="https://dev.to/claude"&gt;@claude&lt;/a&gt; Workflow, Line by Line
&lt;/h2&gt;

&lt;p&gt;Here is the workflow from the docs for responding to mentions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Claude Code&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issue_comment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;created&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;pull_request_review_comment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;created&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;claude&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;contains(github.event.comment.body, '@claude')&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;id-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
      &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v6&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;anthropics/claude-code-action@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;anthropic_api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parts that are not boilerplate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;id-token: write&lt;/code&gt;&lt;/strong&gt; is required for the action's default GitHub App authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;actions: read&lt;/code&gt;&lt;/strong&gt; lets Claude read CI results on pull requests. That is how it can say "the tests failed on this line" instead of guessing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;actions/checkout&lt;/code&gt;&lt;/strong&gt; gives Claude a local copy of the repo to work in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;if: contains(...)&lt;/code&gt;&lt;/strong&gt; keeps runners from starting on comments that do not mention &lt;code&gt;@claude&lt;/code&gt;. The action also checks the trigger phrase itself, but the &lt;code&gt;if&lt;/code&gt; saves you a runner spin-up on every unrelated comment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once it is merged, you talk to it in plain language:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@claude implement this feature based on the issue description
@claude how should I implement user authentication for this endpoint?
@claude fix the TypeError in the user dashboard component
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude replies in a comment on the same issue or PR and updates that comment as it works. The trigger phrase is &lt;code&gt;@claude&lt;/code&gt; by default and can be changed with &lt;code&gt;trigger_phrase&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One thing the docs state that is easy to miss: the comment must contain &lt;code&gt;@claude&lt;/code&gt; as a complete word. &lt;code&gt;/claude&lt;/code&gt; and &lt;code&gt;@claude-bot&lt;/code&gt; do not count.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Makes a Good &lt;a class="mentioned-user" href="https://dev.to/claude"&gt;@claude&lt;/a&gt; Request
&lt;/h3&gt;

&lt;p&gt;The action is only as good as the instruction. The cost section below says the same thing from the money side: specific requests need fewer turns. Three habits that help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Point at files and symptoms.&lt;/strong&gt; "Fix the TypeError in &lt;code&gt;UserDashboard.tsx&lt;/code&gt; when &lt;code&gt;user.profile&lt;/code&gt; is null" beats "fix the dashboard bug".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Say what done looks like.&lt;/strong&gt; "Add a test that fails before the fix" gives it a finish line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask questions first when the design is open.&lt;/strong&gt; &lt;code&gt;@claude how would you approach this?&lt;/code&gt; costs less than a branch you throw away. It is the same logic as &lt;a href="https://dev.to/blog/claude-code-plan-mode-2026/"&gt;plan mode&lt;/a&gt;: decide before you build.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Interactive Mode vs Automation Mode
&lt;/h2&gt;

&lt;p&gt;The action picks its mode from your workflow, with no &lt;code&gt;mode&lt;/code&gt; input to set.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interactive mode.&lt;/strong&gt; No &lt;code&gt;prompt&lt;/code&gt; input. Claude waits for the trigger phrase in an issue comment, a PR comment, a PR review, or the title or body of a newly opened issue, then responds. Progress and results show up as a comment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automation mode.&lt;/strong&gt; You provide a &lt;code&gt;prompt&lt;/code&gt;. Claude runs on whatever event triggers the workflow, without anyone mentioning it. By default the output goes to the workflow run log, not a comment. It can post to the issue or PR only when your prompt tells it to and it has a tool that can post.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That second point trips people up. You set up an automatic reviewer, the job goes green, and nothing appears on the pull request. The review is in the run log. Posting is opt-in, and the next section shows how.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automatic Pull Request Review
&lt;/h2&gt;

&lt;p&gt;This is the workflow most teams actually want. It runs on every pull request and posts a review. The docs example uses the official &lt;code&gt;code-review&lt;/code&gt; plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Code Review&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;opened&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;synchronize&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;ready_for_review&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;reopened&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;review&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;id-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v6&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;anthropics/claude-code-action@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;anthropic_api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;plugin_marketplaces&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://github.com/anthropics/claude-plugins-official.git"&lt;/span&gt;
          &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;code-review@claude-plugins-official"&lt;/span&gt;
          &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/code-review:code-review&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--comment&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.repository&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}/pull/${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.number&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
          &lt;span class="na"&gt;claude_args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--allowedTools&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"mcp__github_inline_comment__create_inline_comment"'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines decide where the review goes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--comment&lt;/code&gt;&lt;/strong&gt; makes Claude post the review on the PR, as an inline comment on each issue or one summary comment when it finds none. Leave it off and nothing is posted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;claude_args&lt;/code&gt; with &lt;code&gt;--allowedTools&lt;/code&gt;&lt;/strong&gt; has to stay, even though the skill names the same tool in its own frontmatter. The action only starts the MCP server that posts inline comments when &lt;code&gt;--allowedTools&lt;/code&gt; in &lt;code&gt;claude_args&lt;/code&gt; names it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the permissions. This job gets &lt;code&gt;contents: read&lt;/code&gt; and &lt;code&gt;pull-requests: read&lt;/code&gt;, not write. A reviewer does not need to push code. Giving it less is free and removes a whole class of surprises.&lt;/p&gt;

&lt;p&gt;What it skips, per the docs: draft and closed pull requests, pull requests it judges not to need a review (automated or trivial ones), and pull requests that already have a comment from Claude.&lt;/p&gt;

&lt;p&gt;Two practical limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fork PRs on public repos.&lt;/strong&gt; GitHub withholds secrets from runs triggered by fork pull requests, so this review only runs on PRs from branches in the same repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It is not a merge gate.&lt;/strong&gt; Treat the output as a second reader, not an approver. My own take is that it should never be the only review on code that touches auth, billing or data deletion. The &lt;a href="https://dev.to/blog/ai-agent-pull-request-review-policy-2026/"&gt;pull request manifest&lt;/a&gt; I wrote about earlier is a better way to make agent-written PRs checkable by a human, whichever tool wrote them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You are not locked into the plugin either. The &lt;code&gt;prompt&lt;/code&gt; input accepts plain text or a skill invocation. For a skill that lives in your repo's &lt;code&gt;.claude/skills/&lt;/code&gt; directory, run &lt;code&gt;actions/checkout&lt;/code&gt; first and pass &lt;code&gt;/skill-name&lt;/code&gt; as the prompt. If you want to write your own review skill with your team's rules in it, &lt;a href="https://dev.to/blog/writing-claude-code-skill-developer-guide-2026/"&gt;writing a Claude Code skill&lt;/a&gt; walks through the format.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Action vs Managed Code Review
&lt;/h2&gt;

&lt;p&gt;There are two ways to get automatic reviews on GitHub, and they are different products. This table is the short version:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;GitHub Action (this guide)&lt;/th&gt;
&lt;th&gt;Managed Code Review&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Setup&lt;/td&gt;
&lt;td&gt;Workflow files in your repo&lt;/td&gt;
&lt;td&gt;An Owner turns it on in admin settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runs on&lt;/td&gt;
&lt;td&gt;Your GitHub runners&lt;/td&gt;
&lt;td&gt;Anthropic infrastructure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plans&lt;/td&gt;
&lt;td&gt;Anyone with an API key or cloud credentials&lt;/td&gt;
&lt;td&gt;Team and Enterprise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Billing&lt;/td&gt;
&lt;td&gt;Actions minutes plus API tokens or subscription&lt;/td&gt;
&lt;td&gt;Managed, with a monthly spend limit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customization&lt;/td&gt;
&lt;td&gt;Your prompt, plugins, &lt;code&gt;CLAUDE.md&lt;/code&gt;, any trigger&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;REVIEW.md&lt;/code&gt; and &lt;code&gt;CLAUDE.md&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Beyond review&lt;/td&gt;
&lt;td&gt;Edits code, pushes commits, runs any prompt&lt;/td&gt;
&lt;td&gt;Review only, read-only access, never pushes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;How the managed product works, per the docs: several agents read each change alongside the surrounding code, a verification step checks the findings against the code to filter false positives, the rest are deduplicated and ranked by severity, and the results land as inline comments, a summary and a check run called Claude Code Review. The check run does not conclude as a failure, and a review never approves or blocks the PR. There are three review levels, Quick, Standard (the default) and Deep, and more thorough means more cost.&lt;/p&gt;

&lt;p&gt;It is not available to organizations with Zero Data Retention enabled or with the HIPAA configuration applied, and a review works only by reading the diff and the surrounding code. It does not build or run your code.&lt;/p&gt;

&lt;p&gt;My rule of thumb: if you are on Team or Enterprise and the only thing you want is reviews, use the managed product and delete the YAML you would otherwise maintain. If you want Claude to also take tickets, fix CI or run scheduled jobs, you need the action anyway, and you can run both. For a wider look at the review tool market, see the &lt;a href="https://dev.to/blog/ai-code-review-tools-comparison-2026/"&gt;AI code review tools comparison&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Teach It Your Standards With CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;Claude reads your &lt;code&gt;CLAUDE.md&lt;/code&gt; on every run. That makes it the cheapest lever you have over review quality. Put in the things a human reviewer on your team would say out loud: code style rules, what counts as a blocker, patterns to prefer, directories nobody should touch.&lt;/p&gt;

&lt;p&gt;Two cautions from the docs and from common sense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep it short.&lt;/strong&gt; The docs list a concise &lt;code&gt;CLAUDE.md&lt;/code&gt; as a cost saver precisely because it is read on every run. A 600-line file is a token tax on every pull request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Move workflow detail into skills.&lt;/strong&gt; Rules about how to do a task belong in a skill that loads on demand. Rules about what the project is belong in &lt;code&gt;CLAUDE.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the managed Code Review product, &lt;code&gt;REVIEW.md&lt;/code&gt; is read from the base or default branch and never from the pull request's own changes. That detail matters: it means a contributor cannot edit the review instructions inside the PR they want reviewed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Claude on a Schedule
&lt;/h2&gt;

&lt;p&gt;With a &lt;code&gt;prompt&lt;/code&gt; and a &lt;code&gt;schedule&lt;/code&gt; trigger, the action becomes a cron job that can think. The docs example generates a daily report of commits and open issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Daily Report&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;9&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;report&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;id-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;anthropics/claude-code-action@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;anthropic_api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Generate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;a&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;summary&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;of&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;yesterday's&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;commits&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;and&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;open&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;issues"&lt;/span&gt;
          &lt;span class="na"&gt;claude_args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;--model claude-opus-5-5&lt;/span&gt;
            &lt;span class="s"&gt;--allowedTools "mcp__github__list_commits,mcp__github__list_issues"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things to know before you rely on it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No tools by default for a plain-text prompt.&lt;/strong&gt; Claude has no shell or GitHub API access until you grant tools with &lt;code&gt;--allowedTools&lt;/code&gt; or a &lt;code&gt;permissions.allow&lt;/code&gt; rule in the &lt;code&gt;settings&lt;/code&gt; input. A skill invocation can use the tools its own frontmatter grants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default branch only.&lt;/strong&gt; GitHub runs scheduled workflows only from the default branch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;60-day shutoff on public repos.&lt;/strong&gt; GitHub disables the schedule after 60 days without repository activity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output goes to the run log&lt;/strong&gt; unless you tell it to post somewhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The actor check still applies.&lt;/strong&gt; GitHub attributes scheduled runs to a repository user, usually the one who last changed the &lt;code&gt;cron&lt;/code&gt; line. If that user is a bot, list it in &lt;code&gt;allowed_bots&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good scheduled jobs are boring ones: a weekly dependency report, a stale-issue triage summary, a changelog draft. Anything that mutates the repo on a timer deserves a second look.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who Can Trigger It, and What It Can Touch
&lt;/h2&gt;

&lt;p&gt;This is the part to read twice. You are letting text typed into a GitHub comment start a process that has write access to your code and a billable credential. The action has guardrails, and you should know exactly what they are.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two checks run before Claude starts.&lt;/strong&gt; The run fails if either rejects the actor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write access.&lt;/strong&gt; On issue and pull request events, the triggering user must have write access to the repo. To allow specific users without it, set &lt;code&gt;allowed_non_write_users&lt;/code&gt; and pass your own &lt;code&gt;github_token&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human actor.&lt;/strong&gt; On every event, a bot actor is rejected unless it is in &lt;code&gt;allowed_bots&lt;/code&gt;. This is what stops bots from triggering Claude in a loop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The app has a wide permission set.&lt;/strong&gt; This surprised me when I first read it. The Claude GitHub App is shared by every Claude feature that integrates with GitHub, so installing it grants Actions, Checks, Contents, Discussions, Issues, Pull requests, Workflows and Repository hooks at read and write, plus Administration, Members, Merge queues, Metadata and Statuses at read. GitHub does not let you accept a subset. If your organization only allows what the action itself needs (Contents, Issues, Pull requests), the docs say to create a custom GitHub App with just those. Note that a custom app covers only the action. Code Review and web auto-fix still need the official app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I would do on top of the defaults:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Give every job the minimum &lt;code&gt;permissions&lt;/code&gt; block.&lt;/strong&gt; The review workflow above is read-only on purpose. Only the &lt;code&gt;@claude&lt;/code&gt; workflow needs write.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat issue and PR text as untrusted input.&lt;/strong&gt; Anyone who can comment can put instructions in front of the model. The write-access check limits who that is, but a repo with many collaborators still has many people who can steer it. This is my reasoning, not a quote from the docs: assume a hostile sentence will eventually reach the prompt, and make sure the damage is bounded by the token's permissions and &lt;code&gt;--allowedTools&lt;/code&gt;. The &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;least-privilege guide for coding agents&lt;/a&gt; goes deeper on that thinking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never put a key in the repo.&lt;/strong&gt; Secrets only, referenced as &lt;code&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/code&gt;. The docs repeat this one for a reason.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review everything before merging.&lt;/strong&gt; Branch protection should still require a human approval. Claude's PRs are PRs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin the action.&lt;/strong&gt; The docs use &lt;code&gt;@v1&lt;/code&gt;. For a job that holds write permissions, pinning a full commit SHA is the standard GitHub hardening advice, and the cost is updating it on purpose.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want a hard stop on specific commands inside the job, &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;Claude Code hooks&lt;/a&gt; work in CI the same way they work on your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a Run Costs and How to Cap It
&lt;/h2&gt;

&lt;p&gt;Each run spends two different things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions minutes.&lt;/strong&gt; The job runs on GitHub-hosted runners and uses your Actions minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tokens.&lt;/strong&gt; Based on prompt and response length, task complexity and codebase size. With an API key you pay API rates. With an OAuth token, runs use your Claude subscription.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The docs list the levers. I would turn most of them on from day one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--max-turns&lt;/code&gt;&lt;/strong&gt; in &lt;code&gt;claude_args&lt;/code&gt; caps iterations. &lt;code&gt;claude_args: "--max-turns 5 --model claude-sonnet-5"&lt;/code&gt; is the docs' own example.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow &lt;code&gt;timeout-minutes&lt;/code&gt;&lt;/strong&gt; stops a runaway job. Pick a number you would be annoyed to exceed, say 15.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency controls&lt;/strong&gt; limit parallel runs so five comments in a row do not start five jobs. A group keyed on the issue or PR number works:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;claude-${{ github.event.issue.number || github.event.pull_request.number }}&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A concise &lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/strong&gt;, since it is read on every run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Specific requests and issue templates&lt;/strong&gt; so Claude needs fewer turns to find the problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A cheaper model for routine jobs.&lt;/strong&gt; Review and triage rarely need the largest model. Set it with &lt;code&gt;--model&lt;/code&gt; in &lt;code&gt;claude_args&lt;/code&gt;, or leave it off to use the Claude Code default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For org-wide tracking, the docs point to the analytics dashboard and the monitoring page. If you are on a subscription token and your allowance keeps vanishing, the reason is probably in &lt;a href="https://dev.to/blog/claude-code-usage-limits-2026/"&gt;what drains Claude Code usage fastest&lt;/a&gt;: long contexts, subagents and large models, all of which a busy CI job can hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roll It Out Across an Organization
&lt;/h2&gt;

&lt;p&gt;Quick setup and manual setup both work one repo at a time. For many repos:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the Claude GitHub App once at the organization level, on all repos or a selected list.&lt;/li&gt;
&lt;li&gt;Store the secret as an organization-level Actions secret. Use an API key, not an OAuth token, for the reason covered earlier.&lt;/li&gt;
&lt;li&gt;Add the workflow to each repo that should run it, or define the job once as a reusable workflow that each repo calls. The reusable route means one place to fix the version pin or the &lt;code&gt;--max-turns&lt;/code&gt; value.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Bedrock, Vertex and Foundry
&lt;/h2&gt;

&lt;p&gt;By default the action calls the Claude API directly. To route inference through your own cloud account instead, set one input:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;use_bedrock: "true"&lt;/code&gt; for Amazon Bedrock&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;use_vertex: "true"&lt;/code&gt; for Google Cloud's Agent Platform&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;use_foundry: "true"&lt;/code&gt; for Microsoft Foundry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three authenticate through OIDC identity federation, so no static cloud credentials sit in the repository. The setup has its own page in the docs, including a custom GitHub App with &lt;code&gt;APP_ID&lt;/code&gt; and &lt;code&gt;APP_PRIVATE_KEY&lt;/code&gt; secrets, and I would follow that page step by step instead of improvising.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Claude does not respond to &lt;code&gt;@claude&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check the GitHub App is installed on the repo and workflows are enabled.&lt;/li&gt;
&lt;li&gt;Check the secret exists in repository secrets.&lt;/li&gt;
&lt;li&gt;Check the comment has &lt;code&gt;@claude&lt;/code&gt; as a whole word.&lt;/li&gt;
&lt;li&gt;Check the commenting user has write access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;CI does not run on Claude's commits.&lt;/strong&gt; GitHub does not trigger workflows on commits made with the default &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;. If you pass &lt;code&gt;github_token: ${{ secrets.GITHUB_TOKEN }}&lt;/code&gt; to the action, remove it so the action authenticates as the Claude GitHub App, or pass a custom app token. Also check that your CI triggers include the events Claude's pushes produce, such as &lt;code&gt;push&lt;/code&gt; or &lt;code&gt;pull_request&lt;/code&gt;. This one bites almost everyone: Claude opens a PR, the checks never start, and the PR looks stuck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication errors.&lt;/strong&gt; Test the key or token locally with &lt;code&gt;claude&lt;/code&gt; before debugging the workflow. A dead credential looks the same as a workflow bug from the outside.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A review job passes but nothing shows on the PR.&lt;/strong&gt; You are in automation mode without &lt;code&gt;--comment&lt;/code&gt; and the inline comment tool. See the review section above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Still on &lt;code&gt;@beta&lt;/code&gt;.&lt;/strong&gt; Update to v1: change &lt;code&gt;@beta&lt;/code&gt; to &lt;code&gt;@v1&lt;/code&gt;, remove the &lt;code&gt;mode&lt;/code&gt; input, replace &lt;code&gt;direct_prompt&lt;/code&gt; with &lt;code&gt;prompt&lt;/code&gt;, and move CLI options such as &lt;code&gt;max_turns&lt;/code&gt; and &lt;code&gt;model&lt;/code&gt; into &lt;code&gt;claude_args&lt;/code&gt;. &lt;code&gt;custom_instructions&lt;/code&gt; becomes &lt;code&gt;--append-system-prompt&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Fits in Your Workflow
&lt;/h2&gt;

&lt;p&gt;My view is that the action earns its keep in two places and wastes money in a third.&lt;/p&gt;

&lt;p&gt;It earns its keep on small, well-specified tickets, where the fix is a paragraph of description and a test. Typos in docs, a missing null check, a dependency bump with a changelog to read. These are the jobs where a twenty-minute wait for a draft PR beats context-switching.&lt;/p&gt;

&lt;p&gt;It also earns its keep as a second reader on pull requests, especially on a team where review is the bottleneck. Used that way it is a filter that catches the obvious mistakes before a human spends attention. If review volume is your actual problem, the &lt;a href="https://dev.to/blog/ai-code-review-bottleneck-2026/"&gt;AI code review bottleneck&lt;/a&gt; is worth a read before you add more generated code to the pile.&lt;/p&gt;

&lt;p&gt;It wastes money when the task is vague. "Improve the performance of the app" will burn turns, produce a sprawling diff and teach your team to distrust the bot. The fix is the same as in any Claude Code session: smaller tasks, clearer instructions. If you are new to the tool itself, start with &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;how to use Claude Code&lt;/a&gt; locally before you hand it your CI.&lt;/p&gt;

&lt;p&gt;A sensible rollout looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;/install-github-app&lt;/code&gt; on one low-risk repo.&lt;/li&gt;
&lt;li&gt;Start with the review workflow, read-only permissions, &lt;code&gt;--max-turns&lt;/code&gt; set.&lt;/li&gt;
&lt;li&gt;Add the &lt;code&gt;@claude&lt;/code&gt; workflow once you trust the reviews.&lt;/li&gt;
&lt;li&gt;Write the project rules into a short &lt;code&gt;CLAUDE.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add concurrency and a timeout.&lt;/li&gt;
&lt;li&gt;Move to an org-level API key and a reusable workflow when a second repo wants it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is Claude Code GitHub Actions?&lt;/strong&gt; It is a GitHub Action, &lt;code&gt;anthropics/claude-code-action&lt;/code&gt;, that runs Claude Code in your workflows. Mention &lt;code&gt;@claude&lt;/code&gt; in a PR or issue comment and it analyzes code, implements changes and pushes commits. With a &lt;code&gt;prompt&lt;/code&gt; it can run on any GitHub event.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I install Claude Code on GitHub?&lt;/strong&gt; Run &lt;code&gt;/install-github-app&lt;/code&gt; inside Claude Code in your repository. It installs the Claude GitHub App, saves an authentication secret and opens a pull request with the workflow files. You need admin access and the GitHub CLI authenticated with &lt;code&gt;gh auth login&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Claude Code GitHub Actions free?&lt;/strong&gt; The action is open source, but each run uses GitHub Actions minutes and either API tokens or your Claude subscription allowance. Cost depends on prompt length, task complexity and codebase size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Code GitHub integration work with a Claude Pro or Max subscription?&lt;/strong&gt; Yes. Generate a token with &lt;code&gt;claude setup-token&lt;/code&gt; and store it as &lt;code&gt;CLAUDE_CODE_OAUTH_TOKEN&lt;/code&gt;. Pro, Max, Team and Enterprise plans can do this. Runs then use your subscription instead of API billing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I use an API key or an OAuth token?&lt;/strong&gt; Use an API key for shared and team repos. An OAuth token is tied to the subscription of the person who generated it, so it breaks when that person leaves and spends their personal allowance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I trigger Claude in a pull request?&lt;/strong&gt; Comment &lt;code&gt;@claude&lt;/code&gt; followed by your request, from a user with write access to the repository. The trigger phrase is configurable with &lt;code&gt;trigger_phrase&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Claude Code review pull requests automatically?&lt;/strong&gt; Yes, two ways. Add a workflow that runs a review skill on &lt;code&gt;pull_request&lt;/code&gt; events, with &lt;code&gt;--comment&lt;/code&gt; so it posts to the PR. Or, on Team and Enterprise plans, turn on the managed Code Review product, which needs no workflow file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between Claude Code Review and the GitHub Action?&lt;/strong&gt; Code Review is a managed service on Anthropic infrastructure for Team and Enterprise plans. It reviews only, with read-only access. The action runs on your runners, works on any plan with a key, and can also edit code, push commits and run any prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Code GitHub work on GitLab?&lt;/strong&gt; &lt;code&gt;/install-github-app&lt;/code&gt; works only with github.com repositories. For GitLab pipelines, use Claude Code GitLab CI/CD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is Claude not responding to my &lt;a class="mentioned-user" href="https://dev.to/claude"&gt;@claude&lt;/a&gt; comment?&lt;/strong&gt; Check that the app is installed, workflows are enabled, the secret is set, the comment contains &lt;code&gt;@claude&lt;/code&gt; as a full word, and the commenter has write access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does CI not run on Claude's commits?&lt;/strong&gt; GitHub does not trigger workflows for commits made with the default &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;. Remove &lt;code&gt;github_token: ${{ secrets.GITHUB_TOKEN }}&lt;/code&gt; from the action so it authenticates as the Claude GitHub App.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Claude Code run on a schedule in GitHub Actions?&lt;/strong&gt; Yes. Add a &lt;code&gt;schedule&lt;/code&gt; trigger and a &lt;code&gt;prompt&lt;/code&gt;. Scheduled workflows run only from the default branch, and public repos lose the schedule after 60 days without activity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I limit what Claude can do in CI?&lt;/strong&gt; Set a minimal &lt;code&gt;permissions&lt;/code&gt; block on the job, restrict tools with &lt;code&gt;--allowedTools&lt;/code&gt;, cap iterations with &lt;code&gt;--max-turns&lt;/code&gt;, add a workflow timeout, and require human approval before merge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use Claude Code GitHub Actions with Bedrock or Vertex?&lt;/strong&gt; Yes. Set &lt;code&gt;use_bedrock&lt;/code&gt;, &lt;code&gt;use_vertex&lt;/code&gt; or &lt;code&gt;use_foundry&lt;/code&gt; to &lt;code&gt;"true"&lt;/code&gt; and authenticate through OIDC federation instead of an API key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the managed Code Review work with Zero Data Retention?&lt;/strong&gt; No. It is not available to organizations with Zero Data Retention enabled or the HIPAA configuration applied.&lt;/p&gt;

&lt;p&gt;Sources, all checked October 29, 2026: &lt;a href="https://code.claude.com/docs/en/github-actions" rel="noopener noreferrer"&gt;Claude Code GitHub Actions&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/code-review" rel="noopener noreferrer"&gt;Code Review&lt;/a&gt;, the &lt;a href="https://github.com/anthropics/claude-code-action" rel="noopener noreferrer"&gt;claude-code-action repository&lt;/a&gt; with its &lt;a href="https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md" rel="noopener noreferrer"&gt;setup guide&lt;/a&gt; and &lt;a href="https://github.com/anthropics/claude-code-action/blob/main/docs/security.md" rel="noopener noreferrer"&gt;security notes&lt;/a&gt;, and the &lt;a href="https://github.com/apps/claude" rel="noopener noreferrer"&gt;Claude GitHub App&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>claude</category>
      <category>developertools</category>
    </item>
    <item>
      <title>Claude Code Usage Limits: How the Weekly Limit, 5-Hour Window and Reset Times Work</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Wed, 28 Oct 2026 12:48:14 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-usage-limits-how-the-weekly-limit-5-hour-window-and-reset-times-work-2hp8</link>
      <guid>https://dev.to/alexcloudstar/claude-code-usage-limits-how-the-weekly-limit-5-hour-window-and-reset-times-work-2hp8</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code Usage Limits: How the Weekly Limit, 5-Hour Window and Reset Times Work
&lt;/h1&gt;

&lt;p&gt;Most people find out about the Claude Code usage limit the same way. You are forty minutes into a good session, the agent is mid-refactor, and the terminal says &lt;code&gt;You've hit your session limit · resets 3:45pm&lt;/code&gt;. Nothing warned you, or if it did, you were not looking. Now you have a half-finished change and a few hours to think about how it happened.&lt;/p&gt;

&lt;p&gt;The frustrating part is that the rules are not complicated. They are just spread across a help center article, a costs page and an errors reference, and none of them gives you a number to plan around. So most advice online is either a table of guessed "prompts per hour" or a rant.&lt;/p&gt;

&lt;p&gt;This guide is the version I wanted. It covers how Claude Code usage limits work on Pro and Max, when the weekly limit and the 5-hour window reset, what actually drains them, how to see where you stand, how to make the allowance last, and what your options are when it runs out. I checked everything against Anthropic's documentation on October 28, 2026. Limits and plan details change often, so if something here has drifted, trust the docs over me. I list the sources at the bottom.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Claude Code Usage Limits Work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;On a Pro or Max plan, Claude Code usage is governed by two limits at the same time: a rolling 5-hour session limit and a weekly limit. Claude Code and claude.ai draw from the same pool, so chatting in the browser uses the same allowance as coding in the terminal.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is what each part means in practice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 5-hour session limit.&lt;/strong&gt; It is a rolling window, not a clock-hour reset. Your usage counts against it, and when you run out, Claude Code blocks requests until the reset time shown in the error message. Hitting it does not mean you are done for the day. It means you are done until that time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The weekly limit.&lt;/strong&gt; This is a second ceiling over a longer period. The errors reference says usage counts against the session and weekly allowances at the same time, and that a large burst of activity can exhaust the weekly allowance before the session window resets. In other words, you can have plenty left in your 5-hour window and still be blocked, because the week is spent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The shared pool.&lt;/strong&gt; The help center says all activity in Claude and Claude Code counts against the same limits. That includes the IDE extensions. If you spend the morning in long claude.ai conversations, you start the afternoon coding session with less.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Separate model limits.&lt;/strong&gt; Max plans also have a separate weekly limit for Fable. On the pricing page, Pro can reach Fable only through usage credits, while both Max tiers get it at 50% of weekly limits. Separately, you can see model-family messages such as &lt;code&gt;You've hit your Opus limit&lt;/code&gt; or &lt;code&gt;You've hit your Sonnet limit&lt;/code&gt;. Those apply only to that family, and switching to a model outside it keeps you working. The session and weekly limits apply across all models, so switching does nothing there.&lt;/p&gt;

&lt;p&gt;One more recent change worth knowing: a promotion that raised Claude Code weekly limits by 50% ran from May 13 through September 13, 2026. It has ended, but Anthropic says part of it stayed. Since September 14, weekly limits in Claude Code are 25% higher than before the promotion. The 5-hour limits were never part of it. If you read an older guide that mentions a 50% boost or an August cutoff, it is out of date.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Does the Claude Code Usage Limit Reset?
&lt;/h2&gt;

&lt;p&gt;When you hit a limit, the message includes the reset time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You've hit your session limit · resets 3:45pm
You've hit your weekly limit · resets Mon 12:00am
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those are the examples from Anthropic's error reference. The times are examples, not a schedule. The docs do not spell out exactly when a window starts counting, so do not do the arithmetic yourself. Read the reset time from the message, or run &lt;code&gt;/usage&lt;/code&gt;, which shows your plan limits and reset times.&lt;/p&gt;

&lt;p&gt;Two things worth knowing about resets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The weekly limit and the 5-hour window are independent.&lt;/strong&gt; The 5-hour window resetting does not refill the weekly allowance. If the weekly limit is what stopped you, the 3:45pm reset in your head is wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There is no documented way to reset early.&lt;/strong&gt; What the docs describe instead are ways to keep working: usage credits (&lt;code&gt;/usage-credits&lt;/code&gt;), a model outside the affected family for Opus and Sonnet limits, API billing, or a higher plan. I cover each below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you stay in the session, Claude Code can wait for the reset and pick the task back up on its own. That is covered in the section on hitting the limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are the Claude Code Limits Per Plan?
&lt;/h2&gt;

&lt;p&gt;This is the question most pages answer with a confident table, and it is where I will disappoint you. &lt;strong&gt;Anthropic does not publish exact token or message counts for Pro, Max 5x or Max 20x.&lt;/strong&gt; The help center article describes the structure (a 5-hour limit and a weekly limit) and says nothing about capacity in numbers. Any "you get 45 messages per window" figure you see is a third-party estimate, and the estimates disagree with each other.&lt;/p&gt;

&lt;p&gt;What is official is the price and the relative size:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Usage compared with Pro&lt;/th&gt;
&lt;th&gt;Claude Code&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pro&lt;/td&gt;
&lt;td&gt;$20/month ($17/month billed annually)&lt;/td&gt;
&lt;td&gt;Baseline&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max 5x&lt;/td&gt;
&lt;td&gt;$100/month&lt;/td&gt;
&lt;td&gt;5x&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max 20x&lt;/td&gt;
&lt;td&gt;$200/month&lt;/td&gt;
&lt;td&gt;20x&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API (Console)&lt;/td&gt;
&lt;td&gt;Pay per token&lt;/td&gt;
&lt;td&gt;No plan window, billed per token&lt;/td&gt;
&lt;td&gt;Pay as you go&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Max price points match the table in my &lt;a href="https://dev.to/blog/claude-june-2026-pricing-survival-guide/"&gt;June pricing survival guide&lt;/a&gt;. The practical reading is simple: Max 5x gives you five times the room Pro gives you, and Max 20x gives you twenty times. Since nobody publishes what the Pro baseline is in tokens, the honest way to size a plan is empirical. Use it for a week and watch &lt;code&gt;/usage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Anthropic's own upgrade advice is similarly empirical. The help center suggests Pro users consider Max 5x if they "consistently hit limits and need more capacity for larger repositories," and Max 5x users consider Max 20x if they keep hitting limits. Notice the phrase "larger repositories." Repository size matters because it changes how much context every request carries, which is the next section.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code limits on the Pro plan
&lt;/h3&gt;

&lt;p&gt;Pro includes Claude Code, with the same two limits as Max, only smaller. Three Pro details from the help center and pricing page:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fable is available on Pro only through usage credits, not the plan allowance.&lt;/li&gt;
&lt;li&gt;The "wrapping up" allowance is more limited on Pro. If you hit the 5-hour limit mid-response, Claude Code may finish the step in progress, and on Pro that can happen up to once per weekly usage period. On Max it can apply each time you reach a 5-hour limit. The help center says this is rolling out gradually, so you may not have it yet.&lt;/li&gt;
&lt;li&gt;The suggested upgrade path is Max 5x if you consistently hit limits, especially on larger repositories.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Pro is your plan, the habits in the stretching section matter more, because you have the least headroom for a long session.&lt;/p&gt;

&lt;p&gt;For teams, the allowance works the same way at a per-seat level: a rolling five-hour window and a weekly window, shared with chat and Cowork, with the size depending on the seat tier (Standard or Premium).&lt;/p&gt;

&lt;h2&gt;
  
  
  What Burns Through Your Claude Code Limit Fastest
&lt;/h2&gt;

&lt;p&gt;The limit is a usage allowance, and usage is tokens, not messages. That one fact explains most "I barely did anything and I'm out" stories. The costs page lists the real causes, and I have put them roughly in the order they bite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Long context.&lt;/strong&gt; Claude Code sends your whole conversation with every request, and every tool use sends another request carrying that batch of tool results. Prompt caching means the history is re-read at the cheaper cached rate, but it is still re-read. The docs spell out the consequence: a one-line question in a session that has been open all day still draws usage for the entire conversation. A session you never clear is the most common way to burn an allowance without noticing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Cache misses after a break.&lt;/strong&gt; Your first message after a pause longer than the cache lifetime misses the cache and reprocesses the full context. Coming back from lunch to a huge session is more expensive than the same question in a fresh one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Subagents and agent teams.&lt;/strong&gt; Every subagent sends its own requests on top of the main conversation. The docs say subagent requests "still draw on your usage." Agent teams are heavier: they use roughly 7x more tokens than a standard session when teammates run in plan mode, because each teammate keeps its own context window. I like &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents&lt;/a&gt; for keeping noisy output out of the main context, but they are a trade, not a free lunch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Model and thinking effort.&lt;/strong&gt; Sonnet handles most coding work and costs less than Opus. Extended thinking is on by default and thinking tokens bill as output tokens, with a default budget that can reach tens of thousands of tokens per request. The docs note that on current models you cannot turn thinking off, so the lever is the effort level, not an on/off switch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Heavy background habits.&lt;/strong&gt; Session-scoped scheduled tasks fire on their interval even while the session is idle, and each firing sends your full context. Messages from other sessions and goal check-ins can start new turns on an idle session too. A &lt;code&gt;/loop&lt;/code&gt; you forgot about is a slow leak.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Bloated setup.&lt;/strong&gt; A long &lt;code&gt;CLAUDE.md&lt;/code&gt; is loaded at the start of every session and sits in context for every request. MCP servers add overhead too, though tool definitions are deferred by default now so only names and server instructions enter context until a tool is used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Compaction itself.&lt;/strong&gt; &lt;code&gt;/compact&lt;/code&gt; reads the whole conversation it summarizes, so compacting a huge context is a large request. When you want a clean slate rather than continuity, &lt;code&gt;/clear&lt;/code&gt; costs nothing.&lt;/p&gt;

&lt;p&gt;If I had to pick one lesson from that list, it is that long sessions are the tax. Almost every other item gets worse as the context grows. The &lt;a href="https://dev.to/blog/claude-code-workflow-32784-lines-2-days-2026/"&gt;32,784-line workflow post&lt;/a&gt; is about shipping a lot of code in short, scoped steps, and part of why that works is that small steps keep each request cheap.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Check Your Claude Code Usage
&lt;/h2&gt;

&lt;p&gt;You do not have to guess where you stand. There are three places to look.&lt;/p&gt;

&lt;h3&gt;
  
  
  The /usage command
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;/usage&lt;/code&gt; inside Claude Code. On Pro, Max, Team and Enterprise plans it shows your plan usage bars, activity stats and a breakdown of what counts against your limits. The pieces worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Attribution.&lt;/strong&gt; Recent usage broken down by skills, subagents, plugins and individual MCP servers, each as a percentage of the total.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recommendations.&lt;/strong&gt; Suggested changes, one per row, each starting with a share of your recent usage (at least 10%), for example &lt;code&gt;25%  Trim ~/code/api/CLAUDE.md · 49k tokens per request&lt;/code&gt;. The share tells you how much of your usage the row applies to, not how much the change saves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loops.&lt;/strong&gt; The heaviest scheduled tasks that ran recently, with how often they fire and how many tokens they used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time range.&lt;/strong&gt; Press &lt;code&gt;d&lt;/code&gt; or &lt;code&gt;w&lt;/code&gt; to switch between the last 24 hours and the last 7 days.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;f&lt;/code&gt; shortcut.&lt;/strong&gt; When the footer shows a hint like &lt;code&gt;f to fix 2 of 3&lt;/code&gt;, pressing &lt;code&gt;f&lt;/code&gt; has Claude Code act on the recommendations it can, such as running an &lt;code&gt;/effort&lt;/code&gt; change. It needs Claude Code v2.1.305 or later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two caveats. The figures are approximate and computed from local session history on the machine you are using, so usage from other devices or claude.ai is not included. And the Session block at the top shows a dollar figure computed at list price. That is meant for API users, so on a subscription ignore the dollar number and look at the plan bars.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/cost&lt;/code&gt; still works as an alias in older write-ups, and the &lt;a href="https://dev.to/blog/claude-code-commands-cheat-sheet-2026/"&gt;commands cheat sheet&lt;/a&gt; covers the rest of the slash commands. The help center also points at &lt;code&gt;/status&lt;/code&gt; for monitoring your remaining allocation, so if &lt;code&gt;/usage&lt;/code&gt; looks different on your version, try that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Warnings before you hit the wall
&lt;/h3&gt;

&lt;p&gt;Claude Code can warn you before a window runs out, with messages like &lt;code&gt;You've used 85% of your session limit · resets 3:45pm&lt;/code&gt;. They are easy to miss in a busy terminal, which is why I prefer a permanent display.&lt;/p&gt;

&lt;h3&gt;
  
  
  A status line that shows it
&lt;/h3&gt;

&lt;p&gt;A custom status line can show both limits all the time. Status line scripts receive &lt;code&gt;rate_limits.five_hour.used_percentage&lt;/code&gt;, &lt;code&gt;rate_limits.seven_day.used_percentage&lt;/code&gt; and &lt;code&gt;rate_limits.five_hour.resets_at&lt;/code&gt;. These fields only appear for claude.ai Pro and Max subscribers and only after the first API response, so give them a fallback. My &lt;a href="https://dev.to/blog/claude-code-status-line-guide-2026/"&gt;status line guide&lt;/a&gt; has a full walkthrough, including a setup that stays quiet until the 7-day limit crosses a threshold.&lt;/p&gt;

&lt;p&gt;If you only do one thing from this post, put the 5-hour percentage in your status line. Knowing you are at 80% before you start a big refactor changes what you start.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Make Your Claude Code Limit Last Longer
&lt;/h2&gt;

&lt;p&gt;None of these are magic. They all do the same thing: send fewer tokens per request, or send fewer requests. Ordered by how much they usually save.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clear between unrelated tasks.&lt;/strong&gt; Use &lt;code&gt;/clear&lt;/code&gt; when you switch work. Stale context taxes every message that follows. Run &lt;code&gt;/rename&lt;/code&gt; first so you can &lt;code&gt;/resume&lt;/code&gt; the old session later. This is the highest-value habit on the list, and it costs nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compact on purpose.&lt;/strong&gt; When you want continuity, &lt;code&gt;/compact&lt;/code&gt; summarizes the conversation. You can steer it: &lt;code&gt;/compact Focus on code samples and API usage&lt;/code&gt; tells Claude what to keep. You can also pin the behavior in &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Compact instructions&lt;/span&gt;

When you are using compact, please focus on test output and code changes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compact before a long break, not after. Coming back to a big context after the cache expires is the expensive version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use plan mode for anything non-trivial.&lt;/strong&gt; A wrong first step is the most expensive thing in a session, because you pay for the wrong diff and then pay again to redo it. Planning first is cheap insurance. The &lt;a href="https://dev.to/blog/claude-code-plan-mode-2026/"&gt;plan mode guide&lt;/a&gt; covers the details, including &lt;code&gt;opusplan&lt;/code&gt;, which uses Opus for planning and switches to Sonnet for the edits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick the model for the job.&lt;/strong&gt; Run &lt;code&gt;/model&lt;/code&gt; to switch mid-session or set a default in &lt;code&gt;/config&lt;/code&gt;. Sonnet for the bulk of the work, Opus for hard architectural decisions. One detail from the docs that people miss: a switch to Opus also applies to subagents that inherit your session's model. For simple subagent tasks you can set &lt;code&gt;model: haiku&lt;/code&gt; in the subagent configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lower the effort level.&lt;/strong&gt; For simple tasks, &lt;code&gt;/effort&lt;/code&gt; reduces how much thinking each request does. The &lt;code&gt;/usage&lt;/code&gt; recommendations will even suggest it when it spots a pattern, for example &lt;code&gt;Switch from max to high effort · /effort high&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep &lt;code&gt;CLAUDE.md&lt;/code&gt; lean.&lt;/strong&gt; The docs suggest under 200 lines, with specialized instructions moved into skills, which load on demand rather than at session start. Detailed workflows for PR reviews or database migrations do not need to be in context while you fix a CSS bug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disable MCP servers you are not using.&lt;/strong&gt; Run &lt;code&gt;/mcp&lt;/code&gt; to see what is configured, and &lt;code&gt;/context&lt;/code&gt; to see what is eating space. Where a CLI tool exists, such as &lt;code&gt;gh&lt;/code&gt; or &lt;code&gt;aws&lt;/code&gt;, the docs say it is still more context-efficient than an MCP server because it adds no per-tool listing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filter noisy output before Claude sees it.&lt;/strong&gt; A hook can grep a 10,000-line log down to the error lines before they enter context. The costs page has a working PreToolUse example that trims test output to failures only, and the &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;hooks guide&lt;/a&gt; shows how to build your own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Write specific prompts.&lt;/strong&gt; "Improve this codebase" triggers broad scanning. "Add input validation to the login function in &lt;code&gt;auth.ts&lt;/code&gt;" does not. A tight prompt means fewer file reads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop wrong turns early.&lt;/strong&gt; Press &lt;code&gt;Esc&lt;/code&gt; the moment Claude heads the wrong way, and use &lt;code&gt;/rewind&lt;/code&gt; to go back to a checkpoint. Letting a bad direction run for ten minutes is paid for twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delegate noisy work, carefully.&lt;/strong&gt; Running tests or reading logs in a subagent keeps the verbose output out of your main context. That saves context, but the subagent's own requests still count, so pair it with a smaller model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be careful with parallel sessions.&lt;/strong&gt; Running several sessions or &lt;a href="https://dev.to/blog/git-worktree-guide-2026/"&gt;git worktrees&lt;/a&gt; at once is great for throughput, but every session burns the same shared allowance. Three sessions working at once pull from that one allowance together, so I treat parallelism as something to spend deliberately, not a default.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens When You Hit the Claude Code Limit
&lt;/h2&gt;

&lt;p&gt;When you run out, the message tells you which limit you hit and when it resets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You've hit your session limit · resets 3:45pm
You've hit your weekly limit · resets Mon 12:00am
You've hit your Opus limit · resets 3:45pm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code blocks further requests until the reset time shown. Your options, in the order I would think about them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let it wait for you.&lt;/strong&gt; On Claude Code v2.1.234 or later, in an interactive session signed in with a claude.ai subscription, Claude Code can wait in the open session and continue the interrupted task on its own after the limit resets. You will see lines like &lt;code&gt;Usage limit reached · limit resets 3:45pm&lt;/code&gt; and &lt;code&gt;Continuing automatically at 3:45pm · Esc to cancel&lt;/code&gt;. Keep the session open. A few details from the docs: it prompts Claude to pick the task up where it stopped rather than resending your last message, it still asks for permissions as usual so it can stall on a prompt while you are away, and it gives up after hitting the limit again twice in a row. Press &lt;code&gt;Esc&lt;/code&gt; at an empty prompt to cancel, or use &lt;code&gt;/rate-limit-options&lt;/code&gt; to manage it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switch model families, if it is an Opus or Sonnet limit.&lt;/strong&gt; Run &lt;code&gt;/model&lt;/code&gt; and pick a model outside that family. This does not help with the session or weekly limits, which are shared across models. It also has a cost: each model has its own prompt cache, so the next request re-reads the whole conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Buy usage credits.&lt;/strong&gt; Run &lt;code&gt;/usage-credits&lt;/code&gt; to turn on or manage extra usage on Pro and Max. It opens the usage settings on claude.ai, where you can switch usage credits on, set a monthly spend limit and check your balance. Credits are billed at standard API rates, which are different from your plan pricing. They cover the five-hour, weekly and Fable weekly limits. On Team and Enterprise, the same command sends a request to your admin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upgrade.&lt;/strong&gt; Pro to Max 5x, or Max 5x to Max 20x, if you keep hitting the wall. Upgrade only after a few weeks of data. A habit change is cheaper than $80 a month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Move to API billing.&lt;/strong&gt; You can switch to a Console account and buy API credits. There is a trap here: if an &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; environment variable is set, Claude Code uses it instead of your subscription, and you get API charges without noticing. If a bill surprises you, run &lt;code&gt;env | grep ANTHROPIC_API_KEY&lt;/code&gt; to see whether the variable is set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use something else for the gap.&lt;/strong&gt; If your work cannot stop, a second tool is a legitimate answer. I compared the realistic options in &lt;a href="https://dev.to/blog/claude-code-alternatives-2026/"&gt;Claude Code alternatives&lt;/a&gt;, and the &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt; covers how the two handle plans and limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Usage Limits vs Rate Limits (429 Errors)
&lt;/h2&gt;

&lt;p&gt;People search for "Claude Code rate limit" and mean two different things.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;usage limit&lt;/strong&gt; is the subscription allowance above: the 5-hour window and the weekly cap. The message starts with &lt;code&gt;You've hit your...&lt;/code&gt; and gives a reset time.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;rate limit&lt;/strong&gt; is a short-lived throttle on how fast you send requests, and it is unrelated to your allowance. &lt;code&gt;Server is temporarily limiting requests&lt;/code&gt; and &lt;code&gt;Request rejected (429)&lt;/code&gt; are this kind. Claude Code retries temporary 429s automatically, up to 10 times with exponential backoff by default, and the spinner shows &lt;code&gt;Retrying in Ns · attempt x/y&lt;/code&gt;. A 529 overloaded error is a capacity problem on Anthropic's side and does not count against your quota. Wait and retry before you assume you are out.&lt;/p&gt;

&lt;p&gt;On API and Console billing, rate limits are the real constraint. The costs page gives per-user starting points for requests-per-minute and tokens-per-minute by team size, for example 200k to 300k TPM and 5 to 7 RPM per user for teams of 1 to 5. Those apply at the organization level, so one user can briefly exceed their share when others are idle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code vs Codex: Which Has the Better Limits?
&lt;/h2&gt;

&lt;p&gt;I get asked this one, and the honest answer is that a number-for-number comparison is not possible. Neither side publishes exact capacity, and the third-party tables that claim otherwise are estimates. What you can compare is structure. Claude Code runs a rolling 5-hour window with weekly limits on top. Codex on Plus meters local messages per 5-hour window and calls those numbers estimates, and my notes say its Pro tiers currently have no 5-hour limit. Those details move, so check the vendor pages before you pay. My &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt; goes through plans, models and limits side by side. If you want the wider field, &lt;a href="https://dev.to/blog/claude-code-alternatives-2026/"&gt;Claude Code alternatives&lt;/a&gt; covers the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  What About Headless Mode and the Agent SDK?
&lt;/h2&gt;

&lt;p&gt;If you run &lt;code&gt;claude -p&lt;/code&gt;, the Agent SDK or Claude Code in CI, the picture is murkier, and it has changed more than once. Anthropic announced that this usage would move to a separate monthly credit pool, then paused the change. As of the last update in that guide, Max and Team plans include monthly API credits covering the Agent SDK, &lt;code&gt;claude -p&lt;/code&gt;, the Claude API and Managed Agents. I walk through the whole timeline in the &lt;a href="https://dev.to/blog/claude-june-2026-pricing-survival-guide/"&gt;pricing survival guide&lt;/a&gt;, and I would read that before you build anything on automated usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Sensible Routine for Staying Under the Limit
&lt;/h2&gt;

&lt;p&gt;If you want something concrete to copy, this is the routine I would give a developer on Pro or Max:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the 5-hour and 7-day percentages to your status line.&lt;/li&gt;
&lt;li&gt;Start each new task in a clean session with &lt;code&gt;/clear&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Use plan mode when the change touches more than a couple of files.&lt;/li&gt;
&lt;li&gt;Default to Sonnet. Use Opus on purpose.&lt;/li&gt;
&lt;li&gt;Keep &lt;code&gt;CLAUDE.md&lt;/code&gt; short and move workflow detail into skills.&lt;/li&gt;
&lt;li&gt;Compact before you step away, not when you come back.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;/usage&lt;/code&gt; once a week and follow the top recommendation.&lt;/li&gt;
&lt;li&gt;Leave a session open if you hit the limit mid-task, so auto-continue can pick it up.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is it. None of it costs quality, and most of it makes sessions faster as well as cheaper, because smaller contexts are quicker to process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What are the Claude Code usage limits?&lt;/strong&gt; On Pro and Max, two limits apply at once: a rolling 5-hour session limit and a weekly limit. Both are shared with claude.ai. Anthropic does not publish exact token counts per plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long is the Claude Code usage limit?&lt;/strong&gt; The session limit is a rolling 5-hour window, and there is a separate weekly limit. The error message shows the exact reset time, for example &lt;code&gt;resets 3:45pm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When does Claude Code usage reset?&lt;/strong&gt; The reset time is shown in the limit message, and &lt;code&gt;/usage&lt;/code&gt; shows your plan limits and reset times. Claude Code can wait and continue your task automatically after the reset if the session stays open.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When does the Claude weekly limit reset?&lt;/strong&gt; The weekly limit message shows its own reset time, for example &lt;code&gt;resets Mon 12:00am&lt;/code&gt; in Anthropic's docs. Read the time from your message or &lt;code&gt;/usage&lt;/code&gt;, because it is independent of the 5-hour window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can you reset the Claude Code usage limit early?&lt;/strong&gt; There is no documented way. You can keep working past the limit with usage credits (&lt;code&gt;/usage-credits&lt;/code&gt;), API billing, a model outside the affected family for Opus and Sonnet limits, or a higher plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the Claude Code Pro limits?&lt;/strong&gt; Pro has the same two limits as Max, at the smallest allowance. Anthropic does not publish token counts, Fable is available only through usage credits, and the suggested upgrade is Max 5x if you consistently hit the wall.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between a usage limit and a rate limit?&lt;/strong&gt; A usage limit is the 5-hour and weekly subscription allowance. A rate limit, such as a 429 or &lt;code&gt;Server is temporarily limiting requests&lt;/code&gt;, is a short throttle that Claude Code retries automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which has better limits, Claude Code or Codex?&lt;/strong&gt; Neither publishes exact capacity. Compare plans and structure in the &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt;, and test on the cheap tier first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do Claude and Claude Code share the same limit?&lt;/strong&gt; Yes. The help center says all activity in both tools counts against the same limits, including IDE usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does switching models fix a session or weekly limit?&lt;/strong&gt; No. Those limits are shared across all models. It only helps with model-family limits such as the Opus limit or Sonnet limit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I check my Claude Code usage?&lt;/strong&gt; Run &lt;code&gt;/usage&lt;/code&gt;. It shows plan usage bars, a breakdown by skills, subagents, plugins and MCP servers, and recommendations. You can also show the 5-hour and 7-day percentages permanently in a custom status line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why did I hit my limit so fast?&lt;/strong&gt; Usually a long, never-cleared session, subagents or agent teams, Opus with high effort, or a cache miss after a long break. Run &lt;code&gt;/usage&lt;/code&gt; and read the attribution and recommendation rows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between Pro, Max 5x and Max 20x?&lt;/strong&gt; Price and relative capacity. Pro is the baseline at $20 a month. Max 5x gives five times Pro's usage at $100 a month, and Max 20x gives twenty times at $200 a month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I keep working after hitting the limit?&lt;/strong&gt; Yes. You can buy usage credits with &lt;code&gt;/usage-credits&lt;/code&gt;, switch to a model outside an affected family, move to API billing, or upgrade your plan. Usage credits are billed at standard API rates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will Claude Code continue my task after the limit resets?&lt;/strong&gt; On v2.1.234 or later, in an interactive session signed in with a claude.ai subscription, it waits and continues automatically. Keep the session open, and cancel with &lt;code&gt;Esc&lt;/code&gt; if you do not want it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the Agent SDK or &lt;code&gt;claude -p&lt;/code&gt; count against my limit?&lt;/strong&gt; It has changed more than once. See the &lt;a href="https://dev.to/blog/claude-june-2026-pricing-survival-guide/"&gt;pricing survival guide&lt;/a&gt; for the current state and how I would plan for it.&lt;/p&gt;

&lt;p&gt;Sources, all checked October 28, 2026: &lt;a href="https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan" rel="noopener noreferrer"&gt;Use Claude Code with your Pro or Max plan&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Manage costs effectively&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/errors" rel="noopener noreferrer"&gt;Claude Code error reference&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/interactive-mode" rel="noopener noreferrer"&gt;Interactive mode&lt;/a&gt;, &lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;, and the &lt;a href="https://support.claude.com/en/articles/15910845" rel="noopener noreferrer"&gt;Claude Code weekly limit promotion article&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>claude</category>
      <category>developertools</category>
    </item>
    <item>
      <title>Claude Code Plan Mode: How It Works, How to Use It, and When to Skip It</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Tue, 27 Oct 2026 06:53:08 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-plan-mode-how-it-works-how-to-use-it-and-when-to-skip-it-57l</link>
      <guid>https://dev.to/alexcloudstar/claude-code-plan-mode-how-it-works-how-to-use-it-and-when-to-skip-it-57l</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code Plan Mode: How It Works, How to Use It, and When to Skip It
&lt;/h1&gt;

&lt;p&gt;The most expensive Claude Code mistake I know is not a bad edit. It is a confident edit. You ask for a refactor, the agent picks an approach in about four seconds, and twenty minutes later you are reading a diff across twelve files that solves a slightly different problem than the one you had. Nothing is broken. It is just wrong, and the cost of finding that out is the whole diff.&lt;/p&gt;

&lt;p&gt;Plan mode is the fix for that, and it costs almost nothing. Claude reads your code, writes down what it intends to do, and waits. You read the plan, change it if it is off, and only then does anything get edited. I wrote &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;a short section on it&lt;/a&gt; in the beginner guide and a one-line entry in the &lt;a href="https://dev.to/blog/claude-code-commands-cheat-sheet-2026/"&gt;commands cheat sheet&lt;/a&gt;, but it deserves its own page, because most of what makes it useful is in the details.&lt;/p&gt;

&lt;p&gt;This guide covers how to turn it on, what Claude can and cannot do inside it, the approval menu, how to edit a plan, the settings that change its behavior, and the cases where I skip it. I checked everything against the official permission modes documentation on October 27, 2026. Claude Code changes often, so treat the docs as the source of truth if something here has drifted.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Claude Code Plan Mode Is
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Claude Code plan mode is a permission mode where Claude researches your codebase and proposes changes without making them. It can read files, run shell commands to explore, and write a plan. It cannot edit your source files until you approve the plan.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is the whole idea. The mode changes one thing: whether Claude is allowed to change your code. Everything else about the session stays the same, including your CLAUDE.md, your tools and your conversation history.&lt;/p&gt;

&lt;p&gt;It helps to think of it as two phases. In the first, Claude gathers context and reasons. In the second, after you approve, it executes with the permissions of whichever mode you picked on the approval screen. The plan is the handoff between the two, and it is also the thing you get to review, which is the point.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Turn On Plan Mode in Claude Code
&lt;/h2&gt;

&lt;p&gt;There are several ways in, and which one you use depends on whether you want it once, for a session, or by default.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;How&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Keyboard&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Shift+Tab&lt;/code&gt; until the status bar shows &lt;code&gt;⏸ plan mode on&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Current session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slash command&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/plan&lt;/code&gt;, or &lt;code&gt;/plan fix the auth bug&lt;/code&gt; to start straight away&lt;/td&gt;
&lt;td&gt;One prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Startup flag&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --permission-mode plan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The whole session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Settings default&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;permissions.defaultMode&lt;/code&gt; set to &lt;code&gt;"plan"&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Every terminal session in the project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Desktop app&lt;/td&gt;
&lt;td&gt;Pick Plan in the mode selector&lt;/td&gt;
&lt;td&gt;Current session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web&lt;/td&gt;
&lt;td&gt;Pick Plan in the dropdown for cloud sessions&lt;/td&gt;
&lt;td&gt;Current session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few notes on those.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Shift+Tab&lt;/code&gt; cycles modes. In default mode the cycle runs &lt;code&gt;default&lt;/code&gt;, then &lt;code&gt;acceptEdits&lt;/code&gt;, then &lt;code&gt;plan&lt;/code&gt;, so you usually press it twice. If you have auto mode available, the first press from &lt;code&gt;auto&lt;/code&gt; drops you to &lt;code&gt;default&lt;/code&gt; first. Watch the status bar instead of counting. Press &lt;code&gt;Shift+Tab&lt;/code&gt; again to leave plan mode without approving anything. On Windows, if &lt;code&gt;Shift+Tab&lt;/code&gt; does not cycle because your Node or Bun runtime does not enable VT input mode, use &lt;code&gt;Alt+M&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/plan&lt;/code&gt; is the one I use most. Typing &lt;code&gt;/plan&lt;/code&gt; followed by a description puts Claude in plan mode and gives it the task in one move. The slash command has to be at the very start of the message, like every slash command. The full list of what else lives at that level is in the &lt;a href="https://dev.to/blog/claude-code-commands-cheat-sheet-2026/"&gt;commands cheat sheet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To make plan mode the default for a project, put this in &lt;code&gt;.claude/settings.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"defaultMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"plan"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;VS Code is the exception. VS Code sessions do not read the project setting for the starting mode. Set &lt;code&gt;claudeCode.initialPermissionMode&lt;/code&gt; to &lt;code&gt;plan&lt;/code&gt; in your VS Code user settings instead.&lt;/p&gt;

&lt;p&gt;Do I recommend plan mode as a default? Not for most people. Every session starts with a plan step, including the ones where you just want a typo fixed. I would use it as a default in one case: a repo you are new to, where every change should start with Claude proving it understood the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Claude Can and Cannot Do in Plan Mode
&lt;/h2&gt;

&lt;p&gt;Inside plan mode, Claude can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read files and search the codebase.&lt;/li&gt;
&lt;li&gt;Run shell commands to explore, such as &lt;code&gt;git log&lt;/code&gt;, &lt;code&gt;ls&lt;/code&gt; or a test listing.&lt;/li&gt;
&lt;li&gt;Ask you clarifying questions.&lt;/li&gt;
&lt;li&gt;Write the plan itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It cannot edit your source files until you approve the plan. That is the guarantee, with one important exception covered in the section on limits below.&lt;/p&gt;

&lt;p&gt;Shell commands are where it gets less obvious, because "run commands to explore" still needs a rule for which commands count. The docs describe three cases, and the first one that matches applies:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Interactive terminal with bypass permissions available.&lt;/strong&gt; Neither the classifier nor a prompt applies to planning commands. Claude is told not to edit, but anything it attempts runs. Explicit &lt;code&gt;ask&lt;/code&gt; rules and critical-path &lt;code&gt;rm&lt;/code&gt; removals still prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto mode available and &lt;code&gt;useAutoModeDuringPlan&lt;/code&gt; on (the default).&lt;/strong&gt; The classifier reviews shell commands instead of prompting you. Approved ones run, rejected ones are blocked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto mode not available, or &lt;code&gt;useAutoModeDuringPlan&lt;/code&gt; off.&lt;/strong&gt; Commands outside the built-in read-only set prompt for approval.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In practice, on a normal setup, you will see Claude run read-only commands freely and ask before anything that could change state. That is what you want from a planning phase.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Plan Approval Menu
&lt;/h2&gt;

&lt;p&gt;When the plan is ready, Claude presents it and asks how to proceed. The options you will see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Yes, and use auto mode.&lt;/strong&gt; Approves the plan and starts auto mode, where a classifier approves routine actions. If auto mode is not available to your session, this reads &lt;strong&gt;Yes, auto-accept edits&lt;/strong&gt; instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yes, manually approve edits.&lt;/strong&gt; Approves the plan, but you review each edit one by one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No, keep planning.&lt;/strong&gt; Stays in plan mode so you can tell Claude what to change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your session started with bypass permissions enabled, the first option instead reads &lt;strong&gt;Yes, and switch to BYPASS PERMISSIONS (no further prompts) for this session&lt;/strong&gt;. Read that label before you press Enter. It is the same switch as running with &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There is also an optional option that clears the planning context. When &lt;code&gt;showClearContextOnPlanAccept&lt;/code&gt; is enabled, a new first option appears that approves the plan and clears the conversation used to build it. That sounds odd until you have done a long planning session: the research, the dead ends and the back-and-forth all sit in the context window, and none of them help the implementation. Starting clean with just the approved plan can leave the execution phase with more room to work and fewer old assumptions to trip over. If you often plan for a long time, turn it on.&lt;/p&gt;

&lt;p&gt;Approving exits plan mode and moves you to whatever mode the option describes. To plan again, cycle back with &lt;code&gt;Shift+Tab&lt;/code&gt; or prefix a prompt with &lt;code&gt;/plan&lt;/code&gt;. Accepting a plan also gives the session a title generated from the plan, unless you already named it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Edit the Plan with Ctrl+G
&lt;/h2&gt;

&lt;p&gt;This is the feature most people never find. Press &lt;code&gt;Ctrl+G&lt;/code&gt; while a plan is on screen and Claude opens it in your default text editor. Change it, save, close, and Claude proceeds with your version.&lt;/p&gt;

&lt;p&gt;Why bother, when you could just reply and ask for changes? Because some corrections are faster to make than to describe. Deleting a step you do not want is one keystroke. Reordering two steps is a cut and paste. Adding a constraint like "do not touch the public API" is one line. Telling the model to do any of that and waiting for it to rewrite the plan is slower and risks it rewording things you did not ask it to change.&lt;/p&gt;

&lt;p&gt;Plan files for the current session live in &lt;code&gt;~/.claude/plans/&lt;/code&gt;, or in the directory set by the &lt;code&gt;plansDirectory&lt;/code&gt; setting. Writes to &lt;code&gt;~/.claude/plans/&lt;/code&gt; are exempt from the protected &lt;code&gt;.claude&lt;/code&gt; directory rule, which is why Claude can save a plan there even in modes that guard that folder. If you want plans in the repo so teammates can read them, point &lt;code&gt;plansDirectory&lt;/code&gt; at a project folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Plan Mode Workflow That Works
&lt;/h2&gt;

&lt;p&gt;Here is the loop I use, with a real-shaped example. The task: add rate limiting to an Express API that already has auth middleware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Start with the goal and the constraints, not the solution.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plan Add per-user rate limiting to the API. Use the existing Redis client.
Do not change the auth middleware's public behavior. Show me which files
you would touch before touching any.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Giving Claude the constraints up front is what keeps the plan from drifting. "Use the existing Redis client" saves me from a plan that adds a second dependency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Let it read, then read the plan critically.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A useful plan names files, in order, and says why. A weak one says "update the relevant middleware." Here is the shape of a good one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Add src/middleware/rateLimit.ts using the client from src/lib/redis.ts
2. Key limits by req.user.id, fall back to IP for unauthenticated routes
3. Register it after auth in src/app.ts so req.user exists
4. Add tests in src/middleware/rateLimit.test.ts (limit hit, reset, no user)
5. Document the new env vars in README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Push back before approving.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Questions I ask at this step: what did you not read? What is the riskiest step? What happens to the unauthenticated routes? A plan is cheap to question. Code is not. If an answer surprises me, I say "No, keep planning" and give the correction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Edit with Ctrl+G when the fix is small.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If step 5 is out of scope, I delete it in the editor rather than debating it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Approve with the mode that matches the risk.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For a change this size, I pick manual approval for the first run and auto mode once I trust the plan. The plan has already done the thinking, so the edits become mostly mechanical.&lt;/p&gt;

&lt;p&gt;That whole loop adds a few minutes. The first time it catches a wrong assumption about the codebase, it pays for a month of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use Plan Mode and When to Skip It
&lt;/h2&gt;

&lt;p&gt;My rule: use plan mode when a wrong first step is expensive.&lt;/p&gt;

&lt;p&gt;Use it for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Changes across more than a couple of files.&lt;/strong&gt; Refactors, renames that cross module boundaries, anything with a migration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code you do not know.&lt;/strong&gt; A repo you just cloned, or a part of your own app you have not touched in a year. The plan shows you whether Claude understood the structure before it changed anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Irreversible or expensive changes.&lt;/strong&gt; Database migrations, public API changes, dependency upgrades with breaking changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Work you will hand off or review.&lt;/strong&gt; A written plan is an easy thing to put in a pull request description.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When you are not sure what you want.&lt;/strong&gt; Asking for a plan is a cheap way to see options.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skip it for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-line fixes.&lt;/strong&gt; A typo, a changed constant, a renamed variable. The plan would be longer than the diff.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks with an obvious single path.&lt;/strong&gt; "Add this field to this type" does not need a review step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Throwaway experiments.&lt;/strong&gt; If you are going to delete it in ten minutes, do not spend three on a plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quick questions.&lt;/strong&gt; Reading code and answering does not need a mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One more mistake worth naming: planning forever. Three rounds of plan revisions on a small task is usually a sign the task needs to be split, not that the plan needs another pass. Approve a smaller plan and do the next piece afterward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan Mode Is Not a Sandbox
&lt;/h2&gt;

&lt;p&gt;This is the caveat people miss, and it is a real one. Plan mode blocks edits by telling Claude not to make them and denying the tools, but in an interactive terminal where bypass permissions is available, those blocks are not enforced. Claude is still told to plan without editing. If it attempts an edit or a shell command anyway, it runs without a prompt.&lt;/p&gt;

&lt;p&gt;So the safe reading is: plan mode is a workflow, and a good one, but it is not a security boundary. If the point is to guarantee nothing changes, do not start the session with &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;. And if you need real limits on what an agent can touch, that is a permissions and sandbox question, which I cover in the &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;least-privilege guide for coding agents&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Plan mode keeps its blocks everywhere that runs without an interactive terminal: &lt;code&gt;claude -p&lt;/code&gt; runs, Agent SDK sessions and the VS Code chat panel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan Mode Settings Worth Knowing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;permissions.defaultMode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Set to &lt;code&gt;"plan"&lt;/code&gt; to start every terminal session in plan mode&lt;/td&gt;
&lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;useAutoModeDuringPlan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lets the auto mode classifier review shell commands during planning instead of prompting you&lt;/td&gt;
&lt;td&gt;On&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;showClearContextOnPlanAccept&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds an approve-and-clear-context option to the approval menu&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;plansDirectory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Where plan files are saved&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.claude/plans/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claudeCode.initialPermissionMode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;VS Code user setting for the starting mode&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I would change two of those. Turn on &lt;code&gt;showClearContextOnPlanAccept&lt;/code&gt; if your planning sessions run long, and set &lt;code&gt;plansDirectory&lt;/code&gt; to a project folder if you want plans in version control. Leave the rest alone until you have a reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Plan Mode in Headless Runs
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;--permission-mode&lt;/code&gt; flag works with &lt;code&gt;-p&lt;/code&gt;, so this is the headless form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="nt"&gt;--permission-mode&lt;/span&gt; plan &lt;span class="s2"&gt;"Plan how to migrate the users table to UUID primary keys"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because plan mode keeps its blocks in non-interactive runs, nothing gets edited, which makes this a decent way to run a read-only analysis in a script or CI job. The docs do not describe an interactive approval step for &lt;code&gt;-p&lt;/code&gt; runs, so treat it as a one-shot "give me the plan" call rather than a plan-then-execute flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan Mode with opusplan and Subagents
&lt;/h2&gt;

&lt;p&gt;Two features pair well with plan mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;opusplan&lt;/code&gt;&lt;/strong&gt; is a model alias that uses Opus while you are in plan mode and switches to Sonnet for the edits. It matches how the work splits: planning is the part where a stronger model pays off, and executing an approved plan is mostly mechanical. Pick it with &lt;code&gt;/model&lt;/code&gt;. My &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt; covers the model lineup and what each plan includes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subagents&lt;/strong&gt; help when the research phase is large. Claude Code's built-in Plan subagent is read-only, with Write and Edit denied, and it is used for research during plan mode. Custom subagents can do the same job with their own prompts and tools, and they keep the exploration out of your main context window. The &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents guide&lt;/a&gt; shows how to write one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Plan Mode Problems
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Shift+Tab&lt;/code&gt; skips plan mode or does nothing.&lt;/strong&gt; The cycle depends on which modes are available to you, so count by the status bar, not by presses. On Windows, use &lt;code&gt;Alt+M&lt;/code&gt; if &lt;code&gt;Shift+Tab&lt;/code&gt; is not recognized.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The plan is vague.&lt;/strong&gt; "Update the relevant files" is a signal that Claude did not read enough. Ask: "Which files did you read? Name the exact files you will change and why." Or point it at the starting files with &lt;code&gt;@&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It plans something huge.&lt;/strong&gt; Ask for a smaller first slice: "Plan only the data layer. We will do the API after." Splitting the work gives you plans you can actually verify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It edited something anyway.&lt;/strong&gt; Check whether bypass permissions was on. In that setup plan mode is advisory, as described above. Use &lt;code&gt;Esc&lt;/code&gt; twice or &lt;code&gt;/rewind&lt;/code&gt; to undo, and start the next session without the bypass flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The execution drifts from the plan.&lt;/strong&gt; Long planning sessions leave a lot of context. Turn on the clear-context option so the execution phase starts from the approved plan alone, and consider running &lt;code&gt;/compact&lt;/code&gt; mid-task if it still drifts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan Mode vs Just Asking for a Plan
&lt;/h2&gt;

&lt;p&gt;You can type "write a plan first, do not edit anything" in the default mode, and sometimes that is enough. The difference is enforcement and workflow. In plan mode the edit tools are denied, there is a defined approval step, and you get the menu and &lt;code&gt;Ctrl+G&lt;/code&gt;. In default mode with a polite request, Claude can forget the instruction two messages later, or interpret "plan" loosely and start changing files. If the cost of an unreviewed edit is real, use the mode. If you only want an outline to think with, asking is fine.&lt;/p&gt;

&lt;p&gt;Plan mode also pairs well with the other habits in the &lt;a href="https://dev.to/blog/claude-code-workflow-32784-lines-2-days-2026/"&gt;32,784-line workflow post&lt;/a&gt;: a written plan, small steps and a review between each. The plan is the cheapest checkpoint in the whole loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is plan mode in Claude Code?&lt;/strong&gt; A permission mode where Claude reads your code and writes a plan but does not edit source files until you approve it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I enter plan mode in Claude Code?&lt;/strong&gt; Press &lt;code&gt;Shift+Tab&lt;/code&gt; until the status bar shows plan mode, type &lt;code&gt;/plan&lt;/code&gt; with an optional description, start with &lt;code&gt;claude --permission-mode plan&lt;/code&gt;, or set &lt;code&gt;permissions.defaultMode&lt;/code&gt; to &lt;code&gt;"plan"&lt;/code&gt; in settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I exit plan mode?&lt;/strong&gt; Approve the plan from the menu, or press &lt;code&gt;Shift+Tab&lt;/code&gt; again to leave without approving. To plan again later, cycle back or prefix a prompt with &lt;code&gt;/plan&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Claude edit files in plan mode?&lt;/strong&gt; Not source files, until you approve the plan. The exception is an interactive terminal session with bypass permissions available, where the block is not enforced.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I edit the plan before approving it?&lt;/strong&gt; Yes. Press &lt;code&gt;Ctrl+G&lt;/code&gt; to open it in your default text editor, edit it and save.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where are Claude Code plans saved?&lt;/strong&gt; In &lt;code&gt;~/.claude/plans/&lt;/code&gt; by default, or the folder set by the &lt;code&gt;plansDirectory&lt;/code&gt; setting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does plan mode cost more tokens?&lt;/strong&gt; It adds a planning pass, so a task uses more tokens up front. It often saves them overall by avoiding a wrong implementation that has to be rewritten. If usage is your worry, &lt;code&gt;opusplan&lt;/code&gt; and a clear-context approval help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I use plan mode for every task?&lt;/strong&gt; No. Use it when a wrong first step is expensive, and skip it for small, obvious changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does plan mode work in headless mode?&lt;/strong&gt; Yes, with &lt;code&gt;claude -p --permission-mode plan&lt;/code&gt;. Nothing is edited, and the run is a read-only analysis.&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;Claude Code permission modes&lt;/a&gt;, checked October 27, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>claude</category>
      <category>developertools</category>
    </item>
    <item>
      <title>Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Mon, 26 Oct 2026 15:50:05 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-commands-cheat-sheet-every-slash-command-shortcut-and-cli-flag-32ak</link>
      <guid>https://dev.to/alexcloudstar/claude-code-commands-cheat-sheet-every-slash-command-shortcut-and-cli-flag-32ak</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag
&lt;/h1&gt;

&lt;p&gt;Type &lt;code&gt;/&lt;/code&gt; in Claude Code and the menu scrolls past a hundred entries. Most people learn six of them, never look at the rest, and wonder why their sessions feel slow and expensive. The commands are not hard. The list is just long, badly sorted for a newcomer, and changing every few weeks.&lt;/p&gt;

&lt;p&gt;This is the cheat sheet I wanted when I started: slash commands grouped by what you are trying to do, the keyboard shortcuts that matter on macOS and Windows, the CLI commands and flags you run from your shell, how custom commands work now, and the commands that were removed so you stop looking for them. I checked it against the official commands, interactive mode and CLI reference pages on October 24, 2026. Claude Code ships updates constantly, so treat the docs as the source of truth if a command here has drifted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Commands at a Glance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Claude Code commands fall into three layers. Slash commands are typed at the start of a message inside a session, such as &lt;code&gt;/clear&lt;/code&gt; or &lt;code&gt;/compact&lt;/code&gt;. Keyboard shortcuts and prefixes are typed in the prompt, such as &lt;code&gt;Shift+Tab&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt; for a shell command, and &lt;code&gt;@&lt;/code&gt; for a file. CLI commands and flags are typed in your terminal before or while launching, such as &lt;code&gt;claude -c&lt;/code&gt; or &lt;code&gt;claude --model&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Where you type it&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;What it controls&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Slash commands&lt;/td&gt;
&lt;td&gt;Start of a message in a session&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/compact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The session: context, model, plans, reviews&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shortcuts and prefixes&lt;/td&gt;
&lt;td&gt;The prompt&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Shift+Tab&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;, &lt;code&gt;@&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;How you interact: modes, shell, files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CLI commands and flags&lt;/td&gt;
&lt;td&gt;Your shell&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude -c&lt;/code&gt;, &lt;code&gt;--permission-mode plan&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;How a session starts and runs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two details save confusion. A slash command is only recognized at the very start of your message, and anything after the name becomes its arguments. And some entries in the menu are not built in at all: &lt;code&gt;/batch&lt;/code&gt;, &lt;code&gt;/loop&lt;/code&gt;, &lt;code&gt;/simplify&lt;/code&gt;, &lt;code&gt;/code-review&lt;/code&gt; and others are bundled skills. They behave like commands, but they are prompts Claude follows, which is why they can do multi-step work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ten Claude Code Commands to Learn First
&lt;/h2&gt;

&lt;p&gt;If you only learn ten things, learn these. They cover most of what separates a smooth session from a messy one.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;When to reach for it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a starter &lt;code&gt;CLAUDE.md&lt;/code&gt; for the project&lt;/td&gt;
&lt;td&gt;First session in any repo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a new conversation with empty context&lt;/td&gt;
&lt;td&gt;Switching to an unrelated task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/compact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Summarizes the conversation to free context&lt;/td&gt;
&lt;td&gt;Mid-task, when history gets long&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/context&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows what is filling the context window&lt;/td&gt;
&lt;td&gt;Before you decide to compact&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/model&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switches the model&lt;/td&gt;
&lt;td&gt;A task needs more or less power&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/plan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enters plan mode&lt;/td&gt;
&lt;td&gt;Anything touching more than a file or two&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/rewind&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rolls code and conversation back to a checkpoint&lt;/td&gt;
&lt;td&gt;Claude went down the wrong path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/resume&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reopens an earlier conversation&lt;/td&gt;
&lt;td&gt;Coming back the next day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/permissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages allow, ask and deny rules&lt;/td&gt;
&lt;td&gt;Tired of approving the same command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/usage&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows session cost, plan limits and activity&lt;/td&gt;
&lt;td&gt;Watching your limits&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two shortcuts belong on that list: &lt;code&gt;Shift+Tab&lt;/code&gt; cycles permission modes, and pressing &lt;code&gt;Esc&lt;/code&gt; twice rewinds. Both are covered below. If you want the guided version of this list, with an install and a first session, start with my &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;Claude Code tutorial&lt;/a&gt; and come back here for the full reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Slash Commands by Task
&lt;/h2&gt;

&lt;p&gt;The official page lists them alphabetically. That is fine for lookup and bad for learning, so these are grouped by the moment you need them. Aliases are noted because the same command often has two or three names.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start a project and set the rules
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a starter &lt;code&gt;CLAUDE.md&lt;/code&gt;. Set &lt;code&gt;CLAUDE_CODE_NEW_INIT=1&lt;/code&gt; for an interactive flow that also covers skills, hooks and personal memory files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/memory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Edits &lt;code&gt;CLAUDE.md&lt;/code&gt; files, turns auto memory on or off and shows its entries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/permissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens a dialog to view, add and remove allow, ask and deny rules. Alias: &lt;code&gt;/allowed-tools&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/mcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages MCP server connections and OAuth. &lt;code&gt;/mcp reconnect all&lt;/code&gt; retries every server that failed or needs auth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/add-dir &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds a working directory for file access during the session. Most &lt;code&gt;.claude/&lt;/code&gt; configuration in that directory is not picked up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/config&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens settings for theme, model, output style and more. It also accepts &lt;code&gt;key=value&lt;/code&gt; pairs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/import&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Brings config from Codex, Gemini CLI or Cursor into Claude Code, including instruction files, MCP servers and skills&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The order the docs suggest for a first session is &lt;code&gt;/init&lt;/code&gt;, then &lt;code&gt;/memory&lt;/code&gt; to refine the file, then &lt;code&gt;/mcp&lt;/code&gt; for any servers, then &lt;code&gt;/permissions&lt;/code&gt;. The &lt;code&gt;CLAUDE.md&lt;/code&gt; part is the one that pays off most, and I walk through what belongs in it in the &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;tutorial&lt;/a&gt;. For MCP specifically, see the &lt;a href="https://dev.to/blog/build-mcp-server-developer-guide-2026/"&gt;MCP server developer guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Control context and cost
&lt;/h3&gt;

&lt;p&gt;Context is the budget you spend every turn, so this group matters more than it looks. I wrote about the bigger picture in &lt;a href="https://dev.to/blog/context-engineering-ai-coding-2026/"&gt;context engineering for AI coding&lt;/a&gt;. The commands themselves are simple.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear [name]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a new conversation with empty context. Pass a name to label the old one in the &lt;code&gt;/resume&lt;/code&gt; picker. Aliases: &lt;code&gt;/reset&lt;/code&gt;, &lt;code&gt;/new&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/compact [instructions]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Summarizes the conversation so far. Add focus instructions to steer what the summary keeps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/context [all]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Draws your context usage as a colored grid and flags memory bloat and context-heavy tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/usage&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows session cost, plan limits and activity stats. Aliases: &lt;code&gt;/cost&lt;/code&gt;, &lt;code&gt;/stats&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/btw [question]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Asks a side question without adding it to the conversation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/rewind&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rolls back the conversation, the code, or both to an earlier point. Aliases: &lt;code&gt;/checkpoint&lt;/code&gt;, &lt;code&gt;/undo&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/recap&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a one-line summary of the session on demand&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/autocompact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets how full the context window gets before compaction runs automatically&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/export [filename]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exports the conversation as plain text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/copy [N]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Copies the last assistant response, or the Nth-latest with a number&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;/clear&lt;/code&gt; versus &lt;code&gt;/compact&lt;/code&gt; is the decision people get wrong. &lt;code&gt;/clear&lt;/code&gt; throws the conversation away and keeps project memory, so use it when the next task is unrelated. &lt;code&gt;/compact&lt;/code&gt; keeps a summary and continues the same task. Running &lt;code&gt;/context&lt;/code&gt; first tells you whether compaction is even worth it. &lt;code&gt;/btw&lt;/code&gt; is the quiet winner of this group: you get an answer without paying for it in the main thread's history.&lt;/p&gt;

&lt;h3&gt;
  
  
  Switch the model and effort
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/model [model]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switches the model and saves it as your default for new sessions. With no argument it opens a picker, and pressing &lt;code&gt;s&lt;/code&gt; on a row switches for the current session only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/effort [level]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets reasoning effort from &lt;code&gt;low&lt;/code&gt; to &lt;code&gt;xhigh&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;, or &lt;code&gt;auto&lt;/code&gt;. &lt;code&gt;status&lt;/code&gt; prints the current level. &lt;code&gt;max&lt;/code&gt; lasts only for the session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/fast [on or off]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggles fast mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/advisor [model or off]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Turns on an advisor tool that consults a second model at key moments&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you are weighing models by price and capability, my &lt;a href="https://dev.to/blog/claude-fable-5-1-review-cache-pricing-2026/"&gt;cache pricing review of Fable 5.1&lt;/a&gt; covers what switching mid-session costs. There is a catch the docs call out: changing model or effort mid-conversation can invalidate your prompt cache, and Claude Code warns you before it does.&lt;/p&gt;

&lt;h3&gt;
  
  
  Plan, review and ship
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/plan [description]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enters plan mode from the prompt. Add a description to start straight away, such as &lt;code&gt;/plan fix the auth bug&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/diff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows the changes in your working tree, including Claude's edits so far&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/code-review [level] [target]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reviews the current diff for correctness bugs. Takes a level from &lt;code&gt;low&lt;/code&gt; to &lt;code&gt;max&lt;/code&gt;, plus &lt;code&gt;--fix&lt;/code&gt;, &lt;code&gt;--comment&lt;/code&gt; and a PR number, branch or path. Alias: &lt;code&gt;/review&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/security-review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Checks the diff between your branch and the default branch for vulnerabilities such as injection, auth issues and data exposure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/simplify [target]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reviews changed code for cleanup and applies the fixes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/batch &amp;lt;instruction&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Splits a large change into independent units and runs them in parallel, each in its own worktree&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/ultrareview [PR or branch]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs a deep multi-agent review in a cloud sandbox&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/autofix-pr [prompt]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a cloud session that watches your PR and pushes fixes when CI fails or reviewers comment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/verify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Builds and runs your app to confirm a change works, instead of trusting tests alone&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Plan mode is the habit I would push hardest. Having Claude write the approach before it edits anything catches a wrong turn while it is still cheap, and &lt;code&gt;/plan&lt;/code&gt; gets you there without remembering the keyboard cycle. For multi-file work in parallel, &lt;code&gt;/batch&lt;/code&gt; leans on &lt;a href="https://dev.to/blog/git-worktree-guide-2026/"&gt;git worktrees&lt;/a&gt;, and the review commands pair with the problems in &lt;a href="https://dev.to/blog/ai-code-review-bottleneck-2026/"&gt;the AI code review bottleneck&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run work in parallel and in the background
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/tasks&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists background work in the session, including finished subagents. Alias: &lt;code&gt;/bashes&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/background [prompt]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Detaches the whole session as a background agent and frees your terminal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/fork [prompt]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Copies the conversation into a new background session and keeps you working here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/subtask &amp;lt;task&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Spawns a forked subagent that inherits the conversation and works while you continue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/agents&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Prints a reminder to ask Claude to create or manage subagents. On v2.1.197 and earlier it opened an interactive screen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/goal [condition]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Keeps Claude working across turns until a condition is met. &lt;code&gt;/goal clear&lt;/code&gt; removes it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/loop [interval] [prompt]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Repeats a prompt while the session stays open, for example &lt;code&gt;/loop 5m check if the deploy finished&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/schedule [description]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates, lists or runs cloud scheduled tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;/agents&lt;/code&gt; row is a good example of why a cheat sheet goes stale. If an older tutorial tells you &lt;code&gt;/agents&lt;/code&gt; opens a manager, check your version. Subagents are covered properly in the &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents guide&lt;/a&gt;, and the broader idea of delegating work to run unattended is in &lt;a href="https://dev.to/blog/background-ai-coding-agents-2026/"&gt;background AI coding agents&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Move between sessions and devices
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/resume [session]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Resumes a conversation by ID or name, or opens the picker. Alias: &lt;code&gt;/continue&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/branch [name]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Branches the conversation here so you can try another direction and keep the original&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/rename [name]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Names the current session. With no name it generates one from the conversation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/teleport&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pulls a cloud session into this terminal. Alias: &lt;code&gt;/tp&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/remote-control&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes this session controllable from claude.ai or the Claude app&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/desktop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Continues the session in the Claude Code desktop app on macOS or x64 Windows. Alias: &lt;code&gt;/app&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/exit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exits the CLI. Alias: &lt;code&gt;/quit&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Set up, diagnose and customize
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/doctor&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs a setup checkup for installation, settings, extensions and &lt;code&gt;CLAUDE.md&lt;/code&gt; problems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/debug [description]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Turns on debug logging and troubleshoots from the session log&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens the Status tab: version, model, account and connectivity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/statusline&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Configures the status line. See my &lt;a href="https://dev.to/blog/claude-code-status-line-guide-2026/"&gt;status line guide&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/hooks&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows your hook configuration. Hooks themselves are in the &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;hooks guide&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/skills&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists available skills, with filtering and sorting by token cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/skill-doctor&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows what each skill costs in context and how often it is used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/plugin [subcommand]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages plugins. See the &lt;a href="https://dev.to/blog/claude-code-plugin-marketplace-skills-2026/"&gt;plugin marketplace guide&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/reload-plugins&lt;/code&gt; and &lt;code&gt;/reload-skills&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Apply plugin or skill changes without restarting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/theme&lt;/code&gt;, &lt;code&gt;/color&lt;/code&gt;, &lt;code&gt;/tui&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Change the color theme, prompt bar color and terminal renderer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/terminal-setup&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Installs a &lt;code&gt;Shift+Enter&lt;/code&gt; newline binding in VS Code, Cursor, Alacritty, Zed and others&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/keybindings&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens your keyboard shortcuts file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/sandbox&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggles sandbox mode on supported platforms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/login&lt;/code&gt;, &lt;code&gt;/logout&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Sign in to or out of your Anthropic account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/help&lt;/code&gt;, &lt;code&gt;/release-notes&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Show help, or browse the changelog by version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/feedback&lt;/code&gt;, &lt;code&gt;/bug&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Report a bug or send feedback, with a consent step before anything is sent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Claude Code commands that were removed or changed
&lt;/h3&gt;

&lt;p&gt;Old blog posts still list these. They no longer work the way they describe.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/vim&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removed in v2.1.92. Use &lt;code&gt;/config&lt;/code&gt; and set Editor mode to switch between Vim and Normal editing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/pr-comments&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removed in v2.1.91. Ask Claude directly to view the pull request comments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/ultraplan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removed. Use plan mode instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/cost&lt;/code&gt; and &lt;code&gt;/stats&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Still work, but they are aliases for &lt;code&gt;/usage&lt;/code&gt; now&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/agents&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Prints a reminder on v2.1.198 and later instead of opening a manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--enable-auto-mode&lt;/code&gt; (flag)&lt;/td&gt;
&lt;td&gt;Removed in v2.1.111. Auto mode is in the &lt;code&gt;Shift+Tab&lt;/code&gt; cycle by default&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Some commands are also hidden from the menu until you type the full name, such as &lt;code&gt;/setup-bedrock&lt;/code&gt; and &lt;code&gt;/setup-vertex&lt;/code&gt;. That is the closest thing to a secret command. Run &lt;code&gt;/help&lt;/code&gt; or type &lt;code&gt;/&lt;/code&gt; and keep typing to filter, and you will see everything your plan and platform allow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Keyboard Shortcuts
&lt;/h2&gt;

&lt;p&gt;Shortcuts are where Claude Code feels fast. The ones worth learning first are &lt;code&gt;Shift+Tab&lt;/code&gt;, &lt;code&gt;Esc&lt;/code&gt;, &lt;code&gt;Ctrl+O&lt;/code&gt; and the &lt;code&gt;!&lt;/code&gt; prefix. A note first: on macOS, any shortcut that uses &lt;code&gt;Option&lt;/code&gt; as &lt;code&gt;Alt&lt;/code&gt; (&lt;code&gt;Alt+B&lt;/code&gt;, &lt;code&gt;Alt+F&lt;/code&gt;, &lt;code&gt;Alt+D&lt;/code&gt;, &lt;code&gt;Alt+Y&lt;/code&gt;, &lt;code&gt;Alt+P&lt;/code&gt;) needs your terminal set to treat Option as Meta. Without that setting they do nothing, and it is the most common reason a shortcut seems broken.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core controls
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shortcut&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Esc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Interrupts Claude mid-turn. The work done so far is kept, so you can redirect&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Esc&lt;/code&gt; then &lt;code&gt;Esc&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;With text in the prompt, clears it and saves the draft to history. With an empty prompt, opens the rewind menu&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Shift+Tab&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cycles permission modes: &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;acceptEdits&lt;/code&gt;, &lt;code&gt;plan&lt;/code&gt;, then &lt;code&gt;bypassPermissions&lt;/code&gt; and &lt;code&gt;auto&lt;/code&gt; when available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+C&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Interrupts a running operation. With nothing running, the first press clears the prompt and a second exits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exits the session. Press twice within 800ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+O&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggles the transcript viewer with detailed tool usage and timestamps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+R&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reverse-searches your command history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Ctrl+G&lt;/code&gt; or &lt;code&gt;Ctrl+X Ctrl+E&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Opens your prompt in your default text editor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+B&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Backgrounds running Bash commands and agents. Tmux users press it twice&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+T&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows or hides Claude's task checklist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+S&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stashes the prompt, or restores it when pressed again on an empty prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+L&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Redraws a garbled screen without losing your conversation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+Z&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Suspends Claude Code to your shell on Unix. Run &lt;code&gt;fg&lt;/code&gt; to resume&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+X Ctrl+K&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stops all background subagents. Press twice within 3 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Model and mode toggles
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;macOS&lt;/th&gt;
&lt;th&gt;Windows and Linux&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option+P&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt+P&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switches model without clearing your prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option+T&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt+T&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggles extended thinking. The docs say it has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, which always use it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option+O&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt+O&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggles fast mode&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Prefixes and multiline input
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/&lt;/code&gt; at the start&lt;/td&gt;
&lt;td&gt;Runs a command or skill&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;!&lt;/code&gt; at the start&lt;/td&gt;
&lt;td&gt;Shell mode: runs the command directly and adds its output to the session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Triggers file path autocomplete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;?&lt;/code&gt; on an empty prompt&lt;/td&gt;
&lt;td&gt;Shows the shortcut help panel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;\&lt;/code&gt; then &lt;code&gt;Enter&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Newline that works in every terminal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Shift+Enter&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Newline. Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+J&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Newline that works in any terminal with no setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Ctrl+V&lt;/code&gt; (&lt;code&gt;Cmd+V&lt;/code&gt; in iTerm2, &lt;code&gt;Alt+V&lt;/code&gt; on Windows and WSL)&lt;/td&gt;
&lt;td&gt;Pastes an image from the clipboard&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;!&lt;/code&gt; prefix is underrated. Typing &lt;code&gt;! npm test&lt;/code&gt; runs it right away, puts the output in the conversation, and lets Claude respond to the result, with no approval step and no model tokens spent deciding to run it. It supports &lt;code&gt;Ctrl+B&lt;/code&gt; backgrounding too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Editing the prompt
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shortcut&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Ctrl+A&lt;/code&gt; and &lt;code&gt;Ctrl+E&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Jump to the start or end of the line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+K&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deletes to the end of the line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+U&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deletes to the start of the line. Repeat to clear across lines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+W&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deletes back to the previous whitespace, so one press removes a whole path or &lt;code&gt;--flag=value&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+Y&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pastes the text you last deleted. &lt;code&gt;Alt+Y&lt;/code&gt; cycles earlier deletions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Alt+B&lt;/code&gt; and &lt;code&gt;Alt+F&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Move back or forward one word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+_&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Undoes the last input edit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On Windows, if &lt;code&gt;Shift+Tab&lt;/code&gt; does not cycle modes because your Node or Bun runtime does not enable VT input mode, use &lt;code&gt;Alt+M&lt;/code&gt;. Customizing any of these goes through &lt;code&gt;/keybindings&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code CLI Commands and Flags
&lt;/h2&gt;

&lt;p&gt;These run in your shell, outside the session. The docs list around 85 flags, and you will use about fifteen. Here are the commands first.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts an interactive session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude "query"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a session with an initial prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -p "query"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs the query non-interactively, prints the result and exits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;`cat file \&lt;/td&gt;
&lt;td&gt;claude -p "query"`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Continues the most recent conversation in this directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude -r "name" "query"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Resumes a session by ID or name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude update&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Updates to the latest version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude install [version]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Installs or reinstalls the native binary, such as &lt;code&gt;claude install stable&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;claude auth login&lt;/code&gt;, &lt;code&gt;logout&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Sign in, sign out, or print auth status as JSON&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude mcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Configures MCP servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude plugin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude agents&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens agent view to monitor and dispatch parallel background sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;claude attach&lt;/code&gt;, &lt;code&gt;logs&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt;, &lt;code&gt;respawn&lt;/code&gt;, &lt;code&gt;rm&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Manage background sessions from the shell&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude doctor&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Prints read-only install and settings diagnostics without starting a session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude setup-token&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a long-lived OAuth token for CI and scripts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claude ultrareview [target]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs ultrareview non-interactively&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The flags that earn their place:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--continue&lt;/code&gt;, &lt;code&gt;-c&lt;/code&gt; and &lt;code&gt;--resume&lt;/code&gt;, &lt;code&gt;-r&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Pick a conversation back up. Add &lt;code&gt;--fork-session&lt;/code&gt; to resume into a new session ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--name&lt;/code&gt;, &lt;code&gt;-n&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Names the session so it is easy to find in &lt;code&gt;/resume&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--model&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets the model for the session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--effort&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets the effort level for the session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--permission-mode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts in a mode: &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;acceptEdits&lt;/code&gt;, &lt;code&gt;plan&lt;/code&gt;, &lt;code&gt;auto&lt;/code&gt;, &lt;code&gt;dontAsk&lt;/code&gt; or &lt;code&gt;bypassPermissions&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--allowedTools&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Tools that run without prompting, such as &lt;code&gt;"Bash(git log *)" "Read"&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--tools&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Restricts which built-in tools Claude can use at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--add-dir&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds extra working directories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--worktree&lt;/code&gt;, &lt;code&gt;-w&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Starts in an isolated git worktree under &lt;code&gt;.claude/worktrees&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--print&lt;/code&gt;, &lt;code&gt;-p&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Non-interactive mode for scripts and pipes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--output-format&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Print mode output: &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;stream-json&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--max-turns&lt;/code&gt; and &lt;code&gt;--max-budget-usd&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Cap agentic turns or spend in print mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--json-schema&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Returns validated JSON matching a schema in print mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--append-system-prompt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds text to the default system prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--bg&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts the session as a background agent and returns immediately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--from-pr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens the picker filtered to sessions linked to a pull request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--bare&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Minimal mode: skips auto-discovery of hooks, skills, plugins, MCP servers and memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--safe-mode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts with all customizations disabled, for troubleshooting a broken config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--debug&lt;/code&gt; and &lt;code&gt;--verbose&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Debug logging, or full turn-by-turn output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--version&lt;/code&gt;, &lt;code&gt;-v&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Prints the version&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few invocations I would actually save:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;-c&lt;/span&gt;
claude &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s2"&gt;"auth-refactor"&lt;/span&gt; &lt;span class="s2"&gt;"finish this PR"&lt;/span&gt;
claude &lt;span class="nt"&gt;-w&lt;/span&gt; feature-auth
claude &lt;span class="nt"&gt;--permission-mode&lt;/span&gt; plan
git diff main | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"review this diff for bugs"&lt;/span&gt;
claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"list every TODO"&lt;/span&gt; &lt;span class="nt"&gt;--output-format&lt;/span&gt; json &lt;span class="nt"&gt;--max-turns&lt;/span&gt; 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you script with &lt;code&gt;-p&lt;/code&gt;, the &lt;a href="https://dev.to/blog/claude-agent-sdk-guide-2026/"&gt;Agent SDK guide&lt;/a&gt; is the next step. For worktree-based parallel work, see the &lt;a href="https://dev.to/blog/git-worktree-guide-2026/"&gt;worktree guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Claude Code Commands Are Skills Now
&lt;/h2&gt;

&lt;p&gt;You can still write your own commands, but the mechanism changed. The docs say custom commands have been merged into skills: a file at &lt;code&gt;.claude/commands/deploy.md&lt;/code&gt; and a skill at &lt;code&gt;.claude/skills/deploy/SKILL.md&lt;/code&gt; both create &lt;code&gt;/deploy&lt;/code&gt; and work the same way. Existing command files keep working. Skills add a folder for supporting files, frontmatter that controls whether you or Claude can invoke them, and automatic loading when relevant. If a command file and a skill share a name, the skill wins.&lt;/p&gt;

&lt;p&gt;A minimal custom command is a markdown file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Review a file for bugs and missing tests&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

Review $ARGUMENTS for correctness bugs and missing tests.
List findings by severity, most serious first.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save it as &lt;code&gt;.claude/commands/review-file.md&lt;/code&gt; and run &lt;code&gt;/review-file src/auth.ts&lt;/code&gt;. &lt;code&gt;$ARGUMENTS&lt;/code&gt; expands to everything after the command name. You can also address arguments by position with &lt;code&gt;$0&lt;/code&gt;, &lt;code&gt;$1&lt;/code&gt; and so on, counting from zero, and wrap multi-word values in quotes. Put files in &lt;code&gt;.claude/&lt;/code&gt; to share them with a project, or &lt;code&gt;~/.claude/&lt;/code&gt; to keep them personal.&lt;/p&gt;

&lt;p&gt;For anything you will reuse or share, write a skill instead. I cover the full format in the &lt;a href="https://dev.to/blog/writing-claude-code-skill-developer-guide-2026/"&gt;skill developer guide&lt;/a&gt;, and the &lt;a href="https://dev.to/blog/claude-code-plugin-marketplace-skills-2026/"&gt;plugin marketplace guide&lt;/a&gt; shows how to package and install them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Allow Commands Without Approval Prompts
&lt;/h2&gt;

&lt;p&gt;People search for "claude code allow all commands" because the prompts get old. There are four sane answers, from narrowest to widest.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Allow specific commands.&lt;/strong&gt; Run &lt;code&gt;/permissions&lt;/code&gt; and add allow rules for the commands you trust, such as &lt;code&gt;Bash(git diff *)&lt;/code&gt;. This is the right default. The rules persist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switch the mode.&lt;/strong&gt; Press &lt;code&gt;Shift+Tab&lt;/code&gt; to move to &lt;code&gt;acceptEdits&lt;/code&gt; so file edits stop prompting, or to &lt;code&gt;auto&lt;/code&gt;, which uses a classifier to approve routine actions. On a file permission prompt, &lt;code&gt;Shift+Tab&lt;/code&gt; also picks the option that allows the action for the rest of the session, when the prompt offers it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allow per run.&lt;/strong&gt; Start with &lt;code&gt;--allowedTools "Bash(git log *)" "Read"&lt;/code&gt; for a scripted session that should never prompt for those.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip all checks.&lt;/strong&gt; &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; is equivalent to &lt;code&gt;--permission-mode bypassPermissions&lt;/code&gt;. Only use it in a throwaway container or sandbox, never on a machine with credentials you care about.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Blanket allow-all is the option I would avoid, and the reason is practical: one bad command in an unattended session is hard to undo. The &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;least-privilege guide for coding agents&lt;/a&gt; goes through how to scope permissions without drowning in prompts, and a &lt;code&gt;PreToolUse&lt;/code&gt; &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;hook&lt;/a&gt; can block the dangerous commands while allowing the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build the Habit, Not the Memory
&lt;/h2&gt;

&lt;p&gt;You do not need to memorize any of this. A short daily loop covers most of it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with &lt;code&gt;claude -c&lt;/code&gt; to pick up yesterday's work, or &lt;code&gt;claude&lt;/code&gt; for something new.&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;Shift+Tab&lt;/code&gt; to &lt;code&gt;plan&lt;/code&gt; before any change that touches more than a couple of files.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;/context&lt;/code&gt; when a session feels sluggish, then &lt;code&gt;/compact&lt;/code&gt; with focus instructions, or &lt;code&gt;/clear&lt;/code&gt; if the task changed.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;!&lt;/code&gt; for quick shell checks instead of asking Claude to run them.&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;Esc&lt;/code&gt; twice when a direction is wrong, instead of arguing with it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same pattern applies to the less common commands. Learn them when a problem shows up. &lt;code&gt;/rewind&lt;/code&gt; makes sense the first time a refactor goes sideways, and &lt;code&gt;/btw&lt;/code&gt; makes sense the first time you want a quick answer without polluting a long thread. For a full worked example of how far this loop can go, see the &lt;a href="https://dev.to/blog/claude-code-workflow-32784-lines-2-days-2026/"&gt;32,784-line workflow post&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What are some useful commands in Claude Code?&lt;/strong&gt; Start with &lt;code&gt;/init&lt;/code&gt;, &lt;code&gt;/clear&lt;/code&gt;, &lt;code&gt;/compact&lt;/code&gt;, &lt;code&gt;/context&lt;/code&gt;, &lt;code&gt;/model&lt;/code&gt;, &lt;code&gt;/plan&lt;/code&gt;, &lt;code&gt;/rewind&lt;/code&gt;, &lt;code&gt;/resume&lt;/code&gt;, &lt;code&gt;/permissions&lt;/code&gt; and &lt;code&gt;/usage&lt;/code&gt;. Add the &lt;code&gt;!&lt;/code&gt; shell prefix, &lt;code&gt;@&lt;/code&gt; file mentions, &lt;code&gt;Shift+Tab&lt;/code&gt; and double &lt;code&gt;Esc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are there secret commands in Claude Code?&lt;/strong&gt; Not really. A few are hidden from the menu until you type their full name, such as &lt;code&gt;/setup-bedrock&lt;/code&gt; and &lt;code&gt;/setup-vertex&lt;/code&gt;, and several useful ones are just overlooked, like &lt;code&gt;/btw&lt;/code&gt;, &lt;code&gt;/recap&lt;/code&gt; and &lt;code&gt;/powerup&lt;/code&gt;. &lt;code&gt;/help&lt;/code&gt; and &lt;code&gt;/skills&lt;/code&gt; list what is available to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I run a command in Claude Code?&lt;/strong&gt; Type &lt;code&gt;/&lt;/code&gt; at the very start of a message, then the command name and any arguments. To run a shell command instead, start the message with &lt;code&gt;!&lt;/code&gt;. A slash command is only recognized at the start of the message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I allow commands in Claude Code?&lt;/strong&gt; Use &lt;code&gt;/permissions&lt;/code&gt; to add allow rules, press &lt;code&gt;Shift+Tab&lt;/code&gt; to change the permission mode, or pass &lt;code&gt;--allowedTools&lt;/code&gt; when you launch. Avoid &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; outside a sandbox.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the Claude Code keyboard shortcuts on Windows?&lt;/strong&gt; Most match macOS with &lt;code&gt;Alt&lt;/code&gt; in place of &lt;code&gt;Option&lt;/code&gt;: &lt;code&gt;Alt+P&lt;/code&gt; switches model, &lt;code&gt;Alt+T&lt;/code&gt; toggles extended thinking and &lt;code&gt;Alt+O&lt;/code&gt; toggles fast mode. Use &lt;code&gt;Alt+V&lt;/code&gt; to paste an image, and &lt;code&gt;Alt+M&lt;/code&gt; for the mode cycle if &lt;code&gt;Shift+Tab&lt;/code&gt; does not work in your runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does Ctrl+O do in Claude Code?&lt;/strong&gt; It toggles the transcript viewer, which shows detailed tool usage and timestamps, and expands lines that collapse by default. &lt;code&gt;Ctrl+G&lt;/code&gt; is a different shortcut: it opens your prompt in your default text editor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between a command and a skill?&lt;/strong&gt; Custom commands have been merged into skills. A markdown file in &lt;code&gt;.claude/commands/&lt;/code&gt; and a skill in &lt;code&gt;.claude/skills/&lt;/code&gt; both create the same &lt;code&gt;/name&lt;/code&gt; command. Skills add supporting files, invocation controls and automatic loading, and the docs recommend them for new work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where do I see every command?&lt;/strong&gt; Type &lt;code&gt;/&lt;/code&gt; and keep typing to filter, run &lt;code&gt;/help&lt;/code&gt;, or run &lt;code&gt;/skills&lt;/code&gt; for the skills list. The full reference is the official commands page.&lt;/p&gt;

&lt;p&gt;Sources: &lt;a href="https://code.claude.com/docs/en/commands" rel="noopener noreferrer"&gt;Claude Code commands&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/interactive-mode" rel="noopener noreferrer"&gt;Interactive mode&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/cli-reference" rel="noopener noreferrer"&gt;CLI reference&lt;/a&gt; and &lt;a href="https://code.claude.com/docs/en/skills" rel="noopener noreferrer"&gt;Skills&lt;/a&gt;, checked October 24, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>claude</category>
      <category>developertools</category>
    </item>
    <item>
      <title>Claude Code Alternatives in 2026: 8 Tools Worth Switching To, and When Not To</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Mon, 26 Oct 2026 15:50:04 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-alternatives-in-2026-8-tools-worth-switching-to-and-when-not-to-40p3</link>
      <guid>https://dev.to/alexcloudstar/claude-code-alternatives-in-2026-8-tools-worth-switching-to-and-when-not-to-40p3</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code Alternatives in 2026: 8 Tools Worth Switching To, and When Not To
&lt;/h1&gt;

&lt;p&gt;Nobody searches for Claude Code alternatives because they are happy. They search after a usage limit lands in the middle of a refactor, or after a bill, or after a coworker says their open source setup does the same job for free. Sometimes the reason is plainer: you just want to use a different model.&lt;/p&gt;

&lt;p&gt;I use Claude Code every day, on client work and on my own products. That makes me biased, and I will say where. It also means I know exactly where it hurts. I have not run the other tools here as daily drivers, so there are no benchmarks in this post and I will not invent any. What I did is check every tool against its own docs, GitHub page and pricing page on October 26, 2026, because this market rewrites its prices and plans every few weeks. Where something changed recently, I say so.&lt;/p&gt;

&lt;p&gt;Eight tools made the list. Each one gets what it is, what it costs, where it beats Claude Code and where it does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Best Claude Code Alternatives at a Glance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The best Claude Code alternatives in 2026 are OpenCode for free, open source and any-model use, Codex if you already pay for ChatGPT, Cursor or Kilo Code if you work inside an editor, GitHub Copilot CLI if you are already on Copilot, Aider for git-first pair programming, and Cline for approval-heavy control. Gemini CLI is no longer a free option for individuals.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Where it runs&lt;/th&gt;
&lt;th&gt;Models&lt;/th&gt;
&lt;th&gt;Entry price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OpenCode&lt;/td&gt;
&lt;td&gt;Terminal, desktop, IDE, web&lt;/td&gt;
&lt;td&gt;75+ providers plus local models&lt;/td&gt;
&lt;td&gt;App is free. Go is $10/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Codex&lt;/td&gt;
&lt;td&gt;CLI, IDE, cloud&lt;/td&gt;
&lt;td&gt;OpenAI models&lt;/td&gt;
&lt;td&gt;Included in ChatGPT Free, Go ($8), Plus ($20)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cursor&lt;/td&gt;
&lt;td&gt;Editor, CLI, cloud agents&lt;/td&gt;
&lt;td&gt;Grok on Plus, third-party models billed by usage&lt;/td&gt;
&lt;td&gt;Free, Plus $8, Premium $30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub Copilot CLI&lt;/td&gt;
&lt;td&gt;Terminal&lt;/td&gt;
&lt;td&gt;Models from your Copilot plan&lt;/td&gt;
&lt;td&gt;Included in every plan, Pro is $10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Antigravity CLI (was Gemini CLI)&lt;/td&gt;
&lt;td&gt;Terminal&lt;/td&gt;
&lt;td&gt;Google models&lt;/td&gt;
&lt;td&gt;Free tier with a weekly cap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aider&lt;/td&gt;
&lt;td&gt;Terminal&lt;/td&gt;
&lt;td&gt;Almost any LLM, local too&lt;/td&gt;
&lt;td&gt;Free, you pay the model provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cline&lt;/td&gt;
&lt;td&gt;VS Code, JetBrains, CLI, desktop&lt;/td&gt;
&lt;td&gt;Any major provider or local&lt;/td&gt;
&lt;td&gt;Free, you pay the model provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kilo Code&lt;/td&gt;
&lt;td&gt;VS Code, JetBrains, CLI, cloud&lt;/td&gt;
&lt;td&gt;500+ models&lt;/td&gt;
&lt;td&gt;Free, no markup on model prices&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Open source in this list means OpenCode (MIT), Codex CLI (Apache-2.0), Aider, Cline (Apache-2.0) and Kilo Code (MIT), plus the old Gemini CLI (Apache-2.0). Cursor, Copilot and Antigravity CLI are the closed ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why People Leave Claude Code
&lt;/h2&gt;

&lt;p&gt;Five reasons come up again and again, and all five are checkable. Knowing which one is yours matters, because each points to a different tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage limits.&lt;/strong&gt; Claude's pricing page says limits reset on a rolling five-hour window, and paid plans also have weekly limits. Claude Code shares that pool with your chats. When you hit the limit you wait, upgrade, or turn on usage credits billed at standard API rates. If you work in long sessions, this is the number one complaint. I wrote about how to stay under it in the &lt;a href="https://dev.to/blog/claude-code-workflow-32784-lines-2-days-2026/"&gt;Claude Code workflow post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No free plan.&lt;/strong&gt; Claude Code is included in Pro ($20 a month, or $17 billed annually), Max (from $100 a month), Team and Enterprise. The Free plan does not have it. Several alternatives do have a free path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One model family.&lt;/strong&gt; Claude Code runs Anthropic models. If you want GPT, Gemini, Kimi, DeepSeek or a model on your own machine, it is the wrong tool. Anthropic's gateway docs also say it does not support routing Claude Code to non-Claude models through any gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closed source.&lt;/strong&gt; Claude Code is not open source. If you want to read the harness, fork it or audit what it sends, you need a different tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You live in an editor.&lt;/strong&gt; Claude Code is terminal-first. It has IDE extensions, but if you want inline edits, tab completion and a diff view as the main experience, an editor-first tool fits better.&lt;/p&gt;

&lt;p&gt;Your reason decides your pick. Limits and cost point to OpenCode or Codex. Model freedom points to OpenCode, Cline, Kilo Code or Aider. Editor-first points to Cursor, Cline or Kilo Code. Open source points to everything except Cursor and Copilot.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. OpenCode: The Open Source Claude Code Alternative
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;OpenCode is the closest open source equivalent to Claude Code. It is MIT licensed, runs in the terminal, a desktop app, your IDE or a web app, and connects to 75+ model providers through Models.dev, including local models.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The numbers on its homepage are big: over 220,000 GitHub stars, 950 contributors, and a claim of over 16 million developers a month. I treat the monthly figure as a vendor number, but the star count and the contributor list are easy to verify on GitHub. It installs with &lt;code&gt;curl -fsSL https://opencode.ai/v2/install | bash&lt;/code&gt;, or through npm, bun or brew.&lt;/p&gt;

&lt;p&gt;What it does well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Any model.&lt;/strong&gt; Connect Claude, GPT, Gemini, xAI and dozens more, or point it at a local model through Ollama or LM Studio. Both are documented as custom providers with an OpenAI-compatible base URL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscription logins.&lt;/strong&gt; You can sign in with a ChatGPT Plus or Pro plan, or with GitHub Copilot, and use those models without a separate API bill.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel agents.&lt;/strong&gt; The homepage lists multi-session support, so you can run several agents on the same project at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A cheap bundle.&lt;/strong&gt; OpenCode Go costs $10 a month and Go Plus costs $40. The Go page lists 29 models, from Kimi, GLM, MiniMax and DeepSeek to Claude Haiku 5.5, GPT 6 Luna and Gemini 4 Argon. Limits are spread across rolling windows: 20 percent of the monthly allowance per five hours, 50 percent per week and 100 percent per month. The page gives estimated request counts per model, and they vary a lot, so read the table for the model you actually want.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One trap, and it matters if you are leaving Claude Code because of cost. &lt;strong&gt;You cannot use a Claude Pro or Max subscription in OpenCode.&lt;/strong&gt; The provider docs say to create an API key in the Anthropic Console, and warn that Anthropic prohibits subscription login in third-party tools. Anthropic's own docs say OAuth authentication is for Claude plan purchasers using Claude Code and native apps, and that developers building on Claude should use API keys. So if OpenCode is your way to keep Claude models, you pay per token, which can cost more than the $20 plan. My &lt;a href="https://dev.to/blog/ai-agent-token-costs-developer-guide-2026/"&gt;token cost guide&lt;/a&gt; shows how fast that adds up in long agent sessions.&lt;/p&gt;

&lt;p&gt;The "OpenCode vs Claude Code" question is the most searched comparison on this list, and the honest answer is that they are different bets. OpenCode bets on openness and model choice. Claude Code bets on one model family and a deep, first-party feature set. I use Claude Code because of that depth, not because the model is the only good one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick OpenCode if:&lt;/strong&gt; you want a free, open source terminal agent, or you want to switch models without switching tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Codex: The Alternative If You Already Pay for ChatGPT
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Codex is OpenAI's coding agent, with a CLI, an IDE extension and cloud tasks. It is Apache-2.0 licensed, has about 131,000 GitHub stars, and signs in with a ChatGPT plan or an API key.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install it with &lt;code&gt;npm install -g @openai/codex&lt;/code&gt; or &lt;code&gt;brew install --cask codex&lt;/code&gt;, then run &lt;code&gt;codex&lt;/code&gt;. There is also a curl install script for macOS and Linux and a PowerShell script for Windows.&lt;/p&gt;

&lt;p&gt;It is the alternative with the easiest money story. Codex is included in ChatGPT Free, Go ($8 a month), Plus ($20 a month), Pro (from $100 a month), Business, Edu and Enterprise. So if you already pay for ChatGPT, trying Codex costs nothing extra, and a free tier exists for light use. The CLI has MCP support through &lt;code&gt;codex mcp&lt;/code&gt;, a &lt;code&gt;/permissions&lt;/code&gt; command to control what it can edit or run without asking, and subagents for delegating focused work.&lt;/p&gt;

&lt;p&gt;I wrote a full head-to-head already, so I will not repeat it here. The short version: both start at $20, Claude Code goes deeper on customization, and Codex has the free tier and a cloud-first task queue. The &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt; has the feature table, pricing breakdown and a pick-by-situation list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Codex if:&lt;/strong&gt; you already live in the ChatGPT ecosystem, or you want the cheapest way to try a second agent.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cursor: The Editor-First Alternative
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cursor is the best Claude Code alternative if you want AI inside the editor first and the terminal second. It is a VS Code fork with an agent, tab completion and a CLI.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Cursor CLI installs with &lt;code&gt;curl https://cursor.com/install -fsS | bash&lt;/code&gt; and starts with &lt;code&gt;agent&lt;/code&gt;. It has three modes: Agent (the default, full tool access), Plan (designs an approach and asks questions before coding) and Ask (read-only). Switch with &lt;code&gt;Shift+Tab&lt;/code&gt;, &lt;code&gt;/plan&lt;/code&gt; or &lt;code&gt;--mode=ask&lt;/code&gt;. The &lt;code&gt;-p&lt;/code&gt; flag runs it non-interactively for scripts and CI, and starting a prompt with &lt;code&gt;&amp;amp;&lt;/code&gt; hands the task to a cloud agent.&lt;/p&gt;

&lt;p&gt;Pricing changed, so ignore older articles that quote a flat $20 Pro plan. The current pricing page lists Free, Plus at $8 a month (Grok models only), Premium at $30, Super at $100 and Ultra at $200. Third-party models are not included in those monthly prices and are billed by usage. That is the catch if you want Claude models inside Cursor: the plan price is not the whole bill.&lt;/p&gt;

&lt;p&gt;The Cursor vs Claude Code question is less of a fight than it sounds. Claude Code ships a VS Code extension that installs into Cursor too, and many people run both. My view, from the &lt;a href="https://dev.to/blog/claude-code-vs-cursor-vs-github-copilot-2026/"&gt;longer Claude Code vs Cursor vs Copilot comparison&lt;/a&gt;: Cursor wins on fast file-level edits and UI work, Claude Code wins on large multi-file jobs and unattended runs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Cursor if:&lt;/strong&gt; you want the editor to be the main thing and the agent to be one feature of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. GitHub Copilot CLI: The Alternative Already on Your Account
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub Copilot CLI is the lowest-friction alternative if your team already pays for Copilot. The plans page says all plans include Copilot CLI.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Individual plans listed on GitHub's docs: Copilot Free, Pro at $10 a month, Pro+ at $39 and Max at $100. They come with a monthly allowance of GitHub AI Credits (1,500 on Pro, 7,000 on Pro+, 20,000 on Max), and usage-based billing applies. This is a recent change. GitHub moved from counting premium requests to token-based credits on June 1, 2026, and some annual subscribers stayed on the legacy premium request model, where each prompt to Copilot CLI uses one premium request at the default model rate. If you read an article quoting 300 or 1,500 premium requests, it describes the old model.&lt;/p&gt;

&lt;p&gt;The strongest argument for Copilot is not the CLI. It is that your organization already approved it, it is already in your billing, and it runs from the same account as your editor features. If you are in a company with a compliance process, that beats almost any feature difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Copilot CLI if:&lt;/strong&gt; you are already on a Copilot plan, or procurement decides your tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Gemini CLI and Antigravity CLI: Read This Before You Install
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gemini CLI is no longer a free alternative for individuals. Google replaced it with Antigravity CLI for free, Google AI Pro and Google AI Ultra users on June 18, 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Gemini CLI GitHub page carries the notice: "Gemini CLI was replaced by Antigravity CLI on June 18th, 2026." The old tool is Apache-2.0 licensed with about 108,000 stars, and it still works if you bring a paid Gemini API key, Vertex AI, or an enterprise Code Assist license. For everyone else the new tool is Antigravity CLI. Reporting from The New Stack describes it as a move from the open source Gemini CLI to a closed source CLI, and secondary coverage says it is a Go rewrite with a weekly compute-based cap in place of the old 1,000-requests-per-day limit.&lt;/p&gt;

&lt;p&gt;I could not find a published daily number for the free tier, and several comparison pages still repeat the old 1,000 requests a day figure. Those pages are stale. If you search for "Gemini CLI vs Claude Code" and land on a post that calls Gemini CLI free with a generous limit, check its date.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Antigravity CLI if:&lt;/strong&gt; you want to try Google's models and you accept a closed source tool with a capped free tier. For a free, open source terminal agent, use OpenCode.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Aider: The Git-First Alternative
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Aider is a terminal pair programmer that commits every accepted change to git with a sensible message. It connects to almost any LLM, including local models, and costs nothing beyond the model you use.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install it with &lt;code&gt;python -m pip install aider-install&lt;/code&gt; followed by &lt;code&gt;aider-install&lt;/code&gt;. Aider's site shows about 44,000 GitHub stars, 6.8 million installs and 15 billion tokens processed per week. It builds a repo map of your codebase so it can work on larger projects, lints and tests after each change, supports over 100 languages, and accepts images and web pages as context. It even has voice-to-code.&lt;/p&gt;

&lt;p&gt;Aider is older and calmer than the agent-heavy tools above. It is built around a loop: you ask, it edits, it commits, you review the diff and undo with normal git commands. That makes it predictable and easy to audit. It also means less autonomy. If you want a tool that works through a long task alone, spawns subagents and runs hooks, Aider is not that. If you want small, reviewable, committed steps, it may suit you better than Claude Code does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Aider if:&lt;/strong&gt; you think in commits, you want full model freedom, and you prefer a tool that stays on a short leash.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Cline: The Approval-First Alternative
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cline is an Apache-2.0 coding agent with about 70,900 GitHub stars that runs in VS Code, JetBrains, a CLI and a desktop app. File edits and terminal commands need your approval by default.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install the CLI with &lt;code&gt;npm i -g cline&lt;/code&gt;, or get the extension from the VS Code Marketplace or the JetBrains plugin store. It has a Plan mode that explores the codebase, asks questions and proposes a strategy, and an Act mode that carries it out. Providers include Anthropic, OpenAI, Google, OpenRouter, AWS Bedrock, Azure and Vertex, Groq, Cerebras, Ollama and LM Studio, and any OpenAI-compatible API.&lt;/p&gt;

&lt;p&gt;The approval-by-default design is the point. You see each file change and each command before it runs, and you can switch on auto-approve when you trust the task. If that sounds like the permission system in Claude Code, it is a similar idea with different defaults. My post on &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;coding agent permissions&lt;/a&gt; covers how to set that up safely in either tool.&lt;/p&gt;

&lt;p&gt;One caveat that applies to Cline and every other tool that takes your own API key: pricing becomes whatever the provider charges. Free software, variable bill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Cline if:&lt;/strong&gt; you want an editor extension that asks first, and you want to bring your own model.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Kilo Code: The Multi-Mode Open Source Alternative
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Kilo Code is an MIT licensed agent with about 27,800 GitHub stars that runs in VS Code, JetBrains, a CLI and a browser-based cloud agent. It supports 500+ models and charges the provider's rate with no markup.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install the CLI through npm, curl, Homebrew or a prebuilt binary and run &lt;code&gt;kilo&lt;/code&gt; in your project. Its built-in agents are Code (the default), Plan, Ask and Debug, and you can define custom ones. You can switch models in the middle of a task, which is handy when you want a cheap model for exploration and a stronger one for the final change.&lt;/p&gt;

&lt;p&gt;It sits in the same family as Cline, with a wider spread of surfaces and a model catalog that includes the current flagships from Anthropic, OpenAI, Google, xAI and DeepSeek. Because its star count is lower than Cline's, check the recent commit history on GitHub before you build a workflow around it. That advice applies to any open source agent in this list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Kilo Code if:&lt;/strong&gt; you want Cline-style control with more modes and a cloud option, and you do not want a markup on model prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which Claude Code Alternative Should You Pick?
&lt;/h2&gt;

&lt;p&gt;Match the tool to your reason for leaving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You want free and open source:&lt;/strong&gt; OpenCode first. Aider, Cline or Kilo Code if you prefer their style.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to keep your current spend flat:&lt;/strong&gt; Codex if you pay for ChatGPT, Copilot CLI if you pay for Copilot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want an editor, not a terminal:&lt;/strong&gt; Cursor, Cline or Kilo Code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want maximum model choice:&lt;/strong&gt; OpenCode, Cline, Kilo Code or Aider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want small, reviewable commits:&lt;/strong&gt; Aider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You need to pass a compliance review:&lt;/strong&gt; whatever your company already approved, which is often Copilot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want a free Google option:&lt;/strong&gt; try Antigravity CLI, and read its limits first.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you cannot decide, install OpenCode and Codex. Both are free to try, they cover the two big bets (open and any-model versus a second vendor), and you will know within a week which one fits your habits. Spend your effort on three real tasks from your own repo, not on someone's leaderboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Not to Switch Away From Claude Code
&lt;/h2&gt;

&lt;p&gt;This is my bias, so read it as opinion. I stay on Claude Code because of the layer around the model: skills, hooks, subagents, plugins and a permission system I have tuned over months. The alternatives are catching up on pieces of it, and some pieces are better elsewhere. But if your workflow depends on &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;hooks&lt;/a&gt; that block bad commands, &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents&lt;/a&gt; that split big tasks, or shared skills across a team, switching means rebuilding that setup. That is a cost nobody puts in the comparison tables.&lt;/p&gt;

&lt;p&gt;I would not leave if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your only complaint is the five-hour limit. Long, bloated sessions burn through it faster, so try &lt;code&gt;/compact&lt;/code&gt; and &lt;code&gt;/clear&lt;/code&gt; at the right moments before you change tools. The &lt;a href="https://dev.to/blog/claude-code-commands-cheat-sheet-2026/"&gt;commands cheat sheet&lt;/a&gt; covers both.&lt;/li&gt;
&lt;li&gt;You are leaving because of a bad week. Tools in this category change monthly. A limit that annoyed you in September may look different in November.&lt;/li&gt;
&lt;li&gt;You plan to keep paying per token for Claude models in another tool. That often costs more than the subscription you are escaping.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I would leave, or at least add a second tool, if you need open source for policy reasons, you want models Claude Code cannot run, or you are on a team that standardized on something else.&lt;/p&gt;

&lt;p&gt;The best setup for a lot of people is two tools, not zero. Use Claude Code for the big jobs and a cheap or free alternative for everything else. If you are just starting out with the main tool, the &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;Claude Code tutorial&lt;/a&gt; is the place to begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the best alternative to Claude Code?&lt;/strong&gt; For most people leaving over cost or model lock-in, OpenCode: it is MIT licensed, supports 75+ providers and local models, and has a $10 monthly Go bundle. If you already pay for ChatGPT, Codex costs nothing extra. If you live in an editor, Cursor, Cline or Kilo Code fit better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a free alternative to Claude Code?&lt;/strong&gt; OpenCode, Aider, Cline and Kilo Code are free software, and you pay only for the model tokens you use, or use a local model for nothing. Codex has a free tier through ChatGPT Free. Copilot has a Free plan that includes Copilot CLI. Gemini CLI's free tier for individuals ended on June 18, 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is there an open source alternative to Claude Code?&lt;/strong&gt; Yes. OpenCode (MIT), Codex CLI (Apache-2.0), Cline (Apache-2.0), Kilo Code (MIT) and Aider are all open source. Claude Code is not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is OpenCode better than Claude Code?&lt;/strong&gt; I have not benchmarked them, and I will not claim a winner on code quality. OpenCode gives you open source and any model. Claude Code gives you one model family and a deeper first-party feature set. Pick based on which of those matters to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use my Claude Pro or Max subscription in OpenCode?&lt;/strong&gt; No. OpenCode's docs say to use an Anthropic API key and note that Anthropic prohibits subscription login in third-party tools. Anthropic's docs say developers building on Claude should use API key authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Gemini CLI still free?&lt;/strong&gt; Not for individuals. Google replaced it with Antigravity CLI for free, AI Pro and AI Ultra users on June 18, 2026. Gemini CLI itself still works with a paid Gemini API key, Vertex AI or an enterprise Code Assist license.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use other models inside Claude Code?&lt;/strong&gt; Not officially. Claude Code can connect through an LLM gateway, but Anthropic's docs say they do not support routing Claude Code to non-Claude models through any gateway. If you want other models, use a tool built for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Cursor or Claude Code better?&lt;/strong&gt; They solve different problems. Cursor is better for fast file-level edits and UI work inside an editor. Claude Code is better for large multi-file changes and long agent runs. Many people use both, and Claude Code installs a VS Code extension that works in Cursor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Claude Code worth $20 a month?&lt;/strong&gt; It depends on your usage. If you code with an agent daily, a flat plan is easier to predict than per-token billing, which can add up fast in long sessions. If you use it a few times a week, a free tier elsewhere may be enough.&lt;/p&gt;

&lt;p&gt;Sources, all checked October 26, 2026: &lt;a href="https://opencode.ai" rel="noopener noreferrer"&gt;OpenCode&lt;/a&gt;, &lt;a href="https://opencode.ai/go" rel="noopener noreferrer"&gt;OpenCode Go&lt;/a&gt;, &lt;a href="https://opencode.ai/docs/providers" rel="noopener noreferrer"&gt;OpenCode providers docs&lt;/a&gt;, &lt;a href="https://github.com/openai/codex" rel="noopener noreferrer"&gt;Codex on GitHub&lt;/a&gt;, &lt;a href="https://learn.chatgpt.com/docs/codex/cli.md" rel="noopener noreferrer"&gt;Codex CLI docs&lt;/a&gt;, &lt;a href="https://cursor.com/docs/cli/overview" rel="noopener noreferrer"&gt;Cursor CLI docs&lt;/a&gt;, &lt;a href="https://cursor.com/pricing" rel="noopener noreferrer"&gt;Cursor pricing&lt;/a&gt;, &lt;a href="https://docs.github.com/en/copilot/get-started/plans" rel="noopener noreferrer"&gt;GitHub Copilot plans&lt;/a&gt;, &lt;a href="https://docs.github.com/en/copilot/concepts/billing/copilot-requests" rel="noopener noreferrer"&gt;Copilot premium requests&lt;/a&gt;, &lt;a href="https://github.com/google-gemini/gemini-cli" rel="noopener noreferrer"&gt;Gemini CLI on GitHub&lt;/a&gt;, &lt;a href="https://thenewstack.io/google-antigravity-cli/" rel="noopener noreferrer"&gt;The New Stack on Antigravity CLI&lt;/a&gt;, &lt;a href="https://aider.chat" rel="noopener noreferrer"&gt;Aider&lt;/a&gt;, &lt;a href="https://github.com/cline/cline" rel="noopener noreferrer"&gt;Cline&lt;/a&gt;, &lt;a href="https://github.com/Kilo-Org/kilocode" rel="noopener noreferrer"&gt;Kilo Code&lt;/a&gt;, &lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/legal-and-compliance" rel="noopener noreferrer"&gt;Claude Code legal and compliance&lt;/a&gt; and &lt;a href="https://code.claude.com/docs/en/llm-gateway" rel="noopener noreferrer"&gt;Claude Code LLM gateways&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>claude</category>
      <category>developertools</category>
    </item>
    <item>
      <title>I Shipped 32,784 Lines of Code in 2 Days With Claude Code. Here Is What the Number Hides</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Fri, 23 Oct 2026 21:51:53 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/i-shipped-32784-lines-of-code-in-2-days-with-claude-code-here-is-what-the-number-hides-276d</link>
      <guid>https://dev.to/alexcloudstar/i-shipped-32784-lines-of-code-in-2-days-with-claude-code-here-is-what-the-number-hides-276d</guid>
      <description>&lt;h1&gt;
  
  
  I Shipped 32,784 Lines of Code in 2 Days With Claude Code. Here Is What the Number Hides
&lt;/h1&gt;

&lt;p&gt;I shipped 32,784 lines of code in two days with Claude Code. I put that number in a LinkedIn post, and the first thing I wrote right after it was that lines of code is a weak metric. I meant it. The number is the least useful fact about the project, and this post is about the facts that matter more.&lt;/p&gt;

&lt;p&gt;Here is what the two days covered: a full rebuild of this site on Next.js 16, 228 blog posts rewritten against real keyword data, 543 tests passing, and zero broken URLs. Two years ago a project like that would have taken me weeks. This time the typing was not the slow part. Neither was the writing.&lt;/p&gt;

&lt;p&gt;The slow part was deciding what to build, and what to leave out. That is the real Claude Code workflow lesson, and it is the one I want to spend most of this post on.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Short Answer: What Actually Changed
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;With Claude Code, the cost of producing code dropped close to zero for me. The cost of deciding which code should exist did not move.&lt;/strong&gt; That is the whole shift in one sentence.&lt;/p&gt;

&lt;p&gt;In practice it meant my days looked different. Less time typing and debugging syntax. More time writing down constraints, reading diffs, saying no to features, and checking that the output matched what I actually wanted. I spent most of the two days acting as a reviewer and an editor, with the agent as a very fast and very literal builder.&lt;/p&gt;

&lt;p&gt;If you only take three things from this post:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write the constraints before you write the prompt. The agent will happily break anything you forgot to mention.&lt;/li&gt;
&lt;li&gt;Treat tests as the contract, not as an afterthought.&lt;/li&gt;
&lt;li&gt;The most valuable thing you ship is often a deletion.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What 32,784 Lines of Code Actually Covered
&lt;/h2&gt;

&lt;p&gt;Here is the honest breakdown of what the work was, because "32,784 lines" tells you nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A full rebuild on Next.js 16.&lt;/strong&gt; The site started as an Astro project in December 2025. The new version runs on Next.js 16 with Cache Components, a light redesign, a shared breadcrumb component, new icons, and a rewritten set of main pages. Nearly every route had to be rebuilt, and every route that the old site served had to keep working.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;228 posts rewritten against keyword data.&lt;/strong&gt; The blog is the part of the site that earns search traffic, so each post's title, meta description, headings and intro got reworked against real query data instead of my gut. More on that below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;543 tests passing.&lt;/strong&gt; The repo has tests for the metadata rules, the structured data, the sitemap, the llms.txt output, the tag pages, the proxy, the markdown negotiation and a lot more. They are what let me merge quickly without holding my breath.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero broken URLs.&lt;/strong&gt; This one sounds boring and it was the hardest requirement. Every URL the live site serves has to keep returning a 200 with real content. Indexed pages are the asset. A pretty redesign that 404s half of them is a net loss.&lt;/p&gt;

&lt;p&gt;All of that landed in roughly 100 commits and 11 merged pull requests. The first commit was late on October 21 and the last one was the morning of October 23.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Lines of Code Is a Weak Metric (and What I Track Instead)
&lt;/h2&gt;

&lt;p&gt;Lines of code has been a bad measure of developer output for a long time. &lt;a href="https://getdx.com/blog/why-lines-code-bad-measure-developer-productivity" rel="noopener noreferrer"&gt;DX's write-up on the metric&lt;/a&gt; makes the old argument well: teams end up optimizing the number instead of the outcome. AI makes the problem worse, because generating lines is now nearly free. InfoWorld made a related point in &lt;a href="https://www.infoworld.com/article/4135492/ai-agents-and-bad-productivity-metrics.html" rel="noopener noreferrer"&gt;its piece on AI agents and bad productivity metrics&lt;/a&gt;: the real bottleneck has moved to validation and integration, not writing.&lt;/p&gt;

&lt;p&gt;My own number is a good example of why. Some of those 32,784 lines are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generated or reformatted content in 228 MDX posts&lt;/li&gt;
&lt;li&gt;Test files and fixtures&lt;/li&gt;
&lt;li&gt;Code I wrote, shipped and then deleted a day later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last category is the interesting one, and I will get to it. The point is that if I had been measured on lines, deleting code would have counted against me, and deleting code was one of the best decisions of the project.&lt;/p&gt;

&lt;p&gt;So what do I look at instead?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do the tests pass, and do they test behavior?&lt;/strong&gt; A green suite that checks nothing is worse than no suite.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does every previously indexed URL still return 200?&lt;/strong&gt; This is a binary check I can automate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Did the change reduce the surface area I have to maintain?&lt;/strong&gt; Fewer routes, fewer concepts, fewer places to be wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can I explain every decision in the diff?&lt;/strong&gt; If I cannot, I did not review it, I just approved it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same gap shows up in the research. In the METR study I wrote about in &lt;a href="https://dev.to/blog/ai-productivity-paradox-developers-2026/"&gt;the AI productivity paradox&lt;/a&gt;, experienced developers using AI tools took 19 percent longer on their own repositories while believing they were faster. Output feels like progress. It often is not. I did not escape that trap by being smarter. I escaped it by measuring things that are hard to fake.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Claude Code Workflow: Best Practices From a Two-Day Rebuild
&lt;/h2&gt;

&lt;p&gt;I am not going to pretend there is a magic prompt. By "workflow" I mean my working habits, not Anthropic's dynamic workflows feature. What worked was a handful of Claude Code best practices, and most of them are about the work around the agent, not the agent itself. If you are new to the tool, start with my &lt;a href="https://dev.to/blog/how-to-use-claude-code-2026/"&gt;Claude Code tutorial&lt;/a&gt; and come back.&lt;/p&gt;

&lt;h3&gt;
  
  
  Write the constraints down before the first prompt
&lt;/h3&gt;

&lt;p&gt;The most expensive mistakes with an agent are the ones where it does exactly what you asked and breaks something you never mentioned.&lt;/p&gt;

&lt;p&gt;For this rebuild the constraints were mostly negative. Do not break any URL the live site serves. Keep the heading wrap on the homepage and page titles stable. Never use certain phrases in titles or metadata. Keep the page metadata rules enforced by tests. I kept them in the instructions and notes the agent reads at the start of a session, and I added to them every time I caught a violation.&lt;/p&gt;

&lt;p&gt;This is the practical core of &lt;a href="https://dev.to/blog/context-engineering-ai-coding-2026/"&gt;context engineering&lt;/a&gt;. The agent is only as good as what is in its context. A constraint that lives in my head does not exist as far as the agent is concerned.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make tests the contract
&lt;/h3&gt;

&lt;p&gt;When you generate code this fast, you cannot read every line with the same care. You need something that reads it for you.&lt;/p&gt;

&lt;p&gt;Tests do that. The page metadata test fails if a title or description breaks the rules I agreed on. The structured data tests fail if the JSON-LD changes shape. The sitemap test fails if a route disappears. None of these are clever. They are cheap to write, and each one turns a rule I would otherwise have to remember into a failing build.&lt;/p&gt;

&lt;p&gt;The rule I follow: when I catch the agent breaking something, I do not just fix it. I add the test that would have caught it, and then the next session cannot make the same mistake silently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep every merge small enough to review
&lt;/h3&gt;

&lt;p&gt;The 100 commits and 11 merged PRs were not an accident. Big diffs are where bugs hide, and an agent can produce a big diff in minutes. If I let one session run for hours and then opened a single pull request, I would be approving code I had not understood.&lt;/p&gt;

&lt;p&gt;So I merged in slices: the redesign, the copy audits, the routing fixes, the review follow-ups. After one batch I ran a review pass and fixed the findings before moving on. This is the same problem I covered in &lt;a href="https://dev.to/blog/ai-code-review-bottleneck-2026/"&gt;AI code review is the new bottleneck&lt;/a&gt;. Generation speed is not the constraint. Your ability to review is, so size the work to fit it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use audits as a loop, not a final step
&lt;/h3&gt;

&lt;p&gt;A lot of the project was a loop: have the agent audit the site against a checklist, read the findings, decide which ones are real, fix those, and run the audit again. Copy audits, metadata audits, project page audits.&lt;/p&gt;

&lt;p&gt;The decision step is the important one. The audit produces a list, and agents are good at producing lists. They are not good at knowing which items are worth your time. If you accept everything an audit says, you have outsourced the judgment, not the typing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Delegate in parallel, but only what is cleanly separable
&lt;/h3&gt;

&lt;p&gt;Subagents and parallel sessions pay off when the tasks do not touch the same files. Rewriting the copy on one page and fixing the sitemap logic are separable. Changing the layout and the metadata helper at the same time is not. If you want the mechanics, I wrote guides on &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents&lt;/a&gt; and &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;hooks&lt;/a&gt;. The catch is that parallelism multiplies your review load, so only split work when the review stays easy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code tips from this project, in one list
&lt;/h3&gt;

&lt;p&gt;If you only want the checklist:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Put your hard rules where the agent reads them at the start of every session.&lt;/li&gt;
&lt;li&gt;Turn every mistake you catch into a test.&lt;/li&gt;
&lt;li&gt;Merge in small slices and review each one before starting the next.&lt;/li&gt;
&lt;li&gt;Run audits, then decide for yourself which findings are real.&lt;/li&gt;
&lt;li&gt;Split work across agents only when the tasks touch different files.&lt;/li&gt;
&lt;li&gt;Ask "should this exist?" before "can the agent build it?"&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Best Thing I Shipped Was a Deletion
&lt;/h2&gt;

&lt;p&gt;Here is the story I mentioned. On the morning of October 23 I had a public JSON API on the site. Posts, projects, an OpenAPI spec, the works. Hours earlier I had spent a commit versioning it under &lt;code&gt;/api/v1&lt;/code&gt; and adding deprecation headers to the old paths. It was clean, documented and tested.&lt;/p&gt;

&lt;p&gt;Then I deleted all of it.&lt;/p&gt;

&lt;p&gt;The reason is in the commit message: the site is a portfolio, and the API added no SEO value and no value for AI discovery, while generating about 500 extra static pages. Agents that want to read the site are already served by &lt;code&gt;llms.txt&lt;/code&gt; and Markdown content negotiation. Removing the API took the static page count from 1,093 down to 596.&lt;/p&gt;

&lt;p&gt;Think about what that means. Claude Code built the versioning, the headers, the serializers and the tests in a very short time. It was easy. It was also pointless. The agent had no way to tell me that, because the question "should this exist?" is not a coding question. It is a product question, and it depends on what the site is for.&lt;/p&gt;

&lt;p&gt;That is the pattern I keep seeing. When building was expensive, the cost forced a filter. You only built what you were sure about, because you could not afford otherwise. When building is nearly free, the filter is gone, and it is easy to ship a lot of well-made things nobody needs. Other people are noticing the same shift. A common theme across recent writing on this is that the question has moved from "can I build this?" to "should I build this?". I came to the same conclusion by deleting my own work.&lt;/p&gt;

&lt;p&gt;If you are curious about the same dynamic at the startup level, my post on &lt;a href="https://dev.to/blog/ai-wrappers-dead-what-to-build-instead-2026/"&gt;why AI wrapper startups are failing&lt;/a&gt; covers the market version of it. Cheap building makes weak ideas more visible, not less.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real Keyword Data Beat My Gut on 228 Posts
&lt;/h2&gt;

&lt;p&gt;The 228-post rewrite is where I let data make the decisions I would normally make by feel.&lt;/p&gt;

&lt;p&gt;I pulled keyword data from DataForSEO: volumes, difficulty scores, live search results and which domains were ranking. The whole research run was 313 API calls and cost $4.37. For that I got a map of which queries the blog could realistically win and which ones were a waste of time.&lt;/p&gt;

&lt;p&gt;A few things that came out of it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Specific tool comparisons are winnable.&lt;/strong&gt; Queries like "cursor vs claude code" have low difficulty, and small solo blogs already rank for them. Head terms like "cursor" or "javascript" are not worth chasing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hiring-intent queries matter more than brand.&lt;/strong&gt; I do not need to rank for my own name. I need the right people to find me when they search for what I do.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Existing posts were often right but badly titled.&lt;/strong&gt; Several posts covered a high-volume query without leading with it. The fix was a title and heading rewrite, not a new post.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is also where taste came in. The data showed one phrase with about 720 searches a month that fit my situation. I decided not to use it anywhere on the site, because I did not like how it sounded. A tool that optimizes only for volume would have used it. That decision cost me a bit of traffic and I would make it again.&lt;/p&gt;

&lt;p&gt;The agent can run the analysis, cluster the posts and draft the rewrites. It cannot tell me which version of myself I want the site to present. That part is mine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Claude Code Got It Wrong
&lt;/h2&gt;

&lt;p&gt;I do not want this to read like a victory lap, so here is what went wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It broke URLs I told it to protect.&lt;/strong&gt; Early in the rebuild, the new design did not need the paginated blog pages or a few hidden project pages. So the agent redirected the pagination and turned the hidden projects into 404s. From a design point of view that made sense. From an SEO point of view it was wrong, because both sets of pages are indexed on the live site. I caught it, and the fix became a commit titled "Keep every URL main serves." It became a standing rule, and I checked the old sitemap against the new routes after every routing change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It followed its own logic over my intent.&lt;/strong&gt; The agent kept optimizing for the cleanest structure. I kept needing the structure that preserved what already worked. Those are different goals, and it only knew about one until I wrote the other down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A passing build is not proof the page is right.&lt;/strong&gt; Compiling and passing tests tells you the code is consistent with itself. Only a person looking at the page can tell you it says the right thing.&lt;/p&gt;

&lt;p&gt;None of these were disasters, because I had tests and small merges to catch them. That is the argument for the workflow above: it is not there to make the agent better, it is there to make its mistakes cheap.&lt;/p&gt;




&lt;h2&gt;
  
  
  Is Judgment Really the Bottleneck Now?
&lt;/h2&gt;

&lt;p&gt;I have eight years of engineering behind me, and for most of that time I treated execution as the hard part. Knowing how to build the thing, and having the stamina to build it, was the scarce resource. Nobody asked whether I should build it, because the building itself was the filter.&lt;/p&gt;

&lt;p&gt;That has flipped for me. Execution is no longer the hard part. These days the hard parts are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Judgment.&lt;/strong&gt; Which problem is worth solving, and which one to skip. The JSON API is the perfect example. I could have built ten more things like it in the same two days.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Taste.&lt;/strong&gt; Knowing when something is good enough, when copy sounds like a person and when it sounds like a template, when a page feels right. An agent will produce competent output forever. Competent is the problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Distribution.&lt;/strong&gt; Shipping a rebuilt site does not mean anyone reads it. When everyone can build quickly, the people who get found are the ones who thought about where their audience is. A big part of this rebuild was making sure search engines and AI tools could read the site properly, which is why &lt;code&gt;llms.txt&lt;/code&gt; and the keyword work got real attention. I looked at whether that file actually helps in &lt;a href="https://dev.to/blog/does-llms-txt-work-ai-visibility-2026/"&gt;does llms.txt work for AI visibility&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The honest caveat is that this does not make engineering skill irrelevant. It is the opposite. I could only trust the output because I know what good looks like. I could write useful constraints because I understood what could break. I could review a diff quickly because I have read thousands of them. &lt;a href="https://dev.to/blog/agentic-coding-2026/"&gt;Agentic coding&lt;/a&gt; rewards experience, because the job moves from typing to directing and verifying, and both of those need judgment you have to earn some other way.&lt;/p&gt;

&lt;p&gt;If you are earlier in your career, that is worth thinking about carefully. The skills that matter most are the ones the tool cannot give you: reading code critically, understanding systems, and developing opinions about what to build.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Questions About This Kind of Project
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can Claude Code rebuild a whole website?&lt;/strong&gt; Yes. The rebuild described here is evidence. But "can" is not "should unsupervised." It rebuilt the structure quickly and also broke indexed URLs and built features that I deleted. Treat it as a fast builder that needs constraints and a reviewer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How good is Claude Code at making websites?&lt;/strong&gt; Very good at the structure, components, routing and tests, as this Next.js 16 rebuild showed. Weaker at the parts that depend on context it cannot see: which URLs are indexed, what the site is for, what sounds like you. Those are the parts you have to supply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the best workflow in Claude Code?&lt;/strong&gt; There is no single best one, but the pattern that held up for me was constraints first, tests as the contract, small merges, and a human decision on every audit finding. The checklist is in the workflow section above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the biggest bottleneck in AI coding?&lt;/strong&gt; It depends on the team. For a lot of teams it is review, as I covered in &lt;a href="https://dev.to/blog/ai-code-review-bottleneck-2026/"&gt;AI code review is the new bottleneck&lt;/a&gt;. For a solo builder like me, it moved one step earlier: deciding what is worth building at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does it take to rebuild a website with Claude Code?&lt;/strong&gt; For this project, about two days from the first to the last commit, with a lot of review in between. That is far shorter than it would have taken me alone, but a good chunk of the time was decisions and checks, not generation. The time you save is the typing. The time you still need is the thinking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is lines of code a good metric for AI coding?&lt;/strong&gt; No. It was a weak metric before AI and it is worse now, because generating lines costs almost nothing. Track outcomes: working tests, intact URLs, less surface area, decisions you can explain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the most important Claude Code habit?&lt;/strong&gt; Writing constraints down where the agent reads them. Most of the failures I hit were the agent doing something reasonable that I had never ruled out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you still need to know how to code?&lt;/strong&gt; Yes, probably more than before. You are reviewing at speed, so you need to recognize bad code, fragile design and silent regressions quickly.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Would Do Differently
&lt;/h2&gt;

&lt;p&gt;If I ran this project again, I would change three things.&lt;/p&gt;

&lt;p&gt;I would write the URL-preservation test on day one instead of discovering the need for it mid-project. A script that diffs the old sitemap against the new routes would have caught the pagination and hidden-project problem immediately.&lt;/p&gt;

&lt;p&gt;I would decide earlier what the site is for. The JSON API existed because I never wrote down the purpose of the site clearly enough to rule it out. A one-paragraph statement of purpose at the top of the instructions file would have saved a day of building.&lt;/p&gt;

&lt;p&gt;I would spend even less time on code and more on the two things the tool cannot do for me: choosing what to publish and getting it in front of people.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Is Your Bottleneck Right Now?
&lt;/h2&gt;

&lt;p&gt;That was the question at the end of my LinkedIn post, and I mean it as a real one. If you build software, try this: pick your last three projects and write down where the time went. Not the hours on the calendar, the actual friction. Was it typing, debugging, reviewing, waiting, deciding, or promoting?&lt;/p&gt;

&lt;p&gt;For most of my career, my answer was typing and debugging. Now it is deciding and distributing. Yours might be different, and the answer should change what you practice.&lt;/p&gt;

&lt;p&gt;If you have a product that needs this kind of rebuild, or you want a second opinion on what to build before you build it, &lt;a href="https://dev.to/contact/"&gt;tell me what you are working on&lt;/a&gt;. I will give you an honest read, and sometimes the honest read is that you should skip the feature.&lt;/p&gt;

&lt;p&gt;Sources: &lt;a href="https://getdx.com/blog/why-lines-code-bad-measure-developer-productivity" rel="noopener noreferrer"&gt;DX on lines of code&lt;/a&gt;, &lt;a href="https://www.infoworld.com/article/4135492/ai-agents-and-bad-productivity-metrics.html" rel="noopener noreferrer"&gt;InfoWorld on AI agents and productivity metrics&lt;/a&gt;. Project numbers come from this site's git history and DataForSEO usage log, checked October 23, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>productivity</category>
      <category>career</category>
    </item>
    <item>
      <title>llms.txt Does Not Get You Cited. Here Is What It Is Actually For.</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:18:26 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/llmstxt-does-not-get-you-cited-here-is-what-it-is-actually-for-27l5</link>
      <guid>https://dev.to/alexcloudstar/llmstxt-does-not-get-you-cited-here-is-what-it-is-actually-for-27l5</guid>
      <description>&lt;h1&gt;
  
  
  llms.txt Does Not Get You Cited. Here Is What It Is Actually For.
&lt;/h1&gt;

&lt;p&gt;There is a small text file being sold as a shortcut through a problem that has no shortcuts.&lt;/p&gt;

&lt;p&gt;Put &lt;code&gt;llms.txt&lt;/code&gt; at the root of your site, the pitch goes, and ChatGPT, Claude, Gemini, and Perplexity will finally understand what you do. You will get cited. Your rankings will move. The robots will stop overlooking you.&lt;/p&gt;

&lt;p&gt;That would be a lovely product feature. It is not how this works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does llms.txt work?&lt;/strong&gt; For AI-search rankings and citations, there is no convincing evidence that it does, and no major answer engine has said it uses the file. For developer documentation it can help coding agents find the right pages. Treat &lt;code&gt;llms.txt&lt;/code&gt; as docs hygiene, with an example file near the end of this post.&lt;/p&gt;

&lt;p&gt;The best public crawl data we have says the major answer engines barely request &lt;code&gt;llms.txt&lt;/code&gt; at all. One recent study of more than 100,000 sites found an association between the file and AI visibility, but association is exactly what you would expect when technically mature sites do many sensible things at once. Other server-log studies found that crawlers request &lt;code&gt;robots.txt&lt;/code&gt; hundreds of times more often, and that most &lt;code&gt;llms.txt&lt;/code&gt; requests come from SEO tools checking whether the file exists.&lt;/p&gt;

&lt;p&gt;So should you create one? Probably. It takes twenty minutes. Just stop treating it as a growth strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  What llms.txt Actually Is
&lt;/h2&gt;

&lt;p&gt;The proposal is simple: a Markdown file at &lt;code&gt;/llms.txt&lt;/code&gt; that gives a language model a compact map of your site. A heading, a sentence explaining the product, links to important documentation, maybe a list of endpoints or guides.&lt;/p&gt;

&lt;p&gt;That is a reasonable convention. Documentation is full of navigation, sidebars, marketing copy, version selectors, and JavaScript that sometimes makes the useful part harder to extract. A clean Markdown index can be genuinely helpful to a coding agent that is trying to answer, "How do I authenticate with this API?"&lt;/p&gt;

&lt;p&gt;This is why Stripe and other developer-first companies have something in the shape of an LLM-friendly docs entry point. Their use case is not search ranking. It is making the correct current information easier to retrieve when an agent is already reading their documentation.&lt;/p&gt;

&lt;p&gt;That distinction matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;llms.txt&lt;/code&gt; can help an agent navigate your docs after it arrives.&lt;/li&gt;
&lt;li&gt;It does not make the agent arrive.&lt;/li&gt;
&lt;li&gt;It does not prove that your claims are true.&lt;/li&gt;
&lt;li&gt;It does not turn a site nobody mentions into a recommended product.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The file is documentation hygiene. Good hygiene matters. It does not replace a product, a reputation, or pages that answer a real question better than the alternatives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does llms.txt Improve AI Visibility?
&lt;/h2&gt;

&lt;p&gt;Not in a way anyone has shown convincingly.&lt;/p&gt;

&lt;p&gt;No major answer engine has said that &lt;code&gt;llms.txt&lt;/code&gt; is a ranking factor or a citation input. Google has been especially clear that its ordinary search guidance still applies to AI features. Make pages accessible. Make them useful. Use descriptive titles. Give users a reason to choose them. The answer is boring because the answer has always been boring.&lt;/p&gt;

&lt;p&gt;The temptation to believe otherwise is understandable. &lt;a href="https://dev.to/blog/zero-click-search-2026-measuring-ai-visibility/"&gt;Zero-click search is now the majority of Google searches&lt;/a&gt;, so a file that promises a direct line to the answer box feels like a thing you should not miss.&lt;/p&gt;

&lt;p&gt;But a file cannot solve the actual citation question: why should a model name you rather than the company it has already seen in documentation, reviews, Reddit threads, comparison pages, editorial coverage, and its own training data?&lt;/p&gt;

&lt;p&gt;It cannot.&lt;/p&gt;

&lt;p&gt;The strongest signal in the studies is not file format. It is clarity plus corroboration. Brands that appear in several independent, trustworthy places get named more often. Brands whose own site states exactly who they serve, what they do, how they compare, and what it costs are easier to cite accurately once the model encounters them. That is work. A text file is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Correlation Trap Is Doing Most of the Selling
&lt;/h2&gt;

&lt;p&gt;Here is how a bad conclusion becomes a marketing claim.&lt;/p&gt;

&lt;p&gt;Someone scans 100,000 websites. Sites with &lt;code&gt;llms.txt&lt;/code&gt; score better in an AI visibility tool. They publish the graph. A software company turns the graph into "add an llms.txt file to increase citations." Another company builds a scanner that gives you a red warning until you add one.&lt;/p&gt;

&lt;p&gt;What the graph actually captures is that a team that publishes an LLM file is more likely to also have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;documentation that is current and crawlable&lt;/li&gt;
&lt;li&gt;schema markup and clean canonical URLs&lt;/li&gt;
&lt;li&gt;comparison pages with a clear category definition&lt;/li&gt;
&lt;li&gt;an active product with reviews, backlinks, and community mentions&lt;/li&gt;
&lt;li&gt;someone who notices when a page is broken&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those things have a chance of helping. The file is a useful proxy for "this team cares about its website," not evidence of causation.&lt;/p&gt;

&lt;p&gt;You can see the same problem with the whole category of AI visibility dashboards. A graph showing that your competitor was cited 18 times and you were cited 6 times is a diagnosis, not a plan. That gap is exactly why I built &lt;a href="https://dev.to/blog/beseen-so-ai-visibility-tool-launch/"&gt;beseen.so&lt;/a&gt;: I wanted the missing page and rewrite, not a more decorative thermometer.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Should Publish llms.txt
&lt;/h2&gt;

&lt;p&gt;I would add it in three cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You have developer documentation.&lt;/strong&gt; If your users paste prompts into coding agents, a compact entry point reduces the odds that the agent follows an old blog post, a deprecated endpoint, or a random answer from Stack Overflow. Point to versioned guides and make the current path obvious.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your site is large or hard to navigate.&lt;/strong&gt; A docs site with hundreds of pages, a dashboard that renders client-side, or a product with multiple APIs can benefit from an explicit map. It is the same argument for a good &lt;code&gt;README&lt;/code&gt;: people should not have to play scavenger hunt to understand the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can keep it current.&lt;/strong&gt; An inaccurate &lt;code&gt;llms.txt&lt;/code&gt; is worse than no file. It gives a confident agent a clean, concise way to be wrong. Put ownership on it, review it when you change a public API, and remove old links.&lt;/p&gt;

&lt;p&gt;For a small marketing site with five pages and no docs, it is not a priority. Your homepage should already be easy to understand. If it is not, fixing the homepage will do more for people and crawlers than creating a separate map of the confusing homepage.&lt;/p&gt;

&lt;h2&gt;
  
  
  What To Do Before You Touch It
&lt;/h2&gt;

&lt;p&gt;If you want to be named by assistants, use this order instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Make the category and audience painfully clear
&lt;/h3&gt;

&lt;p&gt;The first screen of your homepage should answer three questions without a scroll: what is this, who is it for, and what does it replace or improve? Vague claims such as "the operating system for modern teams" make a design team feel clever and a retrieval system useless.&lt;/p&gt;

&lt;p&gt;Use the words customers use. If you are a rank tracker that checks AI prompts, say that. If you are an invoice tool for freelancers in Romania, say that. Clarity is not boring. Clarity is a feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Publish pages with a reason to exist
&lt;/h3&gt;

&lt;p&gt;Do not make a hundred generic FAQ pages because an agent can write them cheaply. Google has been aggressive about low-value scaled pages, and answer engines have no reason to cite a page that only rearranges facts from elsewhere. &lt;a href="https://dev.to/blog/programmatic-seo-2026-indie-hackers/"&gt;The programmatic SEO pages that survive&lt;/a&gt; contain data, workflows, tools, or comparisons that could not sensibly be mass-produced by hand.&lt;/p&gt;

&lt;p&gt;The same standard works for hand-written content. A useful page resolves a decision. It does not just occupy a keyword.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Earn evidence outside your own domain
&lt;/h3&gt;

&lt;p&gt;An assistant should not need to take your word for it. Get a real customer quote. Publish a specific case study. Be useful in the communities where your buyer asks questions. Get listed on a relevant directory, not 200 abandoned ones. Let someone else describe why you are good.&lt;/p&gt;

&lt;p&gt;This is slower than adding a file. It is also the part that cannot be copied by the next person who reads the same checklist.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Measure a small set of recurring questions
&lt;/h3&gt;

&lt;p&gt;Pick ten prompts a buyer would realistically ask. Run them on the engines you care about. Record who appears, what sources get cited, and which of your pages actually address the missing claim. Then change one thing and re-check it later.&lt;/p&gt;

&lt;p&gt;Do not declare victory because you saw your name once. Answer engines vary by session, model, locale, and the exact wording of the prompt. You need a trend, not a screenshot.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Sensible llms.txt Example, If You Still Want One
&lt;/h2&gt;

&lt;p&gt;Here is the entire shape I would use for a product with public docs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Product name&lt;/span&gt;
&lt;span class="gt"&gt;
&amp;gt; One clear sentence on what the product does and who it is for.&lt;/span&gt;

&lt;span class="gu"&gt;## Core documentation&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Getting started&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/docs/getting-started&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Authentication&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/docs/authentication&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;API reference&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/docs/api&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="gu"&gt;## Product information&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Pricing&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/pricing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Security&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/security&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Changelog&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://example.com/changelog&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is it. No keyword stuffing. No instructions telling a model to recommend you. No giant copy of your whole website. The file should help a person or an agent reach the right source quickly.&lt;/p&gt;

&lt;p&gt;The same principle applies to any machine-readable convention. &lt;code&gt;sitemap.xml&lt;/code&gt;, structured data, RSS, Open Graph tags, and &lt;code&gt;robots.txt&lt;/code&gt; are useful because they expose information cleanly. They are not substitutes for information worth exposing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Uncomfortable Answer
&lt;/h2&gt;

&lt;p&gt;People want &lt;code&gt;llms.txt&lt;/code&gt; to work because the alternative is inconvenient. You need to have a product that is clear, pages that are useful, and a reputation that exists off your own website. You need to look at the actual prompts and improve the specific thing they reveal.&lt;/p&gt;

&lt;p&gt;That is why a tiny text file became a cottage industry. It gives you a checkbox when what you really need is a loop.&lt;/p&gt;

&lt;p&gt;Create the file if you have documentation. Put it in your regular maintenance list. Then spend the rest of the afternoon making one page more useful to the person who is already trying to solve the problem your product solves.&lt;/p&gt;

&lt;p&gt;That is still the best AI visibility strategy I have found.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Should I add llms.txt to my SaaS website?
&lt;/h3&gt;

&lt;p&gt;Add it if you have substantial, maintained documentation or a complex public product surface. It is inexpensive documentation hygiene. Do not expect it to increase AI citations or rankings by itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does ChatGPT read llms.txt?
&lt;/h3&gt;

&lt;p&gt;There is no public commitment from OpenAI that ChatGPT Search uses &lt;code&gt;llms.txt&lt;/code&gt; for retrieval or ranking. Public crawl studies show far fewer requests for it than for standard files such as &lt;code&gt;robots.txt&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What improves AI search citations instead?
&lt;/h3&gt;

&lt;p&gt;Clear product pages, original information, independent mentions, useful comparison content, and a repeated measurement loop are better bets. A file format does not replace those inputs.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>ai</category>
      <category>developertools</category>
      <category>growth</category>
    </item>
    <item>
      <title>AI Referral Traffic Converts Better. That Does Not Mean You Should Chase It Blindly.</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:17:53 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/ai-referral-traffic-converts-better-that-does-not-mean-you-should-chase-it-blindly-3i1b</link>
      <guid>https://dev.to/alexcloudstar/ai-referral-traffic-converts-better-that-does-not-mean-you-should-chase-it-blindly-3i1b</guid>
      <description>&lt;h1&gt;
  
  
  AI Referral Traffic Converts Better. That Does Not Mean You Should Chase It Blindly.
&lt;/h1&gt;

&lt;p&gt;The most exciting chart in a young SaaS dashboard is often the smallest one.&lt;/p&gt;

&lt;p&gt;You filter acquisition by referrer and find 27 visits from ChatGPT last month. Two of them signed up. Your organic traffic sent 400 visitors and converted at a lower rate. Suddenly the conclusion feels obvious: AI search is the channel. We should optimize for citations. We should make more comparison pages. We should find an agency with "GEO" in its name before the window closes.&lt;/p&gt;

&lt;p&gt;Slow down.&lt;/p&gt;

&lt;p&gt;The conversion pattern is real. Across several 2026 benchmarks, AI-referred sessions convert better than ordinary organic sessions. That makes intuitive sense. A traditional searcher often arrives while exploring. A person who clicked after an assistant recommended a specific product has already outsourced a chunk of the evaluation. They arrive later in the decision.&lt;/p&gt;

&lt;p&gt;But a better conversion rate on 27 visits is not a growth engine. It is a useful signal. Treat it like one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AI Referrals Convert Well
&lt;/h2&gt;

&lt;p&gt;An assistant recommendation has context that a search result does not.&lt;/p&gt;

&lt;p&gt;Someone might ask, "What is a simple way to track whether ChatGPT recommends my competitors?" If the answer names a product, the user usually arrives with a framed problem, a category, and a reason to believe this option might fit. They have skipped the phase where they read five unrelated listicles and decide whether the problem even matters.&lt;/p&gt;

&lt;p&gt;That means the visit can look unusually qualified. It is similar to a strong word-of-mouth referral. The person is not giving you trust from zero. Some of it has been borrowed from the system that named you.&lt;/p&gt;

&lt;p&gt;There are three caveats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The assistant may have made a bad recommendation.&lt;/strong&gt; If your landing page does not match the claim, the conversion advantage disappears fast. An assistant calling you a complete analytics suite when you only track a narrow prompt set gives you a visitor and a disappointment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Referrer data misses a lot.&lt;/strong&gt; Some apps strip or hide referrers. A user may ask on one device, remember your name, and type it into a browser later. You will see direct traffic, branded search, or nothing measurable. The report is a lower bound, not a census.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The volume is still tiny for most sites.&lt;/strong&gt; AI referral traffic has grown quickly from a very small base. That means a 300% increase can be the difference between five visits and 20. It is a good reason to pay attention, not a reason to fire the other channels.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/blog/zero-click-search-2026-measuring-ai-visibility/"&gt;The zero-click problem&lt;/a&gt; is still the other half of this story. Answer engines are taking clicks away from ordinary results at a scale that referrals do not yet replace. One good cited visit is valuable. It does not pay back every visit that never reaches you.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Metric Stack That Keeps You Honest
&lt;/h2&gt;

&lt;p&gt;Do not make citation count your north-star metric. A citation is an intermediate event. You need to know whether it produced the kind of visitor who can become a customer.&lt;/p&gt;

&lt;p&gt;For each assistant referrer you can observe, track these six things monthly:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Sessions&lt;/td&gt;
&lt;td&gt;The visible size of the channel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Signup or demo rate&lt;/td&gt;
&lt;td&gt;Whether the recommendation created intent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Activation rate&lt;/td&gt;
&lt;td&gt;Whether the product matched the promise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paid conversion&lt;/td&gt;
&lt;td&gt;The thing that keeps the business alive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Branded search trend&lt;/td&gt;
&lt;td&gt;A partial signal for invisible AI influence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prompt coverage&lt;/td&gt;
&lt;td&gt;Which buyer questions name you or a competitor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do not read the first two without the next two. A referral source can send people who eagerly sign up and quickly churn because the assistant oversold what you do. That is not a channel win. It is a positioning mismatch with a free top-of-funnel layer.&lt;/p&gt;

&lt;p&gt;For the first few months, keep the data simple. Create a channel group for known assistant domains. Annotate the date you changed a page or launched a feature. Add a short, optional question to onboarding: "How did you first hear about us?" Let the answer be free text. People will say ChatGPT even when the referrer did not survive the trip.&lt;/p&gt;

&lt;p&gt;None of this creates perfect attribution. Perfect attribution is the bait. You are trying to make better decisions, not win an argument with a spreadsheet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Landing Page Is Where the Recommendation Gets Tested
&lt;/h2&gt;

&lt;p&gt;The most common mistake in AI visibility work is trying to win the answer while ignoring the page the answer sends people to.&lt;/p&gt;

&lt;p&gt;Read the recommendation you are getting. What exact phrase does the assistant use? Then open the landing page cold and check whether the first screen confirms it.&lt;/p&gt;

&lt;p&gt;If the answer says "use this to compare your AI visibility against competitors," the page should not lead with a vague slogan about the future of search. It should show who gets compared, which engines are checked, what output appears, and how someone starts.&lt;/p&gt;

&lt;p&gt;This is particularly important for comparison prompts. When a model names you alongside known tools, the user will expect an honest difference. Give them the difference. A page that pretends to beat every incumbent on every dimension destroys the trust the recommendation created.&lt;/p&gt;

&lt;p&gt;This is why &lt;a href="https://dev.to/blog/beseen-so-ai-visibility-tool-launch/"&gt;beseen.so&lt;/a&gt; is explicit about what it does not do. No backlink index. No keyword research suite. No auto-publishing. A product page that tells a narrow truth can lose some casual clicks and gain the customers who were actually looking for that narrow thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  How To Improve the Channel Without Gaming It
&lt;/h2&gt;

&lt;p&gt;The boring work is also the durable work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer real buyer questions directly
&lt;/h3&gt;

&lt;p&gt;Build pages around decisions a customer makes. Alternatives, integrations, pricing tradeoffs, setup guides, and case studies all give an assistant something specific to retrieve. Do not churn out definition pages that can be summarized above the result with no reason to click.&lt;/p&gt;

&lt;p&gt;The best test is whether someone would still find the page useful after an assistant summarized its first paragraph. If the answer is no, the page probably does not have enough original value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make claims easy to verify
&lt;/h3&gt;

&lt;p&gt;If you say your product supports four engines, show the four engines. If you say a workflow takes two minutes, show the steps or state the constraint. If you compare yourself with another tool, say when that tool is the better choice.&lt;/p&gt;

&lt;p&gt;Assistants are not fact-checkers in the way people wish they were, but external evidence makes their summaries more stable and makes human visitors less likely to bounce after clicking.&lt;/p&gt;

&lt;h3&gt;
  
  
  Earn mentions where buyers already look
&lt;/h3&gt;

&lt;p&gt;An assistant's training and retrieval universe is not your sitemap. Reviews, community discussions, documentation, directories with actual editorial standards, and genuine customer stories all teach the world that the product exists.&lt;/p&gt;

&lt;p&gt;Do not turn this into fake Reddit answers or a directory-submission marathon. &lt;a href="https://dev.to/blog/startup-directory-submissions-seo-2026/"&gt;Relevant directory placements can help&lt;/a&gt;, but the value is the audience and validation, not a follow link you can count.&lt;/p&gt;

&lt;h3&gt;
  
  
  Measure prompts, not just sessions
&lt;/h3&gt;

&lt;p&gt;Ask the questions your buyer asks, in fresh sessions, on a regular cadence. Record who is named, which page is cited, and whether the wording matches your product. Then improve the missing page and wait long enough for it to be recrawled.&lt;/p&gt;

&lt;p&gt;This is the feedback loop a good visibility tool should support. The output is not "we were cited 14 times." The output is "we are absent from the three comparison prompts that precede our highest-value signup, and our pricing page does not answer the concern those prompts expose."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trap: Optimizing for the Mention Instead of the Customer
&lt;/h2&gt;

&lt;p&gt;The ugly version of AI search optimization is already familiar. Pages written to stuff keywords. Fake reviews. Claims with no source. A hundred shallow answers that all say the same thing. It may produce a momentary citation, just like it sometimes produced a momentary rank.&lt;/p&gt;

&lt;p&gt;The strategy collapses because it optimizes an intermediate metric. A system might name you, but a person still has to decide whether you are worth money.&lt;/p&gt;

&lt;p&gt;The healthy version is almost boring: make the product legible, publish information nobody else can provide, tell the truth about fit, and track whether referral visitors activate and stay. Those practices improve ordinary search, word of mouth, sales calls, and the product itself at the same time.&lt;/p&gt;

&lt;p&gt;That is why I am cautiously optimistic about the conversion numbers. They are a hint that recommendation-driven discovery can send unusually good traffic. They are not permission to stop building everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical 30-Day Experiment
&lt;/h2&gt;

&lt;p&gt;If you want to test this without building an entire AI visibility department, do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick ten questions a qualified buyer would ask before choosing a product like yours.&lt;/li&gt;
&lt;li&gt;Run them in the assistants your customers use, from clean sessions.&lt;/li&gt;
&lt;li&gt;Choose one question where you are absent or badly described.&lt;/li&gt;
&lt;li&gt;Improve one existing page or write one new page that answers the missing decision with real evidence.&lt;/li&gt;
&lt;li&gt;Add an annotation to analytics and wait three to four weeks.&lt;/li&gt;
&lt;li&gt;Compare prompt coverage, known assistant referrals, activation, and paid conversions with the prior month.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One cycle will not prove causation. It will teach you more than a dashboard that converts every citation into a score.&lt;/p&gt;

&lt;p&gt;If you see a repeatable lift, do another cycle. If you do not, you still made a better page. That is a decent downside for a growth experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does AI referral traffic convert better than Google organic traffic?
&lt;/h3&gt;

&lt;p&gt;Often, yes. Users may arrive after receiving a recommendation and therefore have more intent. The result varies by product and volume is still small for most sites, so compare activation and paid conversion, not only click-to-signup rate.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I track traffic from ChatGPT or Perplexity?
&lt;/h3&gt;

&lt;p&gt;Create an analytics channel group for known assistant referrers, track it monthly, and ask new users how they heard about you. Referrers are incomplete, so combine both signals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I optimize only for AI search now?
&lt;/h3&gt;

&lt;p&gt;No. AI citations are one discovery path. Clear product pages, original content, customer evidence, direct distribution, and ordinary SEO remain necessary, especially while AI referral volume is low.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>ai</category>
      <category>saas</category>
      <category>analytics</category>
    </item>
    <item>
      <title>How to Use Claude Code: A Practical Tutorial From Install to Productive</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:17:20 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/how-to-use-claude-code-a-practical-tutorial-from-install-to-productive-4mol</link>
      <guid>https://dev.to/alexcloudstar/how-to-use-claude-code-a-practical-tutorial-from-install-to-productive-4mol</guid>
      <description>&lt;h1&gt;
  
  
  How to Use Claude Code: A Practical Tutorial From Install to Productive
&lt;/h1&gt;

&lt;p&gt;Most Claude Code tutorials stop at "type a prompt and watch it work." That gets you through the first ten minutes. It does not get you to the point where the tool saves you real time, because that depends on a handful of habits: giving it a project file to read, checking its plan before it edits, and knowing which commands keep a long session healthy.&lt;/p&gt;

&lt;p&gt;I have used Claude Code daily since it launched in 2025, on side products and client work. This is the tutorial I would hand to a developer who has never opened it. Everything here is checked against the official docs on October 23, 2026, and I mark the places where behavior changes by plan or install method.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use Claude Code: The Short Answer
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;To use Claude Code, install it with the native installer (&lt;code&gt;curl -fsSL https://claude.ai/install.sh | bash&lt;/code&gt; on macOS, Linux and WSL), run &lt;code&gt;claude&lt;/code&gt; in a project folder, and sign in with a paid Claude plan or Console account. Describe a task in plain English, review each proposed edit, and approve what looks right.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The rest of this post expands each step: the install options per operating system, what to type in your first session, how permissions work, and which settings are worth changing early.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Claude Code Is (and What It Is Not)
&lt;/h2&gt;

&lt;p&gt;Claude Code is Anthropic's agentic coding tool. It reads your codebase, edits files, runs commands and works with git. It started as a terminal CLI and now also runs in VS Code, JetBrains IDEs, a desktop app and the browser. All of those surfaces use the same engine, so your CLAUDE.md files, settings and MCP servers carry across them.&lt;/p&gt;

&lt;p&gt;The terminal is where I spend most of my time, so this guide follows the terminal path. If you prefer a graphical interface, the desktop app includes Claude Code and does not need the CLI installed separately. The VS Code extension also installs into Cursor.&lt;/p&gt;

&lt;p&gt;It is not an autocomplete tool. It does not suggest the next line as you type. You give it a task, it explores the repo, proposes changes, and you decide what lands. If you are still choosing between tools, my &lt;a href="https://dev.to/blog/claude-code-vs-cursor-vs-github-copilot-2026/"&gt;Claude Code vs Cursor vs GitHub Copilot comparison&lt;/a&gt; covers where each one wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Install Claude Code
&lt;/h2&gt;

&lt;p&gt;The official docs recommend the native installer. It needs no Node.js, and it auto-updates in the background.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Auto-updates&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Native, macOS, Linux, WSL&lt;/td&gt;
&lt;td&gt;`curl -fsSL &lt;a href="https://claude.ai/install.sh" rel="noopener noreferrer"&gt;https://claude.ai/install.sh&lt;/a&gt; \&lt;/td&gt;
&lt;td&gt;bash`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native, Windows PowerShell&lt;/td&gt;
&lt;td&gt;`irm &lt;a href="https://claude.ai/install.ps1" rel="noopener noreferrer"&gt;https://claude.ai/install.ps1&lt;/a&gt; \&lt;/td&gt;
&lt;td&gt;iex`&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native, Windows CMD&lt;/td&gt;
&lt;td&gt;&lt;code&gt;curl -fsSL https://claude.ai/install.cmd -o install.cmd &amp;amp;&amp;amp; install.cmd &amp;amp;&amp;amp; del install.cmd&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Homebrew&lt;/td&gt;
&lt;td&gt;&lt;code&gt;brew install --cask claude-code&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WinGet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;winget install Anthropic.ClaudeCode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;npm&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install -g @anthropic-ai/claude-code&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;See note below&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few details that save you a debugging session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PowerShell vs CMD.&lt;/strong&gt; The two Windows commands are not interchangeable. If you see &lt;code&gt;The token '&amp;amp;&amp;amp;' is not a valid statement separator&lt;/code&gt;, you ran the CMD command in PowerShell. If you see &lt;code&gt;'irm' is not recognized&lt;/code&gt;, you ran the PowerShell command in CMD. Your prompt shows &lt;code&gt;PS C:\&lt;/code&gt; in PowerShell.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git for Windows.&lt;/strong&gt; It is recommended on native Windows so Claude Code can use the Bash tool. Without it, Claude Code uses PowerShell as its shell tool. WSL setups do not need it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Homebrew has two casks.&lt;/strong&gt; &lt;code&gt;claude-code&lt;/code&gt; tracks the stable channel, usually about a week behind. &lt;code&gt;claude-code@latest&lt;/code&gt; gets releases as soon as they ship. Upgrade with &lt;code&gt;brew upgrade claude-code&lt;/code&gt; or &lt;code&gt;brew upgrade claude-code@latest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npm needs Node.js 22 or later.&lt;/strong&gt; The package installs the same native binary as the standalone installer. Never use &lt;code&gt;sudo npm install -g&lt;/code&gt;, since it causes permission problems. To upgrade, run &lt;code&gt;npm install -g @anthropic-ai/claude-code@latest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux package managers.&lt;/strong&gt; apt, dnf and apk repositories exist for Debian and Ubuntu, Fedora and RHEL, and Alpine. They do not auto-update through Claude Code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requirements.&lt;/strong&gt; macOS 13.0 or later, Windows 10 1809 or later, Ubuntu 20.04 or later, Debian 10 or later, or Alpine 3.19 or later, with 4 GB of RAM or more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The install command prints no progress while it downloads. When it finishes, open a new terminal and check it worked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your shell says &lt;code&gt;claude&lt;/code&gt; is not found, the install directory is not on your PATH yet. For a deeper check, &lt;code&gt;claude doctor&lt;/code&gt; prints installation and settings diagnostics without starting a session.&lt;/p&gt;

&lt;p&gt;To update by hand, run &lt;code&gt;claude update&lt;/code&gt;. Native installs also update themselves on startup and periodically while running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Log In and Pick a Plan
&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;claude&lt;/code&gt; in any folder and it prompts you to sign in through your browser. Credentials are stored, so you only do this once. To switch accounts later, type &lt;code&gt;/login&lt;/code&gt; inside a session.&lt;/p&gt;

&lt;p&gt;You need one of these accounts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Claude Pro, Max, Team or Enterprise subscription&lt;/li&gt;
&lt;li&gt;A Claude Console account (API access with pre-paid credits)&lt;/li&gt;
&lt;li&gt;Access through a supported cloud provider: Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The free claude.ai plan does not include Claude Code. That is the single most common reason a first login fails.&lt;/p&gt;

&lt;p&gt;Prices I confirmed on claude.com/pricing today: Pro is $20 per month billed monthly, or $17 per month billed annually. Max starts at $100 per month. Team standard seats are $25 per seat per month billed monthly, or $20 billed annually. Enterprise is $20 per seat per month billed annually with a 20-seat minimum, plus usage at API rates. Pricing changes often, so check the page before you commit.&lt;/p&gt;

&lt;p&gt;Subscription plans use a rolling usage window rather than a per-token bill. If you want to understand where usage goes before you hit a limit, I wrote about it in &lt;a href="https://dev.to/blog/ai-agent-token-costs-developer-guide-2026/"&gt;the AI agent token cost guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Tutorial: Your First Session in a Real Repo
&lt;/h2&gt;

&lt;p&gt;Open a terminal in a project and start Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;path/to/your/project
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The prompt shows the version, the current model and the working directory. You do not need to feed it files. It reads what it needs as it goes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start by asking questions
&lt;/h3&gt;

&lt;p&gt;Do not start by asking it to change anything. Ask it to explain the project first. These come straight from the quickstart and they work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what does this project do?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;explain the folder structure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;where is the main entry point?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This does two jobs. You learn whether it understood the codebase, and you find gaps in your own docs. If its summary is wrong, a change request would have gone wrong too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Then make a small change
&lt;/h3&gt;

&lt;p&gt;Pick something low risk, like adding a function or a test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add a unit test for the parseDate helper, then run it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code finds the file, shows you the proposed change, and asks before applying it. Read the diff. If it looks right, approve it. If it does not, tell it what is wrong in plain language and it revises.&lt;/p&gt;

&lt;p&gt;Be specific. The quickstart gives a good example: instead of "fix the bug," try "fix the login bug where users see a blank screen after entering wrong credentials." The more concrete the symptom and the expected result, the fewer rounds you spend.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use git through the conversation
&lt;/h3&gt;

&lt;p&gt;It works with git directly, so these prompts are fine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what files have I changed?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;commit my changes with a descriptive message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I still read the commit message before it goes in, and I only let it push when I ask for that explicitly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Press Shift+Tab to change how much it asks
&lt;/h3&gt;

&lt;p&gt;The session's permission mode sets which actions run without asking. &lt;code&gt;Shift+Tab&lt;/code&gt; cycles through the modes mid-session. The next two sections cover the two that matter most when you are starting out: plan mode and the default manual mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan Mode: Review the Approach Before Any Edits
&lt;/h2&gt;

&lt;p&gt;Plan mode is the habit I would build first. In plan mode, Claude reads files and writes a plan but does not edit your source until you approve the plan.&lt;/p&gt;

&lt;p&gt;Three ways to enter it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;Shift+Tab&lt;/code&gt; until the status bar shows plan mode.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;/plan&lt;/code&gt; at the prompt, optionally followed by a description, such as &lt;code&gt;/plan fix the auth bug&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Start a session in it with &lt;code&gt;claude --permission-mode plan&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Press &lt;code&gt;Shift+Tab&lt;/code&gt; again to leave without approving.&lt;/p&gt;

&lt;p&gt;Use it when the change touches more than a couple of files, when you do not fully know the codebase, or when the first idea might be the wrong one. Reading a plan takes a minute. Unwinding a wrong 12-file edit takes much longer. For one-line fixes, skip it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write a CLAUDE.md So It Knows Your Project
&lt;/h2&gt;

&lt;p&gt;Every session starts with a fresh context window. CLAUDE.md is how you carry instructions across sessions: build commands, test commands, conventions, things not to touch. Claude reads it at the start of every conversation.&lt;/p&gt;

&lt;p&gt;The fastest way to create one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/init&lt;/code&gt; analyzes your codebase and generates a starting CLAUDE.md with the build commands, test instructions and conventions it finds. If a CLAUDE.md already exists, it suggests improvements instead of overwriting. The docs also document an interactive variant: set the &lt;code&gt;CLAUDE_CODE_NEW_INIT&lt;/code&gt; environment variable to &lt;code&gt;1&lt;/code&gt; before running &lt;code&gt;/init&lt;/code&gt;, and it asks which artifacts to set up (CLAUDE.md files, skills and hooks).&lt;/p&gt;

&lt;h3&gt;
  
  
  Where CLAUDE.md files live
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Shared with&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Only you, all projects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Project&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;./CLAUDE.md&lt;/code&gt; or &lt;code&gt;./.claude/CLAUDE.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Your team, via git&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local&lt;/td&gt;
&lt;td&gt;&lt;code&gt;./CLAUDE.local.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Only you, this project (add it to &lt;code&gt;.gitignore&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Files in the directory tree above your working directory are loaded at launch. Files in subdirectories load on demand when Claude works with files there.&lt;/p&gt;

&lt;h3&gt;
  
  
  What to put in it
&lt;/h3&gt;

&lt;p&gt;Treat it as a short onboarding note for a new teammate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Project notes&lt;/span&gt;

&lt;span class="gu"&gt;## Commands&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Install: bun install
&lt;span class="p"&gt;-&lt;/span&gt; Test: bun test
&lt;span class="p"&gt;-&lt;/span&gt; Lint: bun run lint

&lt;span class="gu"&gt;## Conventions&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; TypeScript strict mode, no &lt;span class="sb"&gt;`any`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Named exports only
&lt;span class="p"&gt;-&lt;/span&gt; Server code lives in /lib, UI in /components

&lt;span class="gu"&gt;## Do not&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Edit generated files in /generated
&lt;span class="p"&gt;-&lt;/span&gt; Commit .env files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two rules from the docs are worth following. First, keep it under about 200 lines per file, since longer files consume more context and reduce how well instructions are followed. Second, be specific: "run &lt;code&gt;bun test&lt;/code&gt; before finishing" beats "make sure things work."&lt;/p&gt;

&lt;p&gt;You can also import other files with &lt;code&gt;@path/to/file&lt;/code&gt; syntax, for example &lt;code&gt;See @README for project overview and @package.json for npm commands&lt;/code&gt;. Imports organize a long file, but they do not reduce how much context it uses.&lt;/p&gt;

&lt;p&gt;One more thing to know: CLAUDE.md is context, not enforcement. Claude treats it as guidance. If something must never happen, use a hook or a permission deny rule instead, which I cover in the level-up section below.&lt;/p&gt;

&lt;p&gt;Claude Code also keeps its own notes, called auto memory, based on corrections and preferences it picks up. You can view and toggle it with &lt;code&gt;/memory&lt;/code&gt;. If your repo already has an &lt;code&gt;AGENTS.md&lt;/code&gt; for other tools, Claude Code can read that when there is no CLAUDE.md.&lt;/p&gt;

&lt;h2&gt;
  
  
  Slash Commands Worth Learning First
&lt;/h2&gt;

&lt;p&gt;Type &lt;code&gt;/&lt;/code&gt; to see everything available, and keep typing to filter. A slash command only works at the start of your message. These are the ones I use all the time, all from the official commands reference:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/help&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows help and available commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a CLAUDE.md for the project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a new conversation with empty context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/compact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Summarizes the conversation to free up context. Accepts optional focus instructions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/model&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switches the model. With no argument it opens a picker&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/plan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enters plan mode from the prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/resume&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Resumes a past conversation by ID or name, or opens the picker&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/rewind&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rewinds the conversation and/or code to an earlier point&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/diff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows changes in your working tree, including Claude's edits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/context&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows current context usage as a grid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/usage&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows session cost, plan usage limits and activity stats. &lt;code&gt;/cost&lt;/code&gt; is an alias&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/memory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Edits CLAUDE.md files and toggles auto memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/permissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages allow, ask and deny rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/mcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages MCP server connections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/doctor&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs a setup checkup and proposes fixes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/exit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exits the CLI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two of these deserve a note. &lt;code&gt;/clear&lt;/code&gt; is the one to reach for when you switch tasks. Old context from a finished task makes the next one worse and costs you usage. &lt;code&gt;/compact&lt;/code&gt; is for when you want to keep going in the same task but the conversation has grown long.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/rewind&lt;/code&gt; is the safety net. If a round of edits went the wrong way, you can roll the conversation and the code back to an earlier point instead of untangling it by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose and Switch Models
&lt;/h2&gt;

&lt;p&gt;Claude Code uses model aliases. The ones the docs list: &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;best&lt;/code&gt;, &lt;code&gt;fable&lt;/code&gt;, &lt;code&gt;sonnet&lt;/code&gt;, &lt;code&gt;opus&lt;/code&gt;, &lt;code&gt;haiku&lt;/code&gt;, &lt;code&gt;opusplan&lt;/code&gt;, plus &lt;code&gt;sonnet[1m]&lt;/code&gt; and &lt;code&gt;opus[1m]&lt;/code&gt; for a 1M-token context window.&lt;/p&gt;

&lt;p&gt;On the Anthropic API, &lt;code&gt;opus&lt;/code&gt; resolves to Opus 5.5, &lt;code&gt;sonnet&lt;/code&gt; to Sonnet 5.5 and &lt;code&gt;haiku&lt;/code&gt; to Haiku 5.5. On Pro, Max, Team and Enterprise, the &lt;code&gt;default&lt;/code&gt; is Opus 5.5. Fable is not the default on any plan, so you have to select it.&lt;/p&gt;

&lt;p&gt;Two ways to switch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/model sonnet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--model&lt;/span&gt; opus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With no argument, &lt;code&gt;/model&lt;/code&gt; opens a picker. In the picker, &lt;code&gt;Enter&lt;/code&gt; saves your choice as the default for new sessions, and &lt;code&gt;s&lt;/code&gt; switches for the current session only. You can also set a &lt;code&gt;model&lt;/code&gt; key in a settings file or the &lt;code&gt;ANTHROPIC_MODEL&lt;/code&gt; environment variable.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;opusplan&lt;/code&gt; is a handy one for beginners. It uses Opus while you are in plan mode, then switches to Sonnet for the edits.&lt;/p&gt;

&lt;p&gt;My rough rule: use the strongest model for planning, debugging and cross-file changes, and a faster one for small, well-defined edits. That is my experience, not a benchmark. If you want to see how the options compare on cost, my &lt;a href="https://dev.to/blog/claude-code-vs-codex-2026/"&gt;Claude Code vs Codex comparison&lt;/a&gt; has the plan-level numbers side by side.&lt;/p&gt;

&lt;p&gt;There is also an effort setting. &lt;code&gt;/effort&lt;/code&gt; accepts &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt;, &lt;code&gt;xhigh&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;, and the available levels depend on the model. Leave it alone until you have a reason to change it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Permissions: What Claude Code Can Do Without Asking
&lt;/h2&gt;

&lt;p&gt;The default mode is called Manual in the interface and &lt;code&gt;default&lt;/code&gt; in config. Reads run freely. Edits, shell commands and network access ask for approval. Writes to protected paths such as &lt;code&gt;.git&lt;/code&gt;, &lt;code&gt;.claude&lt;/code&gt;, &lt;code&gt;.bashrc&lt;/code&gt; and &lt;code&gt;.mcp.json&lt;/code&gt; always prompt in this mode.&lt;/p&gt;

&lt;p&gt;Here are the six modes, from the permission modes docs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;default&lt;/code&gt; (Manual)&lt;/td&gt;
&lt;td&gt;Reads run freely, everything else asks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;acceptEdits&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Also auto-approves file edits and common filesystem commands like &lt;code&gt;mkdir&lt;/code&gt;, &lt;code&gt;mv&lt;/code&gt; and &lt;code&gt;cp&lt;/code&gt; in your working directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;plan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Researches and proposes, no edits until you approve&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;auto&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A classifier model reviews actions so routine prompts are skipped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dontAsk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Anything that would prompt is denied. Good for CI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bypassPermissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Everything runs without checks. Isolated containers or VMs only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;As a beginner, stay on &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;plan&lt;/code&gt;. Move to &lt;code&gt;acceptEdits&lt;/code&gt; once you trust it on a task you are reviewing anyway.&lt;/p&gt;

&lt;p&gt;You can pre-approve specific commands so you stop getting asked about the safe ones. Rules live in a settings file under &lt;code&gt;permissions.allow&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"allow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Bash(npm test)"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deny rules block in every mode, including &lt;code&gt;bypassPermissions&lt;/code&gt;. Run &lt;code&gt;/permissions&lt;/code&gt; to see and edit your rules in an interactive dialog.&lt;/p&gt;

&lt;p&gt;Do not reach for &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; to get rid of prompts. If the problem is prompt fatigue, look at &lt;code&gt;auto&lt;/code&gt; mode and a tight allow list first. I go through the flag, the access ladder and a least-privilege &lt;code&gt;settings.json&lt;/code&gt; in &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;my coding agent permissions guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Headless Mode: claude -p for Scripts and Pipes
&lt;/h2&gt;

&lt;p&gt;Everything so far is interactive. Claude Code also runs non-interactively with &lt;code&gt;-p&lt;/code&gt; (print mode). It answers once and exits, which makes it easy to use in scripts and pipes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"explain what this function does"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;logs.txt | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"summarize the errors in this log"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff main &lt;span class="nt"&gt;--name-only&lt;/span&gt; | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"review these changed files for security issues"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few documented flags that matter for scripts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--output-format&lt;/code&gt; accepts &lt;code&gt;text&lt;/code&gt;, &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;stream-json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--max-turns&lt;/code&gt; limits the number of agentic turns and exits with an error when it hits the limit.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--allowedTools&lt;/code&gt; lists tools that run without prompting, for example &lt;code&gt;"Bash(git log *)" "Read"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--max-budget-usd&lt;/code&gt; stops the run once estimated spend reaches the cap. The docs note it is a client-side estimate that can differ from your bill.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;claude -c -p "query"&lt;/code&gt; continues the most recent conversation non-interactively.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In print mode with no permission mode set, calls that need approval are denied unless you allow them. So give a headless run the specific tools it needs with &lt;code&gt;--allowedTools&lt;/code&gt;, and do not rely on a prompt that nobody will answer.&lt;/p&gt;

&lt;p&gt;Other shell commands from the CLI reference that you will use early: &lt;code&gt;claude "task"&lt;/code&gt; starts a session with an initial prompt, &lt;code&gt;claude -c&lt;/code&gt; continues the most recent conversation in the current directory, and &lt;code&gt;claude -r&lt;/code&gt; opens the picker to resume an older one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level Up: Skills, Hooks, Subagents, MCP and More
&lt;/h2&gt;

&lt;p&gt;Once the basics feel natural, these are the features that turn Claude Code from a helpful assistant into part of your workflow. I have a dedicated guide for each, so I will keep this section to what each one is for.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Skills&lt;/strong&gt; package a repeatable workflow into a &lt;code&gt;SKILL.md&lt;/code&gt; file you can invoke as a slash command. Good for things you ask for the same way every time, like a release checklist. See &lt;a href="https://dev.to/blog/writing-claude-code-skill-developer-guide-2026/"&gt;how to write a Claude Code skill&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt; run shell commands before or after Claude Code actions, such as formatting after every edit. They are also the reliable way to block an action, since CLAUDE.md is only guidance. See my &lt;a href="https://dev.to/blog/claude-code-hooks-guide-2026/"&gt;Claude Code hooks guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subagents&lt;/strong&gt; are separate Claude instances with their own context and instructions, useful for side tasks like code review or searching a large codebase without filling your main conversation. See the &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP&lt;/strong&gt; (Model Context Protocol) connects Claude Code to outside tools and data, such as issue trackers and databases. You manage servers with &lt;code&gt;claude mcp&lt;/code&gt; and &lt;code&gt;/mcp&lt;/code&gt;. See the &lt;a href="https://dev.to/blog/mcp-model-context-protocol-developer-guide-2026/"&gt;MCP developer guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status line&lt;/strong&gt; puts useful session info, like the model and context use, at the bottom of the terminal. See the &lt;a href="https://dev.to/blog/claude-code-status-line-guide-2026/"&gt;status line guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git worktrees&lt;/strong&gt; let you run several sessions on separate branches without them stepping on each other. Claude Code supports this directly with &lt;code&gt;claude --worktree&lt;/code&gt; (short form &lt;code&gt;-w&lt;/code&gt;). See my &lt;a href="https://dev.to/blog/git-worktree-guide-2026/"&gt;git worktree guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions&lt;/strong&gt; are worth a second pass once you are comfortable. See the &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;least-privilege guide&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Add these one at a time. Each one is useful on its own, and stacking five new features in a week makes it hard to tell what helped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Mistakes (and How to Avoid Them)
&lt;/h2&gt;

&lt;p&gt;These are the mistakes that cost the most time and usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vague prompts.&lt;/strong&gt; "Fix the tests" gives it too much room. Name the failing test, the error and what the right behavior is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Skipping the read-only warm-up.&lt;/strong&gt; If you ask for a change in an unfamiliar repo, you are betting the model guessed the architecture right. Ask it to explain the relevant area first, or use plan mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never clearing context.&lt;/strong&gt; One long session across five unrelated tasks gets worse as it fills up, and it costs usage. Run &lt;code&gt;/clear&lt;/code&gt; between tasks. Use &lt;code&gt;/compact&lt;/code&gt; when you are mid-task and the history is long.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approving edits without reading them.&lt;/strong&gt; The approval prompt exists so you can catch mistakes. A diff you did not read is a diff you own anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Giant tasks in one prompt.&lt;/strong&gt; "Rebuild the whole auth system" is a project, not a prompt. Break it into steps, and ideally plan first. The quickstart recommends this too: step-by-step instructions work better for complex work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bloated or missing CLAUDE.md.&lt;/strong&gt; No file means it rediscovers your test command every session. A 600-line file means it follows less of it. Aim for short and specific.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treating CLAUDE.md as a guardrail.&lt;/strong&gt; It is guidance. Things that must not happen belong in deny rules or hooks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reaching for bypass mode.&lt;/strong&gt; If the fix for annoying prompts is switching off every safety check, you have picked the wrong fix. Use an allow list or &lt;code&gt;auto&lt;/code&gt; mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using it on the wrong plan.&lt;/strong&gt; If you plan to use it all day, test on a lower tier first, then move up if you hit limits. Check &lt;code&gt;/usage&lt;/code&gt; to see where you stand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips That Make the Daily Loop Faster
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Describe the outcome, not the implementation, then refine.&lt;/li&gt;
&lt;li&gt;Ask it to run the tests and fix what fails, so the loop closes in one prompt.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;claude -c&lt;/code&gt; to pick up where you left off, and &lt;code&gt;/rename&lt;/code&gt; to name sessions you want to find later.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;/diff&lt;/code&gt; before you commit. Seeing the full change at once catches things the individual diffs hid.&lt;/li&gt;
&lt;li&gt;Commit a lean project CLAUDE.md. It is one of the cheapest ways to improve a whole team's sessions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How do I install Claude Code?&lt;/strong&gt; Use the native installer. On macOS, Linux and WSL, run &lt;code&gt;curl -fsSL https://claude.ai/install.sh | bash&lt;/code&gt;. On Windows PowerShell, run &lt;code&gt;irm https://claude.ai/install.ps1 | iex&lt;/code&gt;. You can also use Homebrew (&lt;code&gt;brew install --cask claude-code&lt;/code&gt;), WinGet (&lt;code&gt;winget install Anthropic.ClaudeCode&lt;/code&gt;) or npm (&lt;code&gt;npm install -g @anthropic-ai/claude-code&lt;/code&gt;, Node.js 22 or later). Verify with &lt;code&gt;claude --version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Claude Code free?&lt;/strong&gt; No. The free claude.ai plan does not include it. You need a Pro, Max, Team or Enterprise subscription, a Claude Console account billed at API rates, or access through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. Pro is $20 per month billed monthly or $17 per month billed annually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between Claude Code and Claude in the browser?&lt;/strong&gt; Claude in the browser chats with you about code. Claude Code runs on your machine, reads your repo, edits files and runs commands, with your approval. It also has a web version at claude.ai/code that runs tasks in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does /init do in Claude Code?&lt;/strong&gt; It analyzes your codebase and generates a starting CLAUDE.md with the build commands, test instructions and conventions it finds. If a CLAUDE.md already exists, it suggests improvements instead of overwriting the file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I switch models in Claude Code?&lt;/strong&gt; Type &lt;code&gt;/model sonnet&lt;/code&gt; (or &lt;code&gt;opus&lt;/code&gt;, &lt;code&gt;haiku&lt;/code&gt;, &lt;code&gt;fable&lt;/code&gt;) inside a session, run &lt;code&gt;/model&lt;/code&gt; alone for a picker, or start with &lt;code&gt;claude --model opus&lt;/code&gt;. You can also set a &lt;code&gt;model&lt;/code&gt; key in settings or the &lt;code&gt;ANTHROPIC_MODEL&lt;/code&gt; environment variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I run Claude Code in a script or CI?&lt;/strong&gt; Use print mode: &lt;code&gt;claude -p "your task"&lt;/code&gt;. Add &lt;code&gt;--output-format json&lt;/code&gt; for structured output, &lt;code&gt;--max-turns&lt;/code&gt; to cap the loop, and &lt;code&gt;--allowedTools&lt;/code&gt; to pre-approve the tools the job needs. Use &lt;code&gt;claude setup-token&lt;/code&gt; to generate a long-lived token for CI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I stop Claude Code from asking permission for everything?&lt;/strong&gt; Add allow rules for the safe commands you run all the time, such as &lt;code&gt;Bash(npm test)&lt;/code&gt;, under &lt;code&gt;permissions.allow&lt;/code&gt; in a settings file, or switch to &lt;code&gt;acceptEdits&lt;/code&gt; mode for edit-heavy work. Try &lt;code&gt;auto&lt;/code&gt; mode before &lt;code&gt;bypassPermissions&lt;/code&gt;. Details are in my &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;permissions guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Claude Code better than Cursor?&lt;/strong&gt; It depends on the work. Claude Code is stronger on large multi-file tasks and autonomous runs, and Cursor is better for editor-first work. The full breakdown is in my &lt;a href="https://dev.to/blog/claude-code-vs-cursor-vs-github-copilot-2026/"&gt;Claude Code vs Cursor vs GitHub Copilot comparison&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Sources: code.claude.com/docs (overview, quickstart, advanced setup, CLI reference, commands, memory, permission modes, model configuration) and claude.com/pricing, all checked October 23, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>developertools</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Claude Code Hooks: Every Event, the Config Format and Five Working Examples</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:17:19 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-code-hooks-every-event-the-config-format-and-five-working-examples-ef8</link>
      <guid>https://dev.to/alexcloudstar/claude-code-hooks-every-event-the-config-format-and-five-working-examples-ef8</guid>
      <description>&lt;h1&gt;
  
  
  Claude Code Hooks: Every Event, the Config Format and Five Working Examples
&lt;/h1&gt;

&lt;p&gt;A line in &lt;code&gt;CLAUDE.md&lt;/code&gt; that says "always run the formatter after editing" works most of the time. Most of the time is the problem. The model reads the instruction, weighs it against everything else in the context, and sometimes decides this edit is too small to bother.&lt;/p&gt;

&lt;p&gt;Hooks fix that by taking the decision away from the model. This post covers what Claude Code hooks are, every event the docs list, how to configure them, how exit codes and JSON output control Claude, and five examples you can paste into a settings file. I checked the details against the official hooks reference and hooks guide on October 23, 2026. Hooks change often, so treat the docs as the source of truth if anything here has drifted.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Claude Code Hooks?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Claude Code hooks are user-defined handlers that Claude Code runs automatically at specific points in its lifecycle, such as before a tool call, after a file edit, or when Claude finishes responding. Most hooks are shell commands. Because the harness runs them, not the model, they fire every time, which makes them deterministic.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That last part is the whole point. A skill or a &lt;code&gt;CLAUDE.md&lt;/code&gt; rule is a suggestion the model may follow. A hook is code that runs whether the model remembers it or not. If you want a rule enforced, you write a hook. If you want a rule suggested, you write a skill.&lt;/p&gt;

&lt;p&gt;If you are still sorting out how hooks sit next to skills, plugins and MCP servers, my &lt;a href="https://dev.to/blog/claude-code-plugin-marketplace-skills-2026/"&gt;plugin and skills marketplace guide&lt;/a&gt; has the short version, and this post is the long one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Hook Events and When They Fire
&lt;/h2&gt;

&lt;p&gt;The hooks reference lists 33 events. Each one is a key you put inside the &lt;code&gt;hooks&lt;/code&gt; object in a settings file. These are the events as the docs list them, in the order they appear there.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;When it fires&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SessionStart&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A session begins or resumes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Setup&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Started with &lt;code&gt;--init-only&lt;/code&gt;, or with &lt;code&gt;--init&lt;/code&gt; or &lt;code&gt;--maintenance&lt;/code&gt; in &lt;code&gt;-p&lt;/code&gt; mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;UserPromptSubmit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A prompt is submitted, before Claude processes it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;UserPromptExpansion&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A command you typed expands into a prompt, before it reaches Claude&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PreToolUse&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before a tool call runs. Can block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PermissionRequest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A tool call needs a permission decision&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PermissionDenied&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto mode denies a tool call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PostToolUse&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After a tool call succeeds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PostToolUseFailure&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After a tool call fails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PostToolBatch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After a full batch of parallel tool calls resolves, before the next model call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Notification&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Claude Code sends a notification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MessageDisplay&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;While assistant message text is displayed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SubagentStart&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A subagent is spawned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SubagentStop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A subagent finishes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TaskCreated&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A task is being created with &lt;code&gt;TaskCreate&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TaskCompleted&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A task is being marked completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Stop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Claude finishes responding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;StopFailure&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The turn ends because of an API error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TeammateIdle&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;An agent team teammate is about to go idle&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;InstructionsLoaded&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A &lt;code&gt;CLAUDE.md&lt;/code&gt; or &lt;code&gt;.claude/rules/*.md&lt;/code&gt; file is loaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ConfigChange&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A configuration file changes during a session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CwdChanged&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The working directory changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DirectoryAdded&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A working directory is added mid-session with &lt;code&gt;/add-dir&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FileChanged&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A watched file changes on disk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WorktreeCreate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A worktree is being created&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WorktreeRemove&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A worktree created by a &lt;code&gt;WorktreeCreate&lt;/code&gt; hook is removed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PreCompact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before context compaction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PostCompact&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After context compaction completes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PreModelSwitch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Before a requested model switch is applied. Can block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PostModelSwitch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After the session's model changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Elicitation&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;An MCP server requests user input during a tool call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ElicitationResult&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;After a user responds to an MCP elicitation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SessionEnd&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A session terminates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most people need &lt;code&gt;PreToolUse&lt;/code&gt;, &lt;code&gt;PostToolUse&lt;/code&gt;, &lt;code&gt;Stop&lt;/code&gt;, &lt;code&gt;SessionStart&lt;/code&gt; and &lt;code&gt;Notification&lt;/code&gt;. The rest cover narrower jobs like auditing config changes or reacting to compaction.&lt;/p&gt;

&lt;p&gt;A few details from the docs that save you debugging time. &lt;code&gt;PreToolUse&lt;/code&gt; and &lt;code&gt;PostToolUse&lt;/code&gt; fire on every tool call in the agentic loop. &lt;code&gt;Stop&lt;/code&gt; fires whenever Claude finishes responding, not only when the task is truly done, and it does not fire on user interrupts. And a &lt;code&gt;PostToolUse&lt;/code&gt; hook cannot undo anything, because the tool has already run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Claude Code Hooks Are Configured
&lt;/h2&gt;

&lt;p&gt;Hooks live in JSON. You can put them in several places, and the entries merge across levels instead of replacing each other.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Shareable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;~/.claude/settings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All your projects&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.claude/settings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Single project&lt;/td&gt;
&lt;td&gt;Yes, committed to the repo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.claude/settings.local.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Single project&lt;/td&gt;
&lt;td&gt;No, gitignored&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Managed policy settings&lt;/td&gt;
&lt;td&gt;Organization-wide&lt;/td&gt;
&lt;td&gt;Yes, admin-controlled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plugin &lt;code&gt;hooks/hooks.json&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;While the plugin is enabled&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skill frontmatter&lt;/td&gt;
&lt;td&gt;The rest of the session once the skill is invoked&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subagent frontmatter&lt;/td&gt;
&lt;td&gt;While that subagent runs&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I put personal conveniences like notifications in &lt;code&gt;~/.claude/settings.json&lt;/code&gt;, and team rules like a formatter in the committed &lt;code&gt;.claude/settings.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can browse what is active by typing &lt;code&gt;/hooks&lt;/code&gt; at the Claude Code prompt. It opens a read-only browser of your configured hooks. If a new hook does not appear after a few seconds, restart the session.&lt;/p&gt;

&lt;h3&gt;
  
  
  The JSON shape
&lt;/h3&gt;

&lt;p&gt;Three levels: an event, a matcher group, and one or more handlers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${CLAUDE_PROJECT_DIR}/.claude/hooks/check-bash.sh"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your settings file already has a &lt;code&gt;hooks&lt;/code&gt; key, add the new event as a sibling of the existing ones. Each event name is a key inside the single &lt;code&gt;hooks&lt;/code&gt; object. Overwriting the whole object is the most common way to delete a hook you forgot you had.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hook types
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;type&lt;/code&gt; field decides what the handler does.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;command&lt;/code&gt; runs a shell command and passes the event JSON on stdin.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http&lt;/code&gt; POSTs the event JSON to a URL.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mcp_tool&lt;/code&gt; calls a tool on a configured MCP server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prompt&lt;/code&gt; sends your prompt and the event data to a Claude model for a single-turn yes or no decision.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent&lt;/code&gt; spawns a subagent that can use tools to verify a condition. The docs mark this one experimental.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shared fields include &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;timeout&lt;/code&gt;, &lt;code&gt;statusMessage&lt;/code&gt; and &lt;code&gt;once&lt;/code&gt;. Command hooks add &lt;code&gt;args&lt;/code&gt; (exec form, no shell), &lt;code&gt;async&lt;/code&gt;, &lt;code&gt;shell&lt;/code&gt; and &lt;code&gt;onFailure&lt;/code&gt;. Timeouts default to 600 seconds for &lt;code&gt;command&lt;/code&gt;, &lt;code&gt;http&lt;/code&gt; and &lt;code&gt;mcp_tool&lt;/code&gt;, 30 for &lt;code&gt;prompt&lt;/code&gt; and 60 for &lt;code&gt;agent&lt;/code&gt;, so set &lt;code&gt;timeout&lt;/code&gt; on anything slow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Matchers: Choosing Which Calls a Hook Sees
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;matcher&lt;/code&gt; field filters when a group fires. How it is evaluated depends on what it contains.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Matcher value&lt;/th&gt;
&lt;th&gt;Evaluated as&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;"*"&lt;/code&gt;, &lt;code&gt;""&lt;/code&gt;, or omitted&lt;/td&gt;
&lt;td&gt;Match everything&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Only letters, digits, &lt;code&gt;_&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;, spaces, commas and pipes&lt;/td&gt;
&lt;td&gt;Exact string, or a list separated by pipes or commas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Any other character&lt;/td&gt;
&lt;td&gt;JavaScript regular expression, unanchored&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What the matcher is compared against depends on the event. For &lt;code&gt;PreToolUse&lt;/code&gt;, &lt;code&gt;PostToolUse&lt;/code&gt;, &lt;code&gt;PostToolUseFailure&lt;/code&gt;, &lt;code&gt;PermissionRequest&lt;/code&gt; and &lt;code&gt;PermissionDenied&lt;/code&gt;, it is the tool name, like &lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;Edit&lt;/code&gt; or &lt;code&gt;mcp__memory__.*&lt;/code&gt;. MCP tools are named &lt;code&gt;mcp__&amp;lt;server&amp;gt;__&amp;lt;tool&amp;gt;&lt;/code&gt;, and matching every tool from one server needs the &lt;code&gt;.*&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;SessionStart&lt;/code&gt; it is how the session started: &lt;code&gt;startup&lt;/code&gt;, &lt;code&gt;resume&lt;/code&gt;, &lt;code&gt;clear&lt;/code&gt;, &lt;code&gt;compact&lt;/code&gt; or &lt;code&gt;fork&lt;/code&gt;. For &lt;code&gt;Notification&lt;/code&gt; it is the notification type, such as &lt;code&gt;permission_prompt&lt;/code&gt; or &lt;code&gt;idle_prompt&lt;/code&gt;. &lt;code&gt;UserPromptSubmit&lt;/code&gt;, &lt;code&gt;Stop&lt;/code&gt; and several others take no matcher and always fire.&lt;/p&gt;

&lt;p&gt;On tool events there is also an &lt;code&gt;if&lt;/code&gt; field that uses permission-rule syntax, like &lt;code&gt;"Bash(git *)"&lt;/code&gt; or &lt;code&gt;"Edit(*.ts)"&lt;/code&gt;. It holds one rule and no boolean operators. The docs call it best-effort and say to use the permission system when you need a hard allow or deny.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exit Codes: How a Hook Blocks Claude
&lt;/h2&gt;

&lt;p&gt;A command hook talks to Claude Code through its exit code, stdout and stderr.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exit 0&lt;/strong&gt; means success. If stdout is a single JSON object, Claude Code reads its fields. Plain stdout is added to Claude's context only for &lt;code&gt;UserPromptSubmit&lt;/code&gt;, &lt;code&gt;UserPromptExpansion&lt;/code&gt;, &lt;code&gt;SessionStart&lt;/code&gt; and &lt;code&gt;PostModelSwitch&lt;/code&gt;. Claude never sees stderr on exit 0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit 2&lt;/strong&gt; is a blocking error. On events that can block, the action stops and stderr becomes the reason. Exit 2 wins even if JSON on stdout says "allow".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Any other code&lt;/strong&gt; is a non-blocking error. The action proceeds, and the first line of stderr shows in the notice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which events can actually be blocked matters. By the docs, exit 2 blocks on &lt;code&gt;PreToolUse&lt;/code&gt;, &lt;code&gt;UserPromptSubmit&lt;/code&gt;, &lt;code&gt;UserPromptExpansion&lt;/code&gt;, &lt;code&gt;Stop&lt;/code&gt;, &lt;code&gt;SubagentStop&lt;/code&gt;, &lt;code&gt;TeammateIdle&lt;/code&gt;, &lt;code&gt;TaskCreated&lt;/code&gt;, &lt;code&gt;TaskCompleted&lt;/code&gt;, &lt;code&gt;ConfigChange&lt;/code&gt; (except policy settings), &lt;code&gt;PostToolBatch&lt;/code&gt;, &lt;code&gt;PreCompact&lt;/code&gt;, &lt;code&gt;PreModelSwitch&lt;/code&gt;, &lt;code&gt;Elicitation&lt;/code&gt;, &lt;code&gt;ElicitationResult&lt;/code&gt;, &lt;code&gt;WorktreeCreate&lt;/code&gt; and &lt;code&gt;WorktreeRemove&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It cannot block &lt;code&gt;PostToolUse&lt;/code&gt;, &lt;code&gt;PostToolUseFailure&lt;/code&gt;, &lt;code&gt;PermissionRequest&lt;/code&gt; (use a decision instead), &lt;code&gt;Notification&lt;/code&gt;, &lt;code&gt;SessionStart&lt;/code&gt;, &lt;code&gt;SubagentStart&lt;/code&gt;, &lt;code&gt;SessionEnd&lt;/code&gt;, &lt;code&gt;PostCompact&lt;/code&gt; and the other observational events. On those, exit 2 shows stderr to you and execution continues.&lt;/p&gt;

&lt;p&gt;One gotcha from the guide: exit 0 from a &lt;code&gt;PreToolUse&lt;/code&gt; hook does not approve the call. The tool call still goes through the normal permission flow.&lt;/p&gt;

&lt;h3&gt;
  
  
  JSON output for finer control
&lt;/h3&gt;

&lt;p&gt;Exit codes are blunt. If you need more, exit 0 and print one JSON object to stdout. Print only the JSON. Anything else on stdout, like output from a shell profile, breaks parsing. The docs say to pick one approach per hook: exit 2 with stderr, or exit 0 with JSON.&lt;/p&gt;

&lt;p&gt;Universal fields are &lt;code&gt;continue&lt;/code&gt; (set &lt;code&gt;false&lt;/code&gt; to stop Claude entirely), &lt;code&gt;stopReason&lt;/code&gt;, &lt;code&gt;systemMessage&lt;/code&gt;, &lt;code&gt;suppressOutput&lt;/code&gt; and &lt;code&gt;terminalSequence&lt;/code&gt;. Event-specific decisions go in different places. &lt;code&gt;PreToolUse&lt;/code&gt; uses &lt;code&gt;hookSpecificOutput&lt;/code&gt; with &lt;code&gt;permissionDecision&lt;/code&gt; set to &lt;code&gt;allow&lt;/code&gt;, &lt;code&gt;deny&lt;/code&gt;, &lt;code&gt;ask&lt;/code&gt; or &lt;code&gt;defer&lt;/code&gt;, plus &lt;code&gt;permissionDecisionReason&lt;/code&gt;. &lt;code&gt;PostToolUse&lt;/code&gt; and &lt;code&gt;Stop&lt;/code&gt; use a top-level &lt;code&gt;decision: "block"&lt;/code&gt; with a &lt;code&gt;reason&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hookSpecificOutput"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hookEventName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"permissionDecision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deny"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"permissionDecisionReason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Database writes are not allowed"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A field at the wrong level is a common reason a hook silently does nothing: &lt;code&gt;permissionDecision&lt;/code&gt; belongs inside &lt;code&gt;hookSpecificOutput&lt;/code&gt;, not at the top.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a hook receives and which variables it can use
&lt;/h3&gt;

&lt;p&gt;Command hooks get JSON on stdin. Common fields include &lt;code&gt;session_id&lt;/code&gt;, &lt;code&gt;transcript_path&lt;/code&gt;, &lt;code&gt;cwd&lt;/code&gt;, &lt;code&gt;permission_mode&lt;/code&gt; and &lt;code&gt;hook_event_name&lt;/code&gt;. Tool events add &lt;code&gt;tool_name&lt;/code&gt;, &lt;code&gt;tool_input&lt;/code&gt; and &lt;code&gt;tool_use_id&lt;/code&gt;, which is how a script finds the file path or command Claude is about to use. &lt;code&gt;SessionStart&lt;/code&gt; hooks also get a &lt;code&gt;source&lt;/code&gt;, and &lt;code&gt;UserPromptSubmit&lt;/code&gt; hooks get the &lt;code&gt;prompt&lt;/code&gt; text.&lt;/p&gt;

&lt;p&gt;Environment variables the docs list for hooks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE_PROJECT_DIR&lt;/code&gt;: the project root where the session started&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE_PLUGIN_ROOT&lt;/code&gt; and &lt;code&gt;CLAUDE_PLUGIN_DATA&lt;/code&gt;: a plugin's install and data directories&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE_PLUGIN_OPTION_&amp;lt;KEY&amp;gt;&lt;/code&gt;: a plugin's user-config values&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE_ENV_FILE&lt;/code&gt;: a file a &lt;code&gt;SessionStart&lt;/code&gt; or &lt;code&gt;CwdChanged&lt;/code&gt; hook can write environment variables into, which Claude Code runs as a preamble before each Bash command&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use &lt;code&gt;${CLAUDE_PROJECT_DIR}&lt;/code&gt; in script paths so they work from any directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five Claude Code Hook Examples
&lt;/h2&gt;

&lt;p&gt;These are examples, adapted from the official hooks guide. Test each in a throwaway project before you commit it to a repo your team uses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Get a desktop notification when Claude needs input
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;Notification&lt;/code&gt; event fires when Claude is waiting for input or permission. This is the guide's macOS version. Put it in &lt;code&gt;~/.claude/settings.json&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Notification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"osascript -e 'display notification &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Claude Code needs your attention&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; with title &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Claude Code&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;'"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The empty matcher fires on every notification type. To narrow it, set the matcher to a type like &lt;code&gt;permission_prompt&lt;/code&gt; or &lt;code&gt;idle_prompt&lt;/code&gt;. The guide gives &lt;code&gt;notify-send&lt;/code&gt; for Linux and a PowerShell variant for Windows. On macOS, if nothing appears, &lt;code&gt;osascript&lt;/code&gt; routes through Script Editor, and the docs say to enable notifications for Script Editor in System Settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Format every file Claude edits
&lt;/h3&gt;

&lt;p&gt;This &lt;code&gt;PostToolUse&lt;/code&gt; hook runs Prettier on the file Claude just wrote. It goes in &lt;code&gt;.claude/settings.json&lt;/code&gt; in the project root.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PostToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edit|Write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"jq -r '.tool_input.file_path' | xargs npx prettier --write"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;jq&lt;/code&gt; pulls the path out of the stdin JSON and Prettier does the rest. It needs &lt;code&gt;jq&lt;/code&gt; installed. One limit the guide calls out: Claude can also change files through shell commands, which an &lt;code&gt;Edit|Write&lt;/code&gt; matcher never sees. If your hook must see every change, add a &lt;code&gt;Stop&lt;/code&gt; hook that checks the working tree once per turn.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 3: Block dangerous Bash commands
&lt;/h3&gt;

&lt;p&gt;This &lt;code&gt;PreToolUse&lt;/code&gt; hook exits 2 when a command matches a pattern you never want Claude to run. The guide's own script blocks edits to protected files with the same mechanism. I adapted it to read &lt;code&gt;tool_input.command&lt;/code&gt; for the &lt;code&gt;Bash&lt;/code&gt; tool.&lt;/p&gt;

&lt;p&gt;Save this as &lt;code&gt;.claude/hooks/block-dangerous.sh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# block-dangerous.sh (example adapted from the hooks guide's protect-files.sh)&lt;/span&gt;

&lt;span class="nv"&gt;INPUT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;COMMAND&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$INPUT&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'.tool_input.command // empty'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;BLOCKED_PATTERNS&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="s2"&gt;"rm -rf"&lt;/span&gt; &lt;span class="s2"&gt;"git push --force"&lt;/span&gt; &lt;span class="s2"&gt;"DROP TABLE"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;pattern &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BLOCKED_PATTERNS&lt;/span&gt;&lt;span class="p"&gt;[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$COMMAND&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$pattern&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Blocked: command matches '&lt;/span&gt;&lt;span class="nv"&gt;$pattern&lt;/span&gt;&lt;span class="s2"&gt;'. Ask the user before running it."&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
    &lt;span class="nb"&gt;exit &lt;/span&gt;2
  &lt;span class="k"&gt;fi
done

&lt;/span&gt;&lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it executable with &lt;code&gt;chmod +x .claude/hooks/block-dangerous.sh&lt;/code&gt;, then register it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;$CLAUDE_PROJECT_DIR&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;/.claude/hooks/block-dangerous.sh"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code blocks the call before it runs and passes your stderr message to Claude, so it can pick another approach. Substring matching is crude. A command like &lt;code&gt;rm  -rf&lt;/code&gt; with two spaces slips past it. Treat this as a tripwire for honest mistakes, not as a security boundary, and read the next section before you rely on it.&lt;/p&gt;

&lt;p&gt;The docs add one useful fact: a &lt;code&gt;PreToolUse&lt;/code&gt; hook that returns a &lt;code&gt;deny&lt;/code&gt; blocks the tool even in &lt;code&gt;bypassPermissions&lt;/code&gt; mode or with &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;. That is why hooks pair well with the permission setup in my &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;least-privilege guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 4: Inject context at SessionStart
&lt;/h3&gt;

&lt;p&gt;Compaction summarizes a long conversation and can lose details. A &lt;code&gt;SessionStart&lt;/code&gt; hook with the &lt;code&gt;compact&lt;/code&gt; matcher puts critical context back. This is the guide's version, in &lt;code&gt;.claude/settings.json&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"SessionStart"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"compact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo 'Reminder: use Bun, not npm. Run bun test before committing. Current sprint: auth refactor.'"&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plain text a &lt;code&gt;SessionStart&lt;/code&gt; command writes to stdout goes into Claude's context. Swap the &lt;code&gt;echo&lt;/code&gt; for something dynamic, like &lt;code&gt;git log --oneline -5&lt;/code&gt;. The docs point out that if you want the same context on every session start, &lt;code&gt;CLAUDE.md&lt;/code&gt; is the better home. Use the hook when the context is dynamic or only needed at a specific moment. Change the matcher to &lt;code&gt;startup&lt;/code&gt; to inject on a fresh session instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 5: Run tests before Claude stops
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;Stop&lt;/code&gt; hook can refuse to let Claude finish. This one runs the test suite and, if it fails, exits 2 with the failure output so Claude keeps working. It is an example I built from two pieces of the docs: the exit-2 behavior for &lt;code&gt;Stop&lt;/code&gt;, and the guide's &lt;code&gt;stop_hook_active&lt;/code&gt; check.&lt;/p&gt;

&lt;p&gt;Save this as &lt;code&gt;.claude/hooks/tests-on-stop.sh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# tests-on-stop.sh (example)&lt;/span&gt;

&lt;span class="nv"&gt;INPUT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Stop hooks can re-trigger themselves. Bail out if we already blocked once.&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$INPUT&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'.stop_hook_active'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CLAUDE_PROJECT_DIR&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;exit &lt;/span&gt;0

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;OUTPUT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;bun &lt;span class="nb"&gt;test &lt;/span&gt;2&amp;gt;&amp;amp;1&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Tests are failing. Fix them before finishing:"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$OUTPUT&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 30 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
  &lt;span class="nb"&gt;exit &lt;/span&gt;2
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swap &lt;code&gt;bun test&lt;/code&gt; for your own test command. Then register it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Stop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;$CLAUDE_PROJECT_DIR&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;/.claude/hooks/tests-on-stop.sh"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;stop_hook_active&lt;/code&gt; guard matters. The docs say Claude Code overrides a &lt;code&gt;Stop&lt;/code&gt; hook after it blocks eight times in a row with no tool call in between, and the cap can be raised with &lt;code&gt;CLAUDE_CODE_STOP_HOOK_BLOCK_CAP&lt;/code&gt;. Because &lt;code&gt;Stop&lt;/code&gt; fires after every response, a slow test suite will run more often than you expect. For a lighter touch, the guide shows a &lt;code&gt;prompt&lt;/code&gt; hook on &lt;code&gt;Stop&lt;/code&gt; that asks a model whether all requested tasks are done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security: Hooks Run With Your Permissions
&lt;/h2&gt;

&lt;p&gt;A command hook is a shell command that runs as your user, with your environment and access to your files. There is no sandbox around it unless you build one. That has a few consequences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read every hook you did not write.&lt;/strong&gt; A hook in a shared &lt;code&gt;.claude/settings.json&lt;/code&gt; or a plugin's &lt;code&gt;hooks/hooks.json&lt;/code&gt; runs on your machine once you trust the project or enable the plugin. Cloning a repo and accepting its settings means running its commands. The docs say project hooks in settings files and frontmatter are subject to workspace trust, and frontmatter hooks in project subagents run only after you accept the trust dialog. Treat that dialog the way you treat running an install script.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quote your variables.&lt;/strong&gt; The hook input contains file paths and commands the model chose. A path with a space or shell metacharacter in it will break an unquoted script or, worse, run something you did not intend. The docs recommend exec form with &lt;code&gt;args&lt;/code&gt; for paths, and they note shell form needs careful quoting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not mistake &lt;code&gt;if&lt;/code&gt; or substring matching for enforcement.&lt;/strong&gt; The &lt;code&gt;if&lt;/code&gt; field is best-effort by the docs' own words. For hard rules, use permission rules and managed settings, and use hooks as one more layer.&lt;/p&gt;

&lt;p&gt;For teams, managed settings add controls. &lt;code&gt;allowManagedHooksOnly&lt;/code&gt; blocks user, project, local and plugin hooks, and &lt;code&gt;allowedHttpHookUrls&lt;/code&gt; limits which URLs HTTP hooks can reach. I would also read the plugin security page in the docs before enabling any third-party marketplace, since plugin hooks run with the same authority as the ones you write yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hooks vs Skills vs Permissions vs CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;These four get confused because they all "tell Claude what to do". They differ in who enforces the rule.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Hooks&lt;/th&gt;
&lt;th&gt;Skills&lt;/th&gt;
&lt;th&gt;Permissions&lt;/th&gt;
&lt;th&gt;CLAUDE.md&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;What it is&lt;/td&gt;
&lt;td&gt;Handlers that run at lifecycle events&lt;/td&gt;
&lt;td&gt;Folders with a &lt;code&gt;SKILL.md&lt;/code&gt; of instructions&lt;/td&gt;
&lt;td&gt;Allow, ask and deny rules for tool calls&lt;/td&gt;
&lt;td&gt;A markdown file of standing instructions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who enforces it&lt;/td&gt;
&lt;td&gt;The harness, every time&lt;/td&gt;
&lt;td&gt;The model, when the description matches&lt;/td&gt;
&lt;td&gt;The harness&lt;/td&gt;
&lt;td&gt;The model, as context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can it block an action&lt;/td&gt;
&lt;td&gt;Yes, on events that can block&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runs code&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Only through tools Claude already has&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Formatting, guards, notifications, checks&lt;/td&gt;
&lt;td&gt;Teaching a repeatable workflow&lt;/td&gt;
&lt;td&gt;Limiting what Claude may touch&lt;/td&gt;
&lt;td&gt;Project conventions and commands&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The practical split: use &lt;code&gt;CLAUDE.md&lt;/code&gt; for conventions, skills for workflows, permissions for the allowed surface, and hooks for anything that must happen or must not happen regardless of the model. If I find myself writing "always" or "never" in a &lt;code&gt;CLAUDE.md&lt;/code&gt; rule and it keeps getting ignored, that rule probably wants to be a hook. I wrote about building skills in the &lt;a href="https://dev.to/blog/writing-claude-code-skill-developer-guide-2026/"&gt;skill developer guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;Notification&lt;/code&gt; hook is a cousin of the &lt;a href="https://dev.to/blog/claude-code-status-line-guide-2026/"&gt;status line&lt;/a&gt;, which shows state continuously instead of alerting you once. And &lt;code&gt;SubagentStart&lt;/code&gt; and &lt;code&gt;SubagentStop&lt;/code&gt; let you hook into delegated work, which is covered in the &lt;a href="https://dev.to/blog/claude-code-subagents-guide-2026/"&gt;subagents guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If a hook does nothing, run &lt;code&gt;/hooks&lt;/code&gt; to confirm it is listed, validate the JSON (no trailing commas), check the script is executable, and make sure nothing else prints to stdout before your JSON. Pipe sample JSON into a script to test it outside a session, for example &lt;code&gt;echo '{"tool_input":{"command":"rm -rf /tmp/x"}}' | .claude/hooks/block-dangerous.sh&lt;/code&gt;, then check &lt;code&gt;echo $?&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What are Claude Code hooks?&lt;/strong&gt; They are user-defined handlers that Claude Code runs at specific lifecycle events, such as before a tool call, after an edit, or when Claude finishes responding. Most are shell commands, and because the harness runs them, they fire every time instead of depending on the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where do I put Claude Code hooks?&lt;/strong&gt; In a settings file: &lt;code&gt;~/.claude/settings.json&lt;/code&gt; for all projects, &lt;code&gt;.claude/settings.json&lt;/code&gt; for one project (committed), or &lt;code&gt;.claude/settings.local.json&lt;/code&gt; for one project (gitignored). Plugins can ship them in &lt;code&gt;hooks/hooks.json&lt;/code&gt;, and skills and subagents can define them in frontmatter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I block a tool call with a hook?&lt;/strong&gt; Use a &lt;code&gt;PreToolUse&lt;/code&gt; hook. Exit with code 2 and write the reason to stderr, or exit 0 and print JSON with &lt;code&gt;permissionDecision&lt;/code&gt; set to &lt;code&gt;deny&lt;/code&gt; inside &lt;code&gt;hookSpecificOutput&lt;/code&gt;. Either way, Claude Code stops the call before it runs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a hook run when Claude finishes a task?&lt;/strong&gt; Yes, with the &lt;code&gt;Stop&lt;/code&gt; event. It fires whenever Claude finishes responding, not only at task completion, so check &lt;code&gt;stop_hook_active&lt;/code&gt; in the input to avoid loops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do hooks work with --dangerously-skip-permissions?&lt;/strong&gt; A &lt;code&gt;PreToolUse&lt;/code&gt; hook that denies a call still blocks it in &lt;code&gt;bypassPermissions&lt;/code&gt; mode or with that flag, according to the hooks guide. That makes hooks useful for policy people cannot switch off by changing permission mode.&lt;/p&gt;

&lt;p&gt;Sources: &lt;a href="https://code.claude.com/docs/en/hooks" rel="noopener noreferrer"&gt;Claude Code hooks reference&lt;/a&gt; and &lt;a href="https://code.claude.com/docs/en/hooks-guide" rel="noopener noreferrer"&gt;Automate actions with hooks (hooks guide)&lt;/a&gt;, checked October 23, 2026.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>devtools</category>
      <category>automation</category>
    </item>
    <item>
      <title>Claude --dangerously-skip-permissions: What It Does and How to Set Up Permissions Safely</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:16:45 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/claude-dangerously-skip-permissions-what-it-does-and-how-to-set-up-permissions-safely-5egp</link>
      <guid>https://dev.to/alexcloudstar/claude-dangerously-skip-permissions-what-it-does-and-how-to-set-up-permissions-safely-5egp</guid>
      <description>&lt;h1&gt;
  
  
  Claude --dangerously-skip-permissions: What It Does and How to Set Up Permissions Safely
&lt;/h1&gt;

&lt;p&gt;The dangerous permission prompt is usually the convenient one.&lt;/p&gt;

&lt;p&gt;Your coding agent asks whether it can run commands without asking again. You are halfway through a bug. You have already approved &lt;code&gt;git status&lt;/code&gt;, &lt;code&gt;bun test&lt;/code&gt;, and one harmless file read. You click "allow for this session" because confirming every command is annoying, and ten minutes later the agent has enough authority to install a package, read an environment file, send a request anywhere on the internet, and push a branch if you forgot what was in your shell.&lt;/p&gt;

&lt;p&gt;Nothing bad may happen. That does not make it a good security model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;claude --dangerously-skip-permissions&lt;/code&gt; starts Claude Code in &lt;code&gt;bypassPermissions&lt;/code&gt; mode. Permission prompts and safety checks are switched off, so every tool call runs immediately, including writes to protected paths like &lt;code&gt;.git&lt;/code&gt; and &lt;code&gt;.claude&lt;/code&gt;. Deny rules still apply. Anthropic's docs say to use it only inside isolated containers or VMs.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An agent is not just a text editor with opinions. Once it can act, its effective permission is the combination of every tool you gave it. Read access to the repo plus a shell plus your credentials plus network access is not four small permissions. It may be enough authority to inspect, modify, and send out everything the current user can reach.&lt;/p&gt;

&lt;p&gt;The goal is not to make agents useless. The goal is to give them the narrowest set of abilities that completes the task in front of them, then widen it deliberately when the task changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What --dangerously-skip-permissions actually does
&lt;/h2&gt;

&lt;p&gt;The flag is the same thing as &lt;code&gt;claude --permission-mode bypassPermissions&lt;/code&gt;. Here is what the docs say about the details, checked on October 22, 2026:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Allow rules stop mattering.&lt;/strong&gt; Everything is allowed already. Deny rules still block, which is the useful part for the setup later in this post.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A few things still prompt.&lt;/strong&gt; Tools matched by an explicit &lt;code&gt;ask&lt;/code&gt; rule, &lt;code&gt;AskUserQuestion&lt;/code&gt;, MCP tools that require user interaction, and recognized &lt;code&gt;rm&lt;/code&gt; and &lt;code&gt;rmdir&lt;/code&gt; removals of critical paths.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protected paths are writable.&lt;/strong&gt; In every other mode, writes to &lt;code&gt;.git&lt;/code&gt;, &lt;code&gt;.claude&lt;/code&gt;, &lt;code&gt;.bashrc&lt;/code&gt; and &lt;code&gt;.mcp.json&lt;/code&gt; are prompted, routed to a classifier, or denied. Here they just happen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan mode is not enforced.&lt;/strong&gt; In an interactive terminal session with bypass available, Claude is still told to plan without editing, but an edit or shell command it attempts during planning runs without a prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt injection gets no extra protection.&lt;/strong&gt; The docs say the mode offers no protection against prompt injection or unintended actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You get one warning.&lt;/strong&gt; The first interactive session shows a dialog asking you to accept responsibility. Accepting sets &lt;code&gt;skipDangerousModePermissionPrompt&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; in &lt;code&gt;~/.claude/settings.json&lt;/code&gt;. Declining exits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root is refused.&lt;/strong&gt; On Linux and macOS, Claude Code will not start in this mode as root or under sudo, unless it detects a recognized sandbox. The error reads &lt;code&gt;--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The name is accurate. It is not a faster approval button. It removes the only checkpoint between a confused model and your shell, which is why the rest of this post is about narrowing what that shell can reach.&lt;/p&gt;

&lt;h3&gt;
  
  
  The permission modes, briefly
&lt;/h3&gt;

&lt;p&gt;Claude Code has six permission modes. You set one at startup with &lt;code&gt;claude --permission-mode &amp;lt;mode&amp;gt;&lt;/code&gt;, as a default with &lt;code&gt;permissions.defaultMode&lt;/code&gt; in a settings file, or cycle through some of them with &lt;code&gt;Shift+Tab&lt;/code&gt; in the terminal.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;What runs without a prompt&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;default&lt;/code&gt; (Manual)&lt;/td&gt;
&lt;td&gt;Reads only&lt;/td&gt;
&lt;td&gt;Reviewing every action yourself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;acceptEdits&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads, file edits and common filesystem commands such as &lt;code&gt;mkdir&lt;/code&gt;, &lt;code&gt;touch&lt;/code&gt;, &lt;code&gt;mv&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Iterating on code you are reviewing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;plan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads&lt;/td&gt;
&lt;td&gt;Exploring a codebase before changing it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;auto&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Everything, with background safety checks&lt;/td&gt;
&lt;td&gt;Long tasks without prompt fatigue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dontAsk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads in working directories and pre-approved tools. Anything that would prompt is denied&lt;/td&gt;
&lt;td&gt;Locked-down CI and scripts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bypassPermissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Everything&lt;/td&gt;
&lt;td&gt;Isolated containers and VMs only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If your problem is prompt fatigue rather than a throwaway environment, look at &lt;code&gt;auto&lt;/code&gt; before you reach for the dangerous flag. The docs recommend it when you want far fewer prompts with background safety checks still running. It shows up in the &lt;code&gt;Shift+Tab&lt;/code&gt; cycle only when it is available for your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  When It's Safe: Containers, Worktrees and Throwaway VMs
&lt;/h2&gt;

&lt;p&gt;The docs name the safe place directly: containers, VMs, or dev containers, ideally without internet access, where Claude Code cannot damage your host. I would put it like this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Safe enough:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A container or dev container with only the project mounted.&lt;/strong&gt; No home directory, no SSH keys, no cloud credentials, and ideally restricted network. This is the setup the docs use in their own example for unattended runs: &lt;code&gt;claude -p "&amp;lt;prompt&amp;gt;" --dangerously-skip-permissions&lt;/code&gt; inside a container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A throwaway VM&lt;/strong&gt; you can delete afterwards, with a scoped token for the one thing it needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI runners&lt;/strong&gt; that start clean and hold nothing but the checkout and a scoped credential. See &lt;a href="https://dev.to/blog/sandboxing-ai-generated-code-execution-2026/"&gt;sandboxing AI-generated code execution&lt;/a&gt; for the isolation options.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Not safe on its own:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A git worktree.&lt;/strong&gt; Worktrees are great for running parallel Claude Code sessions (&lt;code&gt;claude --worktree feature-auth&lt;/code&gt; creates one under &lt;code&gt;.claude/worktrees/&lt;/code&gt;, and my &lt;a href="https://dev.to/blog/git-worktree-guide-2026/"&gt;git worktree guide&lt;/a&gt; covers the commands). But they isolate file edits and branches, nothing else. The worktree docs are explicit that checks cover edits and git commands, and that a command like &lt;code&gt;cp&lt;/code&gt; or a shell redirect is treated like any other shell command under your permissions and sandbox settings. A worktree still runs as you, with your network, your SSH agent and your environment variables. Use worktrees to keep sessions from colliding, not as a security boundary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your daily laptop.&lt;/strong&gt; Anything reachable by your user is reachable by the agent: &lt;code&gt;~/.ssh&lt;/code&gt;, &lt;code&gt;~/.aws&lt;/code&gt;, browser profiles, every repo you have checked out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A machine where you are logged in to production tooling.&lt;/strong&gt; One injected instruction plus a logged-in CLI is enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want a middle ground on your own machine, Claude Code has a built-in OS-level sandbox for shell commands (turn it on with &lt;code&gt;/sandbox&lt;/code&gt; or &lt;code&gt;sandbox.enabled&lt;/code&gt;). It restricts which files and network domains those commands can reach, on macOS, Linux and WSL2. It covers shell commands only: Claude's file tools, MCP servers and hooks run outside it. That is a real improvement over nothing, and it is not the same as putting the whole process in a container.&lt;/p&gt;

&lt;p&gt;The Level 7 rule from the ladder below still applies inside a container: do not put production credentials in there just because the box is disposable. A disposable environment protects your host, not the services your credentials reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Permission Question Nobody Asks
&lt;/h2&gt;

&lt;p&gt;Before enabling an agent, ask one question in a very literal way:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What could it read, change, execute, or send if it made the worst plausible decision while following an untrusted instruction?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That last clause matters. An agent that browses an issue, a webpage, a dependency README, or a support ticket may encounter text that tries to redirect it. It does not need to be a malicious hacker note. A misleading install command or a stale docs page can do enough damage when the agent has broad permissions.&lt;/p&gt;

&lt;p&gt;The model cannot reliably infer a safe authorization boundary from the task alone. Research into coding-agent permission boundaries has found the same uncomfortable pattern: models can omit a permission required by a task while also granting unrelated sensitive permissions. More reasoning does not make that tradeoff disappear. Authorization needs to come from policy and tooling, not the agent's confidence.&lt;/p&gt;

&lt;p&gt;That is just least privilege, applied to a new kind of collaborator.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Access Ladder: Least-Privilege Access for Coding Agents
&lt;/h2&gt;

&lt;p&gt;I think about agent access in seven levels. Start at the lowest level that makes the task possible. Move up only when the next level has a clear, named reason.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 1: Read the working tree
&lt;/h3&gt;

&lt;p&gt;The agent can inspect the project files, configuration, and relevant logs. It cannot change anything.&lt;/p&gt;

&lt;p&gt;This is enough for code review, explaining a system, making a plan, diagnosing a failing build, and locating the likely source of a bug. It is the right default when somebody asks, "What is wrong?" rather than, "Fix it."&lt;/p&gt;

&lt;p&gt;The trap at this level is scope. Reading the repository is not the same thing as reading your whole home directory. A project folder often contains more than code: local exports, test fixtures, screenshots, customer samples, and accidentally committed secrets. Mount only the directory the task needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 2: Edit the working tree
&lt;/h3&gt;

&lt;p&gt;The agent can create and change files inside the project, but it cannot run arbitrary commands.&lt;/p&gt;

&lt;p&gt;This is suitable for a content change, a small refactor, a documentation update, or a component you will review manually. It is more powerful than it sounds. File writing can modify configuration, CI workflows, scripts, and code that runs later, so treat it as a real change permission rather than a harmless drafting permission.&lt;/p&gt;

&lt;p&gt;Keep package manifests and CI configuration in the review scope even if the task seems unrelated. Dependency changes are code changes with a delayed execution path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 3: Run a constrained local command set
&lt;/h3&gt;

&lt;p&gt;The agent can run the checks that prove its change works: type checking, unit tests, a formatter, a local build, or a narrowly scoped development server.&lt;/p&gt;

&lt;p&gt;This is where I draw the first hard boundary. &lt;code&gt;bun run build&lt;/code&gt; and &lt;code&gt;bun test&lt;/code&gt; are not the same category as an unrestricted terminal. Know which package manager the repository uses. Know what the scripts run. Do not assume a test command is harmless because it has the word test in it. A project script can execute migrations, call a remote service, rewrite snapshots, or do anything else a shell command can do.&lt;/p&gt;

&lt;p&gt;Use an allowlist for predictable commands. Let the agent propose everything else. This creates a little friction, and the friction is doing work for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 4: Local browser and localhost
&lt;/h3&gt;

&lt;p&gt;The agent can open the application it is running, inspect the rendered UI, and test a local flow. It cannot log into external services or browse arbitrary sites.&lt;/p&gt;

&lt;p&gt;Visual verification belongs here. A code change that looks right in a diff can be broken in the browser. This level is still local: the agent can test &lt;code&gt;localhost&lt;/code&gt;, capture the error, and go back to the source without carrying your authenticated browser profile along with it.&lt;/p&gt;

&lt;p&gt;Keep the distinction between local browser access and your daily browser profile. The second one includes every active session you have forgotten about. Your inbox, GitHub, banking tab, billing dashboard, and customer admin panel are not test fixtures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 5: Narrow outbound network access
&lt;/h3&gt;

&lt;p&gt;The agent can reach a listed domain for a concrete reason. Maybe it needs official framework docs, a package registry, or a staging API endpoint.&lt;/p&gt;

&lt;p&gt;The right setting is not "internet access". It is an allowlist of domains, methods, and where possible paths. An agent changing a React component does not need the ability to post to Slack, download a binary from an arbitrary release page, or call every service reachable from your laptop.&lt;/p&gt;

&lt;p&gt;This is also where you should make a decision about package installation. Dependency installation is remote code execution from a supply chain you did not author. It may be warranted, but it deserves its own approval, a pinned version, and a look at whether a small local utility solves the problem instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 6: Source control and third-party tools
&lt;/h3&gt;

&lt;p&gt;The agent can create a branch, commit code, open a pull request, read an issue tracker, or call an MCP server.&lt;/p&gt;

&lt;p&gt;Give read and write access separately. Reading a GitHub issue does not require pushing to &lt;code&gt;main&lt;/code&gt;. Reading a calendar does not require creating an event. Searching a CRM does not require exporting every contact.&lt;/p&gt;

&lt;p&gt;This is where tool design becomes access control. In &lt;a href="https://dev.to/blog/ai-agent-tool-design-2026/"&gt;my guide to agent tool design&lt;/a&gt;, I argued that tool schemas need to state what they do and when not to use them. Permissions need the same clarity. A tool called &lt;code&gt;manage_repository&lt;/code&gt; is a permission accident waiting to happen. &lt;code&gt;create_pull_request_from_current_branch&lt;/code&gt; is a much narrower promise.&lt;/p&gt;

&lt;p&gt;If a tool offers a write action, make the write target visible before it runs. The model should not be the only place where the difference between reading a record and deleting it exists.&lt;/p&gt;

&lt;h3&gt;
  
  
  Level 7: Deployments, customer data, and production
&lt;/h3&gt;

&lt;p&gt;The agent can affect real users or access secrets.&lt;/p&gt;

&lt;p&gt;This is not a normal default. It should be an exceptional, task-specific permission with a human confirmation at the final boundary. A staging deployment is not production. A read-only production query is not a write. A token that may access one test project is not a token that can access every customer account.&lt;/p&gt;

&lt;p&gt;The word "production" hides too much. Break it down into deploy, read logs, read metrics, read data, write data, rotate credentials, and change infrastructure. An agent may need exactly one of those. Giving it the bundle because a dashboard offers one API key is a design failure, not a necessity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Secrets Are Not Agent Input
&lt;/h2&gt;

&lt;p&gt;The cleanest rule I have found is this: agents need access to a capability, not the secret that represents it.&lt;/p&gt;

&lt;p&gt;Do not paste API keys into prompts. Do not let the agent print environment files to prove it found the configuration. Do not attach a production &lt;code&gt;.env&lt;/code&gt; to a context window. Once a secret becomes model input, you have widened the exposure from a process boundary to every system that handles the conversation.&lt;/p&gt;

&lt;p&gt;Use short-lived, scoped credentials injected into the execution environment. Prefer a service identity that can call one staging endpoint over your own personal token. Rotate the credentials when the task finishes if they were minted for it. Log the action, but never log the secret.&lt;/p&gt;

&lt;p&gt;This is less dramatic than it sounds. Most of the time it means creating a narrower token once instead of reusing the convenient admin token forever.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Permission Set Should Expire
&lt;/h2&gt;

&lt;p&gt;Long-lived approval is where convenience turns into permission creep.&lt;/p&gt;

&lt;p&gt;The task that needed package registry access last Tuesday does not prove the next task needs it. The temporary database credential that made a migration review easier does not belong in a reusable configuration. Agents are unusually good at turning a small convenience into a repeated action because they follow the environment we leave behind.&lt;/p&gt;

&lt;p&gt;Make permission state part of the cleanup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;remove temporary tokens&lt;/li&gt;
&lt;li&gt;stop local servers&lt;/li&gt;
&lt;li&gt;revoke network exceptions&lt;/li&gt;
&lt;li&gt;remove copied fixtures containing customer data&lt;/li&gt;
&lt;li&gt;review changed workflow files and package manifests&lt;/li&gt;
&lt;li&gt;record what the agent was allowed to do when it mattered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point helps incident response and ordinary debugging. When a surprising change lands, you want to know whether the agent could have made it, not reconstruct the answer from a vague chat transcript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code Permissions: A Recommended settings.json
&lt;/h2&gt;

&lt;p&gt;Here is a starting point I would use for ordinary application work, not a copy of any one machine's config. It follows the ladder: reads and local checks are allowed, installs and pushes need a decision, secrets and network downloads are blocked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"allow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(bun run test *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(bun run typecheck)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(bun run lint *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(git status)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(git diff *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(git log *)"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ask"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(bun add *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(bun install *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(git commit *)"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deny"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Read(./.env)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Read(./.env.*)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Read(./secrets/**)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(git push *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(rm -rf *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(curl *)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(wget *)"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save it as &lt;code&gt;.claude/settings.json&lt;/code&gt; in the project to share it with the team, or in &lt;code&gt;~/.claude/settings.json&lt;/code&gt; for your own defaults. Swap &lt;code&gt;bun&lt;/code&gt; for your package manager and adjust the script names to match your &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A few things to know before you rely on it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Order matters.&lt;/strong&gt; Rules are evaluated deny first, then ask, then allow, and the first match wins. A broad deny can't be carved out by a narrower allow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deny survives bypass mode.&lt;/strong&gt; Even with &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;, deny rules still block. If you must run in bypass mode inside a container, a deny list like this is your remaining safety net.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;*&lt;/code&gt; placement matters.&lt;/strong&gt; Put it after the subcommand. &lt;code&gt;Bash(git log *)&lt;/code&gt; allows &lt;code&gt;git log&lt;/code&gt; commands only, while &lt;code&gt;Bash(git *)&lt;/code&gt; allows every git command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bash patterns are not a hard boundary.&lt;/strong&gt; The docs warn that Bash rules that constrain arguments are fragile, and that a deny on &lt;code&gt;curl&lt;/code&gt; does not match &lt;code&gt;/usr/bin/curl&lt;/code&gt; or &lt;code&gt;sh -c 'curl ...'&lt;/code&gt;. For network restrictions that must hold, pair deny rules with the sandbox network allowlist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read deny rules cover Claude's file tools and recognized file commands&lt;/strong&gt; like &lt;code&gt;cat&lt;/code&gt; and &lt;code&gt;head&lt;/code&gt;. They do not stop a script that opens the file itself. A &lt;code&gt;.env&lt;/code&gt; you really need protected should not be on the machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There is no &lt;code&gt;.claudeignore&lt;/code&gt;.&lt;/strong&gt; Per the docs, it has no effect. Use &lt;code&gt;Read&lt;/code&gt; deny rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precedence is deny-wins across scopes.&lt;/strong&gt; If user settings allow something and project settings deny it, it is denied. Managed settings sit on top of everything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For other agents, the same ideas apply even though the syntax differs: allowlist the checks, make installs and pushes explicit, and keep secrets out of reach. &lt;a href="https://dev.to/blog/securing-ai-agents-production-2026/"&gt;Securing AI agents in production&lt;/a&gt; goes deeper on the production side.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Default Setup I Would Use Today
&lt;/h2&gt;

&lt;p&gt;For ordinary application work, I would start an agent with project-only file access, edit permission, a small allowlist of local checks, and localhost browser access. No external browser profile. No arbitrary network. No deployment. No production data. No Git write access until the change has passed review.&lt;/p&gt;

&lt;p&gt;Then I would grant more only in response to a need I can name. "It needs to read the official Next.js documentation" is a reason. "It might be useful" is not.&lt;/p&gt;

&lt;p&gt;That setup does not prevent every bad outcome. Nothing does. It reduces blast radius, makes approvals meaningful, and keeps one confused instruction from becoming a company-wide event.&lt;/p&gt;

&lt;p&gt;An agent that must ask before doing something consequential is not less autonomous in the way that matters. It is working inside a boundary you understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is --dangerously-skip-permissions safe?&lt;/strong&gt; Not on a normal development machine. It turns off permission prompts and safety checks, and the docs say it gives no protection against prompt injection. It is reasonably safe inside a container or throwaway VM that holds only the project and a scoped credential, with deny rules still in place. Anything the agent can reach from there, it can use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I turn off --dangerously-skip-permissions?&lt;/strong&gt; Exit the session and start Claude Code again without the flag, or with &lt;code&gt;claude --permission-mode default&lt;/code&gt;. If you made it the default, remove &lt;code&gt;"defaultMode": "bypassPermissions"&lt;/code&gt; from your user settings. To see the warning dialog again, remove &lt;code&gt;skipDangerousModePermissionPrompt&lt;/code&gt; from &lt;code&gt;~/.claude/settings.json&lt;/code&gt;. Administrators can block the mode for everyone with &lt;code&gt;"permissions": { "disableBypassPermissionsMode": "disable" }&lt;/code&gt; in managed settings, and &lt;code&gt;claude --restricted&lt;/code&gt; refuses it (v2.1.248 or later).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between --dangerously-skip-permissions and auto mode?&lt;/strong&gt; Both reduce prompts. Bypass mode removes the checks entirely. Auto mode runs background safety checks on actions and only prompts when needed. Anthropic's docs point to auto mode when you want fewer prompts without giving up the checks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do deny rules still work with --dangerously-skip-permissions?&lt;/strong&gt; Yes. The docs say deny rules still block in bypass mode and allow rules have no effect. Tools matched by an explicit ask rule still prompt too. That is why a deny list for secrets and pushes is worth keeping even in a container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does Claude refuse --dangerously-skip-permissions as root?&lt;/strong&gt; On Linux and macOS, Claude Code refuses to start in this mode as root or under sudo, because root makes a mistake far more destructive. The check is skipped inside a recognized sandbox. The docs recommend their dev container, which runs as a non-root user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should a coding agent have access to my &lt;code&gt;.env&lt;/code&gt; file?&lt;/strong&gt; Usually no. Give it the required capability through a scoped, temporary environment instead. Secrets should not be copied into prompts, logs, or model context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is it safe to enable unrestricted terminal commands for a coding agent?&lt;/strong&gt; Only in an isolated environment with no sensitive files, credentials, or broad network access. In a normal development machine, allow predictable checks and require approval for the rest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I let an agent deploy to production?&lt;/strong&gt; Only for a tightly defined deployment path with a final human confirmation, scoped credentials, and clear rollback. Deployment access should not imply access to production data or infrastructure administration.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>developertools</category>
      <category>agents</category>
    </item>
    <item>
      <title>Git Worktree Guide: Parallel Branches and Claude Code</title>
      <dc:creator>Alex Cloudstar</dc:creator>
      <pubDate>Thu, 22 Oct 2026 22:16:44 +0000</pubDate>
      <link>https://dev.to/alexcloudstar/git-worktree-guide-parallel-branches-and-claude-code-1bn3</link>
      <guid>https://dev.to/alexcloudstar/git-worktree-guide-parallel-branches-and-claude-code-1bn3</guid>
      <description>&lt;p&gt;Switching branches in the middle of a task is annoying. You stash, you checkout, you fix the thing, you checkout back, you pop the stash and hope. Git worktrees remove that whole loop, and since AI coding agents arrived they have become the standard way to run several of them at once without collisions.&lt;/p&gt;

&lt;p&gt;I touched on worktrees in my post on &lt;a href="https://dev.to/blog/git-beyond-the-basics-tricks-that-actually-save-my-day/"&gt;git tricks that save my day&lt;/a&gt;. This is the full version.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a git worktree?
&lt;/h2&gt;

&lt;p&gt;A git worktree is an extra working directory linked to the same repository. Each worktree has its own checked-out branch, files and index, but they all share one &lt;code&gt;.git&lt;/code&gt; history, so commits, branches and remotes are visible everywhere. You can work on two branches at the same time, in two folders, with no stashing.&lt;/p&gt;

&lt;p&gt;The main checkout you cloned is the main worktree. Every extra one is a linked worktree. The official manual describes the linked worktree as sharing the repository with the main one, except for per-worktree files such as &lt;code&gt;HEAD&lt;/code&gt; and &lt;code&gt;index&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you use git worktree? Commands reference
&lt;/h2&gt;

&lt;p&gt;This is the synopsis from the &lt;a href="https://git-scm.com/docs/git-worktree" rel="noopener noreferrer"&gt;git-worktree manual&lt;/a&gt;, trimmed to what you use day to day.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree add &amp;lt;path&amp;gt; [&amp;lt;commit-ish&amp;gt;]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create a linked worktree at the path and check out the commit-ish&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree list&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show the main worktree first, then each linked one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree remove &amp;lt;worktree&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete a linked worktree directory and its admin data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree prune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clear admin data for worktrees whose directories are gone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree move &amp;lt;worktree&amp;gt; &amp;lt;new-path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Move a linked worktree to a new location&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree lock &amp;lt;worktree&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Protect a worktree from pruning, moving or deleting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree unlock &amp;lt;worktree&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Undo a lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git worktree repair&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fix links that broke after you moved a directory by hand&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  git worktree add
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree add ../project-hotfix hotfix/login-bug
git worktree add &lt;span class="nt"&gt;-b&lt;/span&gt; feature-x ../project-feature-x main
git worktree add &lt;span class="nt"&gt;-d&lt;/span&gt; ../scratch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line checks out an existing branch in a new folder. The second creates a new branch &lt;code&gt;feature-x&lt;/code&gt; from &lt;code&gt;main&lt;/code&gt;. The third creates a worktree with a detached &lt;code&gt;HEAD&lt;/code&gt;, which is handy for throwaway experiments.&lt;/p&gt;

&lt;p&gt;Useful &lt;code&gt;add&lt;/code&gt; options from the manual:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Effect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-b &amp;lt;new-branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create a branch. Refuses if it already exists.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-B &amp;lt;new-branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create the branch, or reset it to the commit-ish if it exists&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;-d&lt;/code&gt;, &lt;code&gt;--detach&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Detached &lt;code&gt;HEAD&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--orphan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Empty worktree and index on a new unborn branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--lock&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lock the worktree at creation (add &lt;code&gt;--reason&lt;/code&gt; for a note)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--no-checkout&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Skip checkout, for example to set up sparse-checkout first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--track&lt;/code&gt;, &lt;code&gt;--no-track&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Control upstream tracking when creating a branch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you leave out the commit-ish and pass no &lt;code&gt;-b&lt;/code&gt;, &lt;code&gt;-B&lt;/code&gt; or &lt;code&gt;--detach&lt;/code&gt;, git names the new branch after the basename of the path, creating it from &lt;code&gt;HEAD&lt;/code&gt; if it does not exist. There is also remote-branch guessing: if the name matches a remote-tracking branch on exactly one remote, git treats the command as &lt;code&gt;add --track -b&lt;/code&gt; against that remote.&lt;/p&gt;

&lt;h3&gt;
  
  
  git worktree list
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output shows the path, the short commit hash and the branch, with annotations such as &lt;code&gt;locked&lt;/code&gt; and &lt;code&gt;prunable&lt;/code&gt;. Use &lt;code&gt;-v&lt;/code&gt; to see lock reasons. For scripts, use &lt;code&gt;git worktree list --porcelain&lt;/code&gt;, which the manual says has a stable format across git versions (add &lt;code&gt;-z&lt;/code&gt; for NUL-terminated lines if paths could contain newlines).&lt;/p&gt;

&lt;h3&gt;
  
  
  git worktree remove and prune
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree remove ../project-hotfix
git worktree remove &lt;span class="nt"&gt;--force&lt;/span&gt; ../project-hotfix
git worktree prune &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;remove&lt;/code&gt; only works on a clean worktree (no untracked files, no modified tracked files) unless you pass &lt;code&gt;--force&lt;/code&gt;. The main worktree cannot be removed. A locked worktree needs &lt;code&gt;--force&lt;/code&gt; twice.&lt;/p&gt;

&lt;p&gt;If you delete a worktree folder with &lt;code&gt;rm -rf&lt;/code&gt; instead, git keeps its admin data in &lt;code&gt;$GIT_DIR/worktrees&lt;/code&gt;. It cleans that up automatically after &lt;code&gt;gc.worktreePruneExpire&lt;/code&gt;, or right away with &lt;code&gt;git worktree prune&lt;/code&gt;. Use &lt;code&gt;git worktree prune -n&lt;/code&gt; for a dry run and &lt;code&gt;--expire&lt;/code&gt; to only prune entries older than a given time.&lt;/p&gt;

&lt;h3&gt;
  
  
  git worktree move, lock and repair
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree move ../project-hotfix ../hotfix
git worktree lock &lt;span class="nt"&gt;--reason&lt;/span&gt; &lt;span class="s2"&gt;"on external drive"&lt;/span&gt; ../project-hotfix
git worktree repair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lock is for worktrees on storage that is not always mounted, such as a USB drive or network share, so a prune does not wipe their admin data. &lt;code&gt;move&lt;/code&gt; cannot move the main worktree or a linked worktree that contains submodules. If you moved a directory manually, &lt;code&gt;repair&lt;/code&gt; fixes the broken links. Run it inside the moved worktree, or pass the new paths from anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git worktree vs branch vs stash
&lt;/h2&gt;

&lt;p&gt;These three solve related problems and people mix them up. A branch is a pointer to commits. A worktree is a folder where a branch is checked out. A stash is a shelf for uncommitted changes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Branch&lt;/th&gt;
&lt;th&gt;Worktree&lt;/th&gt;
&lt;th&gt;Stash&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;What it is&lt;/td&gt;
&lt;td&gt;A named pointer to a commit&lt;/td&gt;
&lt;td&gt;A separate working directory&lt;/td&gt;
&lt;td&gt;Saved uncommitted changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Needs a checkout&lt;/td&gt;
&lt;td&gt;Yes, one per working directory&lt;/td&gt;
&lt;td&gt;It provides one&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two active at once&lt;/td&gt;
&lt;td&gt;Not in one folder&lt;/td&gt;
&lt;td&gt;Yes, one per folder&lt;/td&gt;
&lt;td&gt;Not applicable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keeps uncommitted work&lt;/td&gt;
&lt;td&gt;No, you carry it or stash it&lt;/td&gt;
&lt;td&gt;Yes, in its own folder&lt;/td&gt;
&lt;td&gt;Yes, until popped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disk cost&lt;/td&gt;
&lt;td&gt;Almost none&lt;/td&gt;
&lt;td&gt;A full set of files&lt;/td&gt;
&lt;td&gt;Almost none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Organizing history&lt;/td&gt;
&lt;td&gt;Parallel tasks, hotfixes, agents&lt;/td&gt;
&lt;td&gt;Quick context switch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So "git worktree vs branch" is not either/or. You still need a branch for every worktree (or a detached &lt;code&gt;HEAD&lt;/code&gt;). The worktree is what lets two branches be checked out at once. Use a stash when you have a ten-second interruption. Use a worktree when the interruption will take a while, or when you want two long-running tasks side by side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git worktree gotchas
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;You cannot check out the same branch twice.&lt;/strong&gt; &lt;code&gt;git worktree add&lt;/code&gt; refuses when the branch is already checked out in another worktree. &lt;code&gt;--force&lt;/code&gt; overrides the safeguard, but I would not: two folders writing to one branch is how you lose commits. Make a new branch instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependencies are not shared.&lt;/strong&gt; A worktree is a fresh checkout. &lt;code&gt;node_modules&lt;/code&gt;, build output and virtualenvs are untracked, so they are not there. Run your install command in each worktree.&lt;br&gt;
&lt;strong&gt;Untracked config is not copied.&lt;/strong&gt; Your &lt;code&gt;.env&lt;/code&gt; and &lt;code&gt;.env.local&lt;/code&gt; are gitignored, so they do not appear in the new worktree. Copy them over, or script it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ports and databases collide.&lt;/strong&gt; Two dev servers on port 3000 will fight. Give each worktree its own port and, if you use a local database, its own database name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Submodules are rough.&lt;/strong&gt; The manual says multiple checkout is still experimental, submodule support is incomplete, and it does not recommend making multiple checkouts of a superproject. &lt;code&gt;remove&lt;/code&gt; needs &lt;code&gt;--force&lt;/code&gt; for worktrees with submodules, and &lt;code&gt;move&lt;/code&gt; does not work on them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared and per-worktree state.&lt;/strong&gt; Branches and tags (&lt;code&gt;refs/heads/*&lt;/code&gt;, &lt;code&gt;refs/tags/*&lt;/code&gt;) are shared. &lt;code&gt;HEAD&lt;/code&gt; and the index are per worktree. So are &lt;code&gt;refs/bisect/*&lt;/code&gt;, which means you can bisect in one worktree without disturbing another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Config is shared by default.&lt;/strong&gt; The repo &lt;code&gt;config&lt;/code&gt; file applies to all worktrees. If you need per-worktree settings, such as &lt;code&gt;core.sparseCheckout&lt;/code&gt;, enable &lt;code&gt;extensions.worktreeConfig&lt;/code&gt; and use &lt;code&gt;git config --worktree&lt;/code&gt;. Older git versions refuse to open repositories that use that extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not delete the folder by hand.&lt;/strong&gt; Use &lt;code&gt;git worktree remove&lt;/code&gt;. If you did delete it, run &lt;code&gt;git worktree prune&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Does Claude Code have a worktree feature?
&lt;/h2&gt;

&lt;p&gt;Yes. Claude Code has a built-in &lt;code&gt;--worktree&lt;/code&gt; flag (short form &lt;code&gt;-w&lt;/code&gt;). According to the &lt;a href="https://code.claude.com/docs/en/worktrees" rel="noopener noreferrer"&gt;Claude Code worktree docs&lt;/a&gt;, it creates an isolated worktree and starts the session in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; feature-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Defaults from the docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The worktree is created under &lt;code&gt;.claude/worktrees/&amp;lt;name&amp;gt;/&lt;/code&gt; at the repo root, on a new branch named &lt;code&gt;worktree-&amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you omit the name, Claude generates one (the docs give &lt;code&gt;bright-running-fox&lt;/code&gt; as an example).&lt;/li&gt;
&lt;li&gt;New worktrees branch from the repository's default branch on the remote (&lt;code&gt;worktree.baseRef&lt;/code&gt; is &lt;code&gt;"fresh"&lt;/code&gt; by default). Set &lt;code&gt;worktree.baseRef&lt;/code&gt; to &lt;code&gt;"head"&lt;/code&gt; in settings to branch from your current local &lt;code&gt;HEAD&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;The repository needs at least one commit first.&lt;/li&gt;
&lt;li&gt;The docs suggest adding &lt;code&gt;.claude/worktrees/&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also ask Claude mid-session to "work in a worktree" and it uses its &lt;code&gt;EnterWorktree&lt;/code&gt; tool. You can pass a pull request to &lt;code&gt;--worktree&lt;/code&gt; (for example &lt;code&gt;claude --worktree "#1234"&lt;/code&gt;) and it fetches that PR's head into &lt;code&gt;.claude/worktrees/pr-&amp;lt;number&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two details solve gotchas from the previous section. A &lt;code&gt;.worktreeinclude&lt;/code&gt; file at the project root, in &lt;code&gt;.gitignore&lt;/code&gt; syntax, lists gitignored files (like &lt;code&gt;.env&lt;/code&gt;) that Claude copies into each new worktree it creates. Dependencies are still on you: the docs tell you to install them in the new worktree, or ask Claude to.&lt;/p&gt;

&lt;p&gt;On exit, Claude checks the worktree. A clean unnamed session removes the worktree and branch automatically. If there is work in it, Claude asks whether to keep or remove it.&lt;/p&gt;

&lt;p&gt;If you prefer plain git, that works too, and the docs show it: &lt;code&gt;git worktree add ../project-feature-a -b feature-a&lt;/code&gt;, then &lt;code&gt;cd&lt;/code&gt; in and run &lt;code&gt;claude&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you run parallel AI agents with git worktrees?
&lt;/h2&gt;

&lt;p&gt;The pattern is one worktree per agent session, each on its own branch. The agents cannot overwrite each other's files because they are in different folders. You review and merge branches like any other.&lt;/p&gt;

&lt;p&gt;A workflow that works with Claude Code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick tasks that touch different files. Parallel agents on the same file still produce merge conflicts.&lt;/li&gt;
&lt;li&gt;Start a session per task in its own worktree:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; fix-login-bug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;In a second terminal, start another:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--worktree&lt;/span&gt; add-export-csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Let each agent work, run tests and commit on its own branch.&lt;/li&gt;
&lt;li&gt;Review each branch as a normal pull request.&lt;/li&gt;
&lt;li&gt;Remove the worktrees you no longer need with &lt;code&gt;git worktree remove&lt;/code&gt;, or accept Claude's prompt on exit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Claude Code docs also cover subagents running in their own worktrees. Ask Claude to "use worktrees for your agents", or set &lt;code&gt;isolation: worktree&lt;/code&gt; in a custom subagent's frontmatter. Each subagent gets a temporary worktree that is removed automatically if it finishes without changes.&lt;/p&gt;

&lt;p&gt;Worktrees isolate file edits only. They do not isolate your machine. Agents still share ports, databases and anything outside the checkout, and the docs note that a shell command like &lt;code&gt;cp&lt;/code&gt; writing into the main checkout is not blocked by the worktree checks. Treat permissions as a separate problem, which I cover in &lt;a href="https://dev.to/blog/coding-agent-permissions-least-privilege-2026/"&gt;coding agent permissions and least privilege&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the bigger picture on agents that run unattended, see &lt;a href="https://dev.to/blog/background-ai-coding-agents-2026/"&gt;background AI coding agents&lt;/a&gt;. If you run several sessions, a status line that shows the model, context and branch helps you tell them apart. I wrote a &lt;a href="https://dev.to/blog/claude-code-status-line-guide-2026/"&gt;Claude Code status line guide&lt;/a&gt; for that.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you not use a worktree?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The task is a two-minute detour. A stash is faster.&lt;/li&gt;
&lt;li&gt;The repo is huge and a second full checkout is expensive on disk or install time.&lt;/li&gt;
&lt;li&gt;The project uses submodules heavily, given the manual's warnings.&lt;/li&gt;
&lt;li&gt;Your parallel tasks all touch the same files. You will pay the setup cost and still hit conflicts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently Asked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a git worktree?&lt;/strong&gt; A linked working directory attached to the same repository, with its own checked-out branch and index. It lets you have several branches checked out at once in different folders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between git worktree and git branch?&lt;/strong&gt; A branch is a pointer to a commit. A worktree is a folder where a branch is checked out. You need a branch (or detached &lt;code&gt;HEAD&lt;/code&gt;) per worktree, and worktrees let multiple branches be active at the same time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between git worktree and git clone?&lt;/strong&gt; A clone copies the whole repository, history included. A worktree shares the existing repository's history, so it is cheaper, and branches and commits show up in every worktree immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I list git worktrees?&lt;/strong&gt; Run &lt;code&gt;git worktree list&lt;/code&gt;. Add &lt;code&gt;-v&lt;/code&gt; for lock reasons, or &lt;code&gt;--porcelain&lt;/code&gt; for stable machine-readable output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I delete a git worktree?&lt;/strong&gt; Run &lt;code&gt;git worktree remove &amp;lt;path&amp;gt;&lt;/code&gt;. It refuses if there are untracked or modified files unless you add &lt;code&gt;--force&lt;/code&gt;. If you already deleted the folder, run &lt;code&gt;git worktree prune&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I check out the same branch in two worktrees?&lt;/strong&gt; Not by default. Git refuses, and &lt;code&gt;--force&lt;/code&gt; overrides the check. Create a new branch for the second worktree instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Code support git worktrees?&lt;/strong&gt; Yes. Use &lt;code&gt;claude --worktree &amp;lt;name&amp;gt;&lt;/code&gt; (or &lt;code&gt;-w&lt;/code&gt;) to start a session in a new isolated worktree under &lt;code&gt;.claude/worktrees/&lt;/code&gt;. Subagents can also run in their own worktrees with &lt;code&gt;isolation: worktree&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I run multiple Claude Code sessions at once?&lt;/strong&gt; Start each one with &lt;code&gt;claude --worktree&lt;/code&gt; and a different name, in separate terminals. Each gets its own folder and branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are node_modules shared between worktrees?&lt;/strong&gt; No. A worktree is a fresh checkout, so install dependencies in each one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a worktree include my &lt;code&gt;.env&lt;/code&gt; file?&lt;/strong&gt; No, because it is untracked. With Claude Code, list such files in a &lt;code&gt;.worktreeinclude&lt;/code&gt; file and Claude copies them into worktrees it creates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-worktree" rel="noopener noreferrer"&gt;git-worktree manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/worktrees" rel="noopener noreferrer"&gt;Claude Code docs: Run parallel sessions with worktrees&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/common-workflows" rel="noopener noreferrer"&gt;Claude Code docs: Common workflows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>devtools</category>
      <category>productivity</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
