skills/doctor/SKILL.md
Walk the running app using computer use, inspect the view hierarchy with Grantiva, and report elements missing accessibility identifiers. Use for accessibility audits or test preparation.
npx skillsauth add grantiva/swift-assist doctorInstall 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.
Walk every screen of the running iOS app using computer use, inspect the view hierarchy via grantiva runner dump-hierarchy, and produce a report of interactive elements missing .accessibilityIdentifier().
/swift-assist:doctor
/swift-assist:doctor --screen=LoginView
/swift-assist:doctor --fix
/swift-assist:doctor --json
--screen=<ViewName>: Only audit a specific screen instead of the full app--fix: Automatically run /swift-assist:add-identifiers after the audit completes--json: Output findings as JSON for tooling integration/swift-assist:init first)grantiva runner start
All suggested accessibility identifiers follow this pattern:
<screen>-<elementType>-<descriptor>
Where:
LoginView becomes loginbutton, textfield, securefield, toggle, slider, picker, image, tab, link, labelExamples:
login-button-continue
login-textfield-email
login-securefield-password
onboarding-image-hero-banner
settings-toggle-notifications
deeplinks-link-caching-demo
edit-landmark-button-done
grantiva-textfield-user-id
Before walking the app, scan the Swift source to build a map of views and their elements:
Find all SwiftUI view files:
grep -rl "struct.*:.*View" --include="*.swift" .
For each view file, catalog interactive elements:
Button, TextField, SecureField, Toggle, Slider, Picker, DatePickerNavigationLink, Image (when interactive), .onTapGestureTabView tabs, LinkNote which elements already have .accessibilityIdentifier() applied
Build a lookup table: ViewName -> [element, hasIdentifier, suggestedId]
This phase requires computer use (MCP browser tools targeting the simulator).
grantiva runner dump-hierarchy to get the live accessibility tree--screen was specified, navigate only to that screenTab bar buttons in SwiftUI do NOT receive the .accessibilityIdentifier() you set on the tab content. The hierarchy shows tab buttons as:
[XCUIElementTypeButton] name="map" label="Landmarks"
[XCUIElementTypeButton] name="heart" label="Favorites"
The name is the SF Symbol, the label is the display text. Test flows should tap tabs by their label text (e.g., tap: "Favorites"), not by a custom identifier. Still add identifiers to tab content for code organization, but note in the report that tabs are tapped by label.
grantiva runner dump-hierarchy to get the element treegrantiva runner dump-hierarchy --format json for programmatic parsingscreen from the view struct nameelementType from the UI componentdescriptor from the element's label, text content, or SF Symbol nameProduce a structured report:
Accessibility Doctor Report
============================
Scanned: 11 views, 54 interactive elements
Missing identifiers: 54
ContentView (5 missing)
- Tab "Landmarks" -> content-tab-landmarks (tap by label)
- Tab "Favorites" -> content-tab-favorites (tap by label)
- Tab "Grantiva" -> content-tab-grantiva (tap by label)
- Tab "Feedback" -> content-tab-feedback (tap by label)
- Tab "Deep Links" -> content-tab-deeplinks (tap by label)
LandmarkDetailView (3 missing)
- NavigationLink (category) -> landmark-detail-link-category
- NavigationLink "Plan Visit" -> landmark-detail-link-plan-visit
- Button (favorite) -> landmark-detail-button-favorite
EditLandmarkView (4 missing)
- TextField "Name" -> edit-landmark-textfield-name
- TextField "Location" -> edit-landmark-textfield-location
- Button "Cancel" -> edit-landmark-button-cancel
- Button "Done" -> edit-landmark-button-done
Coverage: 0/54 elements have identifiers (0%)
Save the report to .grantiva/doctor-report.json so that /swift-assist:add-identifiers can consume it.
If --fix was specified, immediately invoke /swift-assist:add-identifiers with the saved report.
--fix is specified, which delegates to /swift-assist:add-identifiers)grantiva runner dump-hierarchy output is ground truth - if source scan and live hierarchy disagree, trust the live hierarchytesting
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.