Get the FREE Ultimate OpenClaw Setup Guide →

bootstrap-swift-package

npx machina-cli add skill gaelic-ghost/apple-dev-skills/bootstrap-swift-package --openclaw
Files (1)
SKILL.md
5.1 KB

Bootstrap Swift Package

Overview

Create a new Swift package quickly with repeatable defaults. Prefer the bundled script for deterministic setup.

Workflow

  1. Confirm package intent.
  • Ask for package name, type (library, executable, or tool), destination path, platform preset (mac, mobile, multiplatform), and version profile (latest-major, current-minus-one, current-minus-two).
  • Accept aliases: macos for mac, ios for mobile, both for multiplatform, and latest/minus-one/minus-two for version profiles.
  1. 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, patch Package.swift platforms, copy assets/AGENTS.md to repo root as AGENTS.md, then run git init.
  1. Validate bootstrap output.
  • Verify Package.swift exists.
  • Verify .git exists.
  • Verify AGENTS.md exists.
  • Verify Tests/ exists.
  • Run swift build and swift test in the package root.
  1. Report result.
  • Summarize created path, package type, platform preset, version profile, build/test status, and immediate next steps.

Defaults

  • Use library unless the user clearly asks for executable or tool.
  • Use multiplatform unless the user clearly wants only mac or mobile.
  • Use current-minus-one as the default version profile.
  • Keep generated structure minimal; do not add extra frameworks unless requested.
  • Always initialize git.
  • Always include AGENTS.md with repository expectations for working with Swift Package Manager and Swift packages.

Automation Prompting

  • Codex App automation fit: Guarded. Prefer event-driven or explicit scaffold requests over frequent recurring schedules.
  • Codex CLI automation fit: Strong. Use deterministic codex exec prompts with explicit placeholders and strict scope.
  • Use references/automation-prompts.md for ready-to-use Codex App and Codex CLI templates.
  • Keep schedule and workspace configuration outside the prompt body for App automations.

Troubleshooting

  • If swift is missing, stop and ask the user to install Xcode command line tools or Swift toolchain.
  • If git is missing, stop and ask the user to install git or Xcode command line tools.
  • If assets/AGENTS.md is 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-validation and report that checks were skipped.

Resources

scripts/

  • scripts/bootstrap_swift_package.sh: Create package directory, run swift package init, apply platforms defaults to Package.swift, initialize git, and run safety/validation checks.

references/

  • references/package-types.md: Quick selection guide for package types, platform presets, and version profiles.
  • references/automation-prompts.md: Codex App and Codex CLI automation prompt templates with placeholders and guardrails.

assets/

  • assets/AGENTS.md: Template copied into each new package repository to set repository expectations for Swift Package Manager workflows.

Interactive Customization Flow

  1. Load current effective customization settings first:
  • uv run python scripts/customization_config.py effective
  1. Ask targeted customization questions:
  • Use references/customization-flow.md to drive knob-by-knob questions.
  • Confirm desired behavior changes and safety constraints.
  1. Map requested changes to implementation files:
  • Update SKILL.md, references/*, and any runtime script files listed in references/customization-flow.md.
  1. Persist durable customization state:
  • Start from customization.template.yaml defaults.
  • Apply approved overrides with uv run python scripts/customization_config.py apply --input <yaml-file>.
  • Durable path: ~/.config/gaelic-ghost/apple-dev-skills/<skill-name>/customization.yaml.
  • Optional override root: APPLE_DEV_SKILLS_CONFIG_HOME.
  1. Report resulting effective configuration:
  • Re-run uv run python scripts/customization_config.py effective and summarize final active settings.
  • If the user asks to remove customization state, run uv run python scripts/customization_config.py reset.

Use references/customization-flow.md for skill-specific knobs, file mapping, guardrails, validation checks, and example requests.

Source

git clone https://github.com/gaelic-ghost/apple-dev-skills/blob/main/apple-swift-bootstraps/bootstrap-swift-package/SKILL.mdView on GitHub

Overview

Bootstraps a new Swift Package Manager project using repeatable defaults for library, executable, or tool types. It emphasizes determinism by preferring the bundled script and standardizes platform and version presets, git initialization, and initial validation.

How This Skill Works

The workflow collects package name, type, destination, platform preset, and version profile (with aliases). It runs the bootstrap script (scripts/bootstrap_swift_package.sh) when possible, or falls back to swift package init, patches Package.swift, copies AGENTS.md, and initializes git, then runs swift build and swift test to confirm the setup.

When to Use It

  • Creating a new Swift package (library, executable, or tool) with defaults
  • Scaffolding a standard package structure with platform presets
  • Initializing git and AGENTS.md for a new repo
  • Using the deterministic bundled bootstrap script for quick setup
  • Customizing bootstrap defaults for future packages

Quick Start

  1. Step 1: Provide package name, type, destination, platform, and version profile
  2. Step 2: Run the bootstrap script or fallback to swift package init in the target dir
  3. Step 3: Verify outputs (Package.swift, .git, AGENTS.md, Tests) and run swift build && swift test

Best Practices

  • Ask for name, type, destination, platform, and version profile up front
  • Prefer the scripts/bootstrap_swift_package.sh for deterministic setup
  • Patch Package.swift to apply platform defaults as needed
  • Always initialize git and include AGENTS.md in the repo
  • Validate with swift build and swift test after bootstrap

Example Use Cases

  • Bootstrap a new library named Utils with multiplatform and latest-major presets
  • Create an executable tool FastTool for macOS and iOS using current-minus-one
  • Initialize a multiplatform library in /projects/NetworkingKit with latest-major
  • Set up a CLI tool with a mac platform preset and current-minus-one
  • Apply custom bootstrap defaults for a team-wide Swift package template

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers