Swift Code One Task
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Carry out a single task’s implementation, tests, and checkbox update against the real codebase — nothing else.
This is the narrowest execution unit in the iru-code pipeline: iru-swift-code-one-task-group calls it once
per task in a bucket (potentially many at once, in parallel agents via iru-isolated-skill-executor).
Purpose
iru-swift-code-one-task is the Swift-specific implementation worker iru-swift-code-one-task-group calls once
per task. Given one task’s own text (what to build, its exact implementation_plan.md checkbox line(s), and any
sub-tasks), it first detects the repository’s Swift project shape and the target the task belongs to, loads only
the matching guidance from its own bundled reference/ directory, re-checks the current code state, implements
exactly what’s specified, and writes/updates tests. If the task didn’t stop on a blocker, it compile-checks the
touched target, then immediately checks off that task’s own checkbox (and its sub-tasks') in
implementation_plan.md with a "group validation pending" note, before reporting back — so an interrupted run
doesn’t re-attempt work that already landed. License headers, DocC audits, the full test suite, coverage, and
code-quality checks all happen once per bucket in iru-swift-code-one-task-group, not here. It uses a medium
model on purpose: the plan already carries the hard reasoning, so this skill only executes one task’s
implementation against code agreements that live in reference/ rather than being re-derived per task.
For a task that adds or changes a screen, component or list in an app it also applies the catalog’s UI contract (see Building user interfaces): it writes the Screen > Region > Component decomposition first, builds leaves first with value-type state plus closures and virtualized collections over keyed view-model state, and writes the UI tests that capture every .ui-quality.yml direction x theme combination and run the accessibility audit. A command-line tool has no UI, so none of this applies there.
Package-vs-app shape and target detection
Before reading anything, Step 1 works out which of two shapes the repository is:
-
A plain Swift Package — a
Package.swiftat or near the root with no.xcodeproj/generator manifest alongside it. Code lives underSources/<Target>/andTests/<Target>Tests/, one pair perPackage.swifttarget. A command-line tool is a plain package whosePackage.swiftdeclares an.executableTargetdepending onArgumentParser(reported byiru-exploreasProject type: cli-tool (swift)). In theiru-setup-swift-clilayout the logic lives in aSources/<Bin>Kit/library,Sources/<Bin>/holds thin swift-argument-parser commands, and the tests areTests/<Bin>KitTests/(in-process) plusTests/<Bin>CLITests/(runs the built binary). -
An Apple app project — an
.xcodeprojexists or is generated, viaproject.yml(XcodeGen),Project.swift(Tuist), or, with neither manifest, a hand-maintained*.xcodeprojwhoseproject.pbxprojis the source of truth. An app project frequently also has a localPackages/Corepackage holding testable logic behind thin, per-platform UI targets.
For an app project it also detects, once from the repository:
-
The layout and the touched target’s platform —
App/Sources/with a single macOS app target is theiru-setup-macos-applayout (a macOS-only desktop app, compile-checked withplatform=macOS, no simulator);Targets/<Platform>/Sources/is theiru-setup-apple-appmultiplatform layout, where the folder names the target (Targets/iOS/covers iPhone and iPad, plusTargets/macOS/,Targets/watchOS/,Targets/visionOS/). The platform is confirmed against the manifest (XcodeGenplatform:/supportedDestinations:, Tuistdestinations:) or the target’sSDKROOT. iPadOS is an iOS target whose destinations include iPad; a visionOS destination on an iOS target, or a standalonexrostarget, is visionOS. -
The UI framework of the touched target —
swiftui(a@main struct …: Appwithsome Scene),uikit(aUIApplicationDelegate/UIWindowSceneDelegatewithUIViewControllersubclasses and no SwiftUIApp) orappkit(anNSApplicationDelegatewithNSWindowController/NSViewControllersubclasses). Hosted content in the other framework doesn’t change the answer; visionOS and watchOS targets are SwiftUI. -
The architecture from the layout contract (
Packages/Core/Sources/Core/ViewModels/→ MVVM,…/Controllers/→ MVC; neither → MV for SwiftUI, MVC for UIKit/AppKit; both → decided per target, UIKit/AppKit targets inControllers/and SwiftUI targets inViewModels/, the scaffolded UIKit-MVC + SwiftUI-platforms mix). SwiftUI uses MVVM or MV, UIKit/AppKit MVC or MVVM; a task never switches it. The 80% coverage bar coversPackages/Coreonly; the app targets are "not measured".
Logic an app task adds goes to Packages/Core (Foundation + Observation only, no SwiftUI/UIKit/AppKit import) in the
detected architecture’s folder; only views, view controllers, window/scene controllers, menus/commands, the
composition root (App, AppDelegate, SceneDelegate), background-task/notification registration, and protocol
implementations that must touch a UI or platform framework belong in the app target.
In a command-line tool, logic, output and errors go to <Bin>Kit; a new subcommand’s thin struct (flags, command
metadata and one call into the Kit) goes to Sources/<Bin>/ and is registered in the root’s subcommands:.
It then works out which target the task’s file paths or description name — a path under Sources/<Target>/
or Packages/Core/Sources/<Target>/ names that target directly; a path under a per-platform app target directory
(read from the manifest’s targets:/Target(…) list rather than guessed) names that target; otherwise the
skill infers from the described behavior (reusable logic with no UI import vs. a SwiftUI/UIKit/AppKit view for
one platform), defaulting to the package’s main target (or Packages/Core) when genuinely ambiguous. This
package/app choice, plus the target, decides both which reference/ files apply and Step 5’s compile-check
command (swift build --build-tests vs. xcodebuild build-for-testing -scheme <AppName>-<Platform> with
-destination 'generic/platform=<P> Simulator' for an iOS/iPadOS, watchOS or visionOS target, or platform=macOS
for a macOS one). The generic destination needs no installed simulator runtime, so a missing visionOS runtime never
makes the compile-check "unavailable".
The bundled reference library
This skill ships a reference/ directory alongside its SKILL.md, holding this catalog’s general Swift 6
code agreements. It is read by progressive disclosure: reference/README.md routes to the rest,
reference/code-style.md is always read, and the others only when the task’s shape calls for them.
| File | Read when | Covers |
|---|---|---|
|
Always |
Swift 6 strict concurrency ( |
|
The task adds or changes a type, or any |
DocC documentation comment conventions. |
|
The task writes or updates tests — nearly every task |
Swift Testing/XCTest conventions: Swift Testing by default, XCTest only for XCUITest and |
|
The task adds or changes a SwiftUI |
SwiftUI view composition conventions, plus pointers to |
|
The task adds or changes a view model, an MVC controller or its view protocol, a service protocol/test double, or decides whether logic goes in |
Layout/platform detection table, MVVM vs. MVC contract, the UI-free |
|
The task touches a macOS app target: scenes/windows, menus/commands/shortcuts, Settings, |
Mac-only scene, menu, file-access and sandbox conventions. |
|
The task adds or changes AppKit code: |
AppKit conventions for macOS apps. |
|
The task touches an iOS/iPadOS app target: |
iOS/iPadOS conventions: suspension model, |
|
The task adds or changes UIKit code: app/scene delegates, |
Programmatic scene-based UIKit conventions, diffable data sources with compositional layout, |
|
The task touches a visionOS target or destination: windows, volumes, immersive spaces, ornaments, hover effects, |
SwiftUI-only visionOS conventions: |
|
The package is a command-line tool and the task adds or changes a command, flag, output, error/exit code, prompt, signal/cleanup, child process or the CLI tests |
Where code goes ( |
|
With |
The catalog’s shared, language-agnostic CLI contract (streams, exit codes, TTY/colour, machine output, safety and idempotency, configuration, self-description, startup). |
|
The task adds or changes a screen, component, list or other UI (any UI framework) |
The catalog-wide UI rules: decomposition, composition, inputs/events, virtualized collections, UI tests, screenshots and accessibility. |
|
With |
The contract mapped onto SwiftUI/UIKit/AppKit, XCUITest and the shared |
|
The task changes a |
Semver-stable package API conventions, availability, |
|
The task adds a new app target, touches the generator manifest, or wires shared logic between |
Per-platform app structure conventions. |
A new screen in a SwiftUI macOS app reads architecture.md + macos.md + swiftui.md; one in an AppKit app reads architecture.md + macos.md + appkit.md (plus swiftui.md only when it hosts SwiftUI content). A new screen in a SwiftUI iOS app reads architecture.md + ios.md + swiftui.md; in a UIKit iOS app architecture.md + ios.md + uikit.md (plus swiftui.md only when it hosts SwiftUI); a visionOS scene reads architecture.md + visionos.md + swiftui.md. A new command in a command-line tool reads cli.md + cli-contract.md + testing.md (and docc.md for its Kit types), never the app files.
Every file states the same override: the rules are the default for new code, and a file that consistently
does something else wins — the divergence is reported in Step 8 rather than silently restyled. If reference/
is missing entirely, the skill falls back to this repository’s own CLAUDE.md conventions and the surrounding
code’s style, and says so in its report.
Plugin
Shipped by the iru-swift plugin of the ai-catalog marketplace (install with /plugin install iru-swift@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
Yes |
The task’s full text as written in |
None — this skill has nothing to do without a task description. |
|
No |
The skill’s own bundled reference directory ( |
Bundled with the skill |
Outputs
-
Source and test files created/modified per the task, following the bundled
reference/agreements — strict-concurrency-clean Swift 6, value types first, narrow access control, typed throws,// MARK:-grouped member order, full DocC on public/package members — plus this repository’s ownCLAUDE.mdconventions where they are more specific, and the surrounding file’s existing style wherever it consistently differs. -
Swift Testing (or XCTest where warranted) tests added/updated covering the new/changed behavior, including a case per documented
- Throws:— not run by this skill; the caller runs the suite once for the whole bucket. -
For a UI task: component tests per visual state capturing each
.ui-quality.ymldirection x theme (UIScreenshots.render/capture), screen/flow XCUITests with--fixturedata and captures, and the screen’sperformAccessibilityAudit()test honouring the configured level; the sharedUIScreenshots.swifthelper is added to the test target when missing. Captures land under.ui-screenshots/<kind>/<Id>/<state>--<direction>--<theme>.pngwhen the group’s UI stage runs them. -
A compile-check of the touched target (
swift build --build-tests— also for a command-line tool, orxcodebuild build-for-testingagainstplatform=macOSor a genericgeneric/platform=<P> Simulatordestination for iOS/visionOS/watchOS, after regenerating the project if the manifest changed) — passed, fixed, found unrelated to this task, or reported unavailable. -
implementation_plan.mdwith this task’s own checkbox (and its sub-tasks') checked off and a "group validation pending" note, written immediately once the task finishes cleanly — before this skill reports back. Left untouched if the task stopped on a blocker. -
A short summary handed back to the caller: project shape and target detected (plus, for an app, the layout, the target’s platform — macOS / iOS-iPadOS / visionOS —, its UI framework and the architecture), reference file(s) read, file(s) touched, tests added/updated, compile-check result, for a UI task the decomposition (one line per component: inputs, events, new or reused) and the UI tests and screenshot paths added, whether the run stopped on a blocker, and any deliberate deviation from
reference/.
Execution flow
A conflict between reference/ and the surrounding code is deliberately not a stop condition — the skill
follows the surrounding code and reports the divergence in Step 8.
Dependencies
Invokes
None — iru-swift-code-one-task is a leaf skill; it does not call any other skill in this catalog. It reads its
own reference/ directory and edits the code and test files the task names. License headers, DocC audits, the
full test suite, coverage, and quality checks all happen once per bucket in iru-swift-code-one-task-group.
Invoked by
-
Swift Code One Task Group — Step 2, once per task in a bucket (concurrently, in a single batch of
Agentcalls, when the group is markedParallelizable: yes; one at a time otherwise), via theiru-isolated-skill-executoragent, passing that task’s full text including its exact checkbox line(s). That caller re-readsimplementation_plan.mdafterward to confirm the checkbox this skill already flipped landed, then replaces the "pending" note with the final validation outcome once the whole bucket’s validation passes.
Source
SKILL.md on GitHub — the file this page was generated from. The bundled Swift code agreements live alongside it under reference/.