bootstrap-swift-package
4
总安装量
2
周安装量
#52915
全站排名
安装命令
npx skills add https://github.com/gaelic-ghost/apple-dev-skills --skill bootstrap-swift-package
Agent 安装分布
codex
2
amp
1
cline
1
opencode
1
cursor
1
kimi-cli
1
Skill 文档
Bootstrap Swift Package
Overview
Create a new Swift package quickly with repeatable defaults. Prefer the bundled script for deterministic setup.
Workflow
- Confirm package intent.
- Ask for package
name,type(library,executable, ortool), destination path, platform preset (mac,mobile,multiplatform), and version profile (latest-major,current-minus-one,current-minus-two). - Accept aliases:
macosformac,iosformobile,bothformultiplatform, andlatest/minus-one/minus-twofor version profiles.
- Create the package.
- Preferred: run
scripts/bootstrap_swift_package.sh --name <Name> --type <library|executable|tool> --destination <dir> --platform <mac|macos|mobile|ios|multiplatform|both> --version-profile <latest-major|current-minus-one|current-minus-two|latest|minus-one|minus-two>. - Fallback: run
swift package init --name <Name> --type <library|executable|tool>manually inside the target directory, patchPackage.swiftplatforms, copyassets/AGENTS.mdto repo root asAGENTS.md, then rungit init.
- Validate bootstrap output.
- Verify
Package.swiftexists. - Verify
.gitexists. - Verify
AGENTS.mdexists. - Verify
Tests/exists. - Run
swift buildandswift testin the package root.
- Report result.
- Summarize created path, package type, platform preset, version profile, build/test status, and immediate next steps.
Defaults
- Use
libraryunless the user clearly asks forexecutableortool. - Use
multiplatformunless the user clearly wants onlymacormobile. - Use
current-minus-oneas the default version profile. - Keep generated structure minimal; do not add extra frameworks unless requested.
- Always initialize git.
- Always include
AGENTS.mdwith repository expectations for working with Swift Package Manager and Swift packages.
Troubleshooting
- If
swiftis missing, stop and ask the user to install Xcode command line tools or Swift toolchain. - If
gitis missing, stop and ask the user to install git or Xcode command line tools. - If
assets/AGENTS.mdis missing, stop and restore the template before bootstrapping packages. - If destination exists and is non-empty (excluding ignorable macOS metadata like
.DS_Store), do not overwrite; ask for a new destination or explicit cleanup instructions. - If validation fails in constrained environments, rerun with
--skip-validationand report that checks were skipped.
Resources
scripts/
scripts/bootstrap_swift_package.sh: Create package directory, runswift package init, apply platforms defaults toPackage.swift, initialize git, and run safety/validation checks.
references/
references/package-types.md: Quick selection guide for package types, platform presets, and version profiles.
assets/
assets/AGENTS.md: Template copied into each new package repository to set repository expectations for Swift Package Manager workflows.