swift
БесплатноБез исполняемых скриптовНе проверенSwift is Apple's compiled, memory-safe programming language, and its toolchain (swift build, swift test, swift run, Swift Package Manager) builds command-line…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Swift — toolchain and Swift Package Manager for command-line and server code
Overview
Swift is a compiled language with strong typing, value types and structured concurrency. Most people meet it through Xcode and iOS, but the same toolchain runs on Linux and macOS from the terminal, which is the part this skill covers: installing a toolchain, creating a package, resolving dependencies, building, testing, running and shipping a binary. The current stable release at the time of writing is Swift 6.4.2.
One command, swift, fronts everything: swift package manages the project, swift build compiles, swift run builds and runs an executable, swift test runs tests, and swift sdk installs cross-compilation SDKs. A project is a Swift package described by a Package.swift manifest, which is itself Swift code.
For SwiftUI views, performance audits and concurrency review of app code, use the existing skills swiftui-ui-patterns, swiftui-performance-audit, swiftui-view-refactor, swiftui-liquid-glass and swift-concurrency-expert. This skill is about the toolchain and SwiftPM.
Instructions
Install a toolchain with swiftly (Linux)
swiftly is the official toolchain manager. Download the archive for the machine's architecture, unpack it, and let it set itself up. Never pipe the download into a shell; each step is a separate command:
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz
tar zxf swiftly-$(uname -m).tar.gz
./swiftly init --quiet-shell-followup
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
hash -r
swift --version
swiftly init installs itself, writes env.sh, edits the shell profile, and installs the latest stable toolchain (about 1 GB, signature verified by default). For automation use swiftly init --assume-yes --no-modify-profile (add --skip-install to install the toolchain separately). swiftly may print an apt-get -y install ... line for missing system packages (it named gnupg2 and libz3-dev on Ubuntu 24.04); the agent cannot run that without root, so show it to the user.
On macOS, Xcode ships a Swift toolchain. For toolchains from swift.org, download https://download.swift.org/swiftly/darwin/swiftly.pkg, run installer -pkg swiftly.pkg -target CurrentUserHomeDirectory, then ~/.swiftly/bin/swiftly init.
Manage versions
swiftly list-available # releases and snapshots that can be installed
swiftly install 6.3 # latest 6.3.x patch; also "latest", "6.4.2", "main-snapshot"
swiftly use 6.3 # switch the in-use toolchain
swiftly use --global-default 6.4.2
swiftly list # installed toolchains
swiftly update latest
swiftly uninstall 6.3.3
A .swift-version file containing a version such as 6.4.2 in the project root pins the toolchain for that directory; swiftly use with no argument prints which one is active. swiftly run swift build +6.3 runs one command against another installed toolchain without switching. Official Docker images are the alternative on CI.
Create a package
mkdir logscan && cd logscan || exit 1
swift package init --name logscan --type executable
Types: library (the default), executable, tool (executable with Swift Argument Parser), build-tool-plugin, command-plugin, macro, empty. Pass --enable-swift-testing or --enable-xctest to choose the test framework; recent toolchains generate a test target by default. The layout is Sources/<Target>/ and Tests/<Target>Tests/.
Package.swift: targets and dependencies
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "logscan",
platforms: [.macOS(.v13)],
products: [.executable(name: "logscan", targets: ["logscan"])],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.8.0"),
],
targets: [
.target(name: "LogScanCore"),
.executableTarget(
name: "logscan",
dependencies: [
"LogScanCore",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.testTarget(name: "LogScanCoreTests", dependencies: ["LogScanCore"]),
]
)
The first line is the minimum toolchain, and it matters: swift-tools-version: 6.0 or higher switches the package to the Swift 6 language mode with strict concurrency checking. Put logic in a library target and keep the executable thin, so tests can import it (test targets can import library targets, and @testable import reaches internal symbols).
The manifest can also be edited from the command line:
swift package add-dependency https://github.com/apple/swift-argument-parser --from 1.8.0
swift package add-target-dependency ArgumentParser logscan --package swift-argument-parser
swift package resolve # fetch and pin; writes Package.resolved
swift package update
Установить swift в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swift?
Swift is Apple's compiled, memory-safe programming language, and its toolchain (swift build, swift test, swift run, Swift Package Manager) builds command-line tools and servers on Linux and macOS as well as apps. Use when someone asks to "install Swift on Linux", "create a Swift package", "add a dependency to Package.swift", "run Swift tests", "build a Swift CLI tool", "build a static Linux binary from Swift", or "pin a Swift version with swiftly". Covers swiftly, Package.swift, Swift Testing and XCTest, and the Static Linux SDK.
Как установить скилл swift?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swift запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic