skills/add-identifiers/SKILL.md
Apply accessibility identifier fixes from a doctor report to Swift source files. Adds .accessibilityIdentifier() modifiers to interactive elements. Use after /swift-assist:doctor.
npx skillsauth add grantiva/swift-assist add-identifiersInstall 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.
Read the doctor report and apply .accessibilityIdentifier() modifiers to Swift source files for every interactive element that is missing one.
/swift-assist:add-identifiers
/swift-assist:add-identifiers --dry-run
/swift-assist:add-identifiers --screen=LoginView
/swift-assist:add-identifiers --report=.grantiva/doctor-report.json
--report=<path>: Path to doctor report JSON (defaults to .grantiva/doctor-report.json)--dry-run: Show what changes would be made without modifying files--screen=<ViewName>: Only fix elements in a specific viewA doctor report must exist. If .grantiva/doctor-report.json is not found:
No doctor report found. Run /swift-assist:doctor first to scan your app.
.grantiva/doctor-report.json (or --report path)has_identifier is false--screen is specified, filter to only that viewFor each finding, edit the Swift source file to add .accessibilityIdentifier().
Button:
// Before
Button("Continue") {
login()
}
// After
Button("Continue") {
login()
}
.accessibilityIdentifier("login-button-continue")
TextField:
// Before
TextField("Email", text: $email)
// After
TextField("Email", text: $email)
.accessibilityIdentifier("login-textfield-email")
SecureField:
// Before
SecureField("Password", text: $password)
// After
SecureField("Password", text: $password)
.accessibilityIdentifier("login-securefield-password")
Toggle:
// Before
Toggle("Notifications", isOn: $notifications)
// After
Toggle("Notifications", isOn: $notifications)
.accessibilityIdentifier("settings-toggle-notifications")
Image (interactive):
// Before
Image("hero-banner")
.resizable()
// After
Image("hero-banner")
.resizable()
.accessibilityIdentifier("onboarding-image-hero-banner")
NavigationLink:
// Before
NavigationLink("Profile") {
ProfileView()
}
// After
NavigationLink("Profile") {
ProfileView()
}
.accessibilityIdentifier("home-link-profile")
TabView tabs:
// Before
ProfileView()
.tabItem {
Label("Profile", systemImage: "person")
}
// After
ProfileView()
.tabItem {
Label("Profile", systemImage: "person")
}
.accessibilityIdentifier("home-tab-profile")
.accessibilityIdentifier() as the LAST modifier on the element, after all visual modifiers.accessibilityLabel, .accessibilityHint), place the identifier after thoseForEach unless they can be made unique (append index or data ID)After applying all fixes:
grantiva diff capture --no-build
Or if a full rebuild is needed, use grantiva diff capture (without --no-build).Accessibility Fix Report
========================
Files modified: 6
Identifiers added: 23
LoginView.swift +5 identifiers
HomeView.swift +3 identifiers
SettingsView.swift +2 identifiers
ProfileView.swift +4 identifiers
OnboardingView.swift +6 identifiers
CheckoutView.swift +3 identifiers
Coverage: 47/47 elements now have identifiers (100%)
Next steps:
/swift-assist:make-tests - Generate test flows using these identifiers
/swift-assist:vrt - Set up visual regression baselines
If --dry-run was specified, show the same summary but prefix with "DRY RUN - no files were modified" and show the diffs that would be applied.
.accessibilityIdentifier() modifier callsForEach elements, skip them and note in the report: "Skipped: element inside ForEach requires unique ID strategy"testing
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.