agentsclimarketplace

Xcode tools

Skill jlreyes/swift-agent-kit/skills/xcode-tools

Operating guide for Xcode 27's bundled MCP server (mcpbridge): when to use each mcp__xcode-tools__* tool versus the agent's native tools or the CLI, connection setup and repair, output-noise control, and the tools that are genuinely unique (live per-file diagnostics, the shared lldb session, preview rendering, project-membership file operations, device driving). Use whenever xcode-tools MCP tools are available and an Xcode project is involved — including building, running, testing, debugging, rendering previews, or driving the simulator — before reaching for any mcp__xcode-tools__* tool, or when those tools are missing or erroring.From its SKILL.md

Install
npx -y skills add jlreyes/swift-agent-kit --skill xcode-tools

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

8.7 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it

Driving Xcode from Claude Code

Working model: Claude Code is the editor; Xcode is an attached build/run/debug/docs service. The user is not editing in Xcode — it's open so its services are reachable. Never assume the Xcode UI state (current file, selection) means anything unless asked about it, and remember some calls mutate state the human also sees (run destination, debugger, simulator).

Per-tool verdicts and nuances: references/tool-reference.md.

Session bootstrap (once per session)

  1. XcodeListWindows → parse tabIdentifier from the message text; match on workspacePath if several windows. No workspace open → everything else is unusable; ask the user or open -a Xcode-beta <path>.xcodeproj.
  2. Only if you'll build/run: confirm the destination via the activeDestinationDisplayTitle field of XcodeSwitchScheme/…Destination responses — do NOT call XcodeListRunDestinations (15KB) unless you actually need to change OS/device class.

tabIdentifier is Xcode-side state: survives agent restarts, dies with Xcode. Tools enumerate at agent-session start — if Xcode wasn't running then, the tools are absent until reconnect/restart.

Division of labor — native tools vs xcode-tools vs CLI

The project type matters: in SwiftPM packages (Package.swift), membership IS the folder layout — native file tools do everything, and the Xcode file tools add nothing. In .xcodeproj projects, membership lives in the pbxproj — file lifecycle must go through Xcode tools or the build won't see your changes.

JobUseDon't useWhy
Read file contentsnative ReadXcodeReadsame bytes without the MCP hop, JSON-escaped payload, or tabIdentifier ceremony
Search/list sourcenative Grep/GlobXcodeGrep/Glob/LSfaster; content is content
Edit existing filenative EditXcodeUpdateEdit errors on ambiguous match; XcodeUpdate silently edits the FIRST occurrence
Create file (.xcodeproj)XcodeWritenative Writeregisters it in project/target; native Write orphans it
Delete/rename/move (.xcodeproj)XcodeRM / XcodeMVnative rm/mvkeeps pbxproj references consistent; RM trashes (recoverable)
Any file op (SwiftPM pkg)native toolsXcode file toolsfolder = membership
Group structure / target membership questionsXcodeLS, GetTargetBuildSettingsguessing from diskgroups ≠ folders
"What is the user looking at?"XcodeGetCurrentFileonly source of editor focus; {"isEditable":false} = nothing focused
One-file compile checkXcodeRefreshCodeIssuesInFilebuildingno build artifacts touched; sees more than the compiler emits (but ~7–10s — a warm incremental BuildProject can be faster)
Full buildBuildProjectshelling to xcodebuildquiet by design (summary + log file); CLI only for clean builds / flag overrides / CI parity
Run tests (.xcodeproj / simulator)RunSomeTests / RunAllTestsxcodebuild teststructured counts + .xcresult, self-building
Run tests (SwiftPM)swift test CLIMCP test toolsno scheme/simulator needed; CLI is leaner
Launch app + debugRunProject(attachDebugger:true) → InvokeDebuggerCommandthe only lldb path; CLI lldb would fight Xcode
App stdout/print + OSLog of an Xcode-launched runGetConsoleOutputlog showprint/stdout never reaches unified logging; session-scoped
Logs of a process YOU launched via CLIlog show/log streamGetConsoleOutputit only sees Xcode launch sessions
Visual check of a SwiftUI viewRenderPreviewbuilding+screenshot ritualsrenders #Preview to PNG, ~25–30s, no simulator interaction
Try an idea in project contextRunCodeSnippetscratch filessees the file's types; stdout-only output
Build settings / Info.plist / entitlementsthe MCP setting toolsediting pbxproj/plist by handvalidated, reference-safe (entitlements are checked against a real database)
String Catalog workStringCatalog* toolsnative Edit of .xcstringstools maintain the translation state machine + extraction sync
Apple docs lookupsee the apple-docs skill's routing sectionDocumentationSearch is discovery, NOT an existence check
iOS UI driving (tap/type/screenshot)DeviceInteraction* suiterequires iOS Simulator 27.0+ runtime; iOS-only — explicitly refuses Mac

