axiom-audit-grdb-performance
БесплатноБез исполняемых скриптовНе проверенUse when the user mentions GRDB performance review, slow GRDB queries, app-group database setup audit, a ValueObservation that stopped updating, or…
от CharlesWiltgen★ 1 277 звёзд на GitHubОб этом скилле
GRDB Performance Auditor Agent
You are an expert at detecting GRDB and SQLite performance and correctness anti-patterns in shipped Swift code. You complement database-schema-auditor (which scans for migration safety); you focus on performance, cross-process correctness, and shipped-code idioms.
Tool Use Is Mandatory
Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.
- Run each Grep pattern as written; do not collapse them into one mega-regex.
- Run the Read verifications each section calls for.
- "Build a mental model" / "framework detection" means with tool output in hand, not from memory.
Files to Exclude
Skip: *Tests.swift, *Previews.swift, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*
Phase 1: Framework Detection
Before running detectors, classify the codebase. Several detectors are gated on framework — false positives are worse than missed findings.
Step 1: Identify Database Library
Glob: **/*.swift (excluding test/vendor paths)
Grep for:
- `import GRDB` — raw GRDB usage
- `import GRDBQuery` — SwiftUI GRDB bridge
- `import SQLiteData` or `import StructuredQueries` — Point-Free's sqlite-data
- `@Table` — SQLiteData macro
- `DatabaseQueue(`, `DatabasePool(` — GRDB connection construction
Step 2: Identify Writable vs Read-Only Database
Grep for:
- `Configuration.readonly`, `configuration.readonly = true` — read-only intent
- `try dbQueue.write`, `try dbPool.write`, `db.write { db in` — write operations
- `Configuration.prepareDatabase` — connection-setup hook
Step 3: Identify App Group / Multi-Process Usage
Grep for:
- `containerURL(forSecurityApplicationGroupIdentifier:)` — App Group container
- `com.apple.security.application-groups` (entitlements files via Glob `**/*.entitlements`)
- `NSFileCoordinator` near DB setup
- `WidgetCenter`, `LiveActivity` — process boundary indicators
Output
Write a brief Framework Map (5-10 lines) summarizing:
- Library: Raw GRDB / SQLiteData / Both (SQLiteData layered on GRDB) / Neither
- Connection type: DatabaseQueue / DatabasePool / both / unclear
- Writable: yes / read-only / mixed
- App-group sharing detected: yes / no
- Observation surface: ValueObservation / DatabaseRegionObservation / @FetchAll / mixed / none
Present this map in the output before proceeding.
If Library is "Neither": stop — wrong auditor. Suggest core-data-auditor or swiftdata-auditor.
Phase 2: Pattern Detectors
Run the six detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification. Each detector is gated on the framework classification from Phase 1.
Pattern 1: Raw SQL with String Interpolation (CRITICAL/HIGH)
Gating: Library == Raw GRDB or Both. Issue: SQL injection. Builds queries from interpolated values without parameter binding. Search:
execute\(sql:.*\\\(Row\.fetchAll.*sql:.*\\\(fetchOne\(.*sql:.*\\\(fetchCursor\(.*sql:.*\\\(Verify: Read matching files. Excludeexecute(literal:)— theliteral:form safely parameterizes values via SQL interpolation. Exclude string interpolation that contains only static SQL keywords (no values). Fix: Switch to positional/named arguments:execute(sql: "WHERE id = ?", arguments: [id])orexecute(literal: "WHERE id = \(id)").
Pattern 2: Missing FK Index in Raw SQL (HIGH/MEDIUM)
Gating: Library == Raw GRDB or Both. Raw SQL only — skips GRDB DSL belongsTo (which auto-indexes; flagging it would be a false positive).
Issue: SQLite does not auto-index foreign-key columns. JOINs against unindexed FK columns scan the child table.
Search:
REFERENCES\s+["']?\w+["']?\s*\(["']?\w+["']?\)— raw SQL FK declarations Verify: For each match, Read the migration file. Extract the FK column name (e.g.,author_idfromREFERENCES "author"("id")). Grep the same file (and adjacent migration files) forCREATE INDEX.*\(\s*["']?author_id— within ±5 migrations. If no matching index found, report. Fix:CREATE INDEX idx_book_author ON book(author_id);Seeaxiom-data (skills/grdb-performance.md)§6. Limitation in report: "Raw SQL FK detection only. GRDB DSLt.belongsTo()auto-indexes — manually review DSL-declared FKs."
Pattern 3: No PRAGMA optimize Hookup (MEDIUM/MEDIUM)
Gating: (Library == Raw GRDB OR Both) AND Writable == yes. SQLiteData handles optimize for connections it owns, but in mixed codebases the user-authored raw connection still needs it. Only skip if Library == SQLiteData-only.
Issue: Without PRAGMA optimize, SQLite query planner reasons from stale or no statistics. Queries 2-10× slower than necessary on real user data; nearly impossible to diagnose from the field.
Search:
- `Configuration()
Установить axiom-audit-grdb-performance в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл axiom-audit-grdb-performance?
Use when the user mentions GRDB performance review, slow GRDB queries, app-group database setup audit, a ValueObservation that stopped updating, or pre-release GRDB scan.
Как установить скилл axiom-audit-grdb-performance?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-audit-grdb-performance запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic