<?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>Forem: Sangmin Lee</title>
    <description>The latest articles on Forem by Sangmin Lee (@claudeguide).</description>
    <link>https://forem.com/claudeguide</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3946361%2F45852601-611d-4e7b-a381-c122ca373b5a.jpg</url>
      <title>Forem: Sangmin Lee</title>
      <link>https://forem.com/claudeguide</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/claudeguide"/>
    <language>en</language>
    <item>
      <title>How to Use Claude Code Subagents for Parallel Research</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sun, 24 May 2026 01:40:33 +0000</pubDate>
      <link>https://forem.com/claudeguide/how-to-use-claude-code-subagents-for-parallel-research-4j9a</link>
      <guid>https://forem.com/claudeguide/how-to-use-claude-code-subagents-for-parallel-research-4j9a</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-subagents-parallel-research?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-subagents-parallel-research" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-subagents-parallel-research&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  How to Use Claude Code Subagents for Parallel Research
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Subagents are the single feature that changes how much work you can get through Claude Code per hour. Used right, a three-subagent fan-out completes cross-codebase research in 90 seconds that a linear pass would spend 7–10 minutes on. Used wrong, you burn tokens and end up with three redundant reports. This is the operating manual. For the broader Claude Code feature set, see the &lt;a href="https://dev.to/claude-code-complete-guide"&gt;Claude Code Complete Guide&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A subagent is a fresh Claude conversation with its own context window, started by your main agent to do a scoped task.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use subagents when&lt;/strong&gt; the work is genuinely independent (multiple files, multiple topics, multiple codebases).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not use subagents when&lt;/strong&gt; the work is sequential (each step needs the previous result).&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Explore subagent&lt;/strong&gt; is the right default for search/read tasks; it has no write tools and returns a summary.&lt;/li&gt;
&lt;li&gt;Spawn up to &lt;strong&gt;3 in parallel&lt;/strong&gt; in a single message; more produces diminishing returns and noisy context.&lt;/li&gt;
&lt;li&gt;The parent does not see the subagent's internal tool calls — only the final summary. Write the prompt so the summary is the thing you need.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What exactly is a subagent
&lt;/h2&gt;

