Skip to content

donaldfilimon/abi / .claude/skills/swift

This skill should be used when the user runs /swift, or asks about fixing Swift builds on this Mac: Xcode vs swiftly/TOOLCHAINS, which compiler a Swift tree under ~/dev/active pins (Gama, GamaStudio, Gama qt/, String, Mixed, accountforge, FlipperCompanion, SocialPilot, DeviceConnector, LiveContainer), SwiftData macro errors, repository-selected Swift 6.5-dev snapshots, external SwiftPM scratch paths, ~Copyable verification (-typecheck false passes), Swift Testing #expect on ~Copyable values, --filter matching nothing and exiting 0, or probing main-snapshot language features. Do not use for Rust/abi or general Swift language tutorials.

FileKindSize
SKILL.mdskill md10.0 KB
references/abbeybot.mdmarkdown1.0 KB
references/toolchain.mdmarkdown2.7 KB

references/toolchain.md

View on GitHub
# Swift toolchain reference (this Mac)

## Preferred invocation

Read repository instructions and pin files before choosing a compiler. A
repository-selected toolchain, external scratch path, or validation wrapper
overrides the generic Xcode commands below.

```bash
unset TOOLCHAINS || true
/usr/bin/xcrun --toolchain default swift --version
/usr/bin/xcrun --toolchain default swift build --scratch-path /private/tmp/MyPkg.build
```

Snapshot-pinned trees (Gama, GamaStudio, String) select
`main-snapshot-2026-08-21` through `.swift-version`:

```bash
cd ~/dev/active/Gama
unset TOOLCHAINS
swiftly run swift --version        # must report 6.5-dev
swiftly run swift test --scratch-path "/private/tmp/gama-test-$USER"
```

## Verify which compiler you actually have

```bash
whence -pa swift                                 # ~/.swiftly/bin/swift first: a shim
swiftly list                                     # installed toolchains and swiftly's default
/usr/bin/xcrun --toolchain default swift --version   # Xcode's compiler (6.4 today)
xcode-select -p                                  # which Xcode (may be Xcode-beta)
```

swiftly's default is a main snapshot, so a bare `swift` outside a tree with a
`.swift-version` is **not** Xcode. `xcrun --toolchain <id>` is unaffected by
`TOOLCHAINS`; a bare `xcrun swift` is not.

Before adopting a main-only language feature or a new SDK API, compile a
minimal probe with the selected compiler and each supported secondary route.
Inspect the installed public `.swiftinterface` when prose and compiler
behavior disagree. A successful type-check establishes only that
compiler/SDK combination: not ABI, runtime behavior, another platform,
packaging, accessibility, or hosted CI.

## Failure signatures

| Symptom | Likely cause | Fix |
|---------|--------------|-----|
| Nonsense errors on `@Query` / `\.modelContext` | Snapshot compiler via swiftly shim or `TOOLCHAINS` | `unset TOOLCHAINS`; `/usr/bin/xcrun --toolchain default` |
| Codesign / "detritus not allowed" failures | xattrs on in-tree build output | Scratch path under `/private/tmp` |
| `swift run Product --build-path …` ignores the path | Flag order | Path flag **before** the product name |
| Version-line failure in a Gama/String script | Wrong compiler for the pin | `swiftly run swift …` from the repo root |
| `couldNotFindTmpDir` | `TMPDIR` points at a missing directory | `mkdir -p "$TMPDIR"` |

## SwiftPM hygiene

- Preserve `Package.resolved` pins unless intentionally bumping dependencies.
- Swift 6 language mode is the norm across these trees; treat strict
  concurrency (actors, `Sendable`) as required.
- Keep `swift-tools-version` where the repo pins it (Gama deliberately stays at
  6.4 so Xcode's integrated SwiftPM can resolve platform gates).
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall