add-accessibility
Scan SwiftUI views and add missing accessibility identifiers using a consistent {screen}-{type}-{name} naming convention. Also flags Dynamic Type…
от yusufkaran★ 24 звезды на GitHub
Установить add-accessibility в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Add Accessibility Skill
Overview
Use this skill to scan all SwiftUI files in a project, find interactive elements missing accessibility identifiers, and add them using a consistent {screen}-{type}-{name} naming convention. Also flags Dynamic Type compatibility issues without auto-fixing them.
Options
--dry-run: Don't modify files, only report what would be changed--path=<path>: Scan only the specified directory (default: all SwiftUI files)--verbose: Log each identifier added in detail
Workflow
1) Scan & Analyze
Find all
*.swiftfiles in the projectFilter to files containing SwiftUI views (
struct X: View,#Preview, etc.)In each file, detect these interactive elements:
Button— buttonsTextFieldandSecureField— input fieldsImage— imagesToggle— toggle switchesSlider— slidersPicker— pickersDatePicker— date pickersNavigationLink— navigation linksTabViewtab items.onTapGestureviews — tap gesture elementsLink— external links
For each element, check existing accessibility state:
- Has
.accessibilityIdentifier()? → SKIP - Has
.accessibilityLabel()? → SKIP - If either exists, do not touch it
- Has
2) Generate Identifiers
Naming convention: {screen}-{type}-{name}
Screen name: derived from the filename
LoginView.swift→loginOnboardingStepView.swift→onboarding-stepHomeTabView.swift→home-tab- Remove
Viewsuffix, convert camelCase to kebab-case
Type: based on the element type
| SwiftUI Element | Type |
|---|---|
| Button | button |
| TextField | textfield |
| SecureField | securefield |
| Image | image |
| Toggle | toggle |
| Slider | slider |
| Picker | picker |
| DatePicker | datepicker |
| NavigationLink | navlink |
| Link | link |
| .onTapGesture view | tap |
| TabView item | tab |
Name: derived from the element's content
Button("Continue")→continueTextField("Email", ...)→emailImage(systemName: "gear")→gearImage("hero-banner")→hero-bannerToggle("Notifications", ...)→notifications- No content or too complex → number sequentially (
button-1,button-2)
Example results:
login-button-continue
login-textfield-email
login-securefield-password
onboarding-image-hero-banner
settings-toggle-notifications
home-tab-profile
3) Apply Changes
Add .accessibilityIdentifier("generated-id") to each element missing one:
// BEFORE
Button("Continue") {
viewModel.proceed()
}
// AFTER
Button("Continue") {
viewModel.proceed()
}
.accessibilityIdentifier("login-button-continue")
For Images, also add accessibilityLabel (for VoiceOver):
// BEFORE
Image(systemName: "gear")
// AFTER
Image(systemName: "gear")
.accessibilityIdentifier("settings-image-gear")
.accessibilityLabel("Settings")
For onTapGesture views, mark as accessibility elements:
// BEFORE
HStack {
Image("avatar")
Text(user.name)
}
.onTapGesture { showProfile() }
// AFTER
HStack {
Image("avatar")
Text(user.name)
}
.onTapGesture { showProfile() }
.accessibilityElement(children: .combine)
.accessibilityIdentifier("profile-tap-user-row")
.accessibilityAddTraits(.isButton)
4) Dynamic Type Check
Check Text elements for Dynamic Type compatibility:
Flag (report as warnings, do NOT auto-fix):
Textwithout.lineLimit()when the content could be longTextwithout.minimumScaleFactor()in constrained areas.font(.system(size: XX))with hardcoded font sizes instead of dynamic fonts like.font(.title),.font(.body)
Report format:
⚠️ Dynamic Type Warnings:
LoginView.swift:42 - Text("Welcome back...") → missing lineLimit or minimumScaleFactor
LoginView.swift:58 - Text(...).font(.system(size: 14)) → consider using dynamic font (.body, .caption, etc.)
SettingsView.swift:23 - Text(longString) → missing lineLimit, risk of overflow with large text
5) Summary Report
Show a summary when the scan is complete:
✅ Accessibility Scan Complete
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Files scanned: 24
Elements found: 87
Already present: 31 (skipped)
Newly added: 56
- Button: 18
- TextField: 8
- Image: 12
- Toggle: 6
- Other: 12
⚠️ Dynamic Type Warnings: 7
(details above)
Pattern: {screen}-{type}-{name}
Important Rules
- NEVER modify or remove existing accessibility modifiers
- NEVER change the view's functionality or appearance
- Only add
.accessibilityIdentifier(),.accessibilityLabel(),.accessibilityElement(),.accessibilityAddTraits() - Do NOT wrap in
#if DEBUG— identifiers must be in production too (for real accessibility / VoiceOver) - If unsure about a name, use
{screen}-{type}-{index}format and flag it in verbose mode - Dynamic T
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл add-accessibility?
Scan SwiftUI views and add missing accessibility identifiers using a consistent {screen}-{type}-{name} naming convention. Also flags Dynamic Type compatibility issues. Use when you need to add accessibility support, make views testable, add VoiceOver labels, or prepare for UI testing.
Как установить скилл add-accessibility?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл add-accessibility запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…