&lt;p&gt;When your main Claude Code session calls the &lt;code&gt;Agent&lt;/code&gt; tool, it spawns a new Claude instance. That instance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Gets its own system prompt (defined by the subagent type — e.g., &lt;code&gt;Explore&lt;/code&gt;, &lt;code&gt;Plan&lt;/code&gt;, &lt;code&gt;general-purpose&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Starts with an empty context window.&lt;/li&gt;
&lt;li&gt;Has its own tool access, possibly narrower than the parent's.&lt;/li&gt;
&lt;li&gt;Runs to completion independently.&lt;/li&gt;
&lt;li&gt;Returns a single message to the parent.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The parent sees the return message and nothing else — not the subagent's intermediate reads, greps, or reasoning. This is a feature. Your parent conversation stays clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three subagent types worth knowing
&lt;/h2&gt;

&lt;p&gt;As of April 2026, Claude Code ships with a handful of built-in subagents plus any project- or user-defined ones. The three you will use 80% of the time:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Explore&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Fast search and read agent. No &lt;code&gt;Edit&lt;/code&gt;, &lt;code&gt;Write&lt;/code&gt;, or other mutation tools. Ideal for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finding where a function or pattern is defined&lt;/li&gt;
&lt;li&gt;Answering "how does X work in this codebase"&lt;/li&gt;
&lt;li&gt;Surveying multiple areas of a codebase in parallel&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Plan&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Software architect agent. Returns a step-by-step implementation plan with critical files and architectural tradeoffs. Use when you need a design pass before coding.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;general-purpose&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Full tool access. Use for multi-step tasks that require both reading and writing. More expensive because it carries the full toolset into its context.&lt;/p&gt;

&lt;p&gt;You can also define &lt;strong&gt;custom subagents&lt;/strong&gt; — a &lt;code&gt;.claude/agents/*.md&lt;/code&gt; file with a description and tool list. I have a &lt;code&gt;design-system-extractor&lt;/code&gt; agent, a &lt;code&gt;code-reviewer&lt;/code&gt; agent, and a &lt;code&gt;security-auditor&lt;/code&gt; agent. Each is narrow enough to do one thing well.&lt;/p&gt;

&lt;h2&gt;
  
  
  When subagents actually help
&lt;/h2&gt;

&lt;p&gt;The rule is: &lt;strong&gt;subagents help when the work is independent and parallelizable&lt;/strong&gt;. Three cases where they pay off handsomely, and three where they don't.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subagents help:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Case A — Cross-codebase survey.&lt;/strong&gt; "How do Stripe, Polar, and Lemonsqueezy each handle webhook signature verification in our codebase?" Three subagents, one per integration, run in parallel. A linear sweep of the same question takes 3-4x longer because each probe blocks the next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case B — Independent file reads.&lt;/strong&gt; "Read these 8 migration files and tell me if any of them drop columns unsafely." Two or three subagents, each handling a subset, run concurrently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case C — Broad-to-narrow research.&lt;/strong&gt; The parent needs a shallow answer across many areas before deciding where to go deep. One subagent per area, all parallel, and the parent integrates the findings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subagents do NOT help:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Case D — Sequential dependency.&lt;/strong&gt; "Refactor the auth module, then update the tests, then update the docs." Each step needs the previous step's output. Subagents here just add overhead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case E — Single-file work.&lt;/strong&gt; Editing one file with one context. The main agent is already scoped correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case F — Tight feedback loops.&lt;/strong&gt; Iterating on a single implementation with the user. Subagents break the loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  The parallel fan-out pattern
&lt;/h2&gt;

&lt;p&gt;The single most useful pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User question: "How does this codebase handle [X] across [A, B, C]?"

Main agent → spawns in parallel:
  - Subagent 1: investigate A
  - Subagent 2: investigate B
  - Subagent 3: investigate C

Main agent → integrates three summaries → delivers unified answer.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get the parallelism, the parent must emit multiple &lt;code&gt;Agent&lt;/code&gt; tool calls &lt;strong&gt;in a single message&lt;/strong&gt;. Emitting them one at a time serializes them. This is the most common user mistake.&lt;/p&gt;

&lt;p&gt;In practice, inside Claude Code, prompt the main agent explicitly:&lt;/p&gt;

&lt;p&gt;40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-subagents-parallel-research" rel="noopener noreferrer"&gt;→ Get Claude Code Power Prompts 300 — $29&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>subagents</category>
    </item>
    <item>
      <title>Claude Code Permissions: Trust Levels, Allow Lists, and Safe Defaults</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sun, 24 May 2026 01:35:20 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-code-permissions-trust-levels-allow-lists-and-safe-defaults-3ek6</link>
      <guid>https://forem.com/claudeguide/claude-code-permissions-trust-levels-allow-lists-and-safe-defaults-3ek6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-permissions?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-permissions" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-permissions&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude Code Permissions: Trust Levels, Allow Lists, and Safe Defaults
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude Code's permission model has 3 levels: Always-allowed (read-only tools, 0 prompts), Prompt-on-first-use (default — Edit/Write/Bash ask once per session), and Skip-permissions (&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; for trusted environments). Configuring this correctly cuts ~80% of routine confirmation prompts while preserving safety for destructive operations.&lt;/strong&gt; Understanding how the permission model works lets you configure it to match your risk tolerance — from "ask me before every file write" to "run fully autonomously."&lt;/p&gt;

&lt;h2&gt;
  
  
  How permissions work
&lt;/h2&gt;

&lt;p&gt;Every tool call Claude Code makes falls into one of three permission buckets:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Always allowed&lt;/strong&gt; — low-risk read operations (Read, Grep, Glob) that never prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Prompt on first use&lt;/strong&gt; (default) — higher-risk operations (Edit, Write, Bash) where Claude asks for your approval the first time in each session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Always denied&lt;/strong&gt; — tools or patterns you've explicitly blocked in settings. Claude cannot call these regardless of context.&lt;/p&gt;

&lt;p&gt;The permission model is configured in your &lt;code&gt;settings.json&lt;/code&gt;. There are two levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User-level&lt;/strong&gt; (&lt;code&gt;~/.claude/settings.json&lt;/code&gt;): applies to all projects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project-level&lt;/strong&gt; (&lt;code&gt;.claude/settings.json&lt;/code&gt;): applies only when running from that directory, overrides user-level for the tools it specifies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a complete reference of every field in &lt;code&gt;settings.json&lt;/code&gt;, see the &lt;a href="https://dev.to/claude-code-settings-json-reference"&gt;Claude Code settings.json reference&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Permission modes
&lt;/h2&gt;

&lt;p&gt;You set the permission mode via the &lt;code&gt;--permission-mode&lt;/code&gt; flag or in settings.&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;Behavior&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;&lt;/td&gt;
&lt;td&gt;Prompt for higher-risk tool uses on first call in session&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;Skip all confirmation prompts — never asks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; (CLI flag)&lt;/td&gt;
&lt;td&gt;Identical to bypassPermissions for one session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;When to use bypass&lt;/strong&gt;: automated scripts, CI/CD pipelines where you've reviewed the task in advance. Never use it when exploring an unfamiliar codebase or running an unknown task.&lt;/p&gt;




&lt;h2&gt;
  
  
  Configuring allowed and disallowed tools
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Allow specific tools only
&lt;/h3&gt;

&lt;p&gt;Restrict Claude to a whitelist of tools. Any tool not in the list is implicitly denied:&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;"allowedTools"&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;"Read"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Grep"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Glob"&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;This creates a read-only Claude Code — it can explore and search but cannot modify files or run commands. Useful for code review and analysis tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Disallow specific tools
&lt;/h3&gt;

&lt;p&gt;Block specific tools while keeping all others available:&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;"disabledTools"&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"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebFetch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebSearch"&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;This keeps file editing but prevents shell execution and web requests. Good for offline-only workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common safe configurations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Read-only mode&lt;/strong&gt; (safe for exploring unfamiliar codebases):&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;"allowedTools"&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;"Read"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Grep"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Glob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Agent"&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;strong&gt;No shell execution&lt;/strong&gt; (file edits only):&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;"disabledTools"&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"&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;strong&gt;No web access&lt;/strong&gt; (air-gapped or policy-restricted environments):&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;"disabledTools"&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;"WebFetch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebSearch"&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;h2&gt;
  
  
  Per-project permissions
&lt;/h2&gt;

&lt;p&gt;For a project with different risk tolerance than your default, use &lt;code&gt;.claude/settings.json&lt;/code&gt; in the project root. This file is typically committed to version control so the entire team shares the same settings. You can layer &lt;a href="https://dev.to/claude-code-hooks"&gt;Claude Code hooks&lt;/a&gt; on top of permissions for even finer control — hooks can block specific commands or run formatters after writes.&lt;/p&gt;

&lt;p&gt;Example: a production infrastructure project where shell execution requires explicit approval:&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="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;"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(kubectl*)"&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(terraform apply*)"&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;This uses pattern-based deny rules: &lt;code&gt;Bash(pattern)&lt;/code&gt; blocks bash commands matching the pattern. Claude cannot run &lt;code&gt;git push&lt;/code&gt;, &lt;code&gt;kubectl&lt;/code&gt; commands, or &lt;code&gt;terraform apply&lt;/code&gt; without triggering an error message.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern-based rules
&lt;/h2&gt;

&lt;p&gt;Pattern rules match against the tool input, not just the tool name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;: &lt;code&gt;ToolName(pattern)&lt;/code&gt; where pattern is a glob-style match against the command input.&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;"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;"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(* --force*)"&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(*/.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;"Write(*secrets*)"&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;This blocks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Any &lt;code&gt;rm -rf&lt;/code&gt; command&lt;/li&gt;
&lt;li&gt;Any command with &lt;code&gt;--force&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Editing any &lt;code&gt;.env&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Writing any file with "secrets" in the path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: the patterns are case-sensitive and match against the full command string for Bash, or the full file path for file-operation tools.&lt;/p&gt;




&lt;h2&gt;
  
  
  The full settings.json reference
&lt;/h2&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(npm 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(npm run build)"&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;"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="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;"allowedTools"&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;"disabledTools"&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="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="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="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;strong&gt;&lt;code&gt;permissions.allow&lt;/code&gt;&lt;/strong&gt;: specific patterns that are always permitted without a prompt, even if they would normally require approval.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;permissions.deny&lt;/code&gt;&lt;/strong&gt;: patterns that are always blocked. Takes precedence over &lt;code&gt;allow&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;allowedTools&lt;/code&gt;&lt;/strong&gt;: if non-empty, only these tools are available. Everything else is blocked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;disabledTools&lt;/code&gt;&lt;/strong&gt;: tools in this list are blocked regardless of other settings.&lt;/p&gt;




&lt;h2&gt;
  
  
  Trust levels explained
&lt;/h2&gt;

&lt;p&gt;When you approve a tool call during a session, Claude Code remembers the approval at different levels:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Response&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yes, allow once&lt;/td&gt;
&lt;td&gt;Approved for this single call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yes, allow for this session&lt;/td&gt;
&lt;td&gt;Approved for all identical calls this session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yes, always allow&lt;/td&gt;
&lt;td&gt;Added to &lt;code&gt;settings.json&lt;/code&gt; permanently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No, deny once&lt;/td&gt;
&lt;td&gt;Blocked for this call; will ask again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No, always deny&lt;/td&gt;
&lt;td&gt;Added to &lt;code&gt;permissions.deny&lt;/code&gt; in settings permanently&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;"Always allow" and "always deny" responses write to your project-level &lt;code&gt;.claude/settings.json&lt;/code&gt; if it exists, or create one. Review these accumulating entries periodically — a "yes always" given hastily can create a permanent permission you didn't intend.&lt;/p&gt;




&lt;h2&gt;
  
  
  Auto mode and autonomous execution
&lt;/h2&gt;

&lt;p&gt;When you invoke &lt;code&gt;/auto&lt;/code&gt; or start a session with a task that requires unattended execution, you can pre-authorize the tools Claude will need rather than accepting all prompts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In settings.json before starting the session:&lt;/strong&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="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"Bash(npm*)"&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 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(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="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;This pre-authorizes npm commands and safe git operations without enabling a full bypass.&lt;/p&gt;




&lt;h2&gt;
  
  
  What each tool can do (risk reference)
&lt;/h2&gt;

&lt;p&gt;Understanding what each tool is capable of helps you set the right defaults.&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;What it does&lt;/th&gt;
&lt;th&gt;Default behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Read&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read file contents&lt;/td&gt;
&lt;td&gt;Always allowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Glob&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Find files by pattern&lt;/td&gt;
&lt;td&gt;Always allowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search file contents&lt;/td&gt;
&lt;td&gt;Always allowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Edit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Replace text in existing files&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Write&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create or overwrite files&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Bash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Execute shell commands&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WebFetch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetch a URL&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WebSearch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search the web&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Agent&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Spawn a subagent&lt;/td&gt;
&lt;td&gt;Prompt on first use&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Bash is the highest-risk tool&lt;/strong&gt; — it has the same access to your system as you do. A Bash command can delete files, push code, modify databases, and make network requests. Pattern-based deny rules on Bash are the most important safety measure.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common permission mistakes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Setting &lt;code&gt;bypassPermissions&lt;/code&gt; permanently in &lt;code&gt;~/.claude/settings.json&lt;/code&gt;&lt;/strong&gt;: this turns off all safety prompts for every project. Only set this for specific automated workflows, not as a global default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forgetting to commit &lt;code&gt;.claude/settings.json&lt;/code&gt;&lt;/strong&gt;: your project team shares your safety rules only if you commit the file. Add it to version control with the rest of your project config.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Too-broad allow rules&lt;/strong&gt;: &lt;code&gt;Bash(*)&lt;/code&gt; in allow means every bash command is approved without prompting — equivalent to full bypass. Be specific: &lt;code&gt;Bash(npm test)&lt;/code&gt; not &lt;code&gt;Bash(*)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not reviewing accumulated &lt;code&gt;always allow&lt;/code&gt; entries&lt;/strong&gt;: over time, quickly-granted "always allow" approvals accumulate in settings.json. Review and trim them quarterly. A well-crafted &lt;a href="https://dev.to/claude-md-effective-patterns"&gt;CLAUDE.md&lt;/a&gt; reduces how often you need to grant "always allow" in the first place by giving Claude clear instructions upfront.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Code need root/sudo access?&lt;/strong&gt;&lt;br&gt;
No. Claude Code runs as the current user. If it attempts a command requiring sudo, it will be blocked by the OS, not by the permission system. Never run Claude Code as root.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Claude Code access files outside my working directory?&lt;/strong&gt;&lt;br&gt;
Yes — Claude Code's Read and Bash tools can access any path the current user can access. Use &lt;code&gt;.gitignore&lt;/code&gt;-style patterns in hooks to block reads of sensitive paths if needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I share settings between team members?&lt;/strong&gt;&lt;br&gt;
Yes — commit &lt;code&gt;.claude/settings.json&lt;/code&gt; to your repository. All team members who use Claude Code in that project will use the same settings. User-level &lt;code&gt;~/.claude/settings.json&lt;/code&gt; is personal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens when Claude tries a denied action?&lt;/strong&gt;&lt;br&gt;
The tool call is blocked and Claude receives an error message explaining what was denied. Claude will typically acknowledge the restriction and ask you how to proceed differently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is there an audit log of what Claude did?&lt;/strong&gt;&lt;br&gt;
Not built-in, but the Hooks system (see &lt;a href="https://dev.to/claude-code-hooks"&gt;Claude Code Hooks guide&lt;/a&gt;) lets you log every tool call to a file with a &lt;code&gt;PreToolUse&lt;/code&gt; hook on &lt;code&gt;"*"&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.anthropic.com/claude-code/settings" rel="noopener noreferrer"&gt;Claude Code permissions documentation&lt;/a&gt; — April 2026&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.anthropic.com/claude-code/security" rel="noopener noreferrer"&gt;Claude Code security guide&lt;/a&gt; — April 2026&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h3&gt;
  
  
  How do I make Claude Code read-only so it can't modify files?
&lt;/h3&gt;

&lt;p&gt;Set &lt;code&gt;allowedTools&lt;/code&gt; to &lt;code&gt;["Read", "Grep", "Glob"]&lt;/code&gt; in your &lt;code&gt;.claude/settings.json&lt;/code&gt;. This restricts Claude to search and read operations only — it cannot edit, write, or run shell commands. Useful for code review tasks or exploring an unfamiliar codebase safely.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between &lt;code&gt;allowedTools&lt;/code&gt; and &lt;code&gt;permissions.allow&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;allowedTools&lt;/code&gt; is a whitelist of tool names — only listed tools are available at all. &lt;code&gt;permissions.allow&lt;/code&gt; contains specific patterns (like &lt;code&gt;Bash(npm test)&lt;/code&gt;) that are pre-approved without a prompt, while all other uses of those tools still require confirmation. Use &lt;code&gt;allowedTools&lt;/code&gt; for hard restrictions; use &lt;code&gt;permissions.allow&lt;/code&gt; for pre-authorizing specific safe commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I block Claude Code from running &lt;code&gt;git push&lt;/code&gt; or &lt;code&gt;kubectl&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;Add pattern-based deny rules under &lt;code&gt;permissions.deny&lt;/code&gt; in &lt;code&gt;.claude/settings.json&lt;/code&gt;: &lt;code&gt;"Bash(git push*)"&lt;/code&gt; and &lt;code&gt;"Bash(kubectl*)"&lt;/code&gt;. These patterns block any Bash command matching the glob, and Claude receives an error message explaining the restriction. Commit this file to version control so the rules apply to your whole team.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I permanently allow a tool action without re-approving every session?
&lt;/h3&gt;

&lt;p&gt;Yes. When Claude Code prompts for approval, choose "Yes, always allow" — this writes the pattern to your &lt;code&gt;settings.json&lt;/code&gt; under &lt;code&gt;permissions.allow&lt;/code&gt;. On subsequent sessions the action runs without prompting. Review accumulated entries periodically; hasty "always allow" grants can create broader permissions than intended.&lt;/p&gt;




&lt;h2&gt;
  
  
  Take It Further
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-permissions" rel="noopener noreferrer"&gt;Claude Code Power Prompts 300&lt;/a&gt;&lt;/strong&gt; — 300 battle-tested prompts for Claude Code, organized by use case. Copy, paste, ship.&lt;/p&gt;

&lt;p&gt;40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-permissions" rel="noopener noreferrer"&gt;→ Get Claude Code Power Prompts 300 — $29&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>permissions</category>
      <category>security</category>
      <category>configuration</category>
    </item>
    <item>
      <title>Claude Code Hooks: Automate and Control Every Tool Call</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sun, 24 May 2026 01:35:17 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-code-hooks-automate-and-control-every-tool-call-343c</link>
      <guid>https://forem.com/claudeguide/claude-code-hooks-automate-and-control-every-tool-call-343c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-hooks?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-hooks" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-hooks&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude Code Hooks: Automate and Control Every Tool Call
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude Code hooks are shell commands that execute automatically before or after tool calls. They give you programmatic control over what Claude Code does — logging every file it touches, blocking certain edits, running formatters after writes, or sending Slack notifications on commit in 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This guide covers every hook type, how to configure them, and 12 production examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  What hooks are
&lt;/h2&gt;

&lt;p&gt;Every time Claude Code calls a tool (Read, Edit, Write, Bash, etc.), two hook points fire:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PreToolUse&lt;/strong&gt;: before the tool executes — can block the call by exiting non-zero&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostToolUse&lt;/strong&gt;: after the tool executes — receives the result, can trigger side effects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hooks are configured in your Claude Code settings (&lt;code&gt;~/.claude/settings.json&lt;/code&gt; for user-level, or &lt;code&gt;.claude/settings.json&lt;/code&gt; for project-level). Project-level settings override user-level for the hooks they define. For a full reference of all settings fields, see the &lt;a href="https://dev.to/claude-code-settings-json-reference"&gt;Claude Code settings.json reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hook configuration format
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "echo \"Running bash: $CLAUDE_TOOL_INPUT\" 

40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.

[→ Get Claude Code Power Prompts 300 — $29](https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-hooks)

*30-day money-back guarantee. Instant download.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hooks</category>
      <category>automation</category>
      <category>configuration</category>
    </item>
    <item>
      <title>Claude Code CLI Commands: Full Reference (2026)</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sun, 24 May 2026 01:30:04 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-code-cli-commands-full-reference-2026-3g8f</link>
      <guid>https://forem.com/claudeguide/claude-code-cli-commands-full-reference-2026-3g8f</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-cli-commands?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-cli-commands" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-cli-commands&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude Code CLI Commands: Full Reference (2026)
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude Code is primarily a conversational tool, but it has a rich set of CLI flags, in-session slash commands, and keyboard shortcuts that change how it behaves. This is the complete reference. For a broader introduction to what Claude Code can do, visit the &lt;a href="https://dev.to/claude-code-complete-guide"&gt;Claude Code Complete Guide&lt;/a&gt; in 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CLI flags (when launching &lt;code&gt;claude&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;These flags are passed when you start Claude Code from the terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic flags
&lt;/h3&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;Description&lt;/th&gt;
&lt;th&gt;Example&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;code&gt;-h&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Show help text&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --help&lt;/code&gt;&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;Show installed version&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --version&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;Print response and exit (non-interactive)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude -p "Explain this file" &amp;lt; main.ts&lt;/code&gt;&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;Set output format for &lt;code&gt;-p&lt;/code&gt; mode&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude -p "..." --output-format json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Model and configuration
&lt;/h3&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;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--model&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Override the model for this session&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --model claude-sonnet-4-6&lt;/code&gt;&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;Path to a custom settings file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --config ./team-settings.json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--system-prompt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inject a one-off system prompt&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --system-prompt "You are a security auditor"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Context and files
&lt;/h3&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;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--context&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add extra context text&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --context "$(cat NOTES.md)"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--allowed-tools&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Restrict which tools Claude can use&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --allowed-tools Read,Grep&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--disallowed-tools&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Block specific tools&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --disallowed-tools Bash,Write&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Permissions and safety
&lt;/h3&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;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Skip all tool-use permission prompts&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --dangerously-skip-permissions&lt;/code&gt;&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;Set permission level (default/bypassPermissions)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --permission-mode bypassPermissions&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; and &lt;code&gt;bypassPermissions&lt;/code&gt; disable all confirmation prompts. Use only in trusted automated environments where you have reviewed the task in advance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Session control
&lt;/h3&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;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--resume&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Resume a previous session by ID&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --resume abc123def&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--continue&lt;/code&gt;, &lt;code&gt;-c&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Continue the most recent session&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude -c&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--max-turns&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Limit the number of agentic turns&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude --max-turns 5&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Non-interactive (pipe) mode
&lt;/h2&gt;

&lt;p&gt;Claude Code can be used in scripts and CI pipelines without an interactive terminal. Use &lt;code&gt;-p&lt;/code&gt; with stdin:&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;# Read a file and ask a question about it&lt;/span&gt;
&lt;span class="nb"&gt;cat &lt;/span&gt;main.ts | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"What does this file do? List the exported functions."&lt;/span&gt;

&lt;span class="c"&gt;# Pipe multiple files&lt;/span&gt;
&lt;span class="nb"&gt;cat &lt;/span&gt;src/auth.ts src/middleware.ts | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Find any security issues in these files."&lt;/span&gt;

&lt;span class="c"&gt;# Save output to a variable&lt;/span&gt;
&lt;span class="nv"&gt;REVIEW&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git diff HEAD~1 | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Review this diff for bugs."&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;$REVIEW&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# JSON output for programmatic use&lt;/span&gt;
git diff | claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"List any breaking changes as JSON"&lt;/span&gt; &lt;span class="nt"&gt;--output-format&lt;/span&gt; json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  In-session slash commands
&lt;/h2&gt;

&lt;p&gt;Once Claude Code is running, these commands are typed in the conversation input.&lt;/p&gt;

&lt;h3&gt;
  
  
  Session management
&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;Description&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;Show help and available commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/quit&lt;/code&gt;, &lt;code&gt;/exit&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Exit Claude Code&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;Clear conversation history (new 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;Compact conversation to reduce token usage&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;Show session info: model, token count, settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/cost&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show token usage and estimated cost for this session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Model switching
&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;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;`/model &amp;lt;name&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-cli-commands" rel="noopener noreferrer"&gt;→ Get Claude Code Power Prompts 300 — $29&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cli</category>
      <category>commands</category>
      <category>reference</category>
    </item>
    <item>
      <title>Claude API Pricing 2026: Complete Breakdown with Calculators</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sun, 24 May 2026 01:30:01 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-api-pricing-2026-complete-breakdown-with-calculators-26c8</link>
      <guid>https://forem.com/claudeguide/claude-api-pricing-2026-complete-breakdown-with-calculators-26c8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-api-pricing-2026?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-api-pricing-2026" rel="noopener noreferrer"&gt;claudeguide.io/claude-api-pricing-2026&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude API Pricing 2026: Complete Breakdown with Calculators
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Anthropic's Claude API uses a per-token pricing model. You pay for tokens consumed — input (what you send) and output (what the model generates). This guide covers every pricing tier, feature, and real-world cost example as of April 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Current pricing table (April 2026)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Standard API
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input per 1M tokens&lt;/th&gt;
&lt;th&gt;Output per 1M tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3.00&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.7&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$25.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Prompt caching
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Cache write per 1M&lt;/th&gt;
&lt;th&gt;Cache read per 1M&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3.75&lt;/td&gt;
&lt;td&gt;$0.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.7&lt;/td&gt;
&lt;td&gt;$6.25&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cache read prices are 10% of standard input prices. Cache writes are 125% of standard input prices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Batch API (50% off all standard rates)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input per 1M tokens&lt;/th&gt;
&lt;th&gt;Output per 1M tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;$7.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.7&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$12.50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Batch API processes requests asynchronously within 24 hours. No streaming. Ideal for non-time-sensitive bulk workloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  1M context window (extended context)
&lt;/h3&gt;

&lt;p&gt;For Sonnet 4.6 and Opus 4.7, input tokens beyond 200K are billed at higher rates. Haiku 4.5 does not support 1M context.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Context range&lt;/th&gt;
&lt;th&gt;Sonnet 4.6 input&lt;/th&gt;
&lt;th&gt;Opus 4.7 input&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0 – 200K tokens&lt;/td&gt;
&lt;td&gt;$3.00/1M&lt;/td&gt;
&lt;td&gt;$5.00/1M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;200K – 1M tokens&lt;/td&gt;
&lt;td&gt;$6.00/1M&lt;/td&gt;
&lt;td&gt;$10.00/1M&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Output pricing is unchanged regardless of context length.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three ratios to memorize
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Output is 5x more expensive than input&lt;/strong&gt; (for all models). A 1K-token output costs the same as a 5K-token input. Every prompt engineering choice that reduces output length saves 5x more than the same reduction in input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Opus is 5x more expensive than Haiku.&lt;/strong&gt; A Haiku workload costing $100/month costs $500/month on Opus. Use the cheapest model that clears your quality bar. For a practical guide to matching tasks to models, see &lt;a href="https://dev.to/claude-haiku-sonnet-opus-which-model"&gt;Haiku vs Sonnet vs Opus: which model to use&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Cache reads are 10% of input price.&lt;/strong&gt; If the same system prompt is reused across calls, every cache hit saves 90% on that input slice. The break-even is reached at 1.28 cache hits per write. See the &lt;a href="https://dev.to/claude-api-cost-prompt-caching-break-even"&gt;prompt caching break-even guide&lt;/a&gt; for the full calculation with worked examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  Worked cost examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Example 1: High-volume classification
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Task: classify user messages into 12 categories&lt;/li&gt;
&lt;li&gt;Input: 500 tokens (message + system prompt)&lt;/li&gt;
&lt;li&gt;Output: 10 tokens (one label + confidence)&lt;/li&gt;
&lt;li&gt;Volume: 200,000 requests/month&lt;/li&gt;
&lt;li&gt;Model: Haiku 4.5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Calculation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 200,000 × 500 tokens = 100M tokens → $100&lt;/li&gt;
&lt;li&gt;Output: 200,000 × 10 tokens = 2M tokens → $10&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total: $110/month&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you used Opus: $550 input + $50 output = $600/month. That is $490/month wasted.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Customer support drafts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Task: generate reply drafts for support tickets&lt;/li&gt;
&lt;li&gt;Input: 2,000 tokens (ticket + system prompt + few-shot examples)&lt;/li&gt;
&lt;li&gt;Output: 300 tokens (draft reply)&lt;/li&gt;
&lt;li&gt;Volume: 30,000 requests/month&lt;/li&gt;
&lt;li&gt;Model: Sonnet 4.6&lt;/li&gt;
&lt;li&gt;Caching: system prompt (1,200 tokens) cached across all requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Without caching:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 30,000 × 2,000 = 60M tokens → $180&lt;/li&gt;
&lt;li&gt;Output: 30,000 × 300 = 9M tokens → $135&lt;/li&gt;
&lt;li&gt;Total: $315/month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;With prompt caching:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache write: 1,200 tokens × 1 write = 1,200 tokens → $0.005 (negligible)&lt;/li&gt;
&lt;li&gt;Cache reads: 1,200 tokens × 30,000 = 36M tokens → $10.80&lt;/li&gt;
&lt;li&gt;Non-cached input: 800 tokens × 30,000 = 24M tokens → $72&lt;/li&gt;
&lt;li&gt;Output: unchanged → $135&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total with caching: $217.80/month (31% savings)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example 3: Document summarization (1M context)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Task: summarize 400K-token legal contracts&lt;/li&gt;
&lt;li&gt;Input: 400,000 tokens per request&lt;/li&gt;
&lt;li&gt;Output: 800 tokens per summary&lt;/li&gt;
&lt;li&gt;Volume: 200 requests/month&lt;/li&gt;
&lt;li&gt;Model: Opus 4.7&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Calculation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First 200K tokens: 200,000 × 200 = 40M tokens → $200&lt;/li&gt;
&lt;li&gt;Extended (200K-400K): 200,000 × 200 = 40M tokens at $10/1M → $400&lt;/li&gt;
&lt;li&gt;Output: 200 × 800 = 160,000 tokens → $4&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total: $604/month&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: a 400K-token document on Sonnet 4.6 would cost $200 + $200 = $400 input + $2 output = $402/month — saving $200/month with minimal quality loss in most summarization tasks. Test before assuming Opus is required.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 4: Batch API for nightly data enrichment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Task: enrich 50,000 product records with descriptions&lt;/li&gt;
&lt;li&gt;Input: 300 tokens per record&lt;/li&gt;
&lt;li&gt;Output: 200 tokens per record&lt;/li&gt;
&lt;li&gt;Model: Sonnet 4.6, Batch API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Without batch (standard):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 50,000 × 300 = 15M tokens → $45&lt;/li&gt;
&lt;li&gt;Output: 50,000 × 200 = 10M tokens → $150&lt;/li&gt;
&lt;li&gt;Total: $195/run&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;With Batch API:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input: 15M tokens at $1.50/1M → $22.50&lt;/li&gt;
&lt;li&gt;Output: 10M tokens at $7.50/1M → $75&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total: $97.50/run (50% savings)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At twice-weekly runs: $195/week → $97.50/week = $410/month saved.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to calculate your own costs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Estimate token volumes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the &lt;code&gt;countTokens&lt;/code&gt; API endpoint to measure actual token counts for your prompts rather than estimating:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count_tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your system prompt here&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sample user message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Input tokens: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Calculate cost&lt;/strong&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
def estimate_monthly_cost(
    model: str,
    input_tokens_per_request: int,
    output_tokens_per_request: int,
    requests_per_month: int,
    cached_tokens_per_request: int = 0,
) -

PDF guide + 6-sheet Excel cost calculator. Example scenario: $2,100 → $187/month on a customer support agent.

[→ Get Cost Optimization Masterclass — $59](https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-api-pricing-2026)

*30-day money-back guarantee. Instant download.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>pricing</category>
      <category>haiku</category>
      <category>sonnet</category>
      <category>opus</category>
    </item>
    <item>
      <title>Claude API Error Handling: Rate Limits, Retries, Patterns</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sat, 23 May 2026 01:40:34 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-api-error-handling-rate-limits-retries-patterns-4nbc</link>
      <guid>https://forem.com/claudeguide/claude-api-error-handling-rate-limits-retries-patterns-4nbc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-api-error-handling?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-api-error-handling" rel="noopener noreferrer"&gt;claudeguide.io/claude-api-error-handling&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude API Error Handling: Rate Limits, Retries, and Production Patterns
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;The Anthropic API returns structured errors with specific HTTP status codes. Knowing which errors to retry, which to log and surface to users, and which indicate bugs in your code is the difference between a production-ready integration and one that silently fails. For general Claude API concepts, see the &lt;a href="https://dev.to/claude-agent-sdk-guide"&gt;Claude Agent SDK Guide&lt;/a&gt; in 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Error code reference
&lt;/h2&gt;

&lt;p&gt;Each row links to a dedicated troubleshooting page with Python + TypeScript code examples (Korean):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;HTTP Status&lt;/th&gt;
&lt;th&gt;Error type&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-400"&gt;400&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;invalid_request_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Malformed request — bad JSON, unsupported parameters, exceeded context window&lt;/td&gt;
&lt;td&gt;Fix the request — do not retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-401"&gt;401&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;authentication_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Invalid API key&lt;/td&gt;
&lt;td&gt;Check key validity — do not retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-403"&gt;403&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;permission_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Valid key but insufficient permissions (e.g. model not enabled)&lt;/td&gt;
&lt;td&gt;Check account permissions — do not retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-404"&gt;404&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;not_found_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Endpoint or model doesn't exist&lt;/td&gt;
&lt;td&gt;Fix model name or endpoint — do not retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-413"&gt;413&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;request_too_large&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request body exceeds 32MB limit&lt;/td&gt;
&lt;td&gt;Use Files API for large attachments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;422&lt;/td&gt;
&lt;td&gt;&lt;code&gt;unprocessable_entity&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request valid but semantically wrong (e.g. invalid tool schema)&lt;/td&gt;
&lt;td&gt;Fix the schema — do not retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-429"&gt;429&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rate_limit_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Too many requests or tokens per minute&lt;/td&gt;
&lt;td&gt;Retry with exponential backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-500"&gt;500&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;api_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Internal server error&lt;/td&gt;
&lt;td&gt;Retry with backoff, max 3 attempts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-529"&gt;529&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;overloaded_error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;API overloaded&lt;/td&gt;
&lt;td&gt;Retry with longer backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Additional HTTP status codes
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Quick fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-502"&gt;502&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bad_gateway&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Retry [3, 10, 30, 60, 120s]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-503"&gt;503&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;service_unavailable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check status.anthropic.com + backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/claude-api-error-504"&gt;504&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gateway_timeout&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switch to streaming for long outputs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Error subtype deep-dives (한국어, code samples)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-context-length-exceeded"&gt;&lt;code&gt;context_length_exceeded&lt;/code&gt;&lt;/a&gt; — 컨텍스트 창 초과 시 트리밍&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-invalid-api-key"&gt;&lt;code&gt;invalid_api_key&lt;/code&gt;&lt;/a&gt; — key 형식 검증 + 환경변수 trim&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-max-tokens"&gt;&lt;code&gt;max_tokens&lt;/code&gt;&lt;/a&gt; — 모델별 8192 한도 cap&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-model-not-found"&gt;&lt;code&gt;model_not_found&lt;/code&gt;&lt;/a&gt; — 최신 모델 식별자&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-prompt-too-long"&gt;&lt;code&gt;prompt_too_long&lt;/code&gt;&lt;/a&gt; — 누적 conversation 자동 trim&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-streaming-error"&gt;&lt;code&gt;streaming_error&lt;/code&gt;&lt;/a&gt; — SSE 끊김 시 resume 패턴&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-tool-use-error"&gt;&lt;code&gt;tool_use_error&lt;/code&gt;&lt;/a&gt; — tool_use ↔ tool_result pairing 검증&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-vision-error"&gt;&lt;code&gt;vision_error&lt;/code&gt;&lt;/a&gt; — 이미지 포맷/크기 자동 정규화&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-file-upload-error"&gt;&lt;code&gt;file_upload_error&lt;/code&gt;&lt;/a&gt; — Files API + beta 헤더&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-batch-error"&gt;&lt;code&gt;batch_error&lt;/code&gt;&lt;/a&gt; — Batch 10K/250MB 한도 검증&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-cache-error"&gt;&lt;code&gt;cache_error&lt;/code&gt;&lt;/a&gt; — Prompt Caching cache_control 위치&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/claude-api-error-billing-error"&gt;&lt;code&gt;billing_error&lt;/code&gt;&lt;/a&gt; — 결제/크레딧 부족 alert&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The critical distinction&lt;/strong&gt;: 4xx errors (except 429) indicate a problem with your request and should not be retried. 429 and 5xx errors are transient and should be retried. To reduce 400-class errors from oversized contexts, see &lt;a href="https://dev.to/claude-1m-context-window"&gt;Claude 1M Context Window&lt;/a&gt; for truncation and caching strategies.&lt;/p&gt;




&lt;h2&gt;
  
  
  Rate limit errors (429)
&lt;/h2&gt;

&lt;p&gt;The most common production error. Rate limits are enforced on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Requests per minute (RPM)&lt;/strong&gt;: number of API calls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Input tokens per minute (ITPM)&lt;/strong&gt;: total input tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output tokens per minute (OTPM)&lt;/strong&gt;: total output tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;Retry-After&lt;/code&gt; header in the 429 response tells you exactly how many seconds to wait.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import anthropic
import time

client = anthropic.Anthropic()

def call_with_retry(
    messages: list,
    model: str = "claude-sonnet-4-6",
    max_retries: int = 5,
    base_delay: float = 1.0,
) -

PDF guide + Excel cost calculator.

[→ Get Cost Optimization Masterclass — $59](https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-api-error-handling)

*30-day money-back guarantee. Instant download.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>retries</category>
      <category>production</category>
    </item>
    <item>
      <title>From $800 to $120/month: A Claude API Cost Optimization Case Study</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sat, 23 May 2026 01:35:21 +0000</pubDate>
      <link>https://forem.com/claudeguide/from-800-to-120month-a-claude-api-cost-optimization-case-study-34a5</link>
      <guid>https://forem.com/claudeguide/from-800-to-120month-a-claude-api-cost-optimization-case-study-34a5</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-api-cost-case-study?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-api-cost-case-study" rel="noopener noreferrer"&gt;claudeguide.io/claude-api-cost-case-study&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  From $800 to $120/month: A Claude API Cost Optimization Case Study
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;This is the story of a 3-person SaaS team that cut their Claude API bill from $800/month to $120/month over 6 weeks — an 85% reduction with zero quality loss.&lt;/strong&gt; The product is a B2B document analysis tool — users upload contracts, the app extracts key clauses, generates summaries, and answers questions about the document.&lt;/p&gt;

&lt;p&gt;PDF guide + 6-sheet Excel cost calculator. Example scenario: $2,100 → $187/month on a customer support agent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-api-cost-case-study" rel="noopener noreferrer"&gt;→ Get Cost Optimization Masterclass — $59&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>haiku</category>
    </item>
    <item>
      <title>Claude Agent SDK Quickstart: Build Your First Agent in 15 Minutes</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sat, 23 May 2026 01:35:18 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-agent-sdk-quickstart-build-your-first-agent-in-15-minutes-5d43</link>
      <guid>https://forem.com/claudeguide/claude-agent-sdk-quickstart-build-your-first-agent-in-15-minutes-5d43</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-agent-sdk-quickstart?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-agent-sdk-quickstart" rel="noopener noreferrer"&gt;claudeguide.io/claude-agent-sdk-quickstart&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude Agent SDK Quickstart: Build Your First Agent in 15 Minutes
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;An agent is a Claude model that can call tools — functions you define — in a loop until it completes a task. This guide walks from zero to a working agent with two tools (web search and unit converter) in Python or TypeScript in 2026.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;: Anthropic API key, Python 3.11+ or Node.js 18+.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you're building
&lt;/h2&gt;

&lt;p&gt;A research assistant that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accepts a question&lt;/li&gt;
&lt;li&gt;Decides whether to search the web or convert a unit&lt;/li&gt;
&lt;li&gt;Calls the tool&lt;/li&gt;
&lt;li&gt;Uses the result to answer (or calls another tool)&lt;/li&gt;
&lt;li&gt;Returns a final answer&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Python version
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Install the SDK
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;anthropic
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sk-ant-your-key-here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Define your tools
&lt;/h3&gt;

&lt;p&gt;Tools are Python functions with JSON Schema descriptions. Claude reads the description to decide when to call each tool.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import anthropic
import json

client = anthropic.Anthropic()

TOOLS = [
    {
        "name": "web_search",
        "description": "Search the web for current information. Use when the question requires recent facts or data.",
        "input_schema": {
            "type": "object",
            "properties": {
                "query": {"type": "string", "description": "The search query"}
            },
            "required": ["query"]
        }
    },
    {
        "name": "unit_converter",
        "description": "Convert between common units. Supports: km/miles, kg/lbs, celsius/fahrenheit, usd/krw.",
        "input_schema": {
            "type": "object",
            "properties": {
                "value": {"type": "number", "description": "The numeric value to convert"},
                "from_unit": {"type": "string", "description": "Source unit"},
                "to_unit": {"type": "string", "description": "Target unit"}
            },
            "required": ["value", "from_unit", "to_unit"]
        }
    }
]

def web_search(query: str) -

Complete, runnable Python and TypeScript code throughout.

[→ Get Agent SDK Cookbook — $49](https://shoutfirst.gumroad.com/l/ogxhmy?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-agent-sdk-quickstart)

*30-day money-back guarantee. Instant download.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>quickstart</category>
      <category>python</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Claude 1M Context Window: What It Can Do and What It Costs</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sat, 23 May 2026 01:30:04 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-1m-context-window-what-it-can-do-and-what-it-costs-1308</link>
      <guid>https://forem.com/claudeguide/claude-1m-context-window-what-it-can-do-and-what-it-costs-1308</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-1m-context-window?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-1m-context-window" rel="noopener noreferrer"&gt;claudeguide.io/claude-1m-context-window&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude 1M Context Window: What It Can Do and What It Costs
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude Opus 4.7 and Claude Sonnet 4.6 support a 1 million token context window — roughly 750,000 words, or the equivalent of 10 average novels. This guide explains what that actually means for your use case, what it costs, and when the extended context is worth it. For guidance on picking the right model tier, see &lt;a href="https://dev.to/claude-haiku-sonnet-opus-which-model"&gt;Haiku vs Sonnet vs Opus: Which Model?&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What 1M tokens looks like in practice
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Content type&lt;/th&gt;
&lt;th&gt;Fits in 1M tokens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Words (English prose)&lt;/td&gt;
&lt;td&gt;~750,000 words&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pages (standard 250 words/page)&lt;/td&gt;
&lt;td&gt;~3,000 pages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code (Python, ~100 tokens/KB)&lt;/td&gt;
&lt;td&gt;~10 MB of source code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub repo (median size)&lt;/td&gt;
&lt;td&gt;~3-5 repos in full&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Legal documents&lt;/td&gt;
&lt;td&gt;~500 standard contracts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Emails&lt;/td&gt;
&lt;td&gt;~5,000 average emails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slack messages&lt;/td&gt;
&lt;td&gt;~20,000 messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PDF pages (no images)&lt;/td&gt;
&lt;td&gt;~2,500 pages&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Practical upper bound&lt;/strong&gt;: 1M tokens is the technical limit. In practice, Anthropic recommends staying under 800K for reliable output quality. The model's attention degrades at the very edges of a very long context.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pricing for extended context
&lt;/h2&gt;

&lt;p&gt;Standard context (0-200K tokens) is billed at the normal rate. Beyond 200K, the per-token rate doubles.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;0-200K input&lt;/th&gt;
&lt;th&gt;200K-1M input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3.00/1M&lt;/td&gt;
&lt;td&gt;$6.00/1M&lt;/td&gt;
&lt;td&gt;$15.00/1M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Opus 4.7&lt;/td&gt;
&lt;td&gt;$5.00/1M&lt;/td&gt;
&lt;td&gt;$10.00/1M&lt;/td&gt;
&lt;td&gt;$25.00/1M&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Real cost example — 800K token request on Opus:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First 200K: 200,000 tokens × $5/1M = $1.00&lt;/li&gt;
&lt;li&gt;Remaining 600K: 600,000 tokens × $10/1M = $6.00&lt;/li&gt;
&lt;li&gt;Total input: &lt;strong&gt;$7.00 per request&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Plus output: if the response is 2,000 tokens → $0.05&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Single request total: ~$7.05&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At 100 requests/month: &lt;strong&gt;$705/month&lt;/strong&gt; on input alone. This is the context where selective context matters enormously.&lt;/p&gt;

&lt;h2&gt;
  
  
  When 1M context is worth it
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Whole-codebase analysis
&lt;/h3&gt;

&lt;p&gt;When you need Claude to reason across an entire codebase — not just find a file, but understand how components interact — you need the whole thing in context at once.&lt;/p&gt;

&lt;p&gt;Use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security audit: finding vulnerability chains across modules&lt;/li&gt;
&lt;li&gt;Architecture review: identifying circular dependencies, anti-patterns&lt;/li&gt;
&lt;li&gt;Refactoring plan: understanding all callers before changing a shared function&lt;/li&gt;
&lt;li&gt;Onboarding doc generation: summarizing the entire codebase for new hires&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Alternative to consider first&lt;/strong&gt;: Claude Code's built-in file navigation (Read, Glob, Grep) lets it explore code without putting everything in context. For 80% of coding tasks, targeted file reading is faster and cheaper.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Multi-document synthesis
&lt;/h3&gt;

&lt;p&gt;Legal due diligence, medical record review, financial document analysis, research literature synthesis — tasks where the answer depends on relationships across hundreds of documents.&lt;/p&gt;

&lt;p&gt;Use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Summarizing 200 earnings calls to find recurring themes&lt;/li&gt;
&lt;li&gt;Finding discrepancies across 50 supplier contracts&lt;/li&gt;
&lt;li&gt;Synthesizing 100 research papers into a literature review&lt;/li&gt;
&lt;li&gt;Analyzing a complete audit trail (logs, tickets, emails) for an incident investigation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Long conversation history
&lt;/h3&gt;

&lt;p&gt;Agents that run for many turns can use the full history as context for decision-making. A research agent that has made 50 tool calls, read 30 documents, and produced intermediate results can load the entire history for a final synthesis step.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Large structured data
&lt;/h3&gt;

&lt;p&gt;When you need Claude to reason over a large dataset — a 100K-row export in CSV form is ~500K tokens — and the reasoning requires seeing all the data rather than a sample. (Note: for data analysis at scale, a database + targeted query is almost always better than loading raw data into context.)&lt;/p&gt;

&lt;h2&gt;
  
  
  When NOT to use 1M context
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. You don't actually need it
&lt;/h3&gt;

&lt;p&gt;The most common misuse is sending the full codebase when the task only requires 2-3 files. Use targeted file reads first. Save the full-context approach for tasks where the answer genuinely requires reading everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test&lt;/strong&gt;: can you find the relevant files with Grep/Glob and read just those? If yes, do that.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Speed matters
&lt;/h3&gt;

&lt;p&gt;1M token requests have measurably higher latency. Time to first token is longer. If you need a fast response for a user-facing workflow, consider whether you can reduce the context or use a retrieval step.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The cost doesn't justify the use case
&lt;/h3&gt;

&lt;p&gt;At $7+ per request, 1M context requests are expensive. For a use case running 1,000 times/month, that is $7,000+ in input alone. The quality premium must be real and measurable.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The task is repetitive over sub-documents
&lt;/h3&gt;

&lt;p&gt;If you are summarizing 1,000 individual documents and do not need cross-document reasoning, process them one at a time (or in batches via Batch API). You do not need 1M context to summarize a single 5-page contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use the 1M context window
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Via the API
&lt;/h3&gt;

&lt;p&gt;1M context requires requesting access via the Anthropic Console for some accounts. Once enabled, you use it by simply sending a larger messages array — no special flag required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Read all your documents
&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;large_document.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;document&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-opus-4-7&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# or claude-sonnet-4-6
&lt;/span&gt;    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4096&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Analyze this document and find all clauses that could represent liability:&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Checking your context usage
&lt;/h3&gt;

&lt;p&gt;The response object includes &lt;code&gt;usage.input_tokens&lt;/code&gt;. Check this to know exactly what you sent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Input tokens: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Output tokens: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Cache read tokens: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cache_read_input_tokens&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Combining with prompt caching
&lt;/h3&gt;

&lt;p&gt;For repeated analysis over the same large document (e.g., answering multiple questions about the same contract), use prompt caching to avoid re-billing the input tokens on each call. See the &lt;a href="https://dev.to/claude-prompt-caching-guide"&gt;Claude Prompt Caching Guide&lt;/a&gt; for a full breakdown of cache pricing and implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;large_document_text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_control&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ephemeral&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;# Cache the document
&lt;/span&gt;        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What are the termination clauses?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Second call reuses cached document — 90% cheaper on the input
&lt;/span&gt;&lt;span class="n"&gt;response2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;large_document_text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_control&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ephemeral&lt;/span&gt;&lt;span class="sh"&gt;"&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="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What are the payment terms?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a 700K-token document on Sonnet 4.6:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Without caching: $3/call for first 200K + $6/call for remaining 500K = $4.80 per question&lt;/li&gt;
&lt;li&gt;With caching (after first write): $0.30/1M on cached tokens = $0.21 for 700K tokens per question&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savings: 96% on repeated queries over the same document&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Claude actually does with a million tokens
&lt;/h2&gt;

&lt;p&gt;This is the question that matters most for deciding whether to use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What works well:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finding specific information anywhere in the context ("does this contract mention force majeure?")&lt;/li&gt;
&lt;li&gt;Cross-referencing across documents ("does the pricing in the email match the contract?")&lt;/li&gt;
&lt;li&gt;Summarizing the whole into a structured output&lt;/li&gt;
&lt;li&gt;Finding patterns that only emerge from seeing many instances&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What degrades at very long context:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Precise recall of specific facts from the middle of a 1M token context (the "lost in the middle" problem — performance is best at the beginning and end)&lt;/li&gt;
&lt;li&gt;Maintaining a single coherent thread over very long outputs&lt;/li&gt;
&lt;li&gt;Complex multi-step reasoning when the relevant context is scattered across the full 1M&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Mitigation&lt;/strong&gt;: structure your context so the most important information appears at the beginning and end of the messages array. If you have critical instructions or key documents, place them first.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is 1M context available on Haiku?&lt;/strong&gt;&lt;br&gt;
No. Haiku 4.5 supports up to 200K tokens. Only Sonnet 4.6 and Opus 4.7 support 1M context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does context length affect output quality?&lt;/strong&gt;&lt;br&gt;
For tasks within the first 200K tokens of context, quality is equivalent to shorter contexts. For very long contexts, attention degrades slightly in the middle. Plan your context layout accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use 1M context with the Batch API?&lt;/strong&gt;&lt;br&gt;
Yes. Batch API supports up to 1M context. Pricing is 50% off standard rates, so extended context on Batch API: Sonnet at $3.00/1M for extended tokens (vs. $6.00 standard).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I estimate whether I need 1M context?&lt;/strong&gt;&lt;br&gt;
Count your actual tokens with the &lt;code&gt;countTokens&lt;/code&gt; endpoint before building. Many tasks that seem to require full context can be handled with targeted retrieval. Build the retrieval version first; upgrade to full context only if quality is insufficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the maximum output token length?&lt;/strong&gt;&lt;br&gt;
Independent of input context length: 8,192 tokens for most models, 16,000 for Opus 4.7. Input context affects what the model knows, not how much it can generate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.anthropic.com/models" rel="noopener noreferrer"&gt;Anthropic models documentation&lt;/a&gt; — April 2026&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://anthropic.com/pricing" rel="noopener noreferrer"&gt;Claude API pricing&lt;/a&gt; — April 2026&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.anthropic.com/guides/long-context" rel="noopener noreferrer"&gt;Long context best practices&lt;/a&gt; — April 2026&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h3&gt;
  
  
  How much does a 1M token request cost on Claude?
&lt;/h3&gt;

&lt;p&gt;On Claude Opus 4.7, a single 800K-token request costs approximately $7.05 in input alone: the first 200K tokens at $5/1M = $1.00, and the remaining 600K at $10/1M = $6.00, plus output. On Sonnet 4.6, the same request costs about $4.80. Use prompt caching on repeated queries over the same document to reduce costs by up to 96%.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which Claude models support the 1M context window?
&lt;/h3&gt;

&lt;p&gt;Only Claude Sonnet 4.6 and Claude Opus 4.7 support 1M token context. Claude Haiku 4.5 is limited to 200K tokens. The 1M context mode may require enabling via the Anthropic Console for some accounts.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the best use cases for Claude's 1M context window?
&lt;/h3&gt;

&lt;p&gt;The highest-value use cases are whole-codebase security audits and architecture reviews, multi-document synthesis (e.g., 200 contracts, 100 research papers), long agent conversation histories requiring full-context synthesis, and large structured data reasoning. Avoid using 1M context when targeted file reads via Grep/Glob can answer the question — it is 4–14x more expensive than standard context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the "lost in the middle" problem affect Claude's 1M context window?
&lt;/h3&gt;

&lt;p&gt;Yes. Performance is strongest at the beginning and end of the context and degrades slightly in the middle for very long inputs. For critical instructions or key documents, place them at the start of your messages array. Anthropic recommends staying under 800K tokens for reliable output quality even when the technical limit is 1M.&lt;/p&gt;




&lt;h2&gt;
  
  
  Take It Further
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-1m-context-window" rel="noopener noreferrer"&gt;Claude API Cost Optimization Masterclass&lt;/a&gt;&lt;/strong&gt; — The practical guide to cutting Claude API costs by 60–90% in production. Model tiering, prompt caching, Batch API, and token compression — with real numbers from 12 optimization scenarios.&lt;/p&gt;

&lt;p&gt;PDF guide + Excel cost calculator.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-1m-context-window" rel="noopener noreferrer"&gt;→ Get Cost Optimization Masterclass — $59&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>opus</category>
      <category>sonnet</category>
    </item>
    <item>
      <title>Running Claude Code across multiple repos without losing context</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Sat, 23 May 2026 01:30:02 +0000</pubDate>
      <link>https://forem.com/claudeguide/running-claude-code-across-multiple-repos-without-losing-context-2k83</link>
      <guid>https://forem.com/claudeguide/running-claude-code-across-multiple-repos-without-losing-context-2k83</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-workflow-multi-repo?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-workflow-multi-repo" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-workflow-multi-repo&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Running Claude Code across multiple repos without losing context
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;If you work on more than one codebase at a time — an API, a dashboard, a shared library — the honest problem with Claude Code is not the tool, it's you forgetting which conversation is which. This post documents the workflow that actually works on a Mac mini M4 with 32GB RAM after six weeks of daily use. For a full overview of what Claude Code can do, see the &lt;a href="https://dev.to/claude-code-complete-guide"&gt;Claude Code Complete Guide&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One Claude Code session = one repository. Do not mix.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;project-scoped &lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/strong&gt; at the root of each repo to pin context.&lt;/li&gt;
&lt;li&gt;Put persistent cross-repo facts in &lt;strong&gt;&lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt;&lt;/strong&gt; (user-global).&lt;/li&gt;
&lt;li&gt;For cross-repo refactors, use a third "orchestrator" session that spawns Explore subagents into each repo.&lt;/li&gt;
&lt;li&gt;Checkpoint before every context-heavy operation with &lt;code&gt;/remember&lt;/code&gt; or &lt;code&gt;/checkpoint&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why the naive approach breaks
&lt;/h2&gt;

&lt;p&gt;The first instinct is to open one Claude Code window and &lt;code&gt;cd&lt;/code&gt; between projects. This fails for three concrete reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;File cache collisions.&lt;/strong&gt; Claude Code tracks which files you've opened. Switching directories mid-session causes stale path assumptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System prompt dilution.&lt;/strong&gt; Each repo's &lt;code&gt;CLAUDE.md&lt;/code&gt; only gets loaded at startup. Switching afterwards means the guidance doesn't reattach.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conversation contamination.&lt;/strong&gt; Decisions made for Repo A leak into Repo B's implementation when a single conversation carries both.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We measured the impact over a 2-week A/B split on a 3-repo project:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Workflow&lt;/th&gt;
&lt;th&gt;Avg tokens / task&lt;/th&gt;
&lt;th&gt;Rework rate&lt;/th&gt;
&lt;th&gt;Subjective frustration (1-5)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Single session, &lt;code&gt;cd&lt;/code&gt; between repos&lt;/td&gt;
&lt;td&gt;42,800&lt;/td&gt;
&lt;td&gt;31%&lt;/td&gt;
&lt;td&gt;4.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One session per repo, user-global &lt;code&gt;CLAUDE.md&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;18,600&lt;/td&gt;
&lt;td&gt;8%&lt;/td&gt;
&lt;td&gt;1.8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The one-session-per-repo workflow used 57% fewer tokens and reduced rework by 4x.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup, step by step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Write a tight &lt;code&gt;CLAUDE.md&lt;/code&gt; in each repo
&lt;/h3&gt;

&lt;p&gt;Keep it under 200 lines. It should answer: what is this repo, what stack, where does the code live, what tests exist, what's the deploy path. No aspirational content — only what's true today.&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;# CLAUDE.md — api-service&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Node 20, TypeScript 5.6, Fastify 5
&lt;span class="p"&gt;-&lt;/span&gt; Routes: src/routes/&lt;span class="err"&gt;*&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Tests: vitest run, one file per route under tests/
&lt;span class="p"&gt;-&lt;/span&gt; Deploy: Fly.io via &lt;span class="sb"&gt;`fly deploy`&lt;/span&gt; (staging auto on main push)
&lt;span class="p"&gt;-&lt;/span&gt; Secrets: .env.local (dev) / Fly secrets (prod)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Put cross-repo facts in &lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This is your shared preamble. Useful entries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your preferred commit message style&lt;/li&gt;
&lt;li&gt;Tools you have globally (tsx, pnpm, bun)&lt;/li&gt;
&lt;li&gt;Platform oddities (Mac mini M4, Apple Silicon specifics)&lt;/li&gt;
&lt;li&gt;Recurring project names and what they mean&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Open one session per repo
&lt;/h3&gt;

&lt;p&gt;Use terminal tabs, iTerm split panes, or Warp workflows — one Claude Code process per repo. Expect 1-3 concurrent at any time. On a Mac mini M4 32GB, three sessions with full context hover around 6-8GB resident.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. For cross-repo work, spawn an orchestrator
&lt;/h3&gt;

&lt;p&gt;When you have a change that spans repos (say, "rename this API endpoint and update all callers across three frontends"), open a &lt;strong&gt;fourth&lt;/strong&gt; session in a neutral directory and use the Agent tool to dispatch Explore subagents into each repo. Collect findings, then hand off to the per-repo sessions for implementation.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Does Claude Code share memory across sessions?
&lt;/h3&gt;

&lt;p&gt;No. Each session has its own conversation. The &lt;code&gt;.remember/&lt;/code&gt; folder in your project directory persists across sessions &lt;em&gt;within that project&lt;/em&gt;, but two separate sessions do not see each other's live context.&lt;/p&gt;

&lt;h3&gt;
  
  
  How big should CLAUDE.md be?
&lt;/h3&gt;

&lt;p&gt;Under 200 lines in the repo; under 100 lines globally. Anything longer will either get ignored or crowd out working memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use Claude Desktop and Claude Code simultaneously?
&lt;/h3&gt;

&lt;p&gt;Yes. They do not interfere. Claude Desktop is better for ideation and writing; Claude Code for anything touching the filesystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about git worktrees?
&lt;/h3&gt;

&lt;p&gt;Worktrees work well for the "spawn orchestrator" pattern. You can have one main checkout for active development and a worktree for an agent to explore safely without conflicting. See &lt;a href="https://dev.to/claude-code-worktree-parallel"&gt;Worktree Isolation in Claude Code&lt;/a&gt; for a step-by-step setup guide.&lt;/p&gt;

&lt;h3&gt;
  
  
  How many concurrent sessions is too many?
&lt;/h3&gt;

&lt;p&gt;On a Mac mini M4 with 32GB RAM, three full sessions hover at 6–8 GB resident. Four to five starts competing for memory with your other tools. In practice, keep concurrent sessions to three — one per active repo. Open a fourth only for short orchestrator tasks, then close it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we got wrong at first
&lt;/h2&gt;

&lt;p&gt;Our first two weeks used a single session with symlinks instead of separate sessions. Token usage was 2.3x higher and we kept getting file path errors because Claude's cached path assumptions outlived our &lt;code&gt;cd&lt;/code&gt; changes. Separate sessions eliminated both problems in a single afternoon of setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source data
&lt;/h2&gt;

&lt;p&gt;All measurements in this post come from logs on a Mac mini M4 32GB running macOS 15.4, April 4-18 2026. The repositories were an API (Fastify), a dashboard (Next.js 15), and a shared library (TypeScript). Raw log samples are available on request.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Part of the Claude Code workflow series on claudeguide.io. Disclosure: This site is part of the Biz AI self-investment project. The SaaS we build (claudecosts.app) is linked in our product index but not promoted in this post.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Take It Further
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-workflow-multi-repo" rel="noopener noreferrer"&gt;Claude Code Power Prompts 300&lt;/a&gt;&lt;/strong&gt; — 300 battle-tested prompts for Claude Code, organized by use case. Copy, paste, ship.&lt;/p&gt;

&lt;p&gt;40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://shoutfirst.gumroad.com/l/agfda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-code-workflow-multi-repo" rel="noopener noreferrer"&gt;→ Get Claude Code Power Prompts 300 — $29&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;30-day money-back guarantee. Instant download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>workflow</category>
    </item>
    <item>
      <title>Claude Prompt Caching: When It Pays Off (2026 Break-Even)</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Fri, 22 May 2026 15:36:38 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-prompt-caching-when-it-pays-off-2026-break-even-2034</link>
      <guid>https://forem.com/claudeguide/claude-prompt-caching-when-it-pays-off-2026-break-even-2034</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-api-cost-prompt-caching-break-even?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-api-cost-prompt-caching-break-even" rel="noopener noreferrer"&gt;claudeguide.io/claude-api-cost-prompt-caching-break-even&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude prompt caching: when it pays off and when it doesn't (2026 numbers)
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude prompt caching breaks even at 1.28 reuses for the 5-minute cache and 4 reuses for the 1-hour cache — below those thresholds, you pay 25% more than not caching. Above them, you save up to 90% on input tokens.&lt;/strong&gt; This post derives the break-even math from 2026 pricing and walks through six real workloads to show where caching wins, breaks even, and loses.&lt;/p&gt;

&lt;p&gt;For the complete pricing table this analysis is based on, see &lt;a href="https://dev.to/claude-api-pricing-2026"&gt;Claude API pricing 2026&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pricing (April 2026)
&lt;/h2&gt;

&lt;p&gt;Per 1M tokens, in USD:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Cache write 5m&lt;/th&gt;
&lt;th&gt;Cache write 1h&lt;/th&gt;
&lt;th&gt;Cache read&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Opus 4.7&lt;/td&gt;
&lt;td&gt;$5&lt;/td&gt;
&lt;td&gt;$25&lt;/td&gt;
&lt;td&gt;$6.25&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3&lt;/td&gt;
&lt;td&gt;$15&lt;/td&gt;
&lt;td&gt;$3.75&lt;/td&gt;
&lt;td&gt;$6&lt;/td&gt;
&lt;td&gt;$0.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1&lt;/td&gt;
&lt;td&gt;$5&lt;/td&gt;
&lt;td&gt;$1.25&lt;/td&gt;
&lt;td&gt;$2&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cache write 5m = 1.25x input price. Cache write 1h = 2x input price. Cache read = 0.1x input price.&lt;/p&gt;

&lt;h2&gt;
  
  
  The break-even formula
&lt;/h2&gt;

&lt;p&gt;For a prefix of size P tokens reused N times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Without cache&lt;/strong&gt;: &lt;code&gt;N * P * input_price&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;With cache&lt;/strong&gt;: &lt;code&gt;1 * P * cache_write_price + N * P * cache_read_price&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Caching is cheaper when:&lt;/p&gt;



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

N * P * input 

PDF guide + 6-sheet Excel cost calculator. Example scenario: $2,100 → $187/month on a customer support agent.

[→ Get Cost Optimization Masterclass — $59](https://shoutfirst.gumroad.com/l/msjkda?utm_source=claudeguide&amp;amp;utm_medium=article&amp;amp;utm_campaign=claude-api-cost-prompt-caching-break-even)

*30-day money-back guarantee. Instant download.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Claude Code Skills Explained: What They Are &amp; When to Use Them (2026)</title>
      <dc:creator>Sangmin Lee</dc:creator>
      <pubDate>Fri, 22 May 2026 15:35:51 +0000</pubDate>
      <link>https://forem.com/claudeguide/claude-code-skills-explained-what-they-are-when-to-use-them-2026-2370</link>
      <guid>https://forem.com/claudeguide/claude-code-skills-explained-what-they-are-when-to-use-them-2026-2370</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://claudeguide.io/claude-code-skills-overview?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=claude-code-skills-overview" rel="noopener noreferrer"&gt;claudeguide.io/claude-code-skills-overview&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Claude Code Skills Explained: What They Are &amp;amp; When to Use Them (2026)
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Claude Code Skills are reusable, AI-callable workflows defined in SKILL.md files in your &lt;code&gt;~/.claude/skills/&lt;/code&gt; directory. Each skill is auto-discovered by Claude Code, can be invoked via the Skill tool, and replaces what would otherwise be one-off prompts copy-pasted between sessions — turning 30-line instructions into a single &lt;code&gt;/skill-name&lt;/code&gt; call.&lt;/strong&gt; Skills are how power users compress repetitive workflows (code review, deployment, content generation, audit) into reusable building blocks. If you find yourself pasting the same instructions into Claude Code multiple times per week, a skill replaces them.&lt;/p&gt;

&lt;p&gt;This guide covers the model: what counts as a skill, how Claude discovers them, when to use a skill vs a slash command vs a CLAUDE.md instruction, and what's already in the public skill library.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Skill, exactly?
&lt;/h2&gt;

&lt;p&gt;A skill is a markdown file (&lt;code&gt;SKILL.md&lt;/code&gt;) with frontmatter that Claude Code can invoke as a tool. It contains:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;YAML frontmatter&lt;/strong&gt; — name, description, when to invoke&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Markdown body&lt;/strong&gt; — step-by-step instructions Claude follows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional helper files&lt;/strong&gt; — scripts, templates, references&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example skill at &lt;code&gt;~/.claude/skills/deploy/SKILL.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="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&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;Ship the current branch to production. Use when the user says "ship it", "deploy", "go live", or after PR merge confirmation.&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Deploy current branch&lt;/span&gt;
&lt;span class="p"&gt;
1.&lt;/span&gt; Run &lt;span class="sb"&gt;`bun run build`&lt;/span&gt; — abort if exit code != 0
&lt;span class="p"&gt;2.&lt;/span&gt; Run &lt;span class="sb"&gt;`vercel deploy --prod --yes`&lt;/span&gt;
&lt;span class="p"&gt;3.&lt;/span&gt; Wait for "Aliased: ..." line, confirm HTTP 200
&lt;span class="p"&gt;4.&lt;/span&gt; Submit IndexNow with any new content slugs
&lt;span class="p"&gt;5.&lt;/span&gt; Report deployment URL + git SHA + line count of changed files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now in any Claude Code session, you can say "ship it" and Claude invokes this skill instead of asking you to clarify the steps.&lt;/p&gt;




&lt;h2&gt;
  
  
  Skills vs Slash Commands vs CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;These three serve overlapping purposes. Picking right is half the battle:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Use case&lt;/th&gt;
&lt;th&gt;Choice&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Repeatable multi-step workflow ("deploy", "audit", "review")&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Skill&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One-shot UI command (Claude built-in like &lt;code&gt;/clear&lt;/code&gt;, &lt;code&gt;/exit&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Slash command&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Project-specific context (stack, conventions, commands)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;CLAUDE.md&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Rule of thumb&lt;/strong&gt;: if you'd write "follow these steps every time" in CLAUDE.md, make it a skill instead. Skills are invoked on demand; CLAUDE.md loads every session.&lt;/p&gt;




&lt;h2&gt;
  
  
  When to use a Skill
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Good fits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deployment workflows&lt;/strong&gt; — &lt;code&gt;deploy&lt;/code&gt;, &lt;code&gt;rollback&lt;/code&gt;, &lt;code&gt;canary&lt;/code&gt; (see &lt;a href="https://dev.to/claude-code-hooks-deep-dive"&gt;Claude Code Hooks Deep Dive&lt;/a&gt; for hook patterns)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit/review&lt;/strong&gt; — &lt;code&gt;aeo-audit&lt;/code&gt;, &lt;code&gt;quality-gate&lt;/code&gt;, &lt;code&gt;security-scan&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content generation&lt;/strong&gt; — &lt;code&gt;write-blog-post&lt;/code&gt;, &lt;code&gt;generate-changelog&lt;/code&gt;, &lt;code&gt;summarize-pr&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Investigation&lt;/strong&gt; — &lt;code&gt;investigate-bug&lt;/code&gt;, &lt;code&gt;find-related-tests&lt;/code&gt;, &lt;code&gt;trace-deployment&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setup&lt;/strong&gt; — &lt;code&gt;init-project&lt;/code&gt;, &lt;code&gt;setup-deploy&lt;/code&gt;, &lt;code&gt;configure-monitoring&lt;/code&gt; (pairs well with &lt;a href="https://dev.to/claude-code-memory-system"&gt;Claude Code memory system&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Bad fits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Trivial one-liners&lt;/strong&gt; — "format this file" doesn't need a skill, just say it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Highly variable workflows&lt;/strong&gt; — if every invocation needs different parameters, a skill becomes brittle&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project-specific commands&lt;/strong&gt; — those belong in CLAUDE.md, not a global skill&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Public Skill Library
&lt;/h2&gt;

&lt;p&gt;Anthropic and the community maintain skills at &lt;code&gt;~/.claude/skills/&lt;/code&gt;. Notable examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;gstack&lt;/strong&gt; — full development stack (review, ship, qa, investigate)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;superpowers&lt;/strong&gt; — TDD, debugging, code review patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;engineering&lt;/strong&gt; — debug, system-design, deploy-checklist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;design&lt;/strong&gt; — design-review, accessibility-check&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;finance&lt;/strong&gt; — reconciliation, journal-entry-prep&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can browse installed skills with &lt;code&gt;ls ~/.claude/skills/&lt;/code&gt;. Each directory contains a &lt;code&gt;SKILL.md&lt;/code&gt; defining when Claude should invoke that skill.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Claude Discovers Skills
&lt;/h2&gt;

&lt;p&gt;At session start, Claude Code lists all available skills with their descriptions. When you say "ship it" or "deploy this", Claude matches your intent against skill descriptions and invokes the best match.&lt;/p&gt;

&lt;p&gt;If you say something ambiguous ("update the docs"), Claude either picks the best match silently or asks "which skill should I use?". Specific phrasing in the user prompt triggers faster matching.&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;ls&lt;/span&gt; ~/.claude/skills/
&lt;span class="c"&gt;# deploy/  audit/  review/  investigate/  setup-deploy/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Building Your First Skill
&lt;/h2&gt;

&lt;p&gt;The minimum viable skill is 5 lines:&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bun-test&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;Run bun test on the current package. Use when user says "test it", "run tests", or after editing test files.&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

Run &lt;span class="sb"&gt;`bun test`&lt;/span&gt; and report results. If any tests fail, show the failure output and stop.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save as &lt;code&gt;~/.claude/skills/bun-test/SKILL.md&lt;/code&gt;. Restart Claude Code. Done.&lt;/p&gt;

&lt;p&gt;For a deeper guide on building skills with arguments, helper scripts, and conditional logic, see &lt;a href="https://dev.to/how-to-build-custom-claude-code-skill"&gt;How to Build a Custom Claude Code Skill&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Skills with Arguments
&lt;/h2&gt;

&lt;p&gt;Skills can accept arguments via &lt;code&gt;$ARGUMENTS&lt;/code&gt;:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
markdown
---
name: trace
description: Trace a deployment by its SHA. Usage: /trace &amp;lt;sha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>skills</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
