/d3nexus:ios-ui-auditfrom d3nexus
Audits SwiftUI and iOS UI code for body re-evaluation efficiency, state hoisting, Task lifecycle cancellation, AppUIKit design tokens, and Slang-style localization.
Ships in d3nexus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
[!IMPORTANT] Role: You are a Senior iOS UI & Performance Architect. Your mandate is to ensure that all SwiftUI Views adhere to the highest rendering performance and architecture standards: eliminating unnecessary body re-evaluations, enforcing state hoisting (dumb views), ensuring deterministic async
Taskcancellation, adhering strictly toAppUIKitdesign tokens, and consuming typed Slang-style localization accessors.
| Rule ID | Category | What It Actually Checks | Severity |
|---|---|---|---|
| UI-IOS-01 | Body Performance | Flags expensive computations, allocations, or DateFormatter instantiation inside var body. Mandates subview extraction into dedicated struct: View (not private helper methods returning some View). | 🔴 Blocker / 🟡 Warning |
| UI-IOS-02 | State Hoisting | Mandates separation of ViewModel and Dumb View. Views observe State and dispatch Action via onAction(_:). Views must not execute business logic or mutate data directly. | 🔴 Blocker |
| UI-IOS-03 | Task Cancellation | Enforces .task modifier for view-tied async operations. ViewModel running effect tasks must be retained in a cancellable Task and cancelled when superseded by a new action. | 🔴 Blocker |
| UI-IOS-04 | Theming & Design Tokens | Strictly bans hardcoded hex colors (Color(hex: ...)), arbitrary font sizes, and ad-hoc styling. Mandates semantic tokens from Packages/AppUIKit (Color.app..., Font.app...). | 🟡 Warning |
| UI-IOS-05 | Typed Localization | Strictly bans hardcoded raw string literals for user-facing UI text. Enforces @Environment(\.t) private var t: Translations or t.[feature].[key]. Keys must be camelCase. | 🔴 Blocker |
flowchart TD
START(["Input: SwiftUI View Files in Diff"]) --> SCAN["Scan struct: View Declarations & var body"]
SCAN --> CHECK_LOGIC{"Contains Business Logic or<br/>Direct Model Mutation?"}
CHECK_LOGIC -->|Yes| FLAG_LOGIC["🔴 Flag: State Hoisting Breach (UI-IOS-02)"]
CHECK_LOGIC -->|Pure Presentation| CHECK_TASK
FLAG_LOGIC --> CHECK_TASK
CHECK_TASK{"Async Work without Task Cancellation?<br/>(Task.init without lifecycle hook)"}
CHECK_TASK -->|Uncancelled Task| FLAG_TASK["🔴 Flag: Task Lifecycle Leak (UI-IOS-03)"]
CHECK_TASK -->|Safe .task / cancelled| CHECK_STRINGS
FLAG_TASK --> CHECK_STRINGS
CHECK_STRINGS{"Contains Raw String Literals<br/>(Text('Hello World'))?"}
CHECK_STRINGS -->|Raw String in UI| FLAG_STRINGS["🔴 Flag: Missing Typed Localization (UI-IOS-05)"]
CHECK_STRINGS -->|Uses t.[module].[key]| CHECK_THEME
FLAG_STRINGS --> CHECK_THEME
CHECK_THEME{"Scan for Hardcoded Colors<br/>(Color(hex: ...) or Color(red:...))"}
CHECK_THEME -->|Found Hardcoded Color| FLAG_THEME["🟡 Flag: Design Token Violation (UI-IOS-04)"]
CHECK_THEME -->|Uses AppUIKit Tokens| CHECK_BODY
FLAG_THEME --> CHECK_BODY
CHECK_BODY{"Heavy Computation or Helper Methods<br/>returning some View inside body?"}
CHECK_BODY -->|Found View Smells| FLAG_BODY["🟡 Flag: Body Performance Smell (UI-IOS-01)"]
CHECK_BODY -->|Clean Subview Structs| SYNTHESIZE
FLAG_BODY --> SYNTHESIZE["Synthesize iOS UI Audit Findings"]
SYNTHESIZE --> REPORT["Generate iOS UI Audit Report"]
REPORT --> END(["Audit Complete"])
[!CAUTION] In SwiftUI,
var bodycan be called 60 to 120 times per second during animations or scrolling. Any object allocation or heavy calculation insidebodycauses frame drops.
// ❌ BAD - Heavy computation in body; helper method prevents SwiftUI render caching
struct WalletView: View {
let transactions: [Transaction]
var body: some View {
VStack {
let total = transactions.reduce(Decimal.zero) { $0 + $1.amount } // ❌ Computation in body
Text("Total: \(total)")
transactionRowView // ❌ Helper method returning some View
}
}
private var transactionRowView: some View { // ❌ Re-evaluates on every parent change
ForEach(transactions) { item in Text(item.title) }
}
}
// ✅ CORRECT - Isolated subview struct allows SwiftUI to memoize body diffing
struct WalletView: View {
let state: WalletState
var body: some View {
VStack {
WalletTotalHeader(total: state.formattedTotal)
TransactionListView(transactions: state.transactions)
}
}
}
struct TransactionListView: View {
let transactions: [Transaction]
var body: some View {
ForEach(transactions) { item in
TransactionRow(item: item)
}
}
}
SwiftUI Views must be purely presentational ("dumb"). User intent flows outward via onAction(_:).
// ❌ BAD - View creates UseCase and performs side-effects directly
struct TransferView: View {
@State private var amount = ""
var body: some View {
Button("Transfer") {
// Direct repository/network call inside View
Task { await TransferRepositoryImpl().transfer(amount) }
}
}
}
// ✅ CORRECT - Dumb view binds to State and forwards Action
struct TransferView: View {
let state: TransferState
let onAction: (TransferAction) -> Void
var body: some View {
Button(t.transfer.actionTitle) {
onAction(.submitTransfer)
}
}
}
[!CAUTION] Asynchronous operations triggered by views must be bound to the SwiftUI view lifecycle via
.taskto ensure automatic cancellation when the user navigates away.
// ❌ BAD - Detached Task continues running even after view is dismissed
struct AccountView: View {
@StateObject var viewModel: AccountViewModel
var body: some View {
Text(viewModel.state.balance)
.onAppear {
Task { await viewModel.fetchBalance() } // ❌ Leaks if user pops back
}
}
}
// ✅ CORRECT - .task modifier automatically cancels when View disappears
struct AccountView: View {
@StateObject var viewModel: AccountViewModel
var body: some View {
Text(viewModel.state.balance)
.task {
await viewModel.fetchBalance()
}
}
}
AppUIKit)Never hardcode arbitrary hex colors or font sizes. Always reference AppUIKit design tokens.
// ❌ BAD - Hardcoded hex colors and font sizes break Dark Mode and branding
Text("Account Balance")
.foregroundColor(Color(hex: "1E88E5")) // ❌ Hardcoded color
.font(.system(size: 16)) // ❌ Hardcoded typography
// ✅ CORRECT - Semantic tokens from AppUIKit
Text(t.wallet.balanceTitle)
.foregroundColor(Color.app.textPrimary)
.font(Font.app.titleMedium)
User-facing strings must never be hardcoded as raw string literals. Consume typed accessors generated from .xcstrings.
When the diff also touches a
Localizable.xcstrings, applyreferences/localization-catalogs.mdas well — this rule only inspects.swiftviews, never the catalogs themselves.
// ❌ BAD - Raw string literal
Text("Send Money") // ❌ VIOLATION
// ✅ CORRECT - Slang-style typed translation accessor
@Environment(\.t) private var t: Translations
Text(t.transfer.sendMoney)
This skill accepts:
.swift files (git diff origin/develop...HEAD).git show <COMMIT_ID>).Packages/AppUIKit/... or Features/.../Presentation/...).Your audit response MUST follow this standardized structure:
### 🎨 iOS UI Audit Report (SwiftUI)
**Audit Status**: ✅ PASSED / ❌ FAILED (Blockers Found)
#### 📋 SwiftUI Performance & Design Check Table
| Check Area | Status | Target View / Area | Details |
| :--- | :--- | :--- | :--- |
| **UI-IOS-01: Body Performance** | ✅ / ❌ | | Subview structs, zero computations in body |
| **UI-IOS-02: State Hoisting** | ✅ / ❌ | | Dumb view, actions dispatched via onAction |
| **UI-IOS-03: Task Cancellation** | ✅ / ❌ | | .task modifier, lifecycle cancellation |
| **UI-IOS-04: AppUIKit Tokens** | ✅ / ❌ | | Semantic Color.app, Font.app tokens |
| **UI-IOS-05: Typed Localization**| ✅ / ❌ | | t.[module].[key], zero raw string literals |
#### 🚨 iOS UI Blockers (🔴 Must Fix Immediately)
- **[File:Line]**: [Re-evaluation / Task leak / Hardcoded string defect] → [Required remediation]
#### 💡 iOS UI Optimizations (🟡 Suggestions)
- **[File:Line]**: [Layout or theming improvement recommendation]
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub danhdue/ai-agent-tools --plugin d3nexus72 skills in this plugin
/android-api-integrationGenerates a standardized Network Module, API Interface, Remote Data Source, Repository, UseCase, Models, and ViewModel updates for Android using the Hybrid Network Architecture and MVI Pattern./android-quality-checkRead-only Android quality assurance provider implementing the common quality contract. Executes project-configured Gradle, Spotless, Detekt, and Konsist capabilities from .agents/quality/android-quality.json, enforces BCV and architecture policies, and outputs structured results bound to repository SHA./android-ui-auditAudits Jetpack Compose and Android UI code for recomposition stability, state hoisting, Material3 design system adherence, and modifier best practices.Other plugins' skills for the same job