agentleFS
fritzprixfritzprix/libr-agent/.agents/skills/performance-audit/SKILL.md

performance-audit

Skill11 starsChanged 19 days agoMITView on GitHub

Analyze and identify performance bottlenecks across the full stack (Rust concurrency and memory, Tauri IPC, React rendering, SQLite queries), and generate a prioritized action plan report (P0-P2) with concrete Before/After code solutions. Use when asked to audit performance, investigate UI lag or freezes, optimize Rust async/locks or memory allocations, eliminate React re-render cascades, diagnose slow SQLite queries or IPC serialization overhead, or when user triggers: "성능상의 개선점 분석", "성능 감사", "성능 최적화", "병목 분석", "performance audit", "perf audit", "profile bottlenecks".

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use incident-response, threat-model and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 4 projects that use this

  • OpenAISkill

    threat-model

    Use when Codex is already in the threat-modeling phase of a security scan, the user explicitly invokes $threat-model, or the user explicitly asks to create, update, or persist a repository threat model. Do not use as the primary trigger for full PR, commit, branch, patch, or repository scans.

    Also in 3 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 8 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

  • SentrySkill

    security-review

    Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check Tokio task safety: Are there std::fs calls or sync loops in async functions?

    line 56
  2. Very specific:

    Check lock granularity: Is a Mutex locked across an .await or around long iterations?

    line 57
  3. Distinctive:

    Check React render trees: Is parent state triggering re-renders of heavy children without memoization?

    line 58
  4. Very specific:

    Check SQLite access: Are queries executed in loops?

    line 59
  5. Distinctive:

    Verify that the fix does not introduce architectural bloat (KISS/YAGNI).

    line 84
  6. Very specific:

    Write the final audit to .libragent/work/perf_audit_<target>_<YYYYMMDD>.md (or present directly to user) following …

    line 88
  7. Very specific:

    No Raw Cargo Execution: NEVER execute raw cargo test, cargo build, or cargo clippy.

    line 94
  8. Distinctive:

    Do NOT introduce dual-ID / dual-state caching mechanisms to "save a few bytes" or "optimize lookups".

    line 97
  9. Distinctive:

    Do NOT build distributed-scale caching layers for a local SQLite desktop app.

    line 98
  10. Distinctive:

    Evidence-Based Citing: Every bottleneck must cite specific file paths, line ranges, or measurable complexity.

    line 99

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance Audit

Systematically identify performance bottlenecks, CPU/memory hotspots, and latency culprits across LibrAgent's full stack, then generate a prioritized action plan (P0-P2) with actionable Before/After code solutions.

Scope & Diagnostic Domains

LibrAgent is a local desktop application (Tauri + Rust + React/TypeScript + SQLite). Performance issues primarily fall into four domains:

  1. Rust Concurrency & Memory:
    • Synchronous blocking inside Tokio async tasks
    • Lock contention and extended guard scopes (Mutex, RwLock)
    • Unnecessary cloning, large buffer allocations, and non-streaming file/payload processing
  2. Tauri IPC Boundary:
    • Massive JSON payload serialization across IPC
    • Chatty, unbatched command invocations
    • Unreleased event listeners causing leaks
  3. Frontend (React / TypeScript):
    • Re-render cascades and unmemoized heavy computations in render paths
    • Unstable object/callback references invalidating child memoization
    • Unvirtualized long lists (chat items, logs, file trees)
  4. SQLite & Data Access:
    • N+1 queries and missing index full-table scans
    • Unbatched bulk inserts/updates outside transactions
    • Connection pool contention and non-WAL mode operations

Detailed checklist: see references/checklist-fullstack.md.


Performance Audit Workflow

1. Target Hot Path ➔ 2. Inspect Code ➔ 3. Classify Priority (P0-P2) ➔ 4. Draft Before/After ➔ 5. Action Plan Report

1. Identify Target Scope

  • Clarify or identify the target module, feature, or flow under investigation (e.g., chat stream rendering, session transcript loading, tool execution pipeline, history search).
  • Examine relevant source files directly without guessing.

2. Systematic Code Inspection

Cross-examine the target against the Full-Stack Checklist:

  • Check Tokio task safety: Are there std::fs calls or sync loops in async functions?
  • Check lock granularity: Is a Mutex locked across an .await or around long iterations?
  • Check React render trees: Is parent state triggering re-renders of heavy children without memoization?
  • Check SQLite access: Are queries executed in loops? Are WHERE/ORDER BY columns indexed?

3. Priority Classification

Classify all identified bottlenecks strictly by impact:

  • P0 (Critical):
    • Freezes main/UI thread for >100ms
    • OOM risks, memory leaks, or potential deadlocks
    • Tokio runtime starvation (sync blocking on worker threads)
  • P1 (High):
    • Noticeable UI stutter or rendering cascades (e.g., 50+ child components re-rendering on every keystroke/token)
    • N+1 SQLite queries or missing indexes on growing tables
    • Uncompressed/unpaginated multi-megabyte IPC serialization
  • P2 (Medium / Low):
    • Micro-optimizations (redundant clones, small heap allocations)
    • Opportunities to use Vec::with_capacity or pass references instead of owned values

4. Provide Concrete Before/After Solutions

For each finding:

  • Specify exact code location: relative/path/to/file.ext:line.
  • Explain the precise root cause (why it degrades performance).
  • Provide minimal, idiomatic Before and After code snippets.
  • Verify that the fix does not introduce architectural bloat (KISS/YAGNI).

5. Generate Action Plan Report

Write the final audit to .libragent/work/perf_audit_<target>_<YYYYMMDD>.md (or present directly to user) following references/reporting-template.md.


Critical Rules & Guardrails

  • No Raw Cargo Execution: NEVER execute raw cargo test, cargo build, or cargo clippy. These cause OOM and system freezes. If verification is needed, only use lightweight commands (pnpm rust:check, pnpm rust:fmt:check).
  • No Unauthorized Test Runs: Static analysis and diff-based inspection are primary. Do not run heavy test suites unless explicitly directed by the user.
  • KISS / YAGNI (No Over-Engineering):
    • Do NOT introduce dual-ID / dual-state caching mechanisms to "save a few bytes" or "optimize lookups".
    • Do NOT build distributed-scale caching layers for a local SQLite desktop app.
  • Evidence-Based Citing: Every bottleneck must cite specific file paths, line ranges, or measurable complexity. Never invent theoretical speedups (e.g. "will make it 300% faster") without concrete measurements.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.