Guides
Platform-Aware Verification Commands
How the task generator picks platform-correct verification commands for every atomic task — registry-driven, with fallbacks, no more `npm test` on iOS.
Problem Solved: Task generator creates iOS task. Embeds npm test. iOS developer cannot run it. Feature appears unverified.
Solution: A multi-platform verification command system that automatically selects appropriate commands based on the project’s target platform.
Quick Start
1. Ensure Registry Has Platform Configuration
Check specs/_defaults/registry.yaml for these keys:
target_platform:
primary: mobile # web | mobile | desktop | both
mobile_platforms: ios # ios | android | both
mobile_framework: native # native | react-native | flutter
backend:
language: typescript # For backend-only projects
2. Task Generator Detects Platform
During /atomicspec.tasks, Section 4.2.4 automatically:
- Reads platform from registry
- Falls back to file pattern scanning if no registry
- Selects appropriate verification templates
3. Generated Tasks Include Correct Commands
iOS Task gets:
xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:MyAppTests/AuthServiceTests | xcpretty
NOT:
npm test -- --grep "AuthService" # WRONG!
Files Created
| File | Purpose |
|---|---|
templates/verification-commands.yaml | Complete template library for all platforms |
templates/commands/tasks.md (Section 4.2.4) | Platform detection and selection logic |
docs/verification-fallback-logic.md | Fallback chains when tools unavailable |
templates/examples/T-025-implement-auth-service-ios.md | Complete iOS task example |
Platform Support Matrix
| Platform | Unit Tests | Lint | Build | API Health | Integration |
|---|---|---|---|---|---|
| iOS (Swift) | xcodebuild test, swift test | swiftlint | xcodebuild build | curl | xcodebuild test |
| Android (Kotlin) | ./gradlew test | ktlint, detekt | ./gradlew assembleDebug | curl | ./gradlew connectedTest |
| React Native | jest | eslint | react-native build-* | curl | detox |
| Flutter | flutter test | dart analyze | flutter build | curl | flutter test integration_test/ |
| Node.js | npm test, vitest | eslint | npm run build | curl | supertest |
| Python | pytest | ruff, flake8 | pip install -e . | curl | pytest |
| Go | go test | golangci-lint | go build | curl | go test -tags=integration |
Fallback Strategy
Every verification command should include fallbacks:
## Verification Command
**Primary** (full test):
```bash
xcodebuild test -scheme MyApp -only-testing:MyAppTests/AuthServiceTests | xcpretty
```
**Fallback** (compile check):
```bash
xcodebuild build -scheme MyApp | xcpretty
```
**Expected Output**: Test Succeeded or Build Succeeded
See Verification fallback logic for complete fallback chains per platform.
Platform Detection Logic
Priority 1: Registry Values
# From specs/_defaults/registry.yaml
target_platform.primary: mobile
target_platform.mobile_platforms: ios
target_platform.mobile_framework: native
Priority 2: File Pattern Scanning
| Pattern | Detected Platform |
|---|---|
*.xcodeproj, Package.swift | iOS |
build.gradle, AndroidManifest.xml | Android |
pubspec.yaml | Flutter |
metro.config.js | React Native |
package.json (without mobile files) | Node.js |
pyproject.toml, requirements.txt | Python |
go.mod | Go |
Priority 3: User Prompt
If platform is ambiguous, ask via AskUserQuestion.
Using verification-commands.yaml
Structure
[platform]:
[verification_type]:
primary:
tool: "tool_name"
command: "command with {{PLACEHOLDERS}}"
expected_output: "success text"
alternatives:
- tool: "alt_tool"
command: "..."
fallback:
command: "minimal check"
Available Placeholders
| Placeholder | Description | Example |
|---|---|---|
{{TEST_NAME}} | Specific test name/pattern | AuthServiceTests |
{{FILE_PATH}} | Path to file being tested | Sources/Auth/AuthService.swift |
{{SCHEME}} | Xcode scheme name | MyApp |
{{MODULE}} | Module/package name | MyAppTests |
{{ENDPOINT}} | API endpoint path | /api/v1/auth/login |
{{PORT}} | Server port | 8000 |
Example: Generating iOS Unit Test Command
# From verification-commands.yaml
ios:
unit_tests:
primary:
tool: "xcodebuild"
command: |
xcodebuild test \
-scheme {{SCHEME}} \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:{{MODULE}}Tests/{{TEST_NAME}} \
| xcpretty
expected_output: "Test Succeeded"
Replace placeholders:
{{SCHEME}}->MyApp{{MODULE}}->MyApp{{TEST_NAME}}->AuthServiceTests
Result:
xcodebuild test \
-scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-only-testing:MyAppTests/AuthServiceTests \
| xcpretty
CI/CD Considerations
GitHub Actions (macOS runner for iOS)
jobs:
test-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run iOS Tests
run: |
xcodebuild test \
-scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15' \
| xcpretty
GitHub Actions (Linux runner - iOS unavailable)
When iOS tools are unavailable, fallback commands should verify what is possible:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Swift (using swiftlint Docker)
run: |
docker run --rm -v $(pwd):/work ghcr.io/realm/swiftlint:latest
Hybrid Projects
For projects with both web and mobile:
-
Set registry correctly:
target_platform: primary: both mobile_platforms: ios backend: language: typescript -
Tasks get platform-appropriate verification:
- Backend API task ->
npm test,curl - iOS service task ->
xcodebuild test,swiftlint - Shared model task -> Both (if code shared)
- Backend API task ->
Troubleshooting
”xcodebuild: command not found”
Cause: Running on non-macOS machine Solution: Use Swift test fallback or skip iOS tests in non-macOS CI
”./gradlew: Permission denied”
Cause: Missing execute permission
Solution: Run chmod +x gradlew or use gradle directly
”flutter: command not found”
Cause: Flutter not in PATH Solution: Add Flutter to PATH or use full path to flutter binary
Tests pass locally but fail in CI
Cause: CI environment differs (simulators, tools, permissions) Solution: Ensure CI has required tools, use fallback commands for CI
Example: Complete iOS Auth Task
See templates/examples/T-025-implement-auth-service-ios.md for a complete example showing:
- Platform-specific embedded context
- Correct verification commands for iOS
- Primary, alternative, and fallback commands
- Expected output for each command
- Lint verification with fallback
Summary
- Configure registry with
target_platform.*values - Task generator reads platform and selects appropriate templates
- verification-commands.yaml provides platform-specific command templates
- Fallback logic ensures verification works even when tools unavailable
- Generated tasks include primary + fallback verification commands
Result: iOS tasks have xcodebuild commands, Android tasks have ./gradlew commands, web tasks have npm commands. No more platform mismatches.