Setting up Claude Code properly for a real codebase takes days. A good configuration needs a CLAUDE.md that captures architecture, patterns, and conventions; skills for every major workflow; hooks that enforce formatting and protect sensitive files; subagents for code review and security analysis; and MCP server connections to databases and documentation. Most teams either skip all of this or write a thin CLAUDE.md that barely scratches the surface.
ultrainit.sh solves this by sending a swarm of Claude Code agents to analyze the codebase from every angle, then synthesizing everything into a production-grade configuration. One command, 15-30 minutes, no dependencies beyond claude and jq.
curl -sL https://github.com/joelbarmettlerUZH/ultrainit.sh/releases/latest/download/ultrainit.sh | bash
A typical run on a full-stack web application generates a 200-300 line root CLAUDE.md, 5-15 subdirectory CLAUDE.md files, 15-25 skills, 3-5 hooks, 3-8 subagents, and 2-6 MCP server configurations.
Eight specialist agents run in parallel, each examining the codebase from a different angle. An Identity agent (Haiku) detects the project name, languages, frameworks, and monorepo structure. A Commands agent finds every build, test, lint, and format command from package.json, Makefiles, and CI pipelines. A Git Forensics agent (Sonnet) analyzes commit history for hotspots, bug-fix density, temporal coupling, and ownership patterns. A Patterns agent discovers architectural conventions, error handling, import styles, and state management. Additional agents scan for tooling, documentation, security-sensitive files, and directory structure.
Based on the Structure Scout's map, deep-dive agents spawn — one per important directory, running in parallel batches of 8. A typical project gets 30-50 directories analyzed this way. Each deep-dive agent reads actual source files and reports internal architecture, key files, coding patterns, naming conventions, gotchas, and skill opportunities. This phase produces 500KB-1MB of structured findings.
Six interactive questions capture knowledge that code analysis alone cannot provide: project purpose, deployment target, external integrations, things Claude should never do, common mistakes new developers make, and anything else. Skipped with --non-interactive for CI environments.
Two agents search the web in parallel. A Domain Researcher looks up framework-version-specific best practices and common pitfalls for the detected tech stack. An MCP Discoverer searches the MCP registry, GitHub, and the web for MCP servers matching the project's databases, frameworks, and services.
All findings (~1MB) are fed into two synthesis passes using the 1M context model. The first pass generates all CLAUDE.md files. The second generates skills, hooks, subagents, MCP configurations, and settings. Splitting into two passes lets each focus deeply rather than trying to produce everything at once.
Generated artifacts go through structural validation. CLAUDE.md files are checked for minimum length, zero generic phrases, command tables, and alternatives for every prohibition. Skills must contain codebase-specific file references and verification sections. Hooks must read JSON from stdin and print actionable error messages. Subagents must have scoped tool access matching their purpose. If validation fails, a revision agent automatically fixes the issues and re-validates.
Artifacts are written with safe merge behavior: CLAUDE.md files are overwritten (with backup), skills and hooks and subagents are merge-only (new files added, existing never touched), and settings.json and mcp.json are deep-merged.
The script saves all intermediate results to .ultrainit/ in the project directory. If interrupted, rerun the same command and completed agents are skipped. Use --force to rerun everything from scratch, or --overwrite to remove existing configuration and regenerate cleanly.
A typical run costs $10-30. Fast analysis agents use Haiku, deep analysis uses Sonnet, and synthesis uses Sonnet with 1M context. Use --model 'opus[1m]' for maximum quality synthesis ($20-50 total). The --budget flag sets a spending cap with automatic allocation across phases.
Repository: github.com/joelbarmettlerUZH/ultrainit.sh
ultrainit.sh is a bash script that automatically generates a complete Claude Code configuration for any codebase. It sends 30-60 focused Claude Code agents to analyze architecture, git history, patterns, tooling, and security in parallel, then synthesizes the findings into CLAUDE.md files, skills, hooks, subagents, and MCP server configurations.
A typical run costs $10-30 depending on codebase size. With Opus for synthesis, $20-50. The --budget flag sets a spending cap with automatic allocation across phases. Fast analysis agents use Haiku, deep analysis uses Sonnet, and synthesis uses Sonnet with 1M context by default.
Typically 15-30 minutes depending on codebase size. The run is fully resumable — if interrupted, rerun the same command and completed agents are skipped. Intermediate results are cached in the .ultrainit/ directory.
ultrainit.sh sends 30-60 specialized agents with structured JSON output schemas, scoped tool access, and focused system prompts. Each agent is an expert at one thing: git forensics, security scanning, pattern detection. A single Claude session cannot match this depth because agents run in parallel, cover the codebase hierarchically, and validate their output structurally.
.
Copyright 2026 - Joel P. Barmettler