audit-swiftui-menus-commands

Audits macOS SwiftUI menu bar, Commands, and keyboard shortcut code for correctness defects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? AI-generated macOS SwiftUI code frequently mishandles the menu bar: app actions are faked as in-window buttons, standard menus get duplicated by misnamed CommandMenu blocks, commands cannot reach the focused window's state, and hallucinated symbols like @FocusedDocument slip in. This Skill systematically detects and reports these defects in existing macOS SwiftUI projects. ## Core Features & Use Cases - Ten-rule defect index (menu-01 to menu-10): Detects missing .commands blocks, duplicated standard menus, broken @FocusedValue routing, missing .disabled guards, reserved-shortcut collisions, and ungated availability-floored command APIs. - Hybrid lint engine: Runs tier-1 ripgrep tells plus tier-2 ast-grep structural rules with a per-file parse probe, emitting unified JSON and SARIF output suitable for CI gating. - Corpus-grounded verification: Cross-checks uncertain findings against 1,857 shipping macOS apps via the swiftui-ctx CLI and Apple documentation fetched through Sosumi, reporting only 100%-certain findings. - Use Case: Point it at a macOS SwiftUI project whose menu bar was written by an AI assistant; it locates every command-routing and menu-structure defect, writes structured findings to swiftui-audits/menus-commands/, and shows the correct production pattern for each. ## Quick Start Audit my macOS SwiftUI project's menu bar, Commands, and keyboard shortcuts for correctness issues and write the findings to disk.

Frequently Asked Questions about audit-swiftui-menus-commands

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

FAQPage Schema
How do I audit SwiftUI menu bar and Commands code on macOS?

Run this Skill against your macOS SwiftUI sources. It executes a shared lint runner with grep tells and ast-grep structural rules, reads every located file in full, and writes confirmed findings to swiftui-audits/menus-commands/ with a per-run index.

What SwiftUI menu defects does this audit detect?

It detects ten defect classes: missing .commands blocks, CommandMenu duplicating standard menus, commands closing over @State instead of @FocusedValue, shortcuts on buried buttons, duplicated About/New items, hand-rolled Help/Sidebar menus, missing .disabled guards, the hallucinated @FocusedDocument symbol, reserved-shortcut conflicts, and ungated availability-floored command APIs.

Is @FocusedDocument a real SwiftUI API?

No, @FocusedDocument is a hallucinated symbol that does not exist in Apple's SDK and causes a build failure. The real mechanism is a custom FocusedValues key via @Entry or FocusedValueKey, read with @FocusedValue. The audit flags any use as a hard-fail finding.

Does the audit automatically fix the menu defects it finds?

No. Every defect in this domain is flag-only because fixes restructure the menu and scene graph. The audit reports each finding with the correct consensus code shape from real shipping apps, and the developer applies the change under the fix-safety protocol.

Can this audit run in a CI pipeline?

Yes. The shared lint runner emits unified JSON and SARIF output and exits with code 2 on any hard-fail finding such as @FocusedDocument, making it usable as a CI gate. It degrades to grep-only with a notice if ast-grep is unavailable.

What is out of scope for the SwiftUI menus audit?

AppKit NSMenu bridging belongs to the appkit-overuse audit, the MenuBarExtra scene and toolbar item placement belong to other domain audits, and the blanket availability-gating sweep is handled by the availability-gating skill. Seam findings are emitted with cross_ref pointers.