No slash command · from swift-foundation
Manages Swift project tooling: Package.swift manifests, dependency constraints, swift build/test/run, xcodebuild, Tuist/XcodeGen project generation, and formatters/linters (swift-format, SwiftFormat, SwiftLint).
Ships in swift-foundation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| Marker in the project root | Build system | Build / test |
|---|---|---|
Package.swift only | SwiftPM | swift build, swift test |
*.xcodeproj / *.xcworkspace | Xcode | xcodebuild with a scheme and destination |
Project.swift / Tuist.swift | Tuist (generates the Xcode project) | tuist generate, then tuist build / tuist test or xcodebuild |
project.yml with targets: | XcodeGen (generates the Xcode project) | xcodegen generate, then xcodebuild |
An Xcode app often also has local Swift packages (Packages/*/Package.swift) — features or shared modules live there and build with swift build on their own only if they do not import UIKit / WatchKit.
When a generator is present, the .xcodeproj is a build artefact: edit the manifest (Project.swift, project.yml), regenerate, never hand-edit the generated project. Check .gitignore to see whether the generated project is committed.
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "Billing",
platforms: [.macOS(.v14), .iOS(.v17)],
products: [.library(name: "Billing", targets: ["Billing"])],
dependencies: [
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.0"),
],
targets: [
.target(name: "Billing", dependencies: [.product(name: "Logging", package: "swift-log")]),
.testTarget(name: "BillingTests", dependencies: ["Billing"]),
]
)
swift-tools-version or platforms to make something compile, and never raise them without the BA spec asking — both change who can use the package.from: (up to next major) by default; .upToNextMinor(from:) for pre-1.0 packages; exact versions or branch: / revision: only with a comment saying why.resources: [.process("Resources")], read with Bundle.module.swiftSettings: [.swiftLanguageMode(.v6), .enableUpcomingFeature("…"), .defaultIsolation(MainActor.self)] — copy what sibling targets use.Sources/<Target>/ are picked up automatically; a new target needs an entry in the manifest.Package.resolved (in .xcworkspace/xcshareddata/swiftpm/ for Xcode projects).swift package update <name>; never in the same change as feature work unless the feature needs it.project.pbxproj contains PBXFileSystemSynchronizedRootGroup. Files created inside that folder belong to its target automatically — just create them.sources: ["Sources/**"]). Create the file under the globbed path, then regenerate.PBXFileReference, a PBXBuildFile, an entry in its group's children, and an entry in the target's PBXSourcesBuildPhase. Use unique 24-hex-character IDs, mirror an existing entry exactly, and say in the report that project.pbxproj was edited by hand. If the structure is unclear, stop and report it as a BLOCKER rather than guessing — a corrupt pbxproj breaks the whole project.Never reformat or reorder project.pbxproj; edit only the lines you add.
xcodebuild -list # schemes, targets, configurations
xcodebuild -scheme App -destination 'generic/platform=iOS Simulator' build
xcodebuild -scheme App -destination 'platform=iOS Simulator,name=iPhone 17' test
xcodebuild -scheme App -destination 'platform=macOS' build
xcodebuild -scheme App -destination 'generic/platform=watchOS Simulator' build
-workspace App.xcworkspace when a workspace exists (CocoaPods, multi-project), else -project.generic/platform=… Simulator builds without booting a device — the fastest compile check. Tests need a concrete simulator: list them with xcrun simctl list devices available and pick one that exists; never hard-code a device name you have not seen.*.xctestplan): run with -testPlan Name when the scheme uses them.-quiet keeps the output readable; pipe through xcbeautify only if the project already does.CODE_SIGNING_ALLOWED=NO into committed scripts; it is fine on the command line for a simulator compile check.Use the tool the project configured — never introduce one:
| Config file | Tool | Format a file | Check |
|---|---|---|---|
.swift-format | swift-format (bundled with the Swift 6 toolchain) | swift format --in-place File.swift | swift format lint --strict -r Sources |
.swiftformat | SwiftFormat | swiftformat File.swift | swiftformat --lint . |
.swiftlint.yml | SwiftLint | swiftlint --fix (only the rules marked correctable) | swiftlint lint |
.swiftlint.yml, .swift-format or .swiftformat to make a change pass — the sdlc config-protection hook blocks it during a run. // swiftlint:disable:next rule_name only for a genuine false positive, with a reason..xcconfig files for build settings per configuration; read values through Info.plist ($(API_BASE_URL)) and Bundle.main.object(forInfoDictionaryKey:)..xcconfig, Info.plist, asset or the binary ships with the app and is extractable — never real secrets.Environment.get("DATABASE_URL") in Vapor, ProcessInfo.processInfo.environment elsewhere) and fail fast when a required value is missing..env files are never committed; commit .env.example..swift-version (swiftly / swiftenv) or a swift:6.x Docker image pins the toolchain for servers — use it..xcode-version or the CI workflow's xcode-select step names the Xcode version for apps. Do not use APIs from a newer SDK than that Xcode ships, unless guarded with if #available.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
swift-package-manager, xcodebuild, tuist, xcodegen, swift-format, swiftlint
3 skills in this plugin
/swift-conventionsSwift language conventions for any Swift codebase: Swift 6 language mode, value types first, optionals without force-unwraps, error handling (throws, typed throws, Result), protocols and generics (some vs any), access control, strict concurrency (async/await, structured tasks, actors, Sendable, @MainActor, default actor isolation and approachable concurrency), memory (ARC, weak/unowned captures), and the Swift API Design Guidelines. Stack-agnostic — referenced by swift-plugin and apple-plugin.
Use this skill to:
- Write Swift that compiles cleanly under the project's language mode and concurrency checking.
- Choose between struct, enum, class and actor.
- Model failures and absence without crashes.
- Name APIs the way the rest of the Swift ecosystem does.
Do NOT use this skill for:
- Package / build / formatter setup — see swift-foundation:swift-tooling.
- Tests — see swift-foundation:swift-testing.
- SwiftUI views and state — see apple-plugin:swiftui-conventions and apple-plugin:swiftui-state.
/swift-testingTesting Swift code: Swift Testing (@Suite, @Test, #expect, #require, parameterized arguments, traits, tags, confirmation for events), XCTest for existing suites (XCTAssert*, setUp/tearDown, expectations), async and actor-isolated tests, protocol-based test doubles, deterministic time and randomness, swift test / xcodebuild test, coverage. Stack-agnostic — referenced by swift-plugin and apple-plugin.
Use this skill to:
- Pick the framework the project already uses for the target you test.
- Write focused, deterministic tests for logic, async code and actors.
- Replace network, disk and clock dependencies with test doubles.
Do NOT use this skill for:
- SwiftUI previews, UI tests and snapshot tests — see apple-plugin:apple-testing.
- Server HTTP-level tests — the swift-plugin stack prompt covers Vapor / Hummingbird testing helpers.
npx claudepluginhub aratkruglik/claude-sdlc --plugin swift-foundationOther plugins' skills for the same job