raintree-technology/hig-doctor
Acerca de
Apple HIG reference and cross-framework UI audit tooling for agents.
Herramientas de desarrolloCrecimiento de estrellas medido
- in 24h
- +1
- in 7 days
- +7
- in 15 days
- +9
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original
HIG Doctor
Static checks for interface and accessibility issues. Apple-platform source is checked against Apple's Human Interface Guidelines; web and cross-platform source against HIG-aligned accessibility rules.
Run an audit
npx hig-doctor .
Output for scripts/fixtures/readme-audit (checked in CI):
2 moderate concerns · swiftui · 1 file
View.swift:5 · swift/navigation-view-deprecated
View.swift:7 · swift/hardcoded-color
75 concern checks flag probable problems across 14 frameworks. Another 356
detectors only note component usage or good practice, which decides which HIG
references the report includes (431 rules in total). Configuration, inline
suppressions, baselines, SARIF output, and --fail-on let you gate only new findings.
Surfaces
| Surface | Use it for | Start |
|---|---|---|
| Audit CLI | Source scans and CI gates | npx hig-doctor . |
| MCP server | Search, lookup, file audits, and explanations | npx -y hig-mcp |
| Agent skills | Design guidance and source audits | Canonical agent skills |
| Core package | Embed the rule engine | npm install @raintree-technology/hig-doctor-core |
The MCP server runs over stdio or streamable HTTP. See packages/mcp for client setup.
How analysis works
framework detection → regex scan → structural refinement → categorized findings → report or SARIF
A comment- and string-aware regex tier runs first. Swift structural analysis and the TypeScript compiler (when installed) then drop findings the code already handles. Each finding records which engine produced it.
Framework coverage
| Framework | Concern checks | Detectors | Basis |
|---|---|---|---|
SwiftUI (swift) |
13 | 57 | Apple HIG |
| UIKit | 9 | 26 | Apple HIG |
| AppKit | 4 | 21 | Apple HIG |
| watchOS | 0 | 13 | Apple HIG |
| visionOS | 0 | 10 | Apple HIG |
React / Next.js (web) |
24 | 98 | HIG-aligned |
| CSS / SCSS | 10 | 15 | HIG-aligned |
| Vue / Nuxt | 1 | 18 | HIG-aligned |
| Angular | 1 | 16 | HIG-aligned |
| Svelte / SvelteKit | 1 | 13 | HIG-aligned |
| Flutter | 3 | 18 | HIG-aligned |
| Jetpack Compose | 4 | 24 | HIG-aligned |
| Android XML | 4 | 14 | HIG-aligned |
| React Native | 1 | 13 | HIG-aligned |
All 75 concern checks
| Rule ID | Severity | Fix | HIG |
|---|---|---|---|
swift/navigation-view-deprecated |
moderate | Migrate to NavigationStack (single column) or NavigationSplitView (sidebar layouts). | hig |
swift/hardcoded-color |
moderate | Use semantic colors (.primary, .secondary, or an asset-catalog color) that adapt to dark mode. | color |
swift/hardcoded-rgbcolor |
moderate | Move the color into an asset catalog with light/dark variants. | color |
swift/hardcoded-uicolor |
moderate | Use a semantic UIColor (label, systemBackground) or an asset-catalog color. | color |
swift/hardcoded-color-ui-color |
moderate | color | |
swift/hardcoded-font-size |
moderate | typography | |
swift/hardcoded-uifont |
moderate | typography | |
swift/on-tap-gesture-without-traits |
moderate | Prefer Button, or add .accessibilityAddTraits(.isButton) so VoiceOver announces it. | accessibility |
swift/image-without-a11y |
moderate | accessibility | |
swift/is-accessibility-element-false-on-interactive |
serious | Keep interactive elements exposed to accessibility; give them a label instead of hiding them. | accessibility |
swift/hardcoded-cgrect |
moderate | layout | |
swift/ignores-safe-area |
moderate | layout | |
swift/non-private-state |
moderate | feedback | |
uikit/hardcoded-uifont-name |
moderate | Scale custom fonts with UIFontMetrics, or use preferredFont(forTextStyle:). | typography |
uikit/hardcoded-uicolor-constant |
moderate | Use a semantic UIColor (.label, .systemBackground, .tintColor) that adapts to appearance. | color |
uikit/view-with-tag-lookup |
moderate | Reference views by outlet or property; tag-based lookup is fragile and breaks with view reordering. | accessibility |
uikit/uiscreen-main-bounds-for-layout |
moderate | Lay out against the view's bounds or safeAreaLayoutGuide; UIScreen.main ignores Split View and Slide Over. | layout |
uikit/uialert-view-deprecated |
moderate | Use UIAlertController with a .alert style. | modality |
uikit/uiaction-sheet-deprecated |
moderate | Use UIAlertController with an .actionSheet style. | modality |
uikit/uiweb-view-deprecated |
moderate | Use WKWebView. | layout |
uikit/uisearch-display-controller-deprecated |
moderate | Use UISearchController. | searching |
uikit/set-status-bar-style-deprecated |
moderate | Override preferredStatusBarStyle on the view controller instead. | layout |
appkit/hardcoded-nscolor-red |
moderate | Use a semantic NSColor (.labelColor, .controlAccentColor) or a Color Set asset with light/dark variants. | color |
appkit/hardcoded-nscolor-constant |
moderate | Use a semantic NSColor (.labelColor, .windowBackgroundColor) that adapts to appearance and accent color. | color |
appkit/hardcoded-nsfont-size |
moderate | Use NSFont.preferredFont(forTextStyle:) so text respects the user's size settings. | typography |
appkit/nsmenu-item-set-submenu-deprecated |
moderate | Set the item's submenu property directly. | the-menu-bar |
web/missing-alt |
critical | Add descriptive alt text, or alt="" when the image is purely decorative. | accessibility |
web/image-without-alt |
critical | Add descriptive alt text, or alt="" when the image is purely decorative. | accessibility |
web/svg-without-a11y |
critical | Give inline SVG role="img" plus a or aria-label, or aria-hidden="true" if decorative.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/div-with-on-click-no-role</code></td> <td>serious</td> <td>Use a native <button>, or add role="button", tabIndex={0}, and Enter/Space key handling.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/span-with-on-click-no-role</code></td> <td>serious</td> <td>Use a native <button>, or add role="button", tabIndex={0}, and Enter/Space key handling.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/ambiguous-link-text</code></td> <td>serious</td> <td>Write link text that names the destination; avoid "click here"/"read more".</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/positive-tabindex</code></td> <td>serious</td> <td>Use tabindex="0" (or -1); positive values override the natural focus order.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/aria-hidden-on-focusable</code></td> <td>serious</td> <td>Remove aria-hidden from focusable elements, or take them out of the tab order too.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/on-mouse-over-without-on-focus</code></td> <td>serious</td> <td>Pair onMouseOver with onFocus so keyboard users get the same affordance.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/on-mouse-out-without-on-blur</code></td> <td>serious</td> <td>Pair onMouseOut with onBlur so keyboard users get the same affordance.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/auto-focus</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/empty-heading</code></td> <td>critical</td> <td>Add text content to the heading or remove it; screen readers announce empty headings as unlabeled.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>web/empty-button</code></td> <td>critical</td> <td>Give the button visible text or an aria-label.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>web/div-as-button</code></td> <td>serious</td> <td>Replace the div with a native <button>; it brings focus, key handling, and semantics for free.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>web/div-as-nav-header-class</code></td> <td>serious</td> <td>Use the semantic <nav>/<header> element instead of a classed div so landmarks exist.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>web/missing-html-lang</code></td> <td>critical</td> <td>Add lang="…" to the <html> element so assistive tech picks the right voice.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>web/inline-color-style</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>web/hardcoded-font-size-px</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>web/video-without-track</code></td> <td>critical</td> <td>Add a <track kind="captions"> file to the video.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/autoplay-media</code></td> <td>serious</td> <td>Avoid autoplay; if unavoidable, autoplay muted with visible controls.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/blink-element</code></td> <td>critical</td> <td>Remove <blink>; if emphasis is needed, use CSS animation that honors prefers-reduced-motion.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/marquee-element</code></td> <td>critical</td> <td>Remove <marquee>; use static layout or an accessible animation that honors prefers-reduced-motion.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/user-scalable-no</code></td> <td>critical</td> <td>Remove user-scalable=no from the viewport meta so pinch-zoom keeps working.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>web/maximum-scale-1</code></td> <td>critical</td> <td>Remove maximum-scale=1 from the viewport meta so users can zoom.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>css/hardcoded-hex-in-css</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>css/font-size-below-12px</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>css/text-align-justify</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>css/line-height-below-1-2</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>css/outline-none</code></td> <td>serious</td> <td>Keep a visible focus indicator — style :focus-visible instead of removing the outline.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>css/hover-without-focus</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>css/overflow-hidden-on-body</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>css/extreme-z-index</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>css/important-usage</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>css/physical-text-align</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/">hig</a></td> </tr> <tr> <td><code>vue/v-on-click-without-keyboard</code></td> <td>serious</td> <td>Add @keydown.enter/@keydown.space handling, or use a <button>.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>svelte/on-click-without-on-keydown</code></td> <td>serious</td> <td>Add on:keydown handling, or use a <button>.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>angular/click-without-keydown</code></td> <td>serious</td> <td>Add a (keydown) handler, or use a <button>.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>compose/clickable-without-role</code></td> <td>serious</td> <td>Pass role = Role.Button (or use Modifier.semantics) so TalkBack announces the control.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>compose/hardcoded-color-0x</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>compose/hardcoded-color-red-blue</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>compose/hardcoded-font-size</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>android-xml/image-view-without-content-description</code></td> <td>critical</td> <td>Add android:contentDescription, or importantForAccessibility="no" if decorative.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>android-xml/hardcoded-color-in-xml</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>android-xml/dp-text-size</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> <tr> <td><code>android-xml/px-units-in-xml</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/layout">layout</a></td> </tr> <tr> <td><code>react-native/nested-touchables</code></td> <td>serious</td> <td>Flatten nested touchables; keep one interactive wrapper per control.</td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/accessibility">accessibility</a></td> </tr> <tr> <td><code>flutter/hardcoded-color</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>flutter/colors-red-blue</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/color">color</a></td> </tr> <tr> <td><code>flutter/hardcoded-font-size</code></td> <td>moderate</td> <td></td> <td><a href="https://developer.apple.com/design/human-interface-guidelines/typography">typography</a></td> </tr> </tbody></table> </details> <!-- rules:end --><p>watchOS and visionOS have detectors only; nothing there reports a concern yet. Detector IDs show up in <code>--json</code> and SARIF output.</p> <h2>Skills corpus</h2> <p>14 skills and 156 reference topics from a 2025-02-02 snapshot. Apple's <a href="https://developer.apple.com/design/human-interface-guidelines/">live HIG</a> is canonical.</p> <table> <thead> <tr> <th>Skill</th> <th>Description</th> </tr> </thead> <tbody><tr> <td><code>hig-foundations</code></td> <td>Color, typography, symbols, accessibility, layout, motion, privacy, and branding</td> </tr> <tr> <td><code>hig-platforms</code></td> <td>iOS, iPadOS, macOS, tvOS, watchOS, and visionOS</td> </tr> <tr> <td><code>hig-patterns</code></td> <td>Onboarding, navigation, search, feedback, modality, and settings</td> </tr> <tr> <td><code>hig-inputs</code></td> <td>Touch, Pencil, keyboard, controller, pointer, Crown, and eye input</td> </tr> <tr> <td><code>hig-technologies</code></td> <td>Siri, Apple Pay, HealthKit, ARKit, ML, Sign in with Apple, and SharePlay</td> </tr> <tr> <td><code>hig-project-context</code></td> <td>Shared project context for tailored guidance</td> </tr> <tr> <td><code>hig-components-content</code></td> <td>Charts, collections, images, web views, and lockups</td> </tr> <tr> <td><code>hig-components-controls</code></td> <td>Pickers, toggles, sliders, buttons, and fields</td> </tr> <tr> <td><code>hig-components-dialogs</code></td> <td>Alerts, action sheets, popovers, and sheets</td> </tr> <tr> <td><code>hig-components-layout</code></td> <td>Sidebars, split views, tabs, lists, tables, and windows</td> </tr> <tr> <td><code>hig-components-menus</code></td> <td>Menus, toolbars, buttons, and menu bars</td> </tr> <tr> <td><code>hig-components-search</code></td> <td>Search fields, page controls, and path controls</td> </tr> <tr> <td><code>hig-components-status</code></td> <td>Progress indicators, status bars, and activity rings</td> </tr> <tr> <td><code>hig-components-system</code></td> <td>Widgets, live activities, notifications, complications, and App Clips</td> </tr> </tbody></table> <p>A nightly job diffs the snapshot against Apple's DocC JSON and flags changes for manual review.</p> <h2>Limits</h2> <p>Findings are prompts for review, not proof of accessibility or HIG conformance.</p> <h2>Documentation</h2> <ul> <li><a href="packages/cli/README.md">CLI</a>: flags, configuration, baselines, CI</li> <li><a href="packages/mcp/README.md">MCP server</a>: tools, transports, client setup</li> <li><a href="packages/core/README.md">Core</a>: embedding API</li> <li><a href="https://apple.raintree.technology">Website</a>: browsable topics</li> </ul> <h2>Project</h2> <p><a href="CONTRIBUTING.md">Contributing</a> · <a href="SECURITY.md">Security</a> · <a href="CHANGELOG.md">Changelog</a> · <a href="https://github.com/raintree-technology/hig-doctor">Source repository</a> · <a href="LICENSE">MIT License</a> · <a href="THIRD_PARTY_NOTICES.md">Third-party notices</a></p> <p>Tooling is MIT. HIG reference text in <code>skills/*/references/</code> is © Apple Inc., kept with attribution and source URLs, and remains subject to Apple's terms.</p> |
Explorar proyectos relacionados
Cargando…