mcpField
S
swift-development

swift-development

github.com/hmohamed01Development6154 installsUpdated 29w ago
Repository

About swift-development

A development skill for Swift developers, covering package and app builds, tests, formatting, and simulator management. It includes scripts, templates, and topic-specific reference material.

Key features

  1. 01Scripts and templates for creating Swift packages
  2. 02Build and test with SwiftPM and xcodebuild
  3. 03Swift formatting and linting
  4. 04iOS simulator management scripts
  5. 05References for SwiftUI, concurrency, and architecture

Use cases

  1. 01Creating a new Swift library package
  2. 02Building and testing an iOS app
  3. 03Formatting and linting Swift source
  4. 04Booting a simulator and installing an app

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/hmohamed01/swift-development --skill swift-development

After installing, type/swift-developmentin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
.swiftformat
.swiftlint.yml
Package.swift.template
assets/ExportOptions/
ad-hoc.plist
app-store.plist
development.plist
references/
architecture.md
best-practices.md
cicd.md
code-signing.md
concurrency.md
simctl.md
spm.md
swiftui-patterns.md
testing-patterns.md
troubleshooting.md
xcodebuild.md
scripts/
format_and_lint.sh
new_package.sh
run_tests.sh
simulator.sh

Details

From the project README

Swift Development

Prerequisites

  • macOS with Xcode 15+ installed (Xcode 16+ for Swift 6)
  • Xcode Command Line Tools: xcode-select --install
  • Verify: xcodebuild -version and swift --version

Quick Start

New Swift Package
# Use the included script for full setup
./scripts/new_package.sh MyLibrary --type library --ios --macos

# Or manually
swift package init --type library --name MyLibrary
Build and Test
# SPM packages
swift build
swift test

# Xcode projects
xcodebuild -workspace App.xcworkspace -scheme App \
    -destination 'platform=iOS Simulator,name=iPhone 15' build

# Use included script for common options
./scripts/run_tests.sh --parallel --coverage
Format and Lint
# Use included script
./scripts/format_and_lint.sh Sources/

# Check mode (CI)
./scripts/format_and_lint.sh --check
Simulator Management
# Use included script
./scripts/simulator.sh list
./scripts/simulator.sh boot "iPhone 15"
./scripts/simulator.sh screenshot
./scripts/simulator.sh dark

Core Workflows

Building iOS Apps
# Debug build for simulator
xcodebuild -workspace App.xcworkspace -scheme App \
    -destination 'platform=iOS Simulator,name=iPhone 15' \
    build

# Release archive
xcodebuild archive \
    -workspace App.xcworkspace -scheme App \
    -archivePath ./build/App.xcarchive \
    -configuration Release

# Export IPA (use templates from assets/ExportOptions/)
xcodebuild -exportArchive \
    -archivePath ./build/App.xcarchive \
    -exportPath ./build/export \
    -exportOptionsPlist assets/ExportOptions/app-store.plist
Testing
# All tests
xcodebuild test -workspace App.xcworkspace -scheme App \
    -destination 'platform=iOS Simulator,name=iPhone 15'

# Specific test
xcodebuild test -only-testing:AppTests/MyTestClass/testMethod

# With coverage
xcodebuild test -enableCodeCoverage YES \
    -resultBundlePath ./TestResults.xcresult
App Installation
# Install on booted simulator
xcrun simctl install booted ./Build/Products/Debug-iphonesimulator/App.app

# Launch
xcrun simctl launch booted com.company.app

Official Documentation

Reference Links (for humans)

These are Apple's official documentation links for manual browsing:

ResourceURL
Swift Documentationhttps://developer.apple.com/documentation/swift
SwiftUIhttps://developer.apple.com/documentation/swiftui
Swift Concurrencyhttps://developer.apple.com/documentation/swift/concurrency
Swift Testinghttps://developer.apple.com/documentation/testing

Note: Apple's documentation sites are JavaScript SPAs and cannot be fetched programmatically with WebFetch. Use GitHub-based sources below instead.

WebFetch-Compatible Sources (Raw GitHub URLs)

Always use raw.githubusercontent.com URLs — regular github.com URLs return garbled HTML/JSON.

Base URL prefix: https://raw.githubusercontent.com/apple

Swift Testing (/swift-testing/main/):

