Swift Claude Code — Design skill for Claude Code
A Swift reimplementation of a Claude Code-style coding agent, built stage by stage to explore what makes coding agents work.
How to install Swift Claude Code
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open ivan-magda/swift-claude-code and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Swift Claude Code does
A Swift reimplementation of a Claude Code-style coding agent, built stage by stage to explore what makes coding agents work.
Alternatives in Design
- Claude Agent Teams UI — You're the CTO, agents are your team 645 ★
- CometixCode — An unofficial Rust reimplementation of Anthropic's Claude Code terminal UI, built on iocraft 321 ★
- Mortiflix OSS — A motion design studio on your own machine: Claude makes the video step by step, you approve every stage 223 ★
README
swift-claude-code
Exploring the architecture of coding agents by rebuilding a Claude Code-style CLI from scratch in Swift.

Learning Series
A complete 9-part learning series is available on [ivanmagda.dev](https://ivanmagda.dev).
[Start the series →](https://ivanmagda.dev/posts/s00-bootstrapping-the-project)
Why This Exists
Claude Code feels unusually effective compared to other coding agents, and I suspect most of it comes from architectural restraint rather than architectural complexity. I studied the tool surface, traced the interaction loop, and tried to isolate which design choices actually matter.
My working theory: **coding agents benefit more from a small set of excellent tools and tight loop design than from large orchestration layers.**
Claude Code doesn't have many tools. The tools it does have are simple: a search tool, a file editing tool. But those tools are really good. And the system leans on the model far more than most agent implementations — less scaffolding, more trust in the LLM to do the heavy lifting.
This project tests that idea by rebuilding the core mechanics from scratch in Swift, one stage at a time, to see how little architecture you actually need.
Hypothesis
This project tests a few specific ideas about coding agents:
- A small number of high-quality tools beats a large tool catalog
- The model should do most of the heavy lifting — thin orchestration, not thick
- Explicit task state improves reliability more than prompt-only planning
- Controlled context injection matters more than persistent memory
- Context compaction is a product feature, not just a token optimization
Each stage is designed to isolate one mechanism and see what it enables.
The Agent Loop
The whole thing boils down to one loop:
func run(query: String) async throws -> String {
messages.append(.user(query))
while true {
let request = APIRequest(
model: model, system: systemPrompt, messages: messages, tools: Self.toolDefinitions
)
let response = try await apiClient.createMessage(request)
messages.append(Message(role: .assistant, content: response.content))
guard response.stopReason == .toolUse else {
return response.content.textContent
}
var results: [ContentBlock] = []
for block in response.content {
if case .toolUse(let id, let name, let input) = block {
let output = await executeTool(name: name, input: input)
results.append(.toolResult(toolUseId: id, content: output, isError: false))
}
}
messages.append(Message(role: .user, content: results))
}
}
The loop is the invariant. Tools are the variable. Every stage adds entries to the tool handler dictionary and injection points before the API call, but the loop body itself never changes.
Roadmap
Progress is tracked via git tags. The roadmap is split into two phases —
Related Skills
Verilog Generator
Claude Code skill for generating synthesizable Verilog-2005 modules from natural language, with built-in self-
Summonbar
Raycast-style macOS launcher with coding agents (Claude Code, Codex, …) built in
Langstage CLI
The terminal stage for your LangGraph agent — a Claude Code-style CLI for any CompiledGraph
Fireworks Design
Generate a world-class frontend page via fireworks-design (explore → judge → synthesize → refine → polish)
Auto Memory Design
Explore an agent and design a tailored memory system
Creative
Enter creative phase - explore design options for complex tasks
Related Agents
iOS Explore
Read-only codebase search for Swift/iOS projects. Use when answering a question requires sweeping many files,
macOS SwiftUI Engineer
Implements features and fixes in native macOS apps built with Swift 6 / SwiftUI / AppKit via SwiftPM command l
App Dev
Builds, changes, and debugs applications and scripts. Use for any coding task (iOS/Swift, Node.js, web, Apps S