<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vartika Tewari</title>
    <description>The latest articles on DEV Community by Vartika Tewari (@vartika_tewari_fe62caeb95).</description>
    <link>https://dev.to/vartika_tewari_fe62caeb95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3891842%2F736ecea4-f894-4dbd-9460-1e0a44a82b50.png</url>
      <title>DEV Community: Vartika Tewari</title>
      <link>https://dev.to/vartika_tewari_fe62caeb95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vartika_tewari_fe62caeb95"/>
    <language>en</language>
    <item>
      <title>What Building a Geopolitical Simulation Taught Me About Claude Code</title>
      <dc:creator>Vartika Tewari</dc:creator>
      <pubDate>Wed, 22 Apr 2026 06:32:19 +0000</pubDate>
      <link>https://dev.to/vartika_tewari_fe62caeb95/what-building-a-geopolitical-simulation-taught-me-about-claude-code-3ddh</link>
      <guid>https://dev.to/vartika_tewari_fe62caeb95/what-building-a-geopolitical-simulation-taught-me-about-claude-code-3ddh</guid>
      <description>&lt;p&gt;&lt;em&gt;The most valuable features weren't the ones that wrote code for me.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;I was 45 minutes into a Sprint 2 session when the test runner caught something I'd completely missed. I'd just saved a React component file — nothing dramatic, a minor prop change — and two seconds later, a notification appeared in my terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;FAIL tests/components/game/EscalationLadder.test.tsx
  ✗ renders correct rung label for rung 4
    Expected: "Conventional Strike"
    Received: "Conventional strike"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The PostToolUse hook had fired automatically. &lt;code&gt;run-tests-on-save.sh&lt;/code&gt; had detected that the saved file path matched a test file pattern, run vitest on that specific test file, and surfaced the failure before I'd even moved on to the next task. I hadn't asked for a test run. I hadn't thought to run one. The hook just enforced it.&lt;/p&gt;

&lt;p&gt;That moment crystallized something I'd been slow to internalize: the most powerful things about Claude Code aren't the AI suggestions. They're the mechanisms that enforce process when you're too deep in a problem to remember to enforce it yourself.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;GeoSim is an AI-powered geopolitical strategic simulation engine. Load an Iran crisis scenario, watch six actors — the US, Iran, Israel, Russia, China, and the Gulf States — simultaneously plan their moves using separate Claude Sonnet agent calls, then watch a resolution engine arbitrate the outcomes and a narrator synthesize them into intelligence reports.&lt;/p&gt;

&lt;p&gt;The core mechanic is a git-like branching system: at any turn node, a player can fork the timeline, take control of an actor, and steer events down a different path. Every branch is immutable once committed. Every actor sees only their own intelligence picture — fog of war filtered at the database layer via Supabase RLS.&lt;/p&gt;

&lt;p&gt;It's live at &lt;a href="https://geosim-eight.vercel.app/" rel="noopener noreferrer"&gt;https://geosim-eight.vercel.app/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The technical stack is Next.js 14 App Router, TypeScript, Supabase (Postgres + Auth + Realtime), Mapbox GL JS, and the Anthropic API. But the interesting story isn't the stack — it's how Claude Code's extensibility layer shaped the way we built it.&lt;/p&gt;




&lt;h2&gt;
  
  
  CLAUDE.md as Architecture Documentation
&lt;/h2&gt;

&lt;p&gt;The first thing we did was write a serious CLAUDE.md. Not a "this project uses Next.js" stub — a 216-line living document with @imports to 15 reference files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@docs/frontend-design.md         — Stitch visual identity, font rules
@docs/prompt-library.ts          — All AI agent system prompts
@docs/agent-architecture.ts      — Agent roles and game loop pseudocode
@docs/geosim-data-model.ts       — TypeScript types for every entity
@docs/testing-strategy.md        — Test priorities, TDD workflow, mocking strategy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The pattern that made this work was modular @imports. Instead of cramming everything into one file, each domain got its own reference doc. Claude Code only loaded what was relevant to the current task. When we were writing a component, it read &lt;code&gt;frontend-design.md&lt;/code&gt;. When we were working on AI agents, it read &lt;code&gt;prompt-library.ts&lt;/code&gt; and &lt;code&gt;agent-architecture.ts&lt;/code&gt;. The whole thing felt like progressive disclosure — the same principle we applied to the fog-of-war system.&lt;/p&gt;

&lt;p&gt;CLAUDE.md evolved across 92 PRs. You can trace the project's maturation by reading the git history of that single file: Sprint 1 added TDD rules and branch conventions; Sprint 2 added Stitch design tokens; Sprint 3 added the node-centric branch architecture. It became the source of truth for every architectural decision, enforced through both documentation and Claude Code's ability to actually read and follow it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Skills as Iterable Automation
&lt;/h2&gt;

&lt;p&gt;We built 14 custom skills. The most instructive story is &lt;code&gt;quality-gate&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Version 1 ran a comprehensive QA audit — tests, types, linting, security, CI verification. It was useful. It also silently failed on our development machine, which runs WSL2 on Windows. The problem: v1 called &lt;code&gt;npm run test&lt;/code&gt;, but on our machine &lt;code&gt;npm&lt;/code&gt; is a Windows binary that can't execute the Linux Vitest binary. The skill appeared to succeed (exit 0) while actually doing nothing.&lt;/p&gt;

&lt;p&gt;Version 2 header: &lt;code&gt;# quality-gate — v2 WSL2 + context-mode aware&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two changes: replaced every &lt;code&gt;npm&lt;/code&gt; call with &lt;code&gt;bun&lt;/code&gt;, and piped all output through &lt;code&gt;ctx_execute&lt;/code&gt; (the context-mode MCP sandbox) instead of letting large test output flood the context window. The fix was trivial once we understood the problem. The lesson was the process: skills are code, and code gets bugs, and bugs get fixed in v2.&lt;/p&gt;

&lt;p&gt;The other skill that became indispensable was &lt;code&gt;run-turn&lt;/code&gt; — a complete game simulation turn executed from the command line. It chains the actor agent calls, runs the resolution engine, invokes the judge, and synthesizes via the narrator. During AI pipeline development, being able to run a full turn cycle from a single skill invocation compressed a development loop that would otherwise involve navigating five separate API endpoints.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hooks as Enforcement, Not Documentation
&lt;/h2&gt;

&lt;p&gt;Five hooks in &lt;code&gt;.claude/settings.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edit|Write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bash .claude/hooks/protect-files.sh"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"PostToolUse"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edit|Write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prettier --write $CLAUDE_FILE_PATH"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Edit|Write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bash .claude/hooks/run-tests-on-save.sh"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Stop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"git status --porcelain | grep -q . &amp;amp;&amp;amp; echo '...uncommitted...'"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference between a documented rule and a hook is enforcement. CLAUDE.md can say "never commit to .env.local" — but a PreToolUse hook that exits with code 2 when you try to write to &lt;code&gt;.env*&lt;/code&gt; files &lt;em&gt;actually stops it from happening&lt;/em&gt;. Documentation is advisory. Hooks are structural.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;run-tests-on-save.sh&lt;/code&gt; hook was the one we felt most during development. It runs vitest only on the specific test file that was saved — not the whole suite — which keeps the feedback loop under two seconds. During component development, we'd write a test, save it, watch it fail, write the implementation, save it, watch it go green. Red-green in the same terminal session, automatically.&lt;/p&gt;

&lt;p&gt;The session lifecycle hooks — &lt;code&gt;SessionStart&lt;/code&gt; injecting a system message to run &lt;code&gt;/start-session&lt;/code&gt;, &lt;code&gt;Stop&lt;/code&gt; warning about uncommitted changes — felt more ergonomic than impactful. But they're there, and they've caught things.&lt;/p&gt;




&lt;h2&gt;
  
  
  Worktrees for Parallel AI Development
&lt;/h2&gt;