What only this server gives you

  1. XcodeRefreshCodeIssuesInFile — live sourcekit diagnostics with no build, seeing more than the compiler emits. Not instant (~7–10s observed): prefer it when a build is undesirable; on warm small projects an incremental BuildProject is both faster and authoritative.
  2. InvokeDebuggerCommand — a real lldb into the running app, sharing Xcode's debug-console session. Etiquette: the human sees your commands; process interrupt before expressions, continue promptly, remove any breakpoints you set.
  3. RenderPreview — compile-and-snapshot any #Preview to a PNG.
  4. Membership-aware file ops for .xcodeproj projects.
  5. DeviceInteractionSynthesize — taps/swipes/typing + screenshot + UI hierarchy + app stderr per call, with command chaining (verified live; needs an iOS 27+ simulator runtime — iOS only, Mac refused).
  6. Crash/field-performance services — Apple's field data + triage docs, for apps connected in Organizer (pass bundle_id explicitly; the auto-resolution claim is false in practice).

Verification ladder (cheapest first — but read the timings)

  1. BuildProject — authoritative compile+link; self-reports elapsedTime (0.1s null build, ~4s small warm compile). On warm projects this is usually the cheapest real check.
  2. XcodeRefreshCodeIssuesInFile — per-file, no build artifacts, catches hallucinated APIs and more diagnostics than the compiler (~7–10s). Misses cross-file/link breaks.
  3. RunCodeSnippet — behavior probe in project context (~15–25s).
  4. RunSomeTestsRunAllTests — highest signal; ~14s with a warm simulator, 45s+ cold. Once the sim is booted, tests are cheap — use them.

Token cost & noise control

Most responses are pre-quieted summaries; the xcodebuild firehose goes to artifact files (/var/folders/…/T/ActionArtifacts/default/<Tool>/…) — grep those, never read linearly. The exceptions to watch:

OffenderCostMitigation
GetTargetBuildSettings~26KB inline, no filterfetch via subagent, or accept once and extract what you need
DocumentationSearch~30KB/query (~12KB with frameworks filter)filter + precise queries; it's vocabulary discovery, not lookup
XcodeListRunDestinations~15KBavoid; read active destination from switch-tool responses
GetConsoleOutput500-line default tailpattern + oslogSeverity + small tailLimit

Gotcha: GetBuildLog and XcodeListNavigatorIssues default to severity:"error" — a warnings-only build looks empty until you pass severity:"warning".

Failure modes & repair

SymptomCause → fix
Server dead at startup: MCP_XCODE_PID … no running Xcode processes foundXcode wasn't running → open Xcode, reconnect/restart session
Tools entirely absentsame; enumeration happens once at session start
No workspace windows foundno project open in Xcode
Wrong Xcode answeringset MCP_XCODE_PID=<pid> in server env
Device tools: Supported: iOS [Simulator] 27.0+install the iOS 27 simulator runtime; Mac is never supported
Hard MCP error {"type":"error","data":…} vs result with success:falsetwo error envelopes — check both

Setup (one-time):

claude mcp add --scope user xcode-tools \
  --env DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer \
  -- /Applications/Xcode-beta.app/Contents/Developer/usr/bin/mcpbridge

What ships with it: 1 file

14.7 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 326,764. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.