<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Kitforge]]></title><description><![CDATA[Kitforge]]></description><link>https://kitforge.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Kitforge</title><link>https://kitforge.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 05:50:46 GMT</lastBuildDate><atom:link href="https://kitforge.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The AI Code Review Checklist: What to Actually Check in Agent-Written Code]]></title><description><![CDATA[Reviewing agent-written code with a human-code checklist misses the ways agents actually fail. Agent output rarely has typos or sloppy formatting - it is fluent, plausible, and wrong in specific, repe]]></description><link>https://kitforge.hashnode.dev/the-ai-code-review-checklist-what-to-actually-check-in-agent-written-code</link><guid isPermaLink="true">https://kitforge.hashnode.dev/the-ai-code-review-checklist-what-to-actually-check-in-agent-written-code</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sun, 13 Sep 2026 06:21:41 GMT</pubDate><content:encoded><![CDATA[<p>Reviewing agent-written code with a human-code checklist misses the ways agents actually fail. Agent output rarely has typos or sloppy formatting - it is fluent, plausible, and wrong in specific, repeatable patterns. This checklist targets those patterns. Run it on every agent-produced diff before merge.</p>
<h2>1. Scope: did it touch more than you asked?</h2>
<p>The most common agent failure is not bad code - it is extra code. You asked for a validation fix and got a refactored helper, a renamed variable three files away, and an "improved" error message. Check the diff file list against the task. Anything outside the ask gets reverted or justified in the PR description. <code>git diff --stat</code> against the branch point is the fastest scope check there is.</p>
<h2>2. Boundaries: did it reach across a line it should not cross?</h2>
<p>Agents do not feel your architecture. They will happily import the database client into a UI component or call an internal service's private helper because it was the shortest path. Check every new import and every new call against your layering rules. This is the check that saves you six months later, and it is the one a skimmed diff never catches - the violation is one line that looks exactly like the legitimate lines around it.</p>
<h2>3. Silent fallbacks and swallowed errors</h2>
<p>Agents love making code that never fails visibly: <code>catch</code> blocks that log and continue, <code>|| defaultValue</code> on things that should be required, retry loops that hide a broken dependency. Search the diff for <code>catch</code>, <code>||</code>, <code>??</code>, and <code>try</code>. For each one, ask: if this fires in production, will anyone know? If the answer is no, the fallback is a bug with extra steps.</p>
<h2>4. Hallucinated APIs and config keys</h2>
<p>The code calls <code>client.getOrCreate()</code> and the library has no such method - but it <em>should</em> have, which is why the agent wrote it and why your eye slides past it. Verify every unfamiliar method, option, and config key against the actual library version in your lockfile. Thirty seconds per call. This is the failure class with the highest embarrassment-per-line ratio.</p>
<h2>5. Test theater</h2>
<p>Agent-written tests often test the mock instead of the code: assertions on the stub's return value, happy-path-only coverage, or a test that passes whether the feature works or not. For each new test, apply the mutation check mentally - if you broke the implementation, would this test fail? If you cannot answer yes quickly, the test is decoration. Delete it or make it load-bearing.</p>
<h2>6. Duplication of what already exists</h2>
<p>Agents write new utilities instead of finding existing ones. Before accepting a new helper, search the repo for its job: <code>rg "formatDate|format_date"</code> style. Merging two near-identical helpers later costs more than catching the duplicate now.</p>
<h2>7. Secrets, logging, and PII</h2>
<p>Check new log lines for what they print - agents log entire request objects, including auth headers and user data. Check new config for keys committed in plaintext. One pass over the diff with this lens is cheap; cleaning a leaked token is not.</p>
<h2>The short version</h2>
<p>Scope, boundaries, silent fallbacks, hallucinated APIs, test theater, duplication, secrets. Seven checks, most answerable in under a minute each, aimed at how agents actually fail instead of how humans do. Paste the list into your PR template and the review stops depending on whoever is awake.</p>
<hr />
<p><em>The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships this review checklist as a drop-in CLAUDE.md section plus pre-commit hooks that catch scope creep and boundary violations automatically. 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Keeps Forgetting Your Project? How CLAUDE.md Survives the Context Window]]></title><description><![CDATA[An hour into a session, Claude Code stops following the conventions you explained at the start. It renames things you told it not to rename, forgets which service owns the database, proposes the patte]]></description><link>https://kitforge.hashnode.dev/claude-code-keeps-forgetting-your-project-how-claude-md-survives-the-context-window</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-keeps-forgetting-your-project-how-claude-md-survives-the-context-window</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sun, 13 Sep 2026 04:53:21 GMT</pubDate><content:encoded><![CDATA[<p>An hour into a session, Claude Code stops following the conventions you explained at the start. It renames things you told it not to rename, forgets which service owns the database, proposes the pattern you rejected twice. This is not the model getting worse. The context window filled up, the conversation was compacted, and your explanations were among the things summarized away. The fix is not repeating yourself louder - it is putting the facts that must survive into the one file that always does.</p>
<h2>What actually happens when the window fills</h2>
<p>Every session has a fixed context window. Your messages, the agent's replies, every file it reads, and every tool result all share that space. When it approaches the limit, Claude Code compacts: earlier conversation gets replaced by a summary, and the session continues. Compaction is lossy by design. A summary keeps the gist of the task and drops most specifics - including the naming rule you stated once, forty minutes ago, in a paragraph about something else.</p>
<h2>CLAUDE.md is the exception</h2>
<p><code>CLAUDE.md</code> is re-read at the start of every session and stays in context regardless of compaction. Facts placed there do not get summarized away. That makes it the right home for exactly the things you find yourself repeating: architecture boundaries, naming conventions, commands that must be run a specific way, files that must never be edited, the test command, the deploy command. If a fact would change what the agent does on any task in the repo, it belongs in <code>CLAUDE.md</code>, not in chat.</p>
<h2>What to keep out of it</h2>
<p>The failure mode in the other direction is a 900-line <code>CLAUDE.md</code> that buries the load-bearing rules under history and aspiration. Every line sits in every session's context, so each one pays rent or leaves. Keep it to current, durable, behavior-changing facts. Meeting notes, roadmap, and explanations of why a decision was made belong in docs the agent can read on demand - point to them with one line: <code>See docs/architecture.md before touching the billing module</code>.</p>
<h2>A structure that holds up</h2>
<pre><code class="language-plaintext"># Project
One paragraph: what this is, who runs it, how.

# Commands
- test: npm test -- --run
- lint: npm run lint:fix
- dev: npm run dev (port 3100)

# Boundaries
- Never edit src/legacy/** - frozen, mirrors production.
- Database access only through src/db/client.ts.
- No new dependencies without asking.

# Conventions
- Files: kebab-case. React components: PascalCase.
- Errors: throw AppError, never raw Error.
- Commits: conventional commits, no scope.
</code></pre>
<p>Thirty to sixty lines like this outperforms a wall of prose. The agent follows lists of constraints far more reliably than paragraphs of advice.</p>
<h2>Recovering a session that already drifted</h2>
<p>When you notice drift mid-session, do not argue with the summary - it cannot give back what it dropped. State the rule once more, then move it into <code>CLAUDE.md</code> so it never needs restating: "Add to CLAUDE.md under Boundaries: never mock the payments service in tests." The agent can edit the file itself, and the rule is permanent from the next line onward. Run <code>/clear</code> between unrelated tasks so a stale summary from the last task does not leak into the next one.</p>
<h2>The short version</h2>
<p>Forgetting is compaction, and compaction is normal. Chat is scratch space; <code>CLAUDE.md</code> is project memory. Keep the file short, current, and limited to facts that change behavior, and the agent stops starting from zero.</p>
<hr />
<p><em>The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships battle-tested CLAUDE.md and AGENTS.md templates - boundaries, commands, conventions - plus 30 more config files for Claude Code and Cursor. $19 one-time. Or draft yours free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Hooks Not Firing? The 6 Causes That Cover Almost Every Case]]></title><description><![CDATA[You wrote the hook, saved the settings, ran the tool - and nothing happened. Hooks fail silently by design: a broken hook should not block your work, so errors get logged instead of raised. That makes]]></description><link>https://kitforge.hashnode.dev/claude-code-hooks-not-firing-the-6-causes-that-cover-almost-every-case</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-hooks-not-firing-the-6-causes-that-cover-almost-every-case</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 18:47:48 GMT</pubDate><content:encoded><![CDATA[<p>You wrote the hook, saved the settings, ran the tool - and nothing happened. Hooks fail silently by design: a broken hook should not block your work, so errors get logged instead of raised. That makes debugging feel like shouting into a void. These six causes cover almost every case, in the order to check them.</p>
<h2>1. The settings file is not where you think it is</h2>
<p>Hooks live in the <code>hooks</code> block of <code>settings.json</code>, and there are three of those files: <code>~/.claude/settings.json</code> (global), <code>.claude/settings.json</code> (project, committed), and <code>.claude/settings.local.json</code> (project, personal). If you edited the project file but your session runs from a different directory - a worktree, a subdirectory outside the project root, a different clone - your hook is not loaded. Inspect from the exact directory where the hook should fire.</p>
<h2>2. The event name is wrong</h2>
<p>The hook events are exact strings: <code>PreToolUse</code>, <code>PostToolUse</code>, <code>UserPromptSubmit</code>, <code>Stop</code>, <code>SubagentStop</code>, <code>Notification</code>, <code>PreCompact</code>, <code>SessionStart</code>. A hook registered under <code>preToolUse</code> or <code>pre_tool_use</code> never fires and never errors - the key is simply ignored. Copy the event name from the docs, not from memory.</p>
<h2>3. The matcher does not match the tool name</h2>
<p>For tool events, the <code>matcher</code> is a regex against the tool name: <code>"Bash"</code>, <code>"Edit|Write"</code>, <code>".*"</code>. The classic miss is matching <code>"bash"</code> (lowercase) or expecting the matcher to see the command content - it matches the tool name only, not the arguments. A hook meant to intercept <code>git push</code> needs <code>Bash</code> as the matcher and the <code>git push</code> check inside the hook script itself.</p>
<h2>4. The JSON is broken</h2>
<p>A trailing comma or an unquoted key makes the whole settings file unparseable - and the failure mode is that the file is skipped, not that you get an error dialog. Validate the file after every edit:</p>
<pre><code class="language-bash">python3 -m json.tool .claude/settings.json &gt; /dev/null &amp;&amp; echo OK
</code></pre>
<p>If your editor shows the file as plain text instead of JSON, something in it is already invalid.</p>
<h2>5. The script is not executable, or the path is wrong</h2>
<p>A hook command that references <code>./scripts/check.sh</code> resolves relative to the project root, not the settings file. And a script without the execute bit fails with a permission error you will never see unless you look at the logs. Test the exact command the hook runs, from the project root, in a plain shell: paste it, run it, check the exit code. If it fails there, it fails as a hook.</p>
<h2>6. The hook runs but errors silently</h2>
<p>Hook stdout for most events is discarded unless the hook exits with a specific code or writes the expected JSON to stdout. If your hook echoes a message and exits 0, you see nothing. For a blocking decision, exit code 2 surfaces stderr to the agent. While debugging, make the hook write to a file you control - <code>echo "$HOOK_INPUT" &gt;&gt; /tmp/hook-debug.log</code> - so you can prove whether it fired at all. That one line separates "never ran" from "ran and did nothing", which sends you to the right half of this list.</p>
<h2>The short version</h2>
<p>Check the file location, the event name casing, the matcher against the tool name only, JSON validity, the script path and execute bit, and finally whether it runs but swallows its own output. Add a debug log line first - it turns guessing into a two-minute check.</p>
<hr />
<p><em>Want hooks that work out of the box? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships tested hook configs - pre-commit checks, secret scanning, format-on-save - with the settings.json wiring already correct. 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[AGENTS.md vs CLAUDE.md vs .cursorrules - Which Agent Config File Do You Need?]]></title><description><![CDATA[Three files, three ecosystems, one job: tell the AI coding agent how your repo works before it starts guessing. They overlap enough that teams routinely cargo-cult all three with contradictory content]]></description><link>https://kitforge.hashnode.dev/agents-md-vs-claude-md-vs-cursorrules-which-agent-config-file-do-you-need</link><guid isPermaLink="true">https://kitforge.hashnode.dev/agents-md-vs-claude-md-vs-cursorrules-which-agent-config-file-do-you-need</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 16:47:08 GMT</pubDate><content:encoded><![CDATA[<p>Three files, three ecosystems, one job: tell the AI coding agent how your repo works before it starts guessing. They overlap enough that teams routinely cargo-cult all three with contradictory contents. Here is who reads what, and the setup that covers everything without duplication.</p>
<h2>Who reads which file</h2>
<table>
<thead>
<tr>
<th>File</th>
<th>Read by</th>
<th>Location</th>
</tr>
</thead>
<tbody><tr>
<td><code>AGENTS.md</code></td>
<td>OpenAI Codex, Amp, Jules, Factory, and a growing list of agents that adopted the open convention</td>
<td>Repo root (nested files supported)</td>
</tr>
<tr>
<td><code>CLAUDE.md</code></td>
<td>Claude Code</td>
<td>Repo root, nested per directory, plus <code>~/.claude/CLAUDE.md</code> globally</td>
</tr>
<tr>
<td><code>.cursorrules</code></td>
<td>Cursor (legacy)</td>
<td>Repo root only</td>
</tr>
<tr>
<td><code>.cursor/rules/*.mdc</code></td>
<td>Cursor (current)</td>
<td><code>.cursor/rules/</code> directory, one file per topic</td>
</tr>
</tbody></table>
<p>Two details matter. First, <code>.cursorrules</code> is deprecated in favor of <code>.cursor/rules/</code> - Cursor still reads the old file, but new projects should use the directory. Second, Claude Code can be pointed at AGENTS.md-style content through imports, which is the key to avoiding duplication.</p>
<h2>They are the same document in spirit</h2>
<p>Every one of these files answers the same five questions: how to build, how to test, what conventions to follow, what to never touch, and where the docs live. If you write that once well, the per-tool file is a packaging problem, not a writing problem.</p>
<h2>The setup that covers everything</h2>
<p>Write the content once in <code>AGENTS.md</code> at the repo root - it is the superset audience, readable by humans and by the widest range of agents. Then make the tool-specific files thin pointers.</p>
<p><strong>CLAUDE.md</strong> becomes:</p>
<pre><code class="language-markdown"># Project rules

See @AGENTS.md for build, test, and conventions.

## Claude Code specifics
- Prefer `pnpm -r test` over per-package runs
- Permissions baseline lives in .claude/settings.json
</code></pre>
<p>The <code>@AGENTS.md</code> import pulls the shared file into context; the rest is only what is genuinely Claude-specific.</p>
<p><strong>.cursor/rules/project.mdc</strong> becomes the same pointer in Cursor's format - a short rule file that says "follow AGENTS.md" plus any Cursor-only settings. Cursor does not have a file-import directive, so paste the critical ten lines rather than referencing the file path and hoping.</p>
<h2>When they conflict, nobody wins</h2>
<p>The classic failure: AGENTS.md says "use pnpm", an old .cursorrules says "use npm", and CLAUDE.md says nothing. Different agents now do different things in the same repo, and a developer running two tools gets inconsistent behavior they cannot explain. One source of truth, thin pointers, and deleting the stale file is the whole fix. Treat these files like CI config: reviewed in pull requests, one owner, no drift.</p>
<h2>What about nested files?</h2>
<p>AGENTS.md and CLAUDE.md both support nested per-directory files in monorepos; Cursor's rules directory approximates it with path-scoped <code>globs</code> frontmatter. The same layering rule applies everywhere: shared rules at the root, local rules next to the code.</p>
<h2>The short version</h2>
<p>Write your rules once in AGENTS.md. Make CLAUDE.md an import plus Claude-only extras. Replace .cursorrules with a .cursor/rules/ file that points at the same content. Delete anything that contradicts the source of truth.</p>
<hr />
<p><em>Want the three-file setup pre-built? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships an AGENTS.md baseline, a CLAUDE.md that imports it, and matching .cursor/rules/ files - 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[CLAUDE.md in a Monorepo - Nested Files, Imports, and What Actually Works]]></title><description><![CDATA[A single root CLAUDE.md works until the repo has twelve packages with different stacks, test commands, and conventions. Then the file either balloons into a 900-line document that costs tokens on ever]]></description><link>https://kitforge.hashnode.dev/claude-md-in-a-monorepo-nested-files-imports-and-what-actually-works</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-md-in-a-monorepo-nested-files-imports-and-what-actually-works</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 15:43:22 GMT</pubDate><content:encoded><![CDATA[<p>A single root CLAUDE.md works until the repo has twelve packages with different stacks, test commands, and conventions. Then the file either balloons into a 900-line document that costs tokens on every prompt, or stays generic enough to be useless. The fix is treating CLAUDE.md like the code: shared rules at the root, local rules next to the code they govern.</p>
<h2>The layout that works</h2>
<pre><code class="language-plaintext">monorepo/
  CLAUDE.md                  # shared rules only
  packages/
    api/
      CLAUDE.md              # api-specific rules
      src/
    web/
      CLAUDE.md              # web-specific rules
      src/
</code></pre>
<p>Claude Code loads the root file on every session, and pulls in nested CLAUDE.md files when it works inside that directory tree. A session editing <code>packages/api/src</code> sees the root file plus <code>packages/api/CLAUDE.md</code> - not the web package's rules, not the other ten packages'. That scoping is the whole point: context follows the work.</p>
<h2>What goes in the root file</h2>
<p>Things that are true for every package, stated once:</p>
<ul>
<li><p>How to install, build, and test from the root (<code>pnpm install</code>, <code>pnpm -r test</code>)</p>
</li>
<li><p>Repo-wide conventions: commit message format, branch naming, the lint config everything inherits</p>
</li>
<li><p>Where the packages live and what each one is, in one line each</p>
</li>
<li><p>Anything an agent must never do anywhere (no force-push, no committing secrets)</p>
</li>
</ul>
<p>Keep it under 100 lines. If a rule only applies to one package, it does not belong here.</p>
<h2>What goes in nested files</h2>
<p>Package-local facts the agent needs only when working there: the package's test command if it differs, its framework quirks ("this package uses Vitest, not Jest"), generated-code directories to leave alone, and pointers to its README or docs. Five to twenty lines each is typical. When a nested file grows past that, the package probably needs its docs reorganized, not a bigger CLAUDE.md.</p>
<h2>Use @imports for the long stuff</h2>
<p>Reference material - API docs, architecture notes, runbooks - does not belong in any always-loaded file. Put it in a normal markdown file and mention it with an <code>@path/to/doc.md</code> import in the package file, or reference it in the task itself. The agent reads it when it needs it instead of paying for it on every prompt.</p>
<h2>Per-package settings</h2>
<p>The same layering applies to <code>.claude/settings.json</code>: a committed root file for shared permission allowlists, and nested settings where a package genuinely differs - the infra package that runs <code>terraform plan</code> needs different allowances than the docs package.</p>
<h2>The failure modes to avoid</h2>
<ul>
<li><p><strong>Duplicated rules.</strong> If the same rule appears in root and three nested files, they will drift. Say it once at the highest level where it is true.</p>
</li>
<li><p><strong>Contradictions.</strong> "Always use npm" at the root and "use pnpm" in a package teaches the agent to guess. Nested files override, but contradictions still waste turns.</p>
</li>
<li><p><strong>A root file that documents everything.</strong> That is what wikis are for. CLAUDE.md is operating rules, not documentation.</p>
</li>
</ul>
<h2>The short version</h2>
<p>Root CLAUDE.md for shared rules, nested CLAUDE.md files for package-local facts, @imports for reference material, nested settings for package-specific permissions. Context that follows the work stays small, cheap, and correct.</p>
<hr />
<p><em>Want the monorepo layout pre-built? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships root and nested CLAUDE.md templates, per-package settings baselines, and import patterns - 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Keeps Asking for Permission - the Allowlist Settings That Fix It]]></title><description><![CDATA[Every Bash call, every file write, every test run - approved, approved, approved. The permission prompts exist because the defaults trust nothing. The fix is not approving faster; it is telling the to]]></description><link>https://kitforge.hashnode.dev/claude-code-keeps-asking-for-permission-the-allowlist-settings-that-fix-it</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-keeps-asking-for-permission-the-allowlist-settings-that-fix-it</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 15:00:37 GMT</pubDate><content:encoded><![CDATA[<p>Every Bash call, every file write, every test run - approved, approved, approved. The permission prompts exist because the defaults trust nothing. The fix is not approving faster; it is telling the tool which commands never need to ask. That lives in the <code>permissions</code> block of <code>settings.json</code>.</p>
<h2>Where the settings live</h2>
<p>Three files, checked in order, later ones win:</p>
<ul>
<li><p><code>~/.claude/settings.json</code> - your global defaults, every project</p>
</li>
<li><p><code>.claude/settings.json</code> - project settings, commit this one so the team shares it</p>
</li>
<li><p><code>.claude/settings.local.json</code> - project settings for just you, gitignore it</p>
</li>
</ul>
<p>Put shared allowlists in the committed project file. Put your personal preferences (your editor, your scratch scripts) in the local one.</p>
<h2>The allowlist syntax</h2>
<p>Permissions are pattern rules in three lists: <code>allow</code>, <code>deny</code>, and <code>ask</code>. A rule names the tool and the argument pattern:</p>
<pre><code class="language-json">{
  "permissions": {
    "allow": [
      "Bash(npm run test:*)",
      "Bash(npm run lint)",
      "Bash(git status)",
      "Bash(git diff:*)",
      "Bash(git log:*)",
      "Read(*)",
      "Edit(src/**)"
    ],
    "ask": [
      "Bash(git push:*)"
    ],
    "deny": [
      "Bash(rm -rf:*)",
      "Read(./.env*)"
    ]
  }
}
</code></pre>
<p>Order of evaluation: <code>deny</code> beats everything, then <code>ask</code>, then <code>allow</code>. A command matching nothing falls back to the default - which is the prompt you are trying to escape. <code>:*</code> means any arguments; a bare pattern means exactly that command.</p>
<h2>What belongs on the allowlist</h2>
<p>Read-only and reversible commands. A good test: could a new hire run this on day one without breaking anything? Test runners, linters, type checks, git inspection commands, build commands. Those are the prompts that interrupt you fifty times a day, and they are the safe ones.</p>
<p>File edits scoped to source directories (<code>Edit(src/**)</code>) are usually fine too - the changes are visible in <code>git diff</code> before you commit them. That is the review step that makes the permission unnecessary.</p>
<h2>What never goes on the allowlist</h2>
<ul>
<li><p><code>git push</code> <strong>and anything that publishes.</strong> Keep it on <code>ask</code>. Publishing is the one step where a mistake leaves the building.</p>
</li>
<li><p><strong>Destructive filesystem commands.</strong> <code>rm -rf</code> belongs on <code>deny</code>, not <code>allow</code>. An agent that can delete freely will eventually delete the wrong thing confidently.</p>
</li>
<li><p><strong>Secrets files.</strong> Deny <code>Read</code> on <code>.env</code>, credential stores, and key material. Context that includes your secrets can end up in a prompt log or a generated file.</p>
</li>
<li><p><strong>Anything piped from the network.</strong> <code>curl ... | bash</code> should require a human every time.</p>
</li>
</ul>
<h2>The trap: allowlisting everything</h2>
<p>The frustrated response to prompt fatigue is <code>"allow": ["Bash(*)"]</code>. That converts the tool from supervised to unsupervised. The prompts are annoying precisely because they catch the moments that matter - the unexpected <code>DROP TABLE</code> inside a migration helper, the force-push hidden in a "fix the branch" request. Allowlist the boring 90% so you actually read the prompts on the dangerous 10%.</p>
<h2>Team-level settings</h2>
<p>Commit <code>.claude/settings.json</code> with the repo and new contributors inherit a sane baseline: tests and linters pre-approved, pushes and deletes gated, secrets unreadable. It is the same philosophy as a committed <code>.editorconfig</code> - one less thing every person configures alone. Review changes to it in pull requests like you would CI config, because it controls what automation can do unsupervised.</p>
<h2>The short version</h2>
<p>Prompt fatigue comes from a default that trusts nothing. Fix it with a <code>permissions</code> block: allowlist read-only and reversible commands, keep publishing and deletion behind <code>ask</code>, deny secrets outright, and commit the project file so the team shares one baseline.</p>
<hr />
<p><em>Want the settings file pre-built? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships a tuned</em> <code>settings.json</code> <em>permissions baseline, CLAUDE.md templates, and hook configs - 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Is Slow and Burning Tokens - How to Fix Both]]></title><description><![CDATA[Every prompt you send re-reads your context: CLAUDE.md, conversation history, tool results, loaded files. Slowness and token burn are the same problem wearing two hats - too much context, loaded too o]]></description><link>https://kitforge.hashnode.dev/claude-code-is-slow-and-burning-tokens-how-to-fix-both</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-is-slow-and-burning-tokens-how-to-fix-both</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 12:59:58 GMT</pubDate><content:encoded><![CDATA[<p>Every prompt you send re-reads your context: CLAUDE.md, conversation history, tool results, loaded files. Slowness and token burn are the same problem wearing two hats - too much context, loaded too often. Fix the context and both improve together.</p>
<h2>Fix 1: Shrink CLAUDE.md</h2>
<p>Every line of CLAUDE.md rides along on every single prompt. A 600-line file costs you on each message whether it is relevant or not. Keep it under 200 lines: rules only, no history, no API docs. Move reference material to separate files and import them when needed with <code>@docs/file.md</code> mentions in a task, not in the always-loaded file.</p>
<h2>Fix 2: Add a .claudeignore</h2>
<p>When Claude Code searches your repo, it searches everything it can see - including <code>node_modules/</code>, build output, and 40,000-line lockfiles. A <code>.claudeignore</code> file (same syntax as .gitignore) keeps searches fast and their results small:</p>
<pre><code class="language-plaintext">node_modules/
dist/
build/
coverage/
*.lock
package-lock.json
*.min.js
public/assets/
</code></pre>
<h2>Fix 3: Reference files directly</h2>
<p>"Find the authentication code and fix the token refresh" triggers a search-and-read sweep across the repo. "@src/auth/token.ts - the refresh logic here loops on 401" skips it. The search is the expensive part, not the edit. Point at files you already know.</p>
<h2>Fix 4: Smaller tasks, fresher sessions</h2>
<p>A long session accumulates dead context: every file read, every dead end, every abandoned approach stays in the conversation and gets re-sent with each prompt. Symptoms: responses get slower and vaguer as the session ages. Run <code>/clear</code> between tasks. One task per session is not too fine-grained - it is the default that keeps each prompt cheap.</p>
<h2>Fix 5: Audit MCP servers and hooks</h2>
<p>Every connected MCP server injects its tool schemas into every prompt. Three servers you tried once and forgot about can cost more context than your CLAUDE.md. List what is connected, remove what you do not use weekly. The same goes for hooks that dump large outputs into context on every tool call - keep hook output to a line or two.</p>
<h2>Fix 6: Measure before optimizing</h2>
<p>Run <code>/cost</code> (or your client's usage view) before and after each change. The fix that matters depends on your repo: a monorepo with no ignore file is Fix 2; a year-old CLAUDE.md is Fix 1; a week-long session is Fix 4. Guess and you will optimize the wrong one.</p>
<h2>The short version</h2>
<p>Context is the currency. Spend it on the task, not on re-reading lockfiles and month-old conversations. A lean CLAUDE.md, a .claudeignore, direct file references, and short sessions cover most of the waste.</p>
<hr />
<p><em>Want the lean setup pre-built? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships a tight CLAUDE.md baseline, ready-made .claudeignore templates, and hook configs tuned to stay quiet - 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Cursor Ignores Your Rules - .cursorrules vs .cursor/rules and How to Fix It]]></title><description><![CDATA[You wrote rules for Cursor. Cursor wrote code that breaks them. This is almost never the model being disobedient - it is one of five configuration mistakes that leave your rules unloaded, unscoped, or]]></description><link>https://kitforge.hashnode.dev/cursor-ignores-your-rules-cursorrules-vs-cursor-rules-and-how-to-fix-it</link><guid isPermaLink="true">https://kitforge.hashnode.dev/cursor-ignores-your-rules-cursorrules-vs-cursor-rules-and-how-to-fix-it</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 12:19:13 GMT</pubDate><content:encoded><![CDATA[<p>You wrote rules for Cursor. Cursor wrote code that breaks them. This is almost never the model being disobedient - it is one of five configuration mistakes that leave your rules unloaded, unscoped, or drowned out. Here is how to tell which one you have.</p>
<h2>Cause 1: You are still using .cursorrules</h2>
<p>The single <code>.cursorrules</code> file at the repo root is the legacy format. Cursor has moved to the <code>.cursor/rules/</code> directory of <code>.mdc</code> files, and the legacy file is on the deprecation path - some versions load it, some ignore it, and it never gets the scoping features. If your rules live in <code>.cursorrules</code>, migrate them first. The new format adds frontmatter that controls when the rule applies:</p>
<pre><code class="language-plaintext">---
description: Next.js App Router conventions
globs: src/app/**/*
alwaysApply: false
---

