agentleFS
mgiovanimgiovani/cc-arsenal/skills/review-perf/SKILL.md

review-perf

Skill8 starsChanged 49 days agoMITView on GitHub

Deep-dive performance audit of database queries, algorithmic complexity,

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If PR or commit specified, pull the *full diff* - not just the file list - so hunk ranges are available for Phase 2's confinement check:

    line 45
  2. Distinctive:

    Read each match to verify context (hot path vs.

    line 84
  3. Distinctive:

    Follow references/report-template.md.

    line 108

“Common” is measured: kept by at least 6 in 10 of the 3 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 Review

Comprehensive performance analysis targeting database query inefficiencies, algorithmic complexity issues, frontend bottlenecks, and resource leaks. This skill only analyzes: it identifies problems and suggests optimizations without making code changes.

Constraints

ConstraintDetail
Analysis onlyNever modifies, fixes, or commits code, even if asked to "also fix these" mid-run; report the findings and stop
Static analysisNo runtime profiling, no benchmarking, no load testing
Pattern-basedBig O and impact estimates are approximate; may miss context-specific issues a profiler would catch
Not exhaustiveDoes not guarantee 100% detection; profiling is recommended before acting on critical findings
Read before claimingNever report a finding in a file that has not actually been read; every finding cites the specific file path and line number it came from
No invented numbersCounts, query-multiplication estimates, and Big O claims must trace back to code actually read, not generic examples copied from the report template
Diff-scope confinementFor a PR or commit review, never grep or read a file the diff didn't touch, and never let a pre-existing issue in a touched file masquerade as a PR finding; see Phase 0/2

Scan Workflow

Phase 0: Determine Scan Scope

Parse arguments:

  • <pr_number>: scan only files changed in that PR (e.g. 123, #123)
  • <commit_sha>: scan only files changed in that commit
  • --all or no args: scan entire codebase
  • --scope [database|algorithm|frontend|resources|backend]: focus on specific categories (backend = database + algorithm + resources, excludes frontend)

If PR or commit specified, pull the full diff - not just the file list - so hunk ranges are available for Phase 2's confinement check:

# For PR
gh pr diff <pr_number>

# For commit
git diff-tree -p <commit_sha>

From that diff, extract two things and carry both into Phase 2:

  1. Changed-file list: the paths after each +++ b/ line.
  2. Hunk ranges per file: each @@ -a,b +c,d @@ header gives the new-file line range c to c+d-1 for that hunk. A file can have multiple hunks.

--all or no args skips this entirely - there's no diff to confine to, the whole codebase is in scope.

Phase 1: Project Technology Discovery

Explore the codebase to identify the stack (language, ORM, framework) - it determines which anti-patterns in references/agent-prompts.md apply and which profiling tools to recommend.

Phase 2: Scan the Codebase

Four scan categories, each with its own grep patterns and reporting format in references/agent-prompts.md:

CategoryCovers
DatabaseN+1 queries, missing indexes, connection management
AlgorithmQuadratic+ complexity, inefficient data structures, unnecessary recomputation
FrontendBundle size, rendering (React re-renders, layout thrashing), network waterfalls
ResourcesMemory leaks, connection/file-handle leaks, thread/process leaks

Spawn only the category matching --scope; spawn all 4 for --all, no scope, or --scope backend (database + algorithm + resources).

With subagent tools available: spawn one Explore agent per category in parallel, using the prompts in the reference file, and track progress with TodoWrite. Without subagent tools: run the categories sequentially inline in the same order, one grep pass and read-verify cycle per category.

For a PR or commit review, pass the Phase 0 changed-file list to every category (agent or inline) as the only valid grep/read target - a file the diff didn't touch is out of bounds even if it looks relevant (e.g. a service a changed view calls into). For --all, there's no such restriction.

Each category, agent or inline:

  1. Grep for the anti-patterns for that category, restricted to the changed-file list on a PR/commit review
  2. Read each match to verify context (hot path vs. cold path - a slow pattern in init code is not the same finding as one in a request handler)
  3. On a PR/commit review, check the match's line number against that file's hunk ranges from Phase 0:
    • Inside a hunk → a PR finding, goes through steps 4-6 into the main Findings section
    • Outside every hunk (pre-existing code in a touched file) → skip steps 4-6's severity/fix writeup and instead route it to the separate "Pre-existing issues" bucket (Phase 4); never mix it into the main findings
  4. Extract the exact code snippet (5-10 lines)
  5. Classify severity (Critical/High/Medium/Low) and explain why
  6. Give 2-3 optimization approaches
  7. Estimate impact where the code supports it (e.g. "O(n²) → O(n log n)", "101 queries → 2 queries for 100 records")

Phase 3: Consolidate & Prioritize

  1. Collect findings from all categories scanned; deduplicate anything two categories both flagged
  2. On a PR/commit review, keep the pre-existing-issues bucket separate from the main findings throughout - it never enters the severity tally below
  3. Sort by severity:
    SeverityCriteria
    CriticalN+1 in loops, O(n²+) on large datasets, memory leaks in long-running processes, unbounded resource allocation
    HighMissing indexes, sync blocking in async contexts, large bundle imports, connection pool exhaustion
    MediumSuboptimal queries, unnecessary re-renders, missing caching, inefficient data structures
    LowMinor optimizations, marginal-impact style preferences
  4. Group by domain (Database/Algorithm/Frontend/Resources) and compute stats: total issues, by severity, by category, files scanned vs. files with issues

Phase 4: Generate Report

Follow references/report-template.md. Every number in it (finding counts, severity totals, file:line refs) must come from Phase 3's actual tally - never fill in the template's placeholder numbers as if they were real.

On a PR/commit review with a non-empty pre-existing-issues bucket, add a "Pre-existing Issues Noticed in Touched Files (outside this PR's changes)" section after the main Findings section - same file:line/snippet/severity format, clearly separated, excluded from the Severity Breakdown and Performance Impact Summary counts (which cover main findings only). If the bucket is empty, omit the section rather than writing a placeholder.

After writing the Findings sections, recount: count the actual Finding entries present in the report (per category and per severity) and use that recount for the Severity Breakdown and Performance Impact Summary table. Never estimate the summary counts or carry forward Phase 3's tally unreconciled - if a finding was dropped or merged while writing the report, the totals must reflect what's actually written, not what was originally found.

Usage

review-perf 123                      # scan PR 123
review-perf #456
review-perf abc123def                # scan a commit
review-perf --all                    # scan entire codebase
review-perf                          # same as --all
review-perf --all --scope database   # codebase-wide, database findings only
review-perf 123 --scope frontend     # PR 123, frontend findings only

Additional Resources

  • references/agent-prompts.md - grep patterns and per-category scan prompts (load in Phase 2)
  • references/report-template.md - full markdown report template (load in Phase 4)

Performance References

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.