&lt;p&gt;One of Sprint 2's structural wins was worktree agents. Five PRs were merged from &lt;code&gt;worktree-agent-*&lt;/code&gt; branches — each one a Claude Code agent session running in a fully isolated git worktree:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;worktree-agent-a29a8263&lt;/code&gt; — trivial bug fixes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;worktree-agent-ae36607a&lt;/code&gt; — prompt caching for AI stable system prompts&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;worktree-agent-a27c703e&lt;/code&gt; — error boundaries and empty states&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;worktree-agent-a32132a5&lt;/code&gt; — Israel decision catalog&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;worktree-agent-ab230cc1&lt;/code&gt; — z-index fixes for actor panel / map controls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pattern: a parent session dispatches a subagent into a worktree (&lt;code&gt;superpowers:dispatching-parallel-agents&lt;/code&gt; skill), the subagent works in isolation with no shared file state, opens a PR when done, and the parent session reviews and merges. No merge conflicts with in-progress main branch work. No contamination of the parent session's context.&lt;/p&gt;

&lt;p&gt;During Sprint 2, while one worktree session was implementing the prompt caching architecture for AI agents, the main session was building the Scenario Hub page. Two nontrivial features, developed in parallel, no coordination overhead.&lt;/p&gt;




&lt;h2&gt;
  
  
  TDD with Claude Code
&lt;/h2&gt;

&lt;p&gt;The project's testable commit history shows five explicit red-before-green sequences. The clearest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;43e857b  test: add failing tests for node API routes (TDD)
d4f9c13  feat(#32): add generateDecisionOptions asset-aware, NEUTRALITY preamble
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;run-tests-on-save.sh&lt;/code&gt; hook makes the red-green loop visceral. You commit the failing test, watch it fail on every save until you wire the implementation, then watch it go green. The hook closes the feedback loop that TDD requires without requiring you to context-switch to run tests manually.&lt;/p&gt;

&lt;p&gt;The test suite has 41 files now: 9 game logic, 2 AI, 3 API integration, 20 components, 3 library utilities, 4 E2E. The component tests are the weakest layer — most are smoke-level assertions (does the element render?) rather than behavioral contracts. The game logic and AI tests are where TDD was practiced most rigorously.&lt;/p&gt;




&lt;h2&gt;
  
  
  Honest Reflection
&lt;/h2&gt;

&lt;p&gt;Three things we'd do differently:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C.L.E.A.R. reviews should be live, not retroactive.&lt;/strong&gt; We had the &lt;code&gt;review-pr.md&lt;/code&gt; skill configured from Sprint 1. We used it inconsistently. The PR reviews we posted retroactively to PRs #83, #88, and #89 are substantive — but they landed after merge, not before. In a future project, the &lt;code&gt;review-pr&lt;/code&gt; skill gets wired to a PR creation checklist, not a sprint retrospective.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E2E tests belong in Sprint 1.&lt;/strong&gt; Our Playwright config lived as a script stub with no actual test files until the project documentation phase. Four smoke tests against the deployed app would have caught the auth redirect regression in Sprint 2 that we found manually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;.mcp.json&lt;/code&gt; file should ship with the repository from day one.&lt;/strong&gt; We configured MCP servers via &lt;code&gt;settings.json&lt;/code&gt; throughout the project — which works fine locally — but the rubric expects a shareable &lt;code&gt;.mcp.json&lt;/code&gt;. It's a five-minute addition, but it signals to the next developer exactly how to reproduce the development environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Five Specific Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Write hooks before you write features.&lt;/strong&gt; A PostToolUse test runner costs 30 minutes to configure and saves hours of "wait, did I break something?" across a sprint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Version your skills.&lt;/strong&gt; &lt;code&gt;quality-gate&lt;/code&gt; v1 was wrong for our environment. &lt;code&gt;quality-gate&lt;/code&gt; v2 was right. Treating skills as code — with versions, bug fixes, and iteration — is the mindset shift.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CLAUDE.md @imports are a force multiplier.&lt;/strong&gt; A single 200-line CLAUDE.md with @imports to domain-specific docs is more effective than one 800-line monolith that Claude Code has to parse in full every time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Worktree agents are underrated for parallel work.&lt;/strong&gt; The agent isolation prevents the context contamination and merge conflicts that slow down parallel development. Use them aggressively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The neutrality principle requires explicit enforcement.&lt;/strong&gt; Our &lt;code&gt;NEUTRALITY_PREAMBLE&lt;/code&gt; (injected into every AI agent system prompt) exists because without it, AI agents drift toward protagonist bias. For a simulation that models six actors with equal rigor, this is a correctness requirement, not an ethical preference. Make your invariants explicit in CLAUDE.md or they won't hold.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>claude</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
