bootstrap-swift-package
Bootstrap new Swift Package Manager repositories with consistent defaults, generated AGENTS guidance, validation, and customizable bootstrap settings. Use when creating a new Swift package, choosing platform or version presets, scaffolding its initial structure, or maintaining th
What it does
Bootstrap Swift Package
Purpose
Create a new Swift package repository with one top-level entry point, a simplicity-first Swift baseline, and a local-first maintainer surface. scripts/run_workflow.py is the runtime wrapper, and scripts/bootstrap_swift_package.sh is the deterministic implementation core for scaffold creation, testing-mode selection, validation, and maintain-project-repo installation with the swift-package profile.
Companion Plugin Requirement
This skill can be discovered from a standalone apple-dev-skills install, but its mutating bootstrap path installs repo-maintenance files through the companion productivity-skills plugin. If the companion maintain-project-repo runner is missing, tell the user to install productivity-skills alongside apple-dev-skills, or add the socket marketplace with codex plugin marketplace add gaelic-ghost/socket and then install or enable both apple-dev-skills and productivity-skills from the Socket catalog.
When To Use
- Use this skill for new Swift package scaffolding.
- Use this skill when the user wants consistent package defaults,
AGENTS.mdgeneration, and immediate validation. - Use this skill when the user wants to customize the documented bootstrap defaults for future runs.
- Do not use this skill as the default path for normal Xcode app collaboration work.
- Do not use this skill as the default path for guidance sync inside an already-existing Swift package repo.
- Recommend
swift-package-build-run-workfloworswift-package-testing-workflowwhen the user is doing ordinary package development after bootstrap. - Recommend
xcode-build-run-workflowwhen the user is working in an existing Xcode project or needs Xcode-managed Apple-platform build, run, toolchain, Metal, or mutation work after bootstrap. - Recommend
xcode-testing-workflowwhen the user needs Xcode-managed Apple-platform test execution after bootstrap. - Recommend
sync-swift-package-guidancewhen an existing Swift package repo needsAGENTS.mdor workflow-guidance alignment rather than fresh bootstrap. - Recommend
explore-apple-swift-docswhen the user needs Apple or Swift docs exploration, Dash-compatible lookup, or Dash follow-up work.
Single-Path Workflow
- Collect the required inputs:
nametypedestinationplatformversion_profile- optional
testing_mode - optional
skip_validation
- Normalize aliases exactly as
scripts/bootstrap_swift_package.shdoes:macos -> macios -> mobileboth -> multiplatformlatest -> latest-majorminus-one -> current-minus-oneminus-two -> current-minus-two
- Run
scripts/run_workflow.pyso documented defaults are loaded from customization state and normalized into one JSON contract. - Select testing mode before scaffold creation:
- require a supported and validated Swift toolchain from the current window, currently
6.3.xand6.2.x, before bootstrap planning continues because the generated manifest uses PackageDescription package traits for the defaultswift-configurationdependency - prefer
swift-testingon supported toolchains that exposeswift package init --enable-swift-testing - use explicit XCTest-selection flags when
xctestis requested and the active toolchain exposes them - fall back to the toolchain's default XCTest template only when
xctestis requested and the activeswift package initcommand exposes no testing-selection flags at all - stop with
blockedwhen the local toolchain is older than6.2or when the activeswift package initcommand cannot guarantee the requested testing mode
- require a supported and validated Swift toolchain from the current window, currently
- Let the wrapper invoke the bundled script:
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> --testing-mode <swift-testing|xctest> - Verify the generated repository:
Package.swift.swiftformat- explicit
swiftLanguageModes: [.v6]inPackage.swift - default
swift-configurationdependency inPackage.swiftwith theConfigurationproduct on the primary target and package traitsReloading,YAML, andCommandLineArguments // swift-tools-version:remains6.2or newer when the generated manifest keeps trait-enabled dependencies.gitAGENTS.mdscripts/repo-maintenance/hooks/pre-commit.samplescripts/repo-maintenance/validate-all.shscripts/repo-maintenance/release.shTests/swift buildandswift testunless--skip-validationwas requested- branch protection, when enabled, requires the GitHub Actions check context
validate; do not require the display-style stringValidate Repo Maintenance / validate
- Ensure the generated guidance encodes the shared Swift policy:
- apply the detailed local policy in
references/snippets/apple-swift-package-core.md - keep the generated repo aligned with the simplicity-first, shape-preserving, and anti-ceremony Swift guidance in that snippet
- keep the generated repo aligned with the checked-in
.swiftformatplus format-then-verify pre-commit-hook baseline in that snippet - keep the generated manifest aligned with the explicit Swift 6 default language-mode declaration
swiftLanguageModes: [.v6] - keep the generated manifest aligned with the default
swift-configurationdependency, using theConfigurationproduct and package traits.defaults,Reloading,YAML, andCommandLineArguments - treat the generated
// swift-tools-version:as a starting point that can be lowered to match the real package compatibility target, but never below6.2while the current supported window is Swift6.3.xand6.2.x - preserve the project-appropriate logging and telemetry guidance from that snippet
- apply the detailed local policy in
- Hand off package execution guidance cleanly:
- use
swift buildandswift testby default - recommend
sync-swift-package-guidancewhen a later repo-guidance refresh or merge is needed for the created package repo - recommend
swift-package-build-run-workfloworswift-package-testing-workflowfor ordinary package development after bootstrap - recommend
xcode-build-run-workflowfor package builds that need Xcode-managed toolchain behavior, such as package builds that depend on Xcode-provided Metal or other Apple-managed build assets
- use
- Return one JSON execution summary with the created path, normalized options, and validation result.
Inputs
name: required; must start with a letter and contain only letters, numbers,_, or-.type:library,executable, or advanced explicittool.destination: parent directory for the new package.platform:mac,mobile, ormultiplatform, with aliases normalized by the script.version_profile:latest-major,current-minus-one, orcurrent-minus-two, with aliases normalized by the script.testing_mode:swift-testingorxctest.skip_validation: optional flag to skipswift buildandswift test.dry_run: optional flag to resolve defaults and emit the normalized command contract without creating files.- Defaults:
- runtime entrypoint: executable
scripts/run_workflow.py typedefaults tolibrarydestinationdefaults to.platformdefaults tomultiplatformversion_profiledefaults tocurrent-minus-onetesting_modedefaults toswift-testing- validation runs unless
--skip-validationis passed - supported and validated Swift toolchain window is Swift
6.3.xand6.2.x - generated manifests should preserve an explicit Swift 6 language-mode declaration with
swiftLanguageModes: [.v6]when the active manifest surface supports it - generated manifests include
swift-configurationby default with theConfigurationproduct on the primary target and traits.defaults,Reloading,YAML, andCommandLineArguments - generated manifests may lower
// swift-tools-version:from the scaffold default when the package should support the previous supported Swift minor, but they should never go below6.2while the current supported window is Swift6.3.xand6.2.x maintain-project-repoinstallsscripts/repo-maintenance/on successful mutating runs
- runtime entrypoint: executable
Outputs
statussuccess: the package was created and verification succeededblocked: prerequisites, unsupported toolchains, unsupported testing-mode selections, or target-directory constraints prevented the runfailed: the script started but did not complete successfully
path_typeprimary: the bundled script completed successfullyfallback: manual scaffold guidance is being used instead of the bundled script
output- resolved package path
- normalized inputs
- resolved
testing_strategy - detected
swift_toolchainon real runs - installed
maintain-project-repopaths - validation result
- one concise next step
Guards and Stop Conditions
- Stop with
blockedifswiftis missing. - Stop with
blockedifswift --versioncannot be parsed into a supported toolchain version. - Stop with
blockedif the local Swift toolchain is older than6.2. - Stop with
blockedifgitis missing. - Stop with
blockedifassets/AGENTS.mdis missing. - Stop with
blockedif the target exists and contains non-ignorable files. - Stop with
blockedifnameis missing. - Stop with
blockedif the requested testing mode cannot be honored or guaranteed by the activeswift package initcommand.
Fallbacks and Handoffs
- Preferred path is always
scripts/bootstrap_swift_package.sh. - Use manual
swift package initguidance only when the script is unavailable or the user explicitly asks for the manual path. toolis an advanced explicit passthrough, not a default branch of the workflow.- Within the supported Swift
6.3.xand6.2.xwindow, prefer currentswift package inittesting flags when the active toolchain exposes them; only rely on the older default XCTest template whenxctestis requested and the activeswift package initcommand exposes no testing-selection flags at all. - After a successful scaffold, hand off ordinary package execution tasks to
swift-package-build-run-workfloworswift-package-testing-workflow. - After a successful scaffold, hand off Xcode-managed package build or run tasks to
xcode-build-run-workflow. - After a successful scaffold, hand off Xcode-managed package test tasks to
xcode-testing-workflow. - After a successful scaffold, use
scripts/repo-maintenance/validate-all.shfor local maintainer validation andscripts/repo-maintenance/release.sh --mode standard --version vX.Y.Zfrom a feature branch or worktree for protected-main releases. - After a successful scaffold, configure protected branches to require
validatefor the managed repo-maintenance workflow; GitHub exposes that job check context directly rather than the workflow title plus job string. - After a successful scaffold, hand off later repo-guidance alignment work to
sync-swift-package-guidance. - For ordinary package work, prefer
swift buildandswift test. - For package builds that need Xcode-managed SDK or toolchain behavior, use
xcode-build-run-workflowandxcodebuildguidance instead of stretching the bootstrap skill into an execution skill. - Recommend
explore-apple-swift-docsdirectly when the user’s next step is Apple or Swift docs exploration or Dash-compatible docs management. scripts/run_workflow.pyis the top-level runtime entrypoint and converts the shell script result into the documented JSON contract.
Customization
- Use
references/customization-flow.md. scripts/customization_config.pystores and reports customization state.scripts/run_workflow.pyloads runtime-safe defaults from customization state before invoking the shell script.scripts/bootstrap_swift_package.shnow honors the wrapper's git andAGENTS.mdcopy flags.- Run the Python wrapper and customization entrypoints through
uv, because they rely on inlinePyYAMLscript metadata rather than a repo-global Python environment. - In consuming repos, the supported path is
uv run scripts/run_workflow.py ...anduv run scripts/customization_config.py ...; do not assume plainpythonorpython3will have the needed YAML dependency installed.
References
Workflow References
references/package-types.md
Contract References
references/automation-prompts.mdreferences/customization-flow.md
Support References
- Recommend
references/snippets/apple-swift-package-core.mdwhen the new package repo should start with reusable SwiftPM baseline policy content next to the generatedAGENTS.md. assets/AGENTS.mdreferences/snippets/apple-swift-package-core.md
Script Inventory
scripts/run_workflow.pyscripts/bootstrap_swift_package.shscripts/customization_config.py
Capabilities
Install
Quality
deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (13,238 chars)