- Server Components by default; add "use client" only for interactivity.
- Data fetching in the page or layout, not in client components.
- Route handlers in route.ts, never pages/api.
</code></pre>
<h2>Cause 2: No glob scoping, so rules compete</h2>
<p>A rule file with no <code>globs</code> and <code>alwaysApply: false</code> is matched by description alone - Cursor decides from the description whether the rule is relevant to the current file. Vague description, rule skipped. Scope each rule to the paths it governs:</p>
<pre><code class="language-plaintext">---
description: Database migration safety
globs: prisma/migrations/**/*, db/migrations/**/*
alwaysApply: true
---

- Never edit an existing migration. Create a new one.
- Destructive changes (DROP, column removal) need a comment explaining the rollback.
</code></pre>
<h2>Cause 3: alwaysApply everywhere (or nowhere)</h2>
<p><code>alwaysApply: true</code> puts the rule in every prompt. Set it on ten files and you have recreated the 900-line CLAUDE.md problem - every rule diluted by every other rule. Reserve <code>alwaysApply</code> for the handful of project-wide rules (package manager, test command, forbidden paths). Everything else gets a glob.</p>
<h2>Cause 4: Contradictory rule files</h2>
<p>Two rules that disagree ("use default exports" in one, "named exports only" in another) do not average out - the model follows whichever loaded last or reads louder in context. Audit the whole <code>.cursor/rules/</code> directory the way you would review a diff: one owner per decision, overlaps merged, losers deleted.</p>
<h2>Cause 5: Prose instead of rules</h2>
<p>Same failure as every agent config: "try to keep things tidy and consistent" is untestable. Working rules are one line, trigger plus action:</p>
<pre><code class="language-plaintext">- Always run `pnpm test:unit` before declaring a task done.
- When you add a component, add a story in the same folder.
- Never import from @/legacy in new code.
</code></pre>
<h2>Verify like you would any config</h2>
<p>After changing rules, open a file the rule should govern and ask: "Which rules apply to this file?" Cursor will list them. A missing rule means a loading problem (Causes 1-3), not a behavior problem - fix the config before blaming the model.</p>
<hr />
<p><em>Want the migration done for you? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships ready-made .mdc rule packs for Next.js, Python, Go, and more - with glob scoping and alwaysApply already set correctly - plus CLAUDE.md templates and hook configs. 34 files, $19 one-time. A free Next.js .mdc example is on</em> <a href="https://github.com/kitforgedev/claude-md-templates"><em>GitHub</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Ignores Your CLAUDE.md - Why and How to Fix It]]></title><description><![CDATA[You wrote a careful CLAUDE.md. You told it which test command to run, which files are off-limits, which style to follow. Two prompts later, Claude Code runs the wrong test suite and reformats a file y]]></description><link>https://kitforge.hashnode.dev/claude-code-ignores-your-claude-md-why-and-how-to-fix-it</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-ignores-your-claude-md-why-and-how-to-fix-it</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Sat, 12 Sep 2026 10:17:15 GMT</pubDate><content:encoded><![CDATA[<p>You wrote a careful CLAUDE.md. You told it which test command to run, which files are off-limits, which style to follow. Two prompts later, Claude Code runs the wrong test suite and reformats a file you marked untouchable. The file is not broken. One of five specific problems is, and each has a specific fix.</p>
<h2>Cause 1: The file is not actually loaded</h2>
<p>Claude Code reads CLAUDE.md from specific places: the project root (<code>./CLAUDE.md</code>), your user home (<code>~/.claude/CLAUDE.md</code>), and parent directories of where you launched it. A file named <code>claude.md</code> on a case-sensitive filesystem, sitting in <code>docs/</code>, or created after the session started will be silently ignored.</p>
<p>Check what is loaded with the <code>/memory</code> command inside Claude Code. It lists every memory file in play. If yours is not listed, nothing else in this post matters until you move it.</p>
<h2>Cause 2: The file is too long</h2>
<p>CLAUDE.md goes into the context of every single prompt. A 900-line file is not documentation; it is noise your actual instructions drown in. The model weights recent, short, clearly formatted text. Your rule about migrations is competing with 850 lines of architecture history.</p>
<p>Target under 200 lines. Move reference material out to separate files and pull it in only when needed with imports:</p>
<pre><code class="language-plaintext"># CLAUDE.md
See @docs/api-conventions.md when editing anything under src/api/.
</code></pre>
<h2>Cause 3: Your rules are prose, not rules</h2>
<p>"We generally prefer to keep components reasonably small and consistent with the existing style" is a wish. The agent cannot test it, so it cannot follow it. Rules that work have a trigger and an action:</p>
<pre><code class="language-plaintext">## Rules
- Run tests with `pnpm test:unit`, never `npm test`.
- When you add an API route, also add a zod schema in schemas/.
- Never edit files under generated/ - run `pnpm codegen` instead.
- Components stay under 150 lines. Extract helpers when you hit the limit.
</code></pre>
<p>One line per rule. Start with Always, Never, or When. If you cannot phrase it as a condition and an action, it does not belong in the file.</p>
<h2>Cause 4: Contradictions across your config</h2>
<p>If CLAUDE.md says "use tabs," .cursorrules says "use spaces," and your first prompt says "match existing style," the agent picks whichever instruction is loudest in context - usually not the one you meant. Audit every instruction file in the repo (CLAUDE.md, .cursorrules, .github/copilot-instructions.md, AGENTS.md) and make them agree, or delete the losers.</p>
<h2>Cause 5: You never verified, so drift went unnoticed</h2>
<p>Memory is advisory. In a long session the model can literally forget mid-conversation. Two habits fix this:</p>
<ul>
<li><p>Start sessions with: "What rules from CLAUDE.md apply to this task?" A wrong answer means a loading problem (Cause 1), not a behavior problem.</p>
</li>
<li><p>For rules that must never break - do not touch .env, never force-push, always run the linter - use a hook instead of memory. Hooks run as code, not as suggestions. A PreToolUse hook blocks the action no matter what the model decided:</p>
</li>
</ul>
<pre><code class="language-json">{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Edit|Write",
      "hooks": [{
        "type": "command",
        "command": "f=$(jq -r '.tool_input.file_path'); case \"$f\" in *.env*) echo 'Blocked: .env files are read-only for agents' &gt;&amp;2; exit 2;; esac; exit 0"
      }]
    }]
  }
}
</code></pre>
<p>Full hook configs, including plan-gating and legacy-path protection, are in the <a href="https://kitforgehq.surge.sh/blog/claude-code-hooks-examples/">hooks examples post</a>.</p>
<h2>The short version</h2>
<p>Check <code>/memory</code> first. Then shorten the file, sharpen the rules into trigger-action lines, kill contradictions, and move the non-negotiables into hooks. A CLAUDE.md that fits on one screen, written in imperatives, with hooks behind it, is followed. A long one, written in prose, is decoration.</p>
<hr />
<p><em>Want this pre-packaged? The</em> <a href="https://kitforgedev.itch.io/agentic-coding-kit"><em>Agentic Coding Kit</em></a> <em>ships a tight CLAUDE.md baseline, five stack-specific templates, hook configs, and review checklists - 34 files, $19 one-time. Or start free with the</em> <a href="https://kitforgehq.surge.sh/generator/"><em>CLAUDE.md generator</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Keeps Editing Files It Shouldn't - How to Stop It]]></title><description><![CDATA[Ask Claude Code to fix one function and it "improves" three neighboring files, renames your utilities, and reformats a config you were afraid to touch since March. If this sounds familiar, you do not ]]></description><link>https://kitforge.hashnode.dev/claude-code-keeps-editing-files-it-shouldn-t-how-to-stop-it</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-keeps-editing-files-it-shouldn-t-how-to-stop-it</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 23:37:35 GMT</pubDate><content:encoded><![CDATA[<p>Ask Claude Code to fix one function and it "improves" three neighboring files, renames your utilities, and reformats a config you were afraid to touch since March. If this sounds familiar, you do not have a prompting problem. You have a scope problem, and scope problems are fixed with constraints the agent cannot talk its way out of.</p>
<p>Here are five fixes, ordered from "do this today" to "belt and suspenders."</p>
<h2>Why it happens</h2>
<p>The agent is optimizing for "task looks complete," not "diff stays small." Anything that plausibly blocks the task - an outdated helper, a mismatched type, a TODO comment - looks like part of the job. Telling it "be careful" does nothing, because careful is not measurable. Scope is.</p>
<h2>Fix 1: A scope rule in CLAUDE.md</h2>
<p>Put an explicit boundary at the top of your CLAUDE.md, phrased as a rule with an action:</p>
<pre><code>## Ground rules

- Stay in scope: touch only the files the task requires.
  If you believe a change outside the diff is needed, stop and ask first.
- Never modify: .env*, migrations/, generated/, package-lock.json.
</code></pre>
<p>This alone cuts the problem down noticeably. It is still advisory - the agent can forget it in a long session - which is why the next fixes exist.</p>
<h2>Fix 2: Permission deny rules in settings.json</h2>
<p>Claude Code supports permission rules that flat-out deny tool calls against path patterns. In <code>.claude/settings.json</code>:</p>
<pre><code class="language-json">{
  "permissions": {
    "deny": [
      "Edit(.env*)",
      "Edit(migrations/**)",
      "Write(migrations/**)",
      "Edit(package-lock.json)"
    ]
  }
}
</code></pre>
<p>Denied calls fail no matter what the agent decides mid-task. This is the right place for files that should never change: environment files, lockfiles, generated code, migration history.</p>
<h2>Fix 3: A PreToolUse hook for judgment calls</h2>
<p>For anything subtler than "never touch this," a hook can intercept every edit and apply your own logic. This one blocks edits to any file under <code>src/legacy/</code> unless a plan file exists:</p>
<pre><code class="language-json">{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Edit|Write",
      "hooks": [{
        "type": "command",
        "command": "f=$(jq -r '.tool_input.file_path'); case \"$f\" in *src/legacy/*) test -f .claude/plan.md || { echo 'Blocked: src/legacy changes need .claude/plan.md' &gt;&amp;2; exit 2; };; esac; exit 0"
      }]
    }]
  }
}
</code></pre>
<p>Exit code 2 blocks the call and feeds the message back to the agent, so it learns the boundary instead of silently failing.</p>
<h2>Fix 4: Require a plan before edits</h2>
<p>Most scope creep happens when the agent starts editing before it has a plan. A one-line hook flips the order: no <code>.claude/plan.md</code>, no edits. The agent writes the plan, you glance at it, and the diff that follows matches the plan you approved.</p>
<h2>Fix 5: A review checklist you actually run</h2>
<p>Constraints reduce the problem; review catches what leaks through. Keep a short list in the repo and make "diff reviewed against it" part of done:</p>
<pre><code>- [ ] Diff touches only files named in the task or plan
- [ ] No changes to .env, lockfiles, migrations, generated code
- [ ] Tests pass; new behavior has a failing-then-passing test
</code></pre>
<h2>Putting it together</h2>
<p>The reliable setup is layered: CLAUDE.md sets expectations, deny rules hard-block the untouchable files, a hook enforces process, and a checklist catches the rest. Each layer is a few lines of config. Together they turn "please stay in scope" into something structural.</p>
<hr />
<p><em>This post first appeared on the <a href="https://kitforgehq.surge.sh/blog/claude-code-keeps-editing-files/">Kitforge blog</a>. Kitforge makes <a href="https://kitforgedev.itch.io/agentic-coding-kit">The Agentic Coding Kit</a> - 34 drop-in templates (scope rules, deny lists, hook configs, review checklists) that make AI coding agents behave like senior teammates. The CLAUDE.md templates and hooks pack are free on <a href="https://github.com/kitforgedev/claude-md-templates">GitHub</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Agent Guardrails: 6 Rules That Keep Agents Useful (Not Dangerous)]]></title><description><![CDATA[Every team that adopts an AI coding agent goes through the same arc: week one is magic, week three is an incident - the agent deletes a migration, adds four dependencies, or refactors a file nobody as]]></description><link>https://kitforge.hashnode.dev/ai-coding-agent-guardrails-6-rules-that-keep-agents-useful-not-dangerous</link><guid isPermaLink="true">https://kitforge.hashnode.dev/ai-coding-agent-guardrails-6-rules-that-keep-agents-useful-not-dangerous</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 19:47:32 GMT</pubDate><content:encoded><![CDATA[<p>Every team that adopts an AI coding agent goes through the same arc: week one is magic, week three is an incident - the agent deletes a migration, adds four dependencies, or refactors a file nobody asked it to touch. Then the team writes guardrails. Here are the six that actually stick, in the order teams usually add them.</p>
<h2>1. Freeze the dependency tree</h2>
<p>The single most common agent surprise: a new package appears in package.json because the agent "needed" it. It didn't. The rule is one line: <em>never add a dependency without asking.</em> This lives in your CLAUDE.md or rules file, and the serious version is a hook that blocks edits to lockfiles outright.</p>
<p>Every dependency is a supply-chain decision, a license decision, and a maintenance decision. An agent optimizing for "make the test pass" will happily import a 2019 package with three CVEs.</p>
<h2>2. Scope the edit surface</h2>
<p>Tell the agent where it's allowed to work. "Only touch files under <code>src/features/checkout/</code>" turns a possible repo-wide refactor into a reviewable diff. Claude Code's subdirectory CLAUDE.md files and Cursor's glob-scoped rules both exist for this - a rule placed in a folder only activates when the agent works there.</p>
<h2>3. No tests, no "done"</h2>
<p>Agents are optimists. Left alone, "done" means "the code is written." The fix is a definition of done with teeth: <em>a task is finished when the tests pass and you've shown the output.</em> Pair it with a PostToolUse hook that runs your fast test suite after every edit and the optimism problem mostly disappears.</p>
<h2>4. Protect the files agents love to break</h2>
<p>Every repo has them: .env, migrations, CI configs, the generated lockfile, the one legacy file held together by hope. List them by name. A PreToolUse hook can hard-block edits:</p>
<pre><code class="language-json">"matcher": "Edit|Write",
"command": "jq -r '.tool_input.file_path' | grep -qE '\\.env|migrations/|package-lock' &amp;&amp; echo 'Blocked: protected file' &gt;&amp;2 &amp;&amp; exit 2 || exit 0"
</code></pre>
<p>The agent routes around the block - that's the point. It asks you instead of apologizing later.</p>
<h2>5. Keep the audit trail</h2>
<p>When something breaks at 5 PM, "the agent did it" is not an answer. Two cheap habits: a hook that appends every bash command to a log file, and a rule that commits stay small and frequent so <code>git log</code> tells the story. Both take minutes to set up and pay off the first time you need them.</p>
<h2>6. Humans own the irreversible steps</h2>
<p>Force-pushes, schema migrations against production, deleting branches, publishing packages, deploying: these are the human's job. Write it down. Agents are excellent at preparing these steps - the migration file, the release notes, the deploy command - and should stop one step short of running them.</p>
<h2>The pattern underneath</h2>
<p>None of these are about making the agent smarter. They're about making the environment honest: fast feedback (tests), hard boundaries (hooks, scopes), and a paper trail (logs, small commits). A mediocre agent in an honest environment beats a brilliant agent in a chaotic one.</p>
<hr />
<p>All six, pre-built: the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> ships these guardrails as drop-in CLAUDE.md sections and ready-made hooks, plus 28 more templates - $19 one-time. Or start free with the <a href="https://kitforgehq.surge.sh/generator/">Kitforge generator</a>.</p>
<p><em>Cross-posted from the</em> <a href="https://kitforgehq.surge.sh/blog/ai-coding-agent-guardrails/"><em>Kitforge blog</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[CLAUDE.md vs .cursorrules: What's the Difference and Which Do You Need?]]></title><description><![CDATA[If you use Claude Code or Cursor, you've heard you need a rules file. The confusing part: each tool has its own filename, its own loading rules, and its own scope system. Here's the practical differen]]></description><link>https://kitforge.hashnode.dev/claude-md-vs-cursorrules-what-s-the-difference-and-which-do-you-need</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-md-vs-cursorrules-what-s-the-difference-and-which-do-you-need</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 19:33:19 GMT</pubDate><content:encoded><![CDATA[<p>If you use Claude Code or Cursor, you've heard you need a rules file. The confusing part: each tool has its own filename, its own loading rules, and its own scope system. Here's the practical difference, and how to run both without maintaining two copies of everything.</p>
<h2>The short version</h2>
<ul>
<li><p><strong>CLAUDE.md</strong> is read by Claude Code (the terminal agent) at session start and stays in context the whole session. Best for long-horizon instructions: build commands, workflows, definition of done.</p>
</li>
<li><p><strong>.cursorrules</strong> (legacy) or <strong>.cursor/rules/*.mdc</strong> (modern) attach per-request in the Cursor editor. Best for inline-edit behavior: style, import rules, per-filetype conventions.</p>
</li>
</ul>
<p>Both support nesting: Claude Code loads subdirectory CLAUDE.md files when it touches those files; Cursor rules use glob patterns to decide what attaches.</p>
<h2>CLAUDE.md: the session constitution</h2>
<p>Claude Code reads CLAUDE.md at session start and keeps it in context the whole time. That makes it the right place for things the agent must never forget:</p>
<ul>
<li><p>Build, test, and lint commands (so it stops guessing)</p>
</li>
<li><p>Commit and PR conventions</p>
</li>
<li><p>Hard prohibitions: don't touch .env, don't add dependencies, don't reformat untouched files</p>
</li>
<li><p>Definition of done: "run the tests before you say finished"</p>
</li>
</ul>
<p>Because sessions run long and edit many files, brevity matters: a 300-line CLAUDE.md gets skimmed like any long document. Keep the root file under ~100 lines and push detail into subdirectory files and slash commands.</p>
<h2>.cursorrules: the pair-programmer's margin notes</h2>
<p>Cursor's rules attach to individual requests. The modern <code>.cursor/rules/*.mdc</code> format lets each rule declare when it applies: always, when matching file globs are open, or only when invoked. That makes Cursor rules the right place for:</p>
<ul>
<li><p>Per-language style ("React components use named exports")</p>
</li>
<li><p>Import and path conventions</p>
</li>
<li><p>Framework-specific patterns that only matter when that framework's files are open</p>
</li>
</ul>
<p>The legacy single <code>.cursorrules</code> file still works, but it applies to everything - the same skim problem as a long CLAUDE.md. New setups should use the rules directory.</p>
<h2>Running both without going insane</h2>
<p>Teams using both tools hit the same trap: two files drift apart, and each tool learns a different version of your conventions. Three rules prevent it:</p>
<ol>
<li><p><strong>One source of truth for the overlap.</strong> Put shared conventions in CLAUDE.md and make the Cursor rule a three-liner that says "read CLAUDE.md." Both tools can read files.</p>
</li>
<li><p><strong>Tool-specific rules stay tool-specific.</strong> Cursor's inline-edit rules mention Cursor features; Claude Code's workflow rules mention slash commands and subagents.</p>
</li>
<li><p><strong>Review rules changes like code changes.</strong> A sloppy rule costs you every session after you merge it.</p>
</li>
</ol>
<h2>What about AGENTS.md?</h2>
<p>AGENTS.md is the emerging cross-tool standard (Codex, Amp, and others read it; Cursor and Claude Code can be pointed at it). If your team uses three or more tools, AGENTS.md as the shared file plus tiny tool-specific stubs is the cleanest 2026 setup. The content principles don't change - only the filename does.</p>
<hr />
<p>Skip the blank page: the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> ships paired CLAUDE.md and .cursorrules templates that stay in sync by design, plus subdirectory scoping examples, subagent configs, and review checklists - 34 files, $19 one-time. Or build a free baseline with the <a href="https://kitforgehq.surge.sh/generator/">Kitforge generator</a>.</p>
<p><em>Cross-posted from the</em> <a href="https://kitforgehq.surge.sh/blog/claude-md-vs-cursorrules/"><em>Kitforge blog</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[5 Claude Code Hooks Examples That Prevent Real Mistakes]]></title><description><![CDATA[Hooks are Claude Code's most underused feature. A hook is a shell command that runs automatically at a specific point in the agent's lifecycle - before a tool runs, after a file is written, when the a]]></description><link>https://kitforge.hashnode.dev/5-claude-code-hooks-examples-that-prevent-real-mistakes</link><guid isPermaLink="true">https://kitforge.hashnode.dev/5-claude-code-hooks-examples-that-prevent-real-mistakes</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 19:19:42 GMT</pubDate><content:encoded><![CDATA[<p>Hooks are Claude Code's most underused feature. A hook is a shell command that runs automatically at a specific point in the agent's lifecycle - before a tool runs, after a file is written, when the agent tries to stop. They live in <code>.claude/settings.json</code> and they turn "please remember to" rules into actual enforcement.</p>
<p>Here are five hooks worth copying and what each one fixes.</p>
<h2>How hooks work in 60 seconds</h2>
<p>Hooks are defined per event. The two you'll use most:</p>
<ul>
<li><p><strong>PreToolUse</strong> - runs before a tool call. Exit code 2 blocks the call and feeds your message back to the agent.</p>
</li>
<li><p><strong>PostToolUse</strong> - runs after a tool call. Perfect for formatters and tests.</p>
</li>
</ul>
<p>Each hook gets a <code>matcher</code> (a regex against the tool name) and a shell command that receives JSON about the call on stdin.</p>
<h2>1. Block edits to .env files</h2>
<p><strong>Fixes:</strong> the agent cheerfully pasting a live API key into a committed file.</p>
<pre><code class="language-json">{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Edit|Write",
      "hooks": [{
        "type": "command",
        "command": "jq -r '.tool_input.file_path' | grep -q '\\.env' &amp;&amp; echo 'Blocked: never edit .env files' &gt;&amp;2 &amp;&amp; exit 2 || exit 0"
      }]
    }]
  }
}
</code></pre>
<p>Exit code 2 means "block this and tell the agent why." The agent adjusts immediately instead of you discovering the problem after commit.</p>
<h2>2. Run the test suite after every code edit</h2>
<p><strong>Fixes:</strong> the agent declaring victory with broken tests.</p>
<pre><code class="language-json">"PostToolUse": [{
  "matcher": "Edit|Write",
  "hooks": [{
    "type": "command",
    "command": "jq -r '.tool_input.file_path' | grep -qE '\\.(ts|js|py)$' &amp;&amp; npm test --silent || exit 0"
  }]
}]
</code></pre>
<p>Scope it to your fast unit tests, or pair it with a Stop hook for the slow pass.</p>
<h2>3. Auto-format on write</h2>
<p><strong>Fixes:</strong> style drift and lint noise in review.</p>
<pre><code class="language-json">"PostToolUse": [{
  "matcher": "Edit|Write",
  "hooks": [{
    "type": "command",
    "command": "f=$(jq -r '.tool_input.file_path'); npx prettier --write \"$f\" &gt;/dev/null 2&gt;&amp;1; exit 0"
  }]
}]
</code></pre>
<p>The agent never sees this happen. Your diffs stay clean.</p>
<h2>4. Require a plan file before edits</h2>
<p><strong>Fixes:</strong> the agent spray-editing eight files when you wanted a two-line change.</p>
<pre><code class="language-json">"PreToolUse": [{
  "matcher": "Edit",
  "hooks": [{
    "type": "command",
    "command": "test -f .claude/plan.md || { echo 'Blocked: write .claude/plan.md first' &gt;&amp;2; exit 2; }"
  }]
}]
</code></pre>
<p>Brutal, but effective for big refactors. Delete the plan file when you want freeform mode back.</p>
<h2>5. Log every bash command</h2>
<p><strong>Fixes:</strong> the "what did it actually do?" archaeology session.</p>
<pre><code class="language-json">"PreToolUse": [{
  "matcher": "Bash",
  "hooks": [{
    "type": "command",
    "command": "jq -r '.tool_input.command' &gt;&gt; .claude/bash-history.log; exit 0"
  }]
}]
</code></pre>
<p>Add <code>.claude/*.log</code> to .gitignore and you get a full audit trail for free.</p>
<h2>The gotchas nobody mentions</h2>
<ul>
<li><p><strong>Hooks run with your permissions.</strong> A bad hook can break every tool call. Test the command standalone first.</p>
</li>
<li><p><strong>Keep them fast.</strong> A 10-second test suite on every edit makes the agent feel broken. Move slow checks to the Stop event.</p>
</li>
<li><p><strong>Only stderr + exit 2 reaches the agent.</strong> Write for that channel.</p>
</li>
</ul>
<hr />
<p>Want these without the config archaeology? The <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> ships a ready-made hooks pack plus 29 other templates - $19 one-time, drop into any repo. Or generate a free CLAUDE.md baseline with the <a href="https://kitforgehq.surge.sh/generator/">Kitforge generator</a>.</p>
<p><em>Cross-posted from the</em> <a href="https://kitforgehq.surge.sh/blog/claude-code-hooks-examples/"><em>Kitforge blog</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Where to Find Cursor Rules (and How to Judge Them)]]></title><description><![CDATA[Cursor rules (the old .cursorrules file, or the newer .cursor/rules directory) are the highest-leverage config most Cursor users never set up. Here is where people actually find them in 2026, and how ]]></description><link>https://kitforge.hashnode.dev/where-to-find-cursor-rules-and-how-to-judge-them</link><guid isPermaLink="true">https://kitforge.hashnode.dev/where-to-find-cursor-rules-and-how-to-judge-them</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 19:04:13 GMT</pubDate><content:encoded><![CDATA[<p>Cursor rules (the old <code>.cursorrules</code> file, or the newer <code>.cursor/rules</code> directory) are the highest-leverage config most Cursor users never set up. Here is where people actually find them in 2026, and how to judge what you find.</p>
<h2>1. Community directories</h2>
<p>Sites like cursor.directory collect rules by framework and language. Good for seeing conventions and stealing phrasing. The weakness: most entries are unreviewed, so popularity tracks "posted early" more than "works well." Treat them as inspiration, not gospel.</p>
<h2>2. Awesome-lists on GitHub</h2>
<p>Several awesome-cursorrules repos collect files per stack. Same caveat as directories, plus bit-rot: rules written for 2024 models often fight 2026 behavior. Check the last commit date before copying anything.</p>
<h2>3. Generators</h2>
<p>Rules generators ask about your stack and emit a tailored file. This beats copying a stranger's file because the output names YOUR tools, not theirs. The best use of a directory is as a checklist of topics to include; the best source of the actual text is a generator or your own hand.</p>
<h2>The 60-second quality test</h2>
<p>Before you adopt any rules file, scan it for four things:</p>
<p><strong>Specificity.</strong> "Write clean code" is noise. "Use the existing cn() helper for conditional classes" is a rule.</p>
<p><strong>Brevity.</strong> Over about 100 lines the model skims, like people do. Long files should move detail into scoped <code>.cursor/rules</code> files.</p>
<p><strong>Negative rules.</strong> The highest-value lines are prohibitions: don't add dependencies, don't reformat untouched code, don't commit .env.</p>
<p><strong>A definition of done.</strong> "Run the tests before declaring finished" saves more time than any style rule.</p>
<h2>When to write your own</h2>
<p>Always, eventually. Borrowed rules describe someone else's repo. Start from a template or generator output, then add a line every time the AI annoys you twice. After a month you have a rules file that fits like a glove - and it took five minutes at a time.</p>
<hr />
<p>Start here: the <a href="https://kitforgehq.surge.sh/generator/">free Kitforge generator</a> builds a CLAUDE.md or .cursorrules for your stack in about a minute, with a shareable link for your team. For the deep bench - subagents, slash commands, review checklists, git hooks - the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> is 34 templates for $19, one-time.</p>
<p><em>Cross-posted from the</em> <a href="https://kitforgehq.surge.sh/blog/cursor-rules-directory/"><em>Kitforge blog</em></a><em>.</em></p>
]]></content:encoded></item><item><title><![CDATA[The .cursorrules Template That Tames Cursor (Copy, Then Customize)]]></title><description><![CDATA[Cursor's rules file is the difference between an assistant that writes code your team recognizes and one that invents its own conventions on every prompt. Here is a template that covers the sections t]]></description><link>https://kitforge.hashnode.dev/the-cursorrules-template-that-tames-cursor-copy-then-customize</link><guid isPermaLink="true">https://kitforge.hashnode.dev/the-cursorrules-template-that-tames-cursor-copy-then-customize</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 18:49:10 GMT</pubDate><content:encoded><![CDATA[<p>Cursor's rules file is the difference between an assistant that writes code your team recognizes and one that invents its own conventions on every prompt. Here is a template that covers the sections that matter, with the reasoning for each. Copy it, then replace every bracketed line with your project's truth.</p>
<h2>The template</h2>
<pre><code># Project
[One sentence: what this repo is and who uses it.]
Stack: [Next.js 15 / FastAPI / Rails - name exact versions]
Package manager: [pnpm / uv / poetry - the agent will guess wrong]

# Hard rules
- Make the smallest change that satisfies the request. Do not
  refactor untouched code.
- Only use dependencies already in the project. Name any new one
  and stop before adding it.
- Never commit .env, credentials, or anything under /secrets.
- Match existing style: [quote style, naming, import order - point
  at a reference file]

# Architecture
- [Where things live: app/, src/, lib/, and what belongs in each]
- [The boundaries: what never imports from what]

# Testing
- Run tests with: [exact command]
- A task is not done until tests pass. Show the output.
- New behavior needs a test that fails without the change.

# When stuck
If two approaches fail, stop and describe the blocker in plain
language. Do not improvise a third approach.
</code></pre>
<h2>Why each section earns its place</h2>
<p><strong>Project + stack.</strong> The agent hallucinates versions constantly. Naming "pnpm" alone prevents a class of lockfile corruption.</p>
<p><strong>Hard rules.</strong> Prohibitions outperform suggestions. "Never commit .env" stops a leak; "be careful with secrets" does not. Every rule here should be a scar from a real incident - yours or someone else's.</p>
<p><strong>Architecture.</strong> Without boundaries, the agent puts new code wherever the cursor was. Two lines of "what lives where" prevent the slow sprawl that makes a repo unreviewable.</p>
<p><strong>Testing.</strong> The single most important line in any rules file is the requirement to show test output. Agents that must show evidence stop declaring victory over red suites.</p>
<p><strong>When stuck.</strong> This is the safety valve. An agent with permission to stop asks good questions. An agent without it guesses, and guesses on load-bearing decisions are how databases get dropped.</p>
<h2>.cursorrules vs .cursor/rules</h2>
<p>Cursor is moving to a <code>.cursor/rules/</code> directory where each file can carry a glob scope (e.g. Python rules that only load for *.py files). The template above works in both places. If you use the directory, split it: <code>general.mdc</code> for the hard rules, one file per stack section.</p>
<hr />
<p>Want this tailored to your stack instead of templated? The <a href="https://kitforgehq.surge.sh/generator/">free Kitforge generator</a> asks five questions and emits a ready-to-paste file. For the full system - CLAUDE.md presets, subagents, slash commands, hooks, review checklists - the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> has all 34 files for $19 one-time.</p>
<p><em>Cross-posted from the <a href="https://kitforgehq.surge.sh/blog/cursor-rules-template/">Kitforge blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[5 .cursorrules Examples Worth Copying (and What Each One Fixes)]]></title><description><![CDATA[Cursor reads a .cursorrules file at the root of your project and treats it as standing instructions for every chat and edit. Without one, the AI guesses your conventions from whatever file is open - a]]></description><link>https://kitforge.hashnode.dev/5-cursorrules-examples-worth-copying-and-what-each-one-fixes</link><guid isPermaLink="true">https://kitforge.hashnode.dev/5-cursorrules-examples-worth-copying-and-what-each-one-fixes</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 18:31:09 GMT</pubDate><content:encoded><![CDATA[<p>Cursor reads a <code>.cursorrules</code> file at the root of your project and treats it as standing instructions for every chat and edit. Without one, the AI guesses your conventions from whatever file is open - and guesses wrong often enough to cost you real review time. Each example below fixes a specific, common failure. Copy the one that matches your pain.</p>
<h2>1. The general starter</h2>
<p>Fixes: the AI rewriting half your file to change one line, and inventing libraries you do not use.</p>
<pre><code>Make the smallest change that satisfies the request. Do not refactor
surrounding code unless asked.
Only use dependencies already in the project. If a new one seems
necessary, stop and name it first.
Match the existing code style: quote style, indentation, naming.
When the request is ambiguous, ask one question instead of guessing.
</code></pre>
<h2>2. The Next.js / React ruleset</h2>
<p>Fixes: client components creeping everywhere, and data fetching in the wrong layer.</p>
<pre><code>This is a Next.js App Router project with TypeScript and Tailwind.
Default to server components. Add "use client" only when the component
uses state, effects, or browser APIs.
Fetch data in server components or route handlers, never in useEffect.
Use the existing cn() helper for conditional classes.
Forms use react-hook-form with zod schemas from /lib/validators.
</code></pre>
<h2>3. The Python ruleset</h2>
<p>Fixes: untyped function soup and print() debugging left in commits.</p>
<pre><code>Python 3.12, type hints on all public functions, pydantic for data
shapes. No bare except. Use structlog, never print.
Tests go in tests/ and use pytest fixtures from conftest.py.
Functions over classes unless the class models a real entity.
Keep functions under 40 lines; extract helpers rather than nesting.
</code></pre>
<h2>4. The API discipline ruleset</h2>
<p>Fixes: breaking API contracts silently and inconsistent error shapes.</p>
<pre><code>Never change a public endpoint's request or response shape without
updating openapi.yaml in the same change.
All errors return {"error": {"code", "message"}} with the right HTTP
status. No stack traces in responses.
Validate input at the boundary with zod; trust nothing downstream.
New endpoints need at least one integration test.
</code></pre>
<h2>5. The git and commit ruleset</h2>
<p>Fixes: the AI staging unrelated files and writing novels in commit messages.</p>
<pre><code>When asked to commit: stage only files you changed for this task.
Commit messages are imperative, under 72 characters, no emoji.
Never commit .env files, credentials, or files under /secrets.
Never force-push or amend published commits unless explicitly told.
</code></pre>
<h2>How to combine these</h2>
<p>Start with the general starter, then add the stack-specific block that matches your project. Keep the whole file under about 100 lines - long rules files get skimmed by the model just like long READMEs get skimmed by people. Put the rules that hurt most when broken at the top.</p>
<p>One caveat: Cursor is phasing in <code>.cursor/rules</code> directory files with per-file glob scoping, which is the better long-term home for stack rules. The same text works in both places.</p>
<hr />
<p>Want a tailored file instead of a template? The <a href="https://kitforgehq.surge.sh/generator/">free Kitforge generator</a> builds a CLAUDE.md or .cursorrules for your stack in about a minute. And the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> ships 34 ready-made rules, subagents, and workflows for $19 one-time.</p>
<p><em>Cross-posted from the <a href="https://kitforgehq.surge.sh/blog/cursorrules-examples/">Kitforge blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Best Practices: 9 Habits That Keep AI Coding Agents Productive]]></title><description><![CDATA[After months of running Claude Code across real projects, the difference between a session that ships and a session that spirals is rarely the model. It is the setup around it. These nine habits are t]]></description><link>https://kitforge.hashnode.dev/claude-code-best-practices-9-habits-that-keep-ai-coding-agents-productive</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-best-practices-9-habits-that-keep-ai-coding-agents-productive</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 18:15:34 GMT</pubDate><content:encoded><![CDATA[<p>After months of running Claude Code across real projects, the difference between a session that ships and a session that spirals is rarely the model. It is the setup around it. These nine habits are the ones that stuck.</p>
<h2>1. Write the rules down before you prompt</h2>
<p>An empty CLAUDE.md means the agent infers conventions from whatever file happens to be open. Put your stack, style rules, and prohibitions in CLAUDE.md once, and every session starts aligned. Five minutes here saves an hour of review.</p>
<h2>2. Scope every task to one diff</h2>
<p>"Add auth" spirals. "Add a login endpoint that takes email and password and returns a session token" ships. If you cannot describe the change in one sentence, split it.</p>
<h2>3. Make the agent run the tests</h2>
<p>Never accept "the tests pass" as a claim. Require the command output in the reply. Agents that must show evidence stop declaring victory over red suites.</p>
<h2>4. Review the diff, not the summary</h2>
<p>Agent summaries are optimistic by construction. The diff is the truth. Build the habit: summary first for orientation, diff before approval.</p>
<h2>5. Give it a way to stop</h2>
<p>Tell the agent what to do when it is stuck: "if two approaches fail, stop and describe the blocker instead of trying a third." Without this, a stuck agent improvises, and improvisation is where the destructive commands come from.</p>
<h2>6. Keep secrets out of reach</h2>
<p>No .env in context, no credentials in prompts, and a pre-commit hook that blocks secret-looking strings. The agent cannot leak what it cannot read.</p>
<h2>7. Use subagents for specialist jobs</h2>
<p>A reviewer subagent with a strict checklist outperforms "now review your work" every time. Named specialists in <code>.claude/agents/</code> get their own context and their own rules.</p>
<h2>8. Turn repeated instructions into slash commands</h2>
<p>If you typed it twice this week, make it a file in <code>.claude/commands/</code>. <code>/review</code>, <code>/test</code>, <code>/changelog</code> - one word instead of a paragraph, and the same quality bar every time.</p>
<h2>9. Reset early, reset often</h2>
<p>Long sessions decay. When the thread fills with dead ends, <code>/clear</code> and restart with a crisp task and the rules file. A fresh context with good instructions beats a long context with baggage.</p>
<hr />
<p>All nine ship as ready-made files in the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> - CLAUDE.md presets, subagents, slash commands, hooks, and review checklists for Claude Code and Cursor, $19 one-time. Or start free: the <a href="https://kitforgehq.surge.sh/generator/">Kitforge generator</a> builds a tailored rules file for your stack in about a minute.</p>
<p><em>Cross-posted from the <a href="https://kitforgehq.surge.sh/blog/claude-code-best-practices/">Kitforge blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code Subagents: What They Are and 4 Worth Adding to Every Repo]]></title><description><![CDATA[A CLAUDE.md file tells Claude Code how to behave in every session. A subagent is different: it is a named specialist Claude can hand a task to, defined in a Markdown file under .claude/agents/. Each s]]></description><link>https://kitforge.hashnode.dev/claude-code-subagents-what-they-are-and-4-worth-adding-to-every-repo</link><guid isPermaLink="true">https://kitforge.hashnode.dev/claude-code-subagents-what-they-are-and-4-worth-adding-to-every-repo</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Fri, 11 Sep 2026 17:58:35 GMT</pubDate><content:encoded><![CDATA[<p>A CLAUDE.md file tells Claude Code how to behave in every session. A subagent is different: it is a named specialist Claude can hand a task to, defined in a Markdown file under <code>.claude/agents/</code>. Each subagent gets its own instructions, its own context window, and optionally a restricted tool set. When the main agent hits a matching task - "review this diff", "write tests for this module" - it delegates to the specialist instead of doing everything itself.</p>
<p>Why bother: specialization keeps the main context clean and makes output more consistent. A reviewer subagent with a strict checklist produces the same shape of review every time, no matter what else happened in the session.</p>
<h2>The file format</h2>
<p>Each subagent is one Markdown file with frontmatter: a name, a description of when to use it, and the system prompt body. Drop it in <code>.claude/agents/</code> and Claude Code picks it up automatically.</p>
<h2>1. The diff reviewer</h2>
<pre><code>---
name: reviewer
description: Reviews a diff before it is called done. Use after any code change.
---
You are a strict code reviewer. Given a diff, check:
- Correctness: does the change do what the task asked, nothing more?
- Tests: is there a test that fails without this change?
- Style: does it follow the rules in CLAUDE.md?
- Risk: anything that touches auth, payments, or migrations gets flagged.
Report findings as a numbered list, most severe first. If clean, say so in one line.
</code></pre>
<h2>2. The test writer</h2>
<pre><code>---
name: test-writer
description: Writes tests for a module. Use when new code lacks coverage.
---
Write tests for the specified module. Cover the happy path, one edge
case per branch, and one failure mode. Use the repo's existing test
framework and fixtures. Do not change the code under test. If a bug
surfaces while writing tests, report it instead of fixing it.
</code></pre>
<h2>3. The security pass</h2>
<pre><code>---
name: security-pass
description: Audits a change for secrets, injection, and unsafe file ops.
---
Review the change for: hardcoded secrets or tokens, unsanitized input
reaching shell commands or SQL, file operations outside the project
root, and new network calls to unknown hosts. Report each finding with
the file and line. Never modify code in this pass.
</code></pre>
<h2>4. The docs writer</h2>
<pre><code>---
name: docs-writer
description: Updates README and docs after a behavior change lands.
---
Given a merged change, update the README and any affected docs.
Match the existing tone. Add or fix examples so they reflect the new
behavior. Do not document unreleased flags or internal helpers.
</code></pre>
<h2>How they work together</h2>
<p>The main agent keeps the big picture. When it finishes an implementation, it hands the diff to <code>reviewer</code>. Reviewer findings go back to the implementer. Once clean, <code>test-writer</code> fills coverage gaps, <code>security-pass</code> audits anything touching input or files, and <code>docs-writer</code> tidies up. Each specialist sees only what it needs, so nobody's context window fills with the other five steps.</p>
<p>Two practical notes. Keep each subagent's scope narrow enough to describe in one sentence - broad subagents degrade into a second generalist. And restrict tools where you can: a reviewer that cannot edit files will never "fix" something while reviewing it.</p>
<hr />
<p>These four definitions ship ready-made in the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> - 34 templates, rules and workflows for Claude Code and Cursor, $19 one-time. Or start free: the <a href="https://kitforgehq.surge.sh/generator/">Kitforge generator</a> builds a tailored CLAUDE.md or .cursorrules for your stack in about a minute.</p>
<p><em>Cross-posted from the <a href="https://kitforgehq.surge.sh/blog/claude-code-subagents/">Kitforge blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Subagent Patterns: How to Split Work Across AI Coding Agents Without Losing Coherence]]></title><description><![CDATA[This is a chapter from The Agentic Coding Kit - 34 ready-to-use files that package a senior engineer's AI coding setup: CLAUDE.md templates, permission guardrails, git hooks, and subagent playbooks. $]]></description><link>https://kitforge.hashnode.dev/subagent-patterns-how-to-split-work-across-ai-coding-agents-without-losing-coherence</link><guid isPermaLink="true">https://kitforge.hashnode.dev/subagent-patterns-how-to-split-work-across-ai-coding-agents-without-losing-coherence</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Tue, 08 Sep 2026 22:08:02 GMT</pubDate><content:encoded><![CDATA[<p><em>This is a chapter from <a href="https://kitforgedev.itch.io/agentic-coding-kit">The Agentic Coding Kit</a> - 34 ready-to-use files that package a senior engineer's AI coding setup: CLAUDE.md templates, permission guardrails, git hooks, and subagent playbooks. $19, instant download.</em></p>
<hr />
<p>Claude Code and other agentic coding tools can spawn subagents: separate agent instances that get a slice of the work, their own context window, and a narrow job description. Used well, subagents are how you get parallel speed without the main agent losing the plot. Used badly, they are how you get five half-finished refactors that don't compile together.</p>
<p>After running subagent-heavy workflows on real codebases for months, here are the patterns that hold up.</p>
<h2>Pattern 1: Scout agents for read-only exploration</h2>
<p>The cheapest, safest subagent is one that can only read. Send it to answer a question like "where is authentication enforced in this repo?" or "what breaks if I change this interface?"</p>
<p>Why it works: the scout burns its own context on the boring traversal - opening 30 files, tracing imports - and returns a 10-line answer. Your main agent's context stays clean for the actual work.</p>
<p>Rules that keep scouts useful:</p>
<ul>
<li>Give it a question, not a task. "Map the billing flow" not "refactor billing."</li>
<li>Cap the output. "Return the file paths, the key functions, and a 5-sentence summary."</li>
<li>Forbid writes entirely. A scout that edits is no longer a scout.</li>
</ul>
<h2>Pattern 2: Worker agents with a definition of done</h2>
<p>A worker subagent gets a concrete, verifiable task: "add input validation to these three endpoints, with tests that fail before and pass after." The key is that the task must be checkable without judgment.</p>
<p>If you can't write the done-condition in one sentence, the task isn't ready to delegate. Split it further or do it yourself.</p>
<p>The playbook version I use:</p>
<ol>
<li><strong>Scope</strong>: exact files or directories it may touch.</li>
<li><strong>Done condition</strong>: the command that must pass (e.g. <code>npm test -- billing</code>).</li>
<li><strong>Budget</strong>: stop and report after N minutes or M failed attempts, instead of spiraling.</li>
</ol>
<p>That third one is the one everyone skips. An unbounded worker will confidently produce 800 lines of wrong. A bounded one reports "stuck, here's what I tried" and costs you two minutes.</p>
<h2>Pattern 3: The reviewer is not the author</h2>
<p>Never let the agent that wrote code be the agent that reviews it. Same context, same blind spots. A fresh reviewer subagent, given only the diff and the requirements, catches things the author agent sailed past - because it has no sunk cost in the approach.</p>
<p>This mirrors human teams for a reason. The kit's review checklist templates exist to give the reviewer agent the same bar every time: error handling, injection surface, migration safety, test quality.</p>
<h2>What to never delegate</h2>
<p>Some work should stay with the main agent (or with you):</p>
<ul>
<li><strong>Deciding what to build.</strong> Subagents execute judgment; they shouldn't create it.</li>
<li><strong>Cross-cutting design.</strong> Anything that changes contracts between modules needs one coherent mind.</li>
<li><strong>Final review before merge.</strong> Delegated review is a filter, not a gate. The last pass belongs to whoever owns the outcome.</li>
<li><strong>Secrets and destructive ops.</strong> Permission guardrails should make this impossible, not just discouraged.</li>
</ul>
<h2>The coordination tax</h2>
<p>Every subagent adds overhead: you write a brief, wait, and integrate the result. If the task takes less time than the brief, do it inline. My rule of thumb: delegate when the subtask needs more than ~10 minutes of focused work or a separate context window's worth of reading.</p>
<p>The win isn't parallelism for its own sake. It's keeping the main agent's attention on the decisions while the grunt work happens in quarantined contexts.</p>
<hr />
<p><em>The full subagent playbooks - scout, worker, reviewer templates with done-conditions, budgets, and integration checklists - are in <a href="https://kitforgedev.itch.io/agentic-coding-kit">The Agentic Coding Kit</a>, along with the CLAUDE.md template and permission guardrails that make delegation safe. One-time $19, lifetime updates.</em></p>
]]></content:encoded></item><item><title><![CDATA[Anatomy of a CLAUDE.md That Actually Controls Your AI Agent]]></title><description><![CDATA[Every Claude Code setup lives or dies by one file. Not the model, not the prompts you type at 2 AM - the CLAUDE.md sitting at the root of the repo. It is the first thing the agent reads and the only t]]></description><link>https://kitforge.hashnode.dev/anatomy-of-a-claude-md-that-actually-controls-your-ai-agent</link><guid isPermaLink="true">https://kitforge.hashnode.dev/anatomy-of-a-claude-md-that-actually-controls-your-ai-agent</guid><dc:creator><![CDATA[Kitforge]]></dc:creator><pubDate>Tue, 08 Sep 2026 19:14:08 GMT</pubDate><content:encoded><![CDATA[<p>Every Claude Code setup lives or dies by one file. Not the model, not the prompts you type at 2 AM - the CLAUDE.md sitting at the root of the repo. It is the first thing the agent reads and the only thing it reads every single time.</p>
<p>I have reviewed a lot of these files, and the bad ones fail in predictable ways. They are either novels nobody would read, wish lists with no enforcement, or walls of style rules the model ignores because nothing says what matters most. Here is the structure that actually works, section by section.</p>
<h2>1. Identity and mission (2-3 sentences, no more)</h2>
<p>Open with what the project is and what the agent's job is. Not marketing copy - operational context.</p>
<pre><code class="language-markdown">This is a B2B invoicing API in TypeScript (Fastify + Postgres). You are the
primary maintainer. Prioritize correctness of money math over speed. When in
doubt, ask before changing anything under /billing.
</code></pre>
<p>That last line does real work. It tells the agent where the blast radius is.</p>
<h2>2. Commands that must work</h2>
<p>The agent will run things. Tell it exactly which commands are the source of truth so it does not invent <code>npm run test:quick</code> and hallucinate success.</p>
<pre><code class="language-markdown">- Install: `pnpm install`
- Test: `pnpm test` (must pass before every commit)
- Typecheck: `pnpm typecheck`
- Lint: `pnpm lint --fix`
</code></pre>
<p>Agents are surprisingly obedient here. If you give them the exact command, they run the exact command. If you do not, they guess, and guesses fail silently.</p>
<h2>3. Hard rules, stated as rules</h2>
<p>This is where most files go soft. "Try to avoid committing to main" is a suggestion. Write rules like a linter would:</p>
<pre><code class="language-markdown">- NEVER commit directly to main. Always create a feature branch.
- NEVER use `git push --force` on shared branches.
- NEVER commit files matching .env* or containing API keys.
- ALWAYS run `pnpm test` before committing. No exceptions.
</code></pre>
<p>The ALL-CAPS markers are not for style. Models weight emphatic, absolute language more heavily, and these are the rules you most want to survive a long context window.</p>
<h2>4. Architecture map (the 60-second version)</h2>
<p>Agents waste enormous effort exploring. Give them the map:</p>
<pre><code class="language-markdown">/src/routes - HTTP handlers, thin by design
/src/domain - business logic, no I/O allowed here
/src/db - migrations and queries
/tests - mirrors /src structure
</code></pre>
<p>Five lines saves dozens of exploratory tool calls per session.</p>
<h2>5. How to verify work</h2>
<p>This is the section almost everyone skips, and it is the one that changes behavior the most. Define what "done" means:</p>
<pre><code class="language-markdown">A task is done when: tests pass, typecheck is clean, the commit message
follows conventional commits, and you have re-read your own diff for
obvious mistakes.
</code></pre>
<p>Without this, agents declare victory after the code compiles. With it, they self-review.</p>
<h2>6. What the agent is NOT allowed to do</h2>
<p>Boundaries prevent the most expensive mistakes:</p>
<pre><code class="language-markdown">Do not: modify CI configuration, change database migrations that have
already been applied, add dependencies without asking, or touch anything
under /infra.
</code></pre>
<h2>What to leave out</h2>
<p>Three things do not belong in CLAUDE.md: your entire style guide (link it), exhaustive API docs (the agent can read code), and anything you would not enforce in review (every unenforced rule teaches the model that rules are optional).</p>
<h2>The test of a good one</h2>
<p>Read your CLAUDE.md and ask: if a talented contractor read only this file, could they work in this repo without asking me a single question for the first hour? If not, that gap is exactly what your agent is silently guessing about.</p>
<p>If you want this structure without writing it from scratch, I packaged a production-tested version into the <a href="https://kitforgedev.itch.io/agentic-coding-kit">Agentic Coding Kit</a> - a CLAUDE.md template with these six sections, plus the git hooks that enforce the hard rules even when the model forgets them, review subagents, and slash commands. But the anatomy above is the real takeaway: identity, commands, hard rules, map, definition of done, boundaries. Everything else is decoration.</p>
]]></content:encoded></item></channel></rss>