ResourcePath
READMEREADME.md
Defining TestsSources/Testing/Testing.docc/DefiningTests.md
Organizing TestsSources/Testing/Testing.docc/OrganizingTests.md
ExpectationsSources/Testing/Testing.docc/Expectations.md
Parameterized TestingSources/Testing/Testing.docc/ParameterizedTesting.md
Traits OverviewSources/Testing/Testing.docc/Traits.md
Trait ReferenceSources/Testing/Testing.docc/Traits/Trait.md
Adding TagsSources/Testing/Testing.docc/AddingTags.md
Adding CommentsSources/Testing/Testing.docc/AddingComments.md
Associating BugsSources/Testing/Testing.docc/AssociatingBugs.md
Bug IdentifiersSources/Testing/Testing.docc/BugIdentifiers.md
AttachmentsSources/Testing/Testing.docc/Attachments.md
Enabling/Disabling TestsSources/Testing/Testing.docc/EnablingAndDisabling.md
Limiting Execution TimeSources/Testing/Testing.docc/LimitingExecutionTime.md
ParallelizationSources/Testing/Testing.docc/Parallelization.md
Exit TestingSources/Testing/Testing.docc/exit-testing.md
Known IssuesSources/Testing/Testing.docc/known-issues.md
Testing Async CodeSources/Testing/Testing.docc/testing-asynchronous-code.md
Testing for ErrorsSources/Testing/Testing.docc/testing-for-errors-in-swift-code.md
Migrating from XCTestSources/Testing/Testing.docc/MigratingFromXCTest.md
Vision & DesignDocumentation/Vision.md
CLI DebuggingDocumentation/CommandlineDebugging.md
Environment VariablesDocumentation/EnvironmentVariables.md

Other Swift Packages:

ResourceFull Raw URL
Swift Async Algorithmshttps://raw.githubusercontent.com/apple/swift-async-algorithms/main/README.md
Swift Collectionshttps://raw.githubusercontent.com/apple/swift-collections/main/README.md

For Swift Evolution proposals, construct the raw URL from the proposal number: https://raw.githubusercontent.com/apple/swift-evolution/main/proposals/NNNN-proposal-name.md

Example: https://raw.githubusercontent.com/apple/swift-evolution/main/proposals/0409-access-level-on-imports.md

For directory discovery (finding proposal numbers, doc file names): use WebSearch instead of WebFetch — directory listings on GitHub are not parseable.

When to Fetch Documentation

Use WebFetch with raw GitHub URLs in these situations:

  1. Swift Testing: When you need details on @Test, #expect, #require, traits, or parameterized tests
  2. Swift Evolution: When checking accepted proposals for new language features
  3. Framework Details: When implementing features from Apple's open-source Swift packages
  4. Uncertainty: When you're unsure about current API patterns or best practices

URL conversion rule: Replace github.com/{owner}/{repo}/blob/{branch}/ with raw.githubusercontent.com/{owner}/{repo}/{branch}/

Fallback: If WebFetch fails on a raw URL, use WebSearch with the query site:github.com/apple {topic} to discover the correct file path, then construct the raw URL.

Example prompt for WebFetch: "Extract the main features, macros, and usage examples from this documentation"


Reference Files

Detailed documentation for specific topics:

TopicFile
SwiftUI patternsreferences/swiftui-patterns.md
Testing patternsreferences/testing-patterns.md
Swift 6 concurrencyreferences/concurrency.md
Architecture patternsreferences/architecture.md
Best practicesreferences/best-practices.md
Swift Package Managerreferences/spm.md
xcodebuild commandsreferences/xcodebuild.md
Simulator controlreferences/simctl.md
Code signingreferences/code-signing.md
CI/CD setupreferences/cicd.md
Troubleshootingreferences/troubleshooting.md

Included Scripts

ScriptPurpose
scripts/new_package.shCreate new Swift package with config files
scripts/run_tests.shRun tests with common options
scripts/format_and_lint.shFormat and lint Swift code
scripts/simulator.shQuick simulator management

Asset Templates

AssetPurpose
assets/Package.swift.templateSwift package template
assets/.swiftformatSwiftFormat configuration
assets/.swiftlint.ymlSwiftLint configuration
assets/ExportOptions/Archive export plist templates

Quick Reference

Essential Commands
TaskCommand
Build packageswift build
Build releaseswift build -c release
Run testsswift test
Update depsswift package update
List simulatorsxcrun simctl list devices
Boot simulatorxcrun simctl boot "iPhone 15"
Install appxcrun simctl install booted ./App.app
Format codeswiftformat .
Lint codeswiftlint
Common Destinations
# iOS Simulator
-destination 'platform=iOS Simulator,name=iPhone 15'

# macOS
-destination 'platform=macOS'

# Generic iOS (for archives)
-destination 'generic/platform=iOS'

Comments

Markdown supported