skills/init/SKILL.md
Initialize a Grantiva project, build the app, and launch it in the simulator. Use when starting a new swift-assist workflow or first-time project configuration.
npx skillsauth add grantiva/swift-assist initInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Set up Grantiva for the current iOS project, build the app, and launch it in the simulator.
/swift-assist:init
/swift-assist:init --scheme=MyApp
/swift-assist:init --scheme=MyApp --simulator="iPhone 16 Pro"
/swift-assist:init --bundle-id=com.example.MyApp
--scheme=<name>: Xcode scheme to build (auto-detected if only one exists)--bundle-id=<id>: App bundle identifier (auto-derived from build output if omitted)--simulator=<name>: Target simulator device (e.g., "iPhone 16 Pro")Verify the Grantiva CLI is installed before proceeding:
which grantiva
If not installed, tell the user:
Grantiva CLI is required. Install it with:
brew install grantiva/tap/grantiva
Find .xcworkspace or .xcodeproj in the working directory
.xcworkspace if both existDetect available schemes:
grantiva doctor --json
--scheme provided, use itRun Grantiva's built-in environment diagnostic:
grantiva doctor
This checks macOS version, Xcode, Swift, simulator availability, and CLI tools. If any checks fail, report the issues and stop.
Check if grantiva.yml already exists:
ls grantiva.yml 2>/dev/null
grantiva init --scheme=<SCHEME> --bundle-id=<BUNDLE_ID>
If --bundle-id was not provided, omit it (it will be derived after build).
If --simulator was provided, find that device:
xcrun simctl list devices available --json
If not provided, check for booted simulators:
xcrun simctl list devices booted --json
xcrun simctl boot <DEVICE_UDID>
open -a Simulator
Before building, check if the app loads data from an API that won't be available during testing:
Search for .mock or .preview service variants in the source:
grep -rl "\.mock\|UI_TESTING" --include="*.swift" .
If the app has a #if UI_TESTING check or mock services pattern, build with the flag:
grantiva diff capture --scheme <SCHEME> --simulator "<SIMULATOR>"
Note: if the app needs UI_TESTING, the user should build with
SWIFT_ACTIVE_COMPILATION_CONDITIONS='DEBUG UI_TESTING' and then use
--app-file to point Grantiva at the pre-built binary.
If no mock services exist and the app needs an API, tell the user:
Your app loads data from an API. For reliable testing, consider adding
a .mock services variant with a #if UI_TESTING flag. See the swift-assist
docs for the pattern.
Use Grantiva to build and verify the app launches:
grantiva diff capture --scheme <SCHEME> --simulator "<SIMULATOR>"
This builds the app, installs it on the simulator, launches it, and captures the initial screen. If the build fails, stop and report the error.
If using a pre-built binary with mock services:
grantiva diff capture --app-file ./DerivedData/.../MyApp.app
Start the Grantiva runner session so the doctor command can inspect the hierarchy:
grantiva runner start --bundle-id <BUNDLE_ID> --simulator "<SIMULATOR>"
Tell the user:
Project initialized successfully.
Scheme: <SCHEME>
Simulator: <SIMULATOR>
Bundle ID: <BUNDLE_ID>
Config: grantiva.yml
The app is running in the simulator. Next steps:
/swift-assist:doctor - Scan for missing accessibility identifiers
/swift-assist:make-tests - Generate test flows
/swift-assist:vrt - Set up visual regression testing
grantiva doctor reports issues, stop and help the user fix them before continuinggrantiva CLI for building - never call xcodebuild directlytesting
Run visual regression testing using Grantiva's diff pipeline. Capture screenshots, compare against baselines, and report visual differences. Use for catching unintended UI changes.
testing
Approve current VRT captures as new baselines. Can approve all or specific screens selectively. Use after reviewing /swift-assist:vrt results.
testing
Run generated test flows against the app in the simulator using Grantiva. Use after /swift-assist:make-tests to execute and validate your user flows.
development
Add the UI_TESTING / .mock services pattern to the app entry point so Grantiva can run tests with deterministic data and no live server. Use before make-tests when the app talks to an API.