A boilerplate for running Claude Code in an autonomous TDD development loop that builds iOS apps feature-by-feature. Features are parallelized across worktree-isolated subagents, then verified through a mandatory screenshot-driven QA phase.
For this repo, open claude code and ask for your app. Example:
> Create an iOS app that teaches kids mental math. It should have timed
> challenges, difficulty levels, a progress tracker with streaks, and fun
> animations when they get answers right. Make it feel like a game.
That's it. Drop this prompt into Claude Code with AppLoop configured, and walk away.
What happens next:
- Claude scaffolds the Xcode project, defines 30+ features in
features.jsonwith a full dependency graph, and starts the loop - Domain models and protocols are built first (no dependencies), 3-4 at a time in parallel worktrees
- Services layer follows — auth, scoring, streak tracking — each in its own worktree
- UI screens come last — timed challenge view, difficulty picker, progress dashboard — all with XCUITests
- Every feature: test written first, implementation second, screenshot verification third
- When all features pass, QA mode kicks in — Claude uses the app like a real kid would: tapping fast, getting answers wrong on purpose, building up streaks, switching between screens, checking that badges update and animations fire
- Issues found? Fixed automatically, re-screenshotted, re-verified
- QA passes? Claude researches what the best math apps do, adds 5 new polish features, and loops again
What you get:
- A working app with 30+ features, 100+ unit tests, and full UI test coverage
- A
screenshots/folder with visual evidence of every QA check - A
qa-report.jsonproving every flow was verified - Git history with one clean commit per feature
What you do: Watch. Or go get coffee. The stop gate won't let Claude quit until YOU SAY the app is done (press esc to stop). This can run for hours, days or even weeks.
This template sets up Claude Code to:
- Read a
features.jsonspec file with all planned features and their dependency graph - Analyze dependencies and spawn parallel
feature-buildersubagents in git worktrees - Each subagent implements its feature using TDD (red-green-refactor) in isolation
- The orchestrator merges branches, runs integration tests, and loops
- After all features pass, enter a QA phase with mandatory screenshots and soak testing
- After QA passes, enter improvement mode — research, add new features, and loop again
- The stop gate blocks Claude from stopping at every stage
┌─────────────────────────────────────────────────────────────┐
│ FEATURES FAILING │
│ │
│ 1. dependency-graph.py --ready → identify parallel batch │
│ 2. Spawn feature-builder subagents in worktrees │
│ 3. Merge branches → run tests → update features.json │
│ 4. Repeat until all pass │
│ │ │
│ ▼ │
│ QA MODE │
│ │
│ 1. Generate qa-report.json from features.json │
│ 2. Walk every user flow, screenshot every step │
│ 3. Visual checklist: layout, typography, spacing, dark mode│
│ 4. Soak test: use the app like a real user │
│ 5. Fix issues, re-verify, mark flows verified │
│ │ │
│ ▼ │
│ IMPROVEMENT MODE │
│ │
│ 1. Research UX polish and competitive analysis │
│ 2. Add 3-5 new features to features.json │
│ 3. Loop back to Features Failing │
└─────────────────────────────────────────────────────────────┘
A JSON file listing every feature with test steps and a dependency graph. Each feature has a depends_on array that controls build order and parallelization.
{
"id": "ui-001",
"description": "User login screen",
"phase": "mvp",
"category": "ui",
"depends_on": ["core-001", "service-001"],
"passes": false,
"test_steps": ["Launch app", "Tap login", "Enter credentials", "Verify home screen"]
}Features with all dependencies satisfied are grouped into parallel batches. Features within a batch can be built simultaneously.
Project instructions that tell Claude to:
- Never stop and ask "should I continue?"
- Parallelize aggressively using the dependency graph
- Follow TDD strictly (test first, then implement)
- Complete mandatory QA with screenshots after all features pass
A hook that runs every time Claude tries to stop. It enforces the 3-state loop:
| State | Condition | Behavior |
|---|---|---|
| Features Failing | Incomplete features exist | Block stop, show next batch with parallel info |
| QA Mode | All features pass, QA incomplete | Block stop, inject QA protocol |
| Improvement Mode | All features + QA pass | Block stop, inject research prompt |
The stop gate is dependency-aware — it shows which features are ready to build in parallel and which are blocked.
A custom subagent with isolation: worktree that implements a single feature in its own git worktree branch. Each subagent:
- Gets its own isolated copy of the repo
- Follows TDD strictly
- Commits its work to its branch
- Returns results to the orchestrator for merging
Analyzes features.json and computes parallelizable work batches via topological sort:
python3 scripts/dependency-graph.py --ready # Next parallel batch
python3 scripts/dependency-graph.py --validate # Check for cycles/missing deps
python3 scripts/dependency-graph.py # All batches
python3 scripts/dependency-graph.py --dot # Graphviz visualizationAll prompts the agent sees at each loop state are extracted into a markdown file with template variables. Edit this file to change the agent's behavior without touching shell scripts.
- Copy this folder into your project root
- Replace
{{PROJECT_NAME}},{{SIMULATOR_UUID}},{{BUNDLE_ID}}inCLAUDE.mdandinit.sh - Define your features in
features.jsonwithdepends_onfor the dependency graph - Run
python3 scripts/dependency-graph.py --validateto check the graph - Uncomment the hooks in
.claude/settings.json - Run Claude Code and say: "Start the development loop"
.claude/
settings.json # Hooks configuration (stop gate + build-on-edit)
agents/
feature-builder.md # Subagent for parallel feature implementation
CLAUDE.md # Project instructions for Claude
features.json # Feature specs with dependency graph
claude-progress.md # Session progress tracking (auto-updated)
qa-report.json # QA verification report (auto-generated)
init.sh # Environment bootstrap script
.gitignore # Excludes worktrees, build artifacts, screenshots
scripts/
stop-gate.sh # 3-state loop enforcement (features → QA → improvement)
stop-gate-prompts.md # Customizable prompts for each loop state
dependency-graph.py # Dependency analysis and parallel batch scheduling
qa-check.sh # QA report status checker
check-architecture.sh # Layer dependency rule enforcement
docs/
architecture.md # Architecture layers and rules
conventions.md # Code conventions
testing-strategy.md # Test layers: unit → integration → XCUITest → QA
swiftui-testing-best-practices.md # iOS testing patterns and pitfalls
qa-strategy.md # QA phase: flows, visual checklist, soak testing
parallel-development.md # Parallel agents, worktrees, orchestration protocol
screenshots/ # QA screenshots (auto-generated, gitignored)
This template is iOS/Swift-focused but the loop pattern works for any stack:
- Replace
swift build/swift testwith your build/test commands instop-gate.shandinit.sh - Replace XCUITest references with your UI testing framework
- Adjust
features.jsoncategories for your domain - Modify architecture layers in
docs/architecture.md - Update
docs/conventions.mdanddocs/testing-strategy.md
- Edit
depends_onin features to control the dependency graph - Add
filesarrays to features for conflict detection - Adjust max parallel agents in
docs/parallel-development.md(default: 3-4) - Modify the
feature-buildersubagent in.claude/agents/feature-builder.md
Edit scripts/stop-gate-prompts.md to change what the agent sees at each state. Template variables are substituted automatically. No need to touch the shell scripts.
If you don't need the QA phase, create an empty qa-report.json with {"status": "passed"} and the loop will skip directly to improvement mode.
In testing with an iOS mental math trainer app:
- 186 features implemented autonomously
- 563 unit tests + 170 UI tests
- 24 development cycles in a single day
- Zero human intervention during feature implementation