<?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: Gary Dotzlaw</title>
    <description>The latest articles on DEV Community by Gary Dotzlaw (@gary_dotzlaw).</description>
    <link>https://dev.to/gary_dotzlaw</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%2F3811857%2F26b78410-8ed5-4bf0-837e-7579b872a99a.jpg</url>
      <title>DEV Community: Gary Dotzlaw</title>
      <link>https://dev.to/gary_dotzlaw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gary_dotzlaw"/>
    <language>en</language>
    <item>
      <title>An Agent Swarm That Builds Agent Swarms: Automating Claude Code Infrastructure</title>
      <dc:creator>Gary Dotzlaw</dc:creator>
      <pubDate>Tue, 10 Mar 2026 15:12:12 +0000</pubDate>
      <link>https://dev.to/gary_dotzlaw/an-agent-swarm-that-builds-agent-swarms-automating-claude-code-infrastructure-1ih1</link>
      <guid>https://dev.to/gary_dotzlaw/an-agent-swarm-that-builds-agent-swarms-automating-claude-code-infrastructure-1ih1</guid>
      <description>&lt;p&gt;What if Claude Code agents could configure Claude Code infrastructure for any project -- automatically? We built exactly that: a 12-step pipeline where AI agents analyze a codebase and generate complete agent teams, hooks, skills, and slash commands in 30-55 minutes. Three production migrations later, the second was harder but completed faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Claude Code ships with powerful infrastructure: agent definitions, hooks, skills, slash commands, and settings. Most developers use none of it. Configuring a proper Claude Code project takes a full day for an expert. Most people write a basic CLAUDE.md and stop -- getting maybe 20% of Claude Code's potential.&lt;/p&gt;

&lt;p&gt;Migration is even harder. An existing codebase has established patterns, implicit conventions, and domain knowledge buried in code that needs to be extracted into Claude Code infrastructure. We asked: what if Claude Code agents could do this work themselves?&lt;/p&gt;

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

&lt;p&gt;A meta-framework: Claude Code agents that generate Claude Code agent infrastructure. Point it at an existing codebase (migration mode) or give it a plain-English project description (greenfield mode), and it produces a complete &lt;code&gt;.claude/&lt;/code&gt; configuration tailored to that specific project in 30-55 minutes.&lt;/p&gt;

&lt;p&gt;The framework contains no project-specific code. It contains &lt;em&gt;knowledge about how to build Claude Code configurations&lt;/em&gt;: 17 reusable skills, 12 slash commands, 17 hook templates, and over 1,000 lines of methodology refined through real production use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0miv5s0wf12x4anqawl9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0miv5s0wf12x4anqawl9.png" alt="Three-folder architecture diagram showing Bootstrap Framework, READ-ONLY source project, and generated target project" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Three-Folder Architecture&lt;/strong&gt;: The framework reads the source project but never modifies it. All generated infrastructure lands in a fresh target project. This READ-ONLY invariant held across 18 sessions and was never violated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before and After
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Full day of expert configuration per project&lt;/td&gt;
&lt;td&gt;30-55 minute automated pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zero security infrastructure on most projects&lt;/td&gt;
&lt;td&gt;Full OWASP Top 10 for Agentic Applications coverage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No domain knowledge retention between sessions&lt;/td&gt;
&lt;td&gt;Skills provide 140x token efficiency via progressive disclosure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No quality enforcement beyond "remember to lint"&lt;/td&gt;
&lt;td&gt;Hooks enforce linting, testing, and security on every tool call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Each project starts from scratch&lt;/td&gt;
&lt;td&gt;Each migration makes the framework smarter&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27z0g7d1kqo00b8nehx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27z0g7d1kqo00b8nehx5.png" alt="Quantitative before and after comparison across every dimension of the migration" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Results
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Production migrations validated&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;3&lt;/strong&gt; (textToSql-metabase, obsidian-youtube-agent, dotzlaw.com)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hook templates&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;17&lt;/strong&gt; covering safety, quality, and security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reusable skills&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;17&lt;/strong&gt; with progressive disclosure architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pipeline steps&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;12&lt;/strong&gt; with parallel execution paths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OWASP coverage&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;10/10&lt;/strong&gt; items addressed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation checks&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;50+&lt;/strong&gt; structural and coherence checks before delivery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File conflicts across 18 sessions&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;0&lt;/strong&gt; thanks to agent ownership boundaries&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Deep Dive: Compound Returns Across Three Migrations
&lt;/h2&gt;

