跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
安全

ln-25-persistence-auditor

Audits queries, transactions, data-path performance, and persistence resource lifecycle. Use when data correctness or scalability is at risk; not for general performance tuning.

levnikolaevich · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add levnikolaevich/claude-code-skills --skill ln-25-persistence-auditor

技能说明


name: ln-25-persistence-auditor description: "Audits queries, transactions, data-path performance, and persistence resource lifecycle. Use when data correctness or scalability is at risk; not for general performance tuning."

Persistence Auditor

Goal: Perform a read-only audit of persistence and data-heavy runtime paths. Connect static candidates to real query, transaction, resource, or consistency mechanisms and avoid claiming performance impact without evidence.

Execution contract: Treat the ordered checkbox workflow below as this skill's Definition of Done. Track every checkbox as PENDING, then resolve it to PROVEN with concrete evidence, CLEARED with evidence that its conditional trigger is absent, or UNPROVEN; reading, mentioning, delegating, skipping, or tool failure is not proof. Before returning, resolve every PENDING, count only PROVEN and CLEARED items as complete, apply this skill's verdict, decision, and approval rules to every UNPROVEN, and prepend Checklist: X/Y completeIncomplete: None | section/item — reason; outcome impact; exact next action; list every UNPROVEN item.

Tool Routing

NeedPreferred toolUse it whenFallback
Data-layer mapNative file search over manifests, models, mappings, repositories, migrations, queries, cache, queue, and pool configurationEstablishing stores, frameworks, ownership, and scopeTrace from known request, job, or command entrypoints
Call paths and resource ownershipLanguage server or host-native code intelligenceFollowing service calls, transaction boundaries, async flow, session scopes, and cleanupTargeted search plus direct inspection of definitions and callers
Query behaviorExisting query logs, tracing, ORM diagnostics, and application metricsEstablishing frequency, duplication, timing, rows, and cache behaviorStatic query-in-loop and fetch-shape analysis with explicit limits
Query plansDatabase-native explain tooling on an approved non-production targetA safe read query and representative schema/data are availableInspect indexes, predicates, joins, statistics assumptions, and generated SQL statically
Runtime performanceExisting profiler, benchmark, or repository diagnostic commandAllocation, blocking, loop amplification, or I/O cost needs measurementComplete static cost path marked as unmeasured
Correctness verificationRepository-defined tests, integration environment, and migration checksReproducing transaction, retry, consistency, or lifecycle behavior safelyStatic failure trace and required verification plan
External semanticsOfficial database, driver, framework, and runtime documentation matching installed versionsIsolation, pooling, cancellation, caching, trigger, or async semantics affect a findingPrimary-source web research; otherwise mark UNVERIFIED

Never connect to production or run mutating diagnostics. EXPLAIN ANALYZE executes the statement: use it only for confirmed read-only queries on an approved disposable or non-production target. Do not create indexes, migrate, vacuum, rewrite data, or change pool settings during the audit.

Evidence Rules

  • Query count, duration, rows, plan, lock, or profile evidence is stronger than a static performance suspicion.
  • Static evidence can prove correctness and lifecycle defects when the full path is visible, but performance impact must be labeled unmeasured.
  • ORM conventions, bounded administrative paths, startup-only work, and intentionally small datasets require context before becoming findings.
  • Transaction advice must match the actual database, isolation level, driver, framework, and retry model.
  • Recommendations must preserve data integrity and failure semantics, not only reduce latency.

Checklist

1. Establish the Data and Runtime Context

  • Detect databases, ORMs, drivers, caches, queues, schemas, migrations, pools, dependency-injection scopes, and runtime entrypoints in scope.
  • Resolve installed versions, database capabilities, deployment topology, consistency requirements, and expected workload from repository evidence.
  • Identify critical data paths, high-volume paths, streaming paths, scheduled work, and operations that hold transactions or resources across external calls.
  • Read repository instructions and inspect Git state before running diagnostics or interpreting current work.
  • Establish available query logs, metrics, traces, profiles, representative data, test environments, and safe diagnostic permissions.
  • Keep the audit read-only and document every executed query, command, target, and artifact created.

2. Audit Query and Cache Efficiency

  • Trace representative paths from entrypoint through business logic to generated query and materialization.
  • Find N+1 behavior, repeated identical fetches, query-in-loop patterns, sequential independent reads, and redundant existence or count queries.
  • Check over-fetching, broad entity loading, unbounded reads, premature materialization, missing pagination, and user-controlled result amplification.
  • Check missing bulk operations, per-row writes, avoidable round trips, fragmented commits, and opportunities for set-based work.
  • Inspect predicates, joins, sort and group operations, index alignment, query-plan assumptions, and statistics only with schema and workload context.
  • Check cache ownership, key design, scope, invalidation, stampede control, negative caching, staleness tolerance, and duplication with database guarantees.
  • Distinguish latency caused by query shape, connection wait, locks, network, serialization, application work, or downstream services before recommending a fix.
  • Measure or clearly label the expected impact; do not present a candidate index or cache as a proven optimization.

3. Audit Transactions and Consistency

  • Identify who begins, commits, roll
阅读完整来源 ↗