audit-swiftui-availability-gating

Audits macOS SwiftUI code for incorrect or missing availability gates against deployment targets.

2|1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-availability-gating-yigitkonur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-swiftui-availability-gating
Source: https://github.com/yigitkonur/plugin-swiftui/tree/main/plugins/swiftui/skills/audit-swiftui-availability-gating
Command: npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-availability-gating-yigitkonur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? SwiftUI apps targeting older macOS versions break when APIs introduced in newer macOS releases are used without proper #available gates, or when gates use the wrong platform arm, wrong floor version, or missing fallbacks. This Skill systematically finds those gating defects before they cause build failures on supported macOS versions. ## Core Features & Use Cases - Eight defect detectors: Catches ungated above-floor symbols, wrong-arm gates (iOS instead of macOS), floor mismatches, missing else fallbacks, declaration/use-site mismatches, macOS-absent symbols wrapped in gates, and missing * wildcards. - Hybrid lint engine: Combines ripgrep tells with structural ast-grep rules to locate candidate defects, emitting unified JSON and SARIF reports with CI-friendly exit codes. - Evidence-based verification: Cross-checks every floor against a corpus of 1,857 real shipping macOS apps and Apple documentation via Sosumi before reporting. - Use Case: Run it on a macOS SwiftUI project targeting macOS 14 that uses glassEffect (macOS 26) to get a findings report showing exactly which call sites need if #available(macOS 26.0, *) gates with fallbacks, and auto-fix the two mechanical defects. ## Quick Start Ask the AI to audit your macOS SwiftUI project for availability gating issues against its deployment target.

Frequently Asked Questions about audit-swiftui-availability-gating

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check SwiftUI code for missing macOS availability gates?

Run the audit against your SwiftUI sources; it reads your MACOSX_DEPLOYMENT_TARGET, locates every API floored above that target using grep and ast-grep rules, and reports each ungated symbol as a hard-fail finding with the correct gate shape.

What availability gating mistakes does this audit catch?

It catches eight defect classes: ungated above-floor symbols, iOS-arm gates on macOS APIs, floor version mismatches, missing else fallbacks, @available declaration versus #available use-site mismatches, macOS-absent symbols wrapped in gates, missing trailing wildcards, and type-property floor quirks.

Can it automatically fix availability gate errors?

Only two mechanical defects are auto-fixed under a fix-safety protocol: swapping an iOS arm to macOS and appending a missing `, *` wildcard. All other findings are flag-only because the correct fallback or floor is a design judgment.

Does the audit work for iOS or cross-platform SwiftUI projects?

No, it is macOS-only and SwiftUI-only by design. It reads the macOS arm of availability strings and treats iOS-arm gates on macOS-floored APIs as wrong-arm defects rather than valid gates.

Why does an #available(iOS) gate fail on macOS?

The trailing `*` wildcard already covers macOS, so an iOS-arm gate always fires on a Mac and the macOS floor is never enforced. The macOS-floored API then ships unguarded, breaking the build on older macOS versions.