This file provides guidance to Claude Code and developers working with this repository.
iOS Simulator Skill is a production-ready Agent Skill providing 21 scripts for iOS app building, testing, and automation. It wraps Apple's xcrun simctl and Facebook's idb tools with semantic interfaces designed for AI agents and developers.
Key Statistics:
- 22 production scripts (~8,500 lines)
- 5 script categories (Build, Navigation, Testing, Permissions, Lifecycle)
- 6 shared utility modules (~1,400 lines)
- 100% token-optimized default output
- Full test coverage on all new features
ios-simulator-skill/ # Repository root
├── ios-simulator-skill/ # Distributable package
│ ├── .claude-plugin/
│ │ └── plugin.json # Plugin manifest
│ └── skills/
│ └── ios-simulator-skill/
│ ├── SKILL.md # Entry point (table of contents)
│ └── scripts/ # 22 production scripts
│ ├── build_and_test.py
│ ├── xcode/ # Xcode integration module
│ ├── log_monitor.py
│ ├── screen_mapper.py
│ ├── navigator.py
│ ├── gesture.py
│ ├── keyboard.py
│ ├── app_launcher.py
│ ├── accessibility_audit.py
│ ├── visual_diff.py
│ ├── test_recorder.py
│ ├── app_state_capture.py
│ ├── clipboard.py
│ ├── status_bar.py
│ ├── push_notification.py
│ ├── privacy_manager.py
│ ├── simctl_boot.py
│ ├── simctl_shutdown.py
│ ├── simctl_create.py
│ ├── simctl_delete.py
│ ├── simctl_erase.py
│ ├── sim_health_check.sh
│ └── common/ # Shared utilities
├── .github/workflows/
├── pyproject.toml
└── README.md
All scripts use class-based architecture for testability:
class DeviceManager:
def __init__(self, udid: str | None = None):
self.udid = udid
def execute(self, **kwargs) -> tuple[bool, str]:
# Return (success, message) tuple
pass
def main():
parser = argparse.ArgumentParser()
manager = DeviceManager(args.udid)
success, message = manager.execute()
print(message)
sys.exit(0 if success else 1)All scripts support optional --udid with auto-detection:
try:
udid = resolve_device_identifier(args.udid) # May be None
except RuntimeError as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)Consistent format across all scripts:
# Default (3-5 lines)
Device booted: iPhone 16 Pro (ABC123) [2.1s]
# --verbose (50+ lines)
Device booted successfully.
Device UDID: ABC123DEF456...
Boot time: 2.1 seconds
# --json (20-30 lines)
{"action": "boot", "udid": "ABC123", "success": true}
Most scripts support batch operations:
python scripts/simctl_boot.py --all
python scripts/simctl_boot.py --type iPhone- build_and_test.py: Build with progressive disclosure
- log_monitor.py: Real-time log monitoring
- screen_mapper.py: Analyze screen
- navigator.py: Semantic element finding
- gesture.py: Touch simulation
- keyboard.py: Text input and keys
- app_launcher.py: App lifecycle
- accessibility_audit.py: WCAG compliance
- visual_diff.py: Screenshot comparison
- test_recorder.py: Test documentation
- app_state_capture.py: Debugging snapshots
- sim_health_check.sh: Environment verification
- clipboard.py: Clipboard management
- status_bar.py: Status bar control
- push_notification.py: Push notifications
- privacy_manager.py: Permission management
- simctl_boot.py: Boot device
- simctl_shutdown.py: Shutdown device
- simctl_create.py: Create device
- simctl_delete.py: Delete device
- simctl_erase.py: Reset device
resolve_device_identifier(): UDID/name/booted resolutionlist_simulators(): List with state filtering_extract_device_type(): Parse device type from name
capture_screenshot(): File or inline modegenerate_screenshot_name(): Semantic namingresize_screenshot(): Token optimization
ProgressiveCache: Large output caching with TTL
- Type hints (modern Python syntax)
- Docstrings on all functions
- Specific exception handling
- --help support on all scripts
- Black formatter compliance
- Ruff linter (0 errors)
- Never use shell=True
96% reduction in typical output:
- Default: 3-5 lines (5-10 tokens)
- Verbose: 50+ lines (400+ tokens)
- JSON: 20-30 lines (20-30 tokens)
This keeps AI agent conversations focused and cost-effective.
New scripts should:
- Use class-based design for > 50 lines of logic
- Support --udid and auto-detection
- Support --json output
- Provide --help documentation
- Follow Black and Ruff standards
- Update SKILL.md table of contents
- Work with real simulators before submission
- Update version in SKILL.md frontmatter, pyproject.toml
- Verify CI passes (Black, Ruff)
- Create GitHub release with vX.X.X tag
- Attach zipped ios-simulator-skill/ directory
Semantic: Find elements by meaning, not pixels.
Progressive: Minimal output by default, details on demand.
Accessible: Built on standard iOS accessibility APIs.
Zero-Config: Works immediately with no setup.
Structured: JSON and formatted text, not raw logs.
Reusable: Common patterns across all scripts.
This design works for both developers and AI agents.