&lt;p&gt;The framework's core thesis: each migration makes the next one faster, even when the next project is more complex.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migration 1: textToSql-metabase&lt;/strong&gt; -- A text-to-SQL dashboard (FastAPI, React, Metabase, Qdrant, MS SQL Server). 45 Python files ported across 10 sessions. 168 &lt;code&gt;print()&lt;/code&gt; statements eliminated. 223 unit tests created from zero. 7 anti-pattern categories fixed during migration. The framework itself was built during this migration -- 3 sessions just for framework knowledge base construction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migration 2: obsidian-youtube-agent&lt;/strong&gt; -- A YouTube-to-Obsidian AI pipeline (FastAPI, React, PostgreSQL, Qdrant, Anthropic Claude). 67 Python files -- more complex than Migration 1. Completed in 8 sessions, not 10. The framework build phase (3 sessions in Migration 1) dropped to zero on reuse. The most dramatic change: the Anthropic Batch API (4+ hour waits, opaque failures) was replaced entirely with &lt;code&gt;asyncio.TaskGroup&lt;/code&gt; parallel processing -- seconds per video instead of hours per batch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migration 3: dotzlaw.com&lt;/strong&gt; -- A WordPress-to-Astro migration. 41 articles extracted from a SQL backup file (no live admin access), 187 images redistributed from WordPress's flat upload structure to per-article co-located folders, a design-matched dark theme rebuilt from scratch. The framework contributed methodology and skills but the bulk was content transformation and visual design -- domains the framework guides rather than automates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnh92dhceo7cjsqu2d9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnh92dhceo7cjsqu2d9c.png" alt="Side-by-side migration comparison showing Migration 1 at 45 files in 10 sessions versus Migration 2 at 67 files in 8 sessions" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compound Returns&lt;/strong&gt;: Migration 2 was more complex (67 files vs 45, AI/ML integration, full architectural redesign) but completed in fewer sessions. The 3-session framework investment from Migration 1 paid for itself immediately and continues paying on every subsequent project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deep Dive: Defense-in-Depth Security
&lt;/h2&gt;

&lt;p&gt;After two production migrations, a security audit against the OWASP Top 10 for Agentic Applications found 11 concrete gaps -- not theoretical risks, specific vulnerabilities with concrete attack paths. We closed all 11 across 14 tasks in 4 phases.&lt;/p&gt;

&lt;p&gt;The security architecture uses four concentric defense rings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ring 1 (Per-call)&lt;/strong&gt;: Input sanitization (22 patterns), security scan (17 patterns, two-tier enforcement), rate limiting (per-tool thresholds), artifact validation (JSON Schema), audit logging (JSONL metadata-only)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ring 2 (Trajectory)&lt;/strong&gt;: Heartbeat checkpoint every 25 calls detecting 5 anomaly patterns, watchdog timers per pipeline step, optional trajectory analysis agent&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ring 3 (Structural)&lt;/strong&gt;: File ownership boundaries, tool restrictions, 72 blocked commands, three-folder architecture&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ring 4 (Session)&lt;/strong&gt;: Pre-commit secrets scanning, 5 hygiene checks, stop hooks, security review step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Per-archetype security patterns cover all 7 project types: Python FastAPI, React Vite, SSG/Astro, Node.js Express, AI/ML, Fullstack, and CLI tools. Each archetype gets security hooks tailored to its specific threat surface.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fic75ecgdfjsi9uf00ftk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fic75ecgdfjsi9uf00ftk.png" alt="Concentric defense rings diagram showing 4 security layers protecting the pipeline core" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Defense in Depth&lt;/strong&gt;: Four concentric rings protect the pipeline. Each ring catches what the others miss. The architecture operates across 4 timescales -- from sub-millisecond per-call hooks to session-level pre-commit scans.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The highest-leverage improvement is improving the framework itself.&lt;/strong&gt; Every capability added benefits every future project. The cost is paid once; the return compounds indefinitely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Migration is an opportunity to fix architecture, not just port code.&lt;/strong&gt; When a component is demonstrably failing, redesign it during migration rather than porting the failure and planning a future rewrite that never happens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hooks are the only deterministic control in a probabilistic system.&lt;/strong&gt; Prompt instructions achieve ~90% compliance. Hooks achieve 100%. For security-critical behavior, "usually works" is not acceptable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Information asymmetry must be enforced by architecture, not by prompts.&lt;/strong&gt; If you tell an agent "don't look at another agent's files," it eventually will. If a hook blocks the file read, it cannot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Honesty builds more credibility than perfection.&lt;/strong&gt; We found 11 security gaps in our own production framework. Publishing the gaps and the fixes earned more trust than claiming it was secure from the start.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Read the Full Series
&lt;/h2&gt;

&lt;p&gt;This cross-post covers the highlights. The full 4-part article series goes deep on architecture, self-improvement, security hardening, and a real WordPress-to-Astro migration case study.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dotzlaw.com/insights/bootstrap-framework-01/" rel="noopener noreferrer"&gt;Part 1: An Agent Swarm That Builds Agent Swarms&lt;/a&gt; -- Two production migrations prove the concept&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dotzlaw.com/insights/bootstrap-framework-02/" rel="noopener noreferrer"&gt;Part 2: From Prototype to Platform&lt;/a&gt; -- The framework improves itself using its own methodology&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dotzlaw.com/insights/bootstrap-framework-03/" rel="noopener noreferrer"&gt;Part 3: Securing Agentic AI&lt;/a&gt; -- 11 gaps found, 11 gaps closed, 10/10 OWASP coverage&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dotzlaw.com/insights/bootstrap-framework-04/" rel="noopener noreferrer"&gt;Part 4: WordPress to Astro&lt;/a&gt; -- The third migration and an honest assessment of what worked&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Built by Gary, Katrina, and Ryan Dotzlaw&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>security</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
