Swift Package Build Run Workflow
Purpose
Use this skill as the primary execution workflow for ordinary non-testing work in existing Swift package components. Keep it focused on manifest and dependency changes, package resources, builds, runs, and Release-versus-Debug validation. scripts/run-workflow.fsx resolves the nearest package root and plans commands without classifying the containing repository.
When To Use
- Use this skill for ordinary build and run work inside an existing Swift package repo.
- Use this skill for ordinary manifest, target, product, dependency, and package-resource work driven by
Package.swift. - Recommend
swift-package-extension-workflowfor package plugins, macros, traits, generated source, or plugin permissions. - Use this skill for package resources,
Bundle.module,.process(...),.copy(...),.embedInCode(...), and package-local fixture layout decisions. - Use this skill for Metal library packaging, distribution, and the SwiftPM side of Metal-related package work before Xcode-managed Apple toolchain behavior becomes the real concern.
- Use this skill for Debug-versus-Release validation, build artifacts, and tagged-release package expectations.
- Use this skill for Swift Package Index readiness checks in package repositories, but hand external add-package submission to Socket's guarded
scripts/spi_add_package.pyissue-form flow when that script is available. - Do not use this skill for package-testing-first work, test-plan execution, XCTest or Swift Testing diagnosis, or test-specific filtering and retries.
- Do not use this skill for brand-new package bootstrap from nothing.
- Do not use this skill for repo-guidance alignment in an existing package repo.
- Do not use this skill as the default path for Xcode workspace, scheme, preview, simulator, or navigator-driven work.
- Recommend
swift-package-testing-workflowwhen the request is primarily about running, diagnosing, organizing, or evolving tests. - Recommend
bootstrap-xcode-workspace --operation create --component-kind librarywhen the package repo does not exist yet. - Recommend root workspace
just alignwhen product guidance needs to be refreshed. - Recommend
xcode-build-run-workflowwhen the task depends on active Xcode workspace state, scheme-aware execution, previews, navigator diagnostics, simulator or device flows, or guarded mutation inside Xcode-managed scope. - Recommend
explore-apple-swift-docswhen the user needs Apple or Swift docs exploration before implementation or package changes.
Single-Path Workflow
- Classify the request into one operation type:
- package inspection
- read or search
- manifest or dependency changes
- build
- run
- package extension handoff
- toolchain management
- mutation
- Apply the Apple and Swift docs gate before any design, architecture, implementation, or refactor guidance:
- use
explore-apple-swift-docsto gather the relevant SwiftPM, Swift, or Apple documentation first - when SwiftPM behavior, manifest syntax, package plugins, resources, products, targets, or dependency rules matter, prefer the Dash.app docset workflow with the
swiftlang/swift-package-managerdocset first - fall back to the canonical
swiftlang/swift-package-managerGitHub repository only when the local Dash docset is unavailable or insufficient - state the documented API behavior, package rule, or workflow requirement being relied on before proposing changes
- do not rely on memory as the primary source when docs exist
- if the docs and the current code conflict, stop and report that conflict
- if no relevant docs can be found, say that explicitly before proceeding
- use
- Apply the shared Swift-package policy before giving implementation guidance:
- apply the detailed local policy in
references/snippets/apple-swift-package-core.mdwhen package-policy wording is needed - preserve its simplicity-first, shape-preserving, and anti-ceremony Swift guidance
- preserve its explicit
swiftLanguageModes: [.v6]package-manifest default and prefer that spelling over the legacyswiftLanguageVersionsalias on current manifest surfaces - preserve its package-appropriate logging, telemetry, and structured-concurrency guidance
- apply the detailed local policy in
- Run
scripts/run-workflow.fsxto resolve the nearest package root, confirm the request stays on the build/run surface, and plan the SwiftPM command path. - Use
references/cli-command-matrix.mdfor agent-executed SwiftPM commands and terminal-first editor workflows. - Use
references/package-resources-testing-and-builds.mdwhen the request touches package resources, Metal artifacts,Bundle.module, or Debug/Release and tagged-release validation. - Apply
../../shared/execution-surface-routing.md; usexcode-build-run-workflowonly when the requested operation needs Xcode-owned state. - For Swift Package Index add-package work, distinguish local readiness from external submission:
- local readiness may include
Package.swift, semantic-version tag,swift package dump-package,swift build,swift test,.spi.yml, and DocC checks - external submission must use the official
SwiftPackageIndex/PackageListAdd Package issue form - when working from Socket, run
uv run /Users/galew/Workspace/gaelic-ghost/socket/scripts/spi_add_package.py hands-free <package-root>and follow its Codex Computer Use handoff - never create PackageList issues with
gh issue create, apply labels manually, fork PackageList, editpackages.json, or open PackageList PRs
- local readiness may include
- Report which parts were agent-executed, the docs relied on, the resolved package context, and any required next step or handoff.
Inputs
operation_type: one of the operation types listed above.request: optional short natural-language request text used to inferoperation_typewhen the explicit operation is omitted.repo_root: optional absolute path for the target package repo.- Defaults:
- runtime entrypoint: executable
scripts/run-workflow.fsx repo_root=.when omitted- the runtime may infer
operation_typefrom--requesttext when the request wording is clear enough - package execution prefers
swift package,swift build, andswift run - Xcode files do not change package routing
- runtime entrypoint: executable
Outputs
statussuccess: the workflow completed on the SwiftPM-first pathhandoff: the workflow is handing off to another skill because testing or Xcode-managed behavior is the safer surfaceblocked: prerequisites or package-root resolution prevented completion
path_typeprimary: the SwiftPM-first path completedfallback: a non-mutating planned command path was returned
output- operation type
- resolved package root
- package context
planned_commands- one concise next step or handoff payload
Guards and Stop Conditions
- Stop with
blockedwhen the package root cannot be resolved. - Stop with
blockedwhen the repo does not containPackage.swift. - Stop with
handoffwhen the request is really package-testing or package-extension work. - Stop with
handoffonly when the requested operation requires an Xcode scheme, destination, preview, target membership, build phase, or app bundle integration. - Stop with
handoffwhen the requested work crosses into Xcode project membership, scheme, preview, simulator, or other Xcode-managed concerns. - Stop with
blockedwhen no safe SwiftPM-first command path exists for the requested operation. - Stop with
blockedwhen Swift Package Index submission is requested but the package is only locally ready, the official Add Package issue form is unavailable, the Socket guarded script reports incomplete readiness, or the created issue cannot be verified with theAdd Packagelabel.
Fallbacks and Handoffs
- SwiftPM and ordinary filesystem edits are the default execution surface for this skill.
- The only current fallback is a non-mutating planned command result when the user asked for guidance rather than immediate execution.
- Hand off to
swift-package-testing-workflowwhen the request becomes primarily about tests, test plans, or test diagnosis. - Hand off to
swift-package-extension-workflowwhen the request becomes primarily about plugins, macros, traits, generated source, or plugin permissions. - Hand off to
xcode-build-run-workflowwhen package build or distribution work depends on:- active Xcode workspace or scheme state
- previews, snippet execution, simulator, or device flows
- navigator issues or Xcode build-log inspection
- Xcode MCP mutation tools
- Metal shader compilation, Apple-managed Metal toolchain inspection, or package distribution that depends on Xcode-managed Apple SDK integration
- direct changes inside
.xcodeproj,.xcworkspace, or.pbxprojmanaged scope
- Recommend root workspace
just alignwhen the request is really about product guidance instead of execution. - Recommend
bootstrap-xcode-workspace --operation create --component-kind librarywhen the repository still needs to be created from scratch. - When maintaining this repository itself, refresh guidance-sync consumers after substantial package-policy changes and keep the top-level export-surface docs aligned. Do not tell users to rely on repo-local installer workflows; this repository does not ship them.
Fixed Policy
scripts/run-workflow.fsxenforces the fixed SwiftPM-first policy without runtime customization.
References
Workflow References
references/workflow-policy.mdreferences/cli-command-matrix.mdreferences/package-resources-testing-and-builds.md../../shared/execution-surface-routing.md
Contract References
Support References
- Recommend
references/snippets/apple-swift-package-core.mdwhen the user needs reusable SwiftPM baseline policy wording in an end-user repo. references/snippets/apple-swift-package-core.md- For Swift Package Index add-package automation in Socket, use
/Users/galew/Workspace/gaelic-ghost/socket/scripts/spi_add_package.pyand/Users/galew/Workspace/gaelic-ghost/socket/docs/maintainers/spi-add-package-automation-plan.md.
Script Inventory
scripts/run-workflow.fsx