Purpose
Create a new Swift package repository with one top-level entry point and a simplicity-first Swift baseline. scripts/run_workflow.py is the runtime wrapper, and scripts/bootstrap_swift_package.sh remains the implementation core for scaffold creation and validation.
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.
- Recommend
apple-xcode-workflowwhen the user is working in an existing Xcode project or needs Apple-platform execution after bootstrap. - Recommend
apple-dash-docsetswhen the user needs Dash docset search, install, or generation 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 5.10+toolchain floor before bootstrap planning continues - prefer
swift-testingon supported current toolchains - use
xctestwhen explicitly requested or when the supported toolchain requires it - stop with
blockedwhen the local toolchain is older than5.10or when the localswift package initcommand cannot select the requested testing mode
- require a supported and validated
- 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.gitAGENTS.mdTests/swift buildandswift testunless--skip-validationwas requested
- Ensure the generated guidance encodes the shared Swift policy:
- apply the detailed local policy in
references/snippets/apple-swift-core.md - keep the generated repo aligned with the simplicity-first, shape-preserving, and anti-ceremony Swift guidance in that snippet
- preserve the project-appropriate logging, telemetry, and SwiftUI architecture guidance from that snippet
- apply the detailed local policy in
- Hand off package execution guidance cleanly:
- use
swift buildandswift testby default - recommend
apple-xcode-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 floor is
5.10+
- 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
- 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 than5.10. - 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 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.- After a successful scaffold, hand off build, test, or Xcode-managed package execution tasks to
apple-xcode-workflow. - For ordinary package work, prefer
swift buildandswift test. - For package builds that need Xcode-managed SDK or toolchain behavior, use
apple-xcode-workflowandxcodebuildguidance instead of stretching the bootstrap skill into an execution skill. - Recommend
apple-dash-docsetsdirectly when the user’s next step is Dash docset or cheatsheet 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.
References
Workflow References
references/package-types.md
Contract References
references/automation-prompts.mdreferences/customization-flow.md
Support References
- Recommend
references/snippets/apple-swift-core.mdwhen the new package repo should start with reusable Apple and Swift baseline policy content next to the generatedAGENTS.md. assets/AGENTS.mdreferences/snippets/apple-swift-core.md
Script Inventory
scripts/run_workflow.pyscripts/bootstrap_swift_package.shscripts/customization_config.py