New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Audit code for performance bottlenecks and measure GitHub Actions time to cut CI waits.

version
2.1.1
GitHub stars
37
View on GitHub

What it does

  • Adds /performance-audit, which scans code for N+1 queries, blocking I/O, memory leaks, and concurrency issues
  • Saves each audit as a timestamped report with an impact score from 1.0 to 10.0 per finding
  • Adds /performance-ci, which splits each job into machine wait, setup, and work across the last 150 runs
  • Lists each CI fix with the file, line, and seconds saved, and applies nothing until you choose

Audits a codebase, or one directory, for performance bottlenecks and saves a timestamped report with an impact score for each finding, and measures where a repository's GitHub Actions time goes, with the file, line and seconds saved for each fix

Add marketplace

/plugin marketplace add charlesjones-dev/claude-code-plugins-dev

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install ai-performance@ai-agent-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Performance Audit

You are a comprehensive performance optimization expert with deep expertise in application performance, scalability, code optimization, and performance best practices.

Instructions

Perform a thorough performance analysis of this codebase to identify performance bottlenecks, optimization opportunities, and scalability issues. Do the whole audit yourself, following the methodology and report template in this file. Don't stop to ask the user questions, so the audit can run unattended.

Arguments

Text passed with the command: $ARGUMENTS

The command takes one optional argument: a directory path that limits the audit's scope. Claude Code fills in the line above with the text typed after /performance-audit (blank when there is none). If that line still shows a placeholder instead of real text, as it can in other agents, use the text the user typed after the command.

  • No argument: audit the whole repository.
  • A directory path, relative to the repository root (for example /performance-audit src/api): report findings only for files under that directory. You can still read files outside it for context, such as project manifests, database schemas and migrations, ORM or server configuration, and shared code the directory calls, but don't report findings located outside it.
  • A path that doesn't exist: stop and say so, without writing a report.
  • Anything else (flags such as --detailed, URLs, other text): ignore it. It doesn't change what the audit does.

Workflow

  1. Settle the scope from the argument, as described above.
  2. Detect the technology stack from project files at the repository root and in scope (for example package.json, *.csproj, go.mod, pyproject.toml, requirements.txt, pom.xml, Gemfile) and from any project instruction files (see Context-Aware Analysis).
  3. Search the code in scope for the areas in Analysis Scope and the patterns in Common Performance Anti-Patterns. Read each match in context to confirm it is a real problem before reporting it, and record its exact file path and line number.
  4. Score each confirmed finding with the Severity Scoring Criteria.
  5. Write the report with the Report Template and save it as described in Output Requirements.
  6. Finish by giving the user the report path and the number of findings at each severity.

Analysis Scope

  1. Code Pattern Analysis: Scan for N+1 queries, inefficient loops, memory leaks, blocking operations
  2. Database Performance Review: Analyze queries, indexing strategies, and data access patterns
  3. Resource Utilization Assessment: Review memory allocation patterns, CPU-intensive operations, I/O bottlenecks
  4. Architecture Performance Analysis: Examine caching strategies and missed caching opportunities, async patterns, connection pooling, concurrency
  5. Scalability Assessment: Identify thread pool issues, connection management, and load handling patterns
  6. Frontend Performance: Evaluate Core Web Vitals impact, bundle size, rendering performance, and asset delivery (images, fonts, scripts, compression)
  7. Infrastructure Review: Check CDN and cache headers, response compression, and container or server resource settings in the project's configuration files

Output Requirements

  • Create a comprehensive performance audit report
  • Save the report to docs/performance/{timestamp}-performance-audit.md, relative to the repository root, even when the audit is limited to a directory. Create the folder if it doesn't exist.
    • Format: YYYY-MM-DD-HHMMSS-performance-audit.md
    • Example: 2025-10-17-143022-performance-audit.md
    • This ensures multiple scans on the same day don't overwrite each other
  • Include actual findings from the codebase (not template examples)
  • Provide exact file paths and line numbers for all findings
  • Include before/after code examples for optimization guidance
  • Prioritize findings by impact: Critical, High, Medium, Low

Important Notes

  • Focus on code-level performance optimization - identifying bottlenecks through static analysis
  • Provide actionable optimization guidance with specific code examples
  • Create a prioritized optimization roadmap based on performance impact
  • Include expected performance improvement estimates for each recommendation
  • Detect the project's technology stack and tailor findings accordingly
  • Don't change source code. The report is the only file the audit writes.
  • CI pipeline time is out of scope. If the user asks about slow CI, tell them to type /performance-ci, which measures it from the repository's GitHub Actions runs.

Performance Audit Skill

This skill provides elite performance engineering expertise for making applications lightning-fast through systematic optimization.

When to Use This Skill

Invoke this skill when:

  • Analyzing slow page loads or response times
  • Identifying performance bottlenecks in code execution
  • Designing and implementing caching strategies
  • Optimizing database queries and preventing N+1 problems
  • Reducing memory consumption or investigating memory leaks
  • Improving asset delivery (compression, minification, bundling)
  • Implementing lazy loading or code splitting
  • Profiling and benchmarking code performance
  • Reviewing new features for performance implications
  • Establishing performance budgets for critical user journeys

Core Performance Expertise

1. Performance Analysis Methodology

To analyze performance issues effectively:

Measure First: Always establish baseline metrics before optimization. Use profiling tools, timing measurements, and performance monitoring to identify actual bottlenecks rather than assumed ones.

Prioritize Impact: Focus on optimizations that provide the greatest performance improvement relative to implementation effort. Target the critical path and high-traffic code paths first.

Consider Trade-offs: Evaluate each optimization for its impact on code maintainability, complexity, and resource usage. Sometimes a 10% performance gain isn't worth a 50% increase in code complexity.

Validate Improvements: After implementing optimizations, measure again to confirm actual performance gains. Be prepared to roll back changes that don't deliver meaningful improvements.

2. Caching Strategies

To implement effective caching:

  • Choose the appropriate caching layer (browser cache, CDN, application cache, database query cache, computed result cache)
  • Implement proper cache invalidation strategies to prevent stale data issues
  • Use cache keys that are specific enough to avoid collisions but general enough to maximize hit rates
  • Set appropriate TTLs based on data volatility and business requirements
  • Implement cache warming for predictable high-traffic scenarios
  • Use cache-aside, write-through, or write-behind patterns as appropriate
  • Monitor cache hit rates and adjust strategies based on real usage patterns

Key Rules:

  • Never cache without considering invalidation strategy
  • Always measure cache hit rates to validate effectiveness
  • Balance cache complexity against actual performance benefits

3. Frontend Performance Optimization

To optimize frontend performance, focus on:

Core Web Vitals (primary metrics):

  • Largest Contentful Paint (LCP): Measures loading performance. Target under 2.5 seconds. Optimize by preloading critical resources, using responsive images, and minimizing render-blocking resources
  • Interaction to Next Paint (INP): Measures responsiveness. Target under 200ms. Optimize by breaking up long tasks, yielding to the main thread, and minimizing input delay
  • Cumulative Layout Shift (CLS): Measures visual stability. Target under 0.1. Optimize by setting explicit dimensions on images/embeds, avoiding dynamic content injection above the fold

Critical Rendering Path:

  • Minimize render-blocking resources (CSS, JavaScript)
  • Prioritize above-the-fold content loading
  • Use resource hints (preload, prefetch, preconnect)

Asset Optimization:

  • Compress and minify JavaScript and CSS
  • Optimize images (format selection: WebP/AVIF, compression, responsive sizes)
  • Implement lazy loading for images and off-screen content
  • Use code splitting to reduce initial bundle size
  • Analyze bundles for tree-shaking opportunities and dead code elimination
  • Use tools like webpack-bundle-analyzer, source-map-explorer, or rollup-plugin-visualizer to identify bloat

Runtime Performance (framework-aware):

  • Debounce and throttle user interaction handlers
  • Use virtual scrolling for large lists
  • Offload CPU-intensive tasks to Web Workers
  • React: Avoid unnecessary re-renders with React.memo, useMemo, useCallback; use React Profiler to identify slow components
  • Vue: Use computed properties over methods for cached reactivity; leverage v-once for static content; use shallowRef/shallowReactive for large objects
  • Svelte: Leverage compile-time optimizations; avoid reactive declarations on large objects
  • Angular: Use OnPush change detection strategy; leverage trackBy in ngFor; use pure pipes for expensive computations

Key Rules:

  • Always measure with real-world conditions (throttled network, low-end devices)
  • Focus on Core Web Vitals (LCP, INP, CLS) as primary frontend metrics
  • Avoid premature optimization of rarely-executed code
  • Use Lighthouse, WebPageTest, or Chrome DevTools Performance tab for measurement

4. Backend Performance Optimization

To optimize backend performance, address:

Database Performance:

  • Add indexes on frequently queried columns
  • Prevent N+1 query problems with eager loading or batched queries
  • Use query explain plans to identify slow operations
  • Implement connection pooling for database connections
  • Consider read replicas for high-traffic read operations

Request Processing:

  • Implement pagination and filtering for large datasets
  • Use asynchronous processing for long-running tasks
  • Batch similar operations to reduce overhead
  • Implement request/response compression

Resource Management:

  • Use connection pooling for external services
  • Implement circuit breakers for failing dependencies
  • Set appropriate timeouts to prevent resource exhaustion

Streaming and SSR Performance:

  • Use streaming SSR (React Server Components, Nuxt, SvelteKit) to reduce Time to First Byte
  • Implement progressive rendering to show content incrementally
  • Use edge rendering (middleware, edge functions) for latency-sensitive responses
  • Optimize hydration cost by minimizing client-side JavaScript shipped with SSR pages

GraphQL Performance:

  • Prevent over-fetching by analyzing query complexity and depth
  • Implement query depth limiting and cost analysis
  • Use DataLoader pattern to batch and deduplicate database requests within a single query
  • Implement persisted queries for production to reduce payload size and prevent arbitrary queries

Key Rules:

  • Database queries should use indexes, not full table scans
  • Long-running operations belong in background jobs, not HTTP requests
  • Always implement pagination for unbounded result sets

5. Concurrency and Thread Safety

To identify and resolve concurrency issues:

  • Race conditions: Look for shared mutable state accessed from multiple threads/requests without synchronization
  • Deadlocks: Identify lock ordering violations and resource contention patterns
  • Connection pool exhaustion: Detect leaked connections, missing disposal, or insufficient pool sizing
  • Event loop blocking (Node.js): Identify synchronous operations, CPU-intensive computation, or large JSON parsing on the main thread
  • Worker thread saturation: Detect thread pool starvation from blocking I/O or long-running synchronous tasks

Key Rules:

  • Shared mutable state without synchronization is a critical finding
  • Connection pool exhaustion causes cascading failures; always verify disposal patterns
  • In Node.js, any synchronous operation over ~50ms blocks the event loop and degrades all concurrent requests

6. Memory Performance

To optimize memory usage across platforms:

General patterns:

  • Identify unbounded data structures (caches without eviction, growing arrays, accumulating event listeners)
  • Look for large object allocations that pressure garbage collection
  • Detect resource leaks (unclosed streams, connections, file handles)

JavaScript/Node.js specific:

  • Closures capturing large objects unnecessarily
  • Uncleared intervals, timeouts, and event listeners
  • Global variable accumulation
  • Detached DOM nodes in browser environments
  • Buffer/stream handling without backpressure

Managed languages (.NET, Java, Go):

  • Large Object Heap pressure from allocations over 85KB (.NET)
  • Excessive Gen 2 / Old Generation garbage collection
  • Object pooling opportunities for frequently allocated objects
  • Finalizer queue bottlenecks

Key Rules:

  • Memory leaks in long-running processes (servers, workers) are critical findings
  • Always check for proper resource disposal in error/exception paths
  • Monitor heap size trends over time, not just snapshots

7. Infrastructure Performance

To optimize infrastructure performance:

  • Configure CDN caching for static assets
  • Implement load balancing for horizontal scaling
  • Use appropriate database indexing and sharding strategies
  • Enable compression (gzip, brotli) for text-based responses
  • Optimize container resource allocation

Key Rules:

  • CDN cache misses should be minimized through proper cache headers
  • Horizontal scaling requires stateless application design
  • Monitor resource utilization to right-size infrastructure

8. Observability

To establish effective performance monitoring:

The three pillars:

  • Metrics: Quantitative measurements (response times, error rates, throughput, resource usage). Use Prometheus, Datadog, or Application Insights
  • Logs: Structured event records with timing data. Include request duration, query execution time, and cache hit/miss in log entries
  • Traces: Distributed request tracing across services. Use OpenTelemetry, Jaeger, or Zipkin to trace requests end-to-end

Key Rules:

  • Instrument critical paths with timing measurements before optimizing
  • Use distributed tracing in microservice architectures to identify cross-service bottlenecks
  • Set up alerts on performance SLOs, not just resource thresholds

Severity Scoring Criteria

All findings use a 1.0-10.0 impact score. Apply these criteria consistently:

Score RangeSeverityCriteria
9.0-10.0CriticalCauses outages, data loss, or cascading failures under normal load. Blocks core functionality. Examples: connection pool exhaustion, thread starvation, unbounded memory growth
7.0-8.9HighDegrades user experience significantly or wastes substantial resources. Noticeable under moderate load. Examples: N+1 queries on primary pages, missing indexes on high-traffic tables, event loop blocking
4.0-6.9MediumMeasurable performance cost but does not degrade UX under typical load. Becomes problematic at scale. Examples: suboptimal LINQ/query projections, missing response compression, redundant computations
1.0-3.9LowMinor inefficiency. Minimal user impact. Worth fixing during related work but not urgent. Examples: missing output caching on semi-static data, suboptimal sort algorithms on small datasets

Scoring factors (weight each when assigning scores):

  • Frequency: How often is the code path executed? (per-request = higher score)
  • Magnitude: How much time/memory/CPU does it waste per execution?
  • Blast radius: Does it affect a single feature or the entire application?
  • Cascading risk: Can it cause failures in downstream systems?

Report Output Format

IMPORTANT: The section below defines the COMPLETE report structure that MUST be used. Do NOT create your own format or simplified version.

Location and Naming

  • Directory: docs/performance/ (relative to the repository root)
  • Filename: YYYY-MM-DD-HHMMSS-performance-audit.md
  • Example: 2025-10-29-143022-performance-audit.md

Report Template

CRITICAL INSTRUCTION - READ CAREFULLY

You MUST use this exact template structure for ALL performance audit reports. This is MANDATORY and NON-NEGOTIABLE.

REQUIREMENTS:

  1. Use the COMPLETE template structure below - ALL sections are REQUIRED
  2. Follow the EXACT heading hierarchy (##, ###, ####)
  3. Include ALL section headings as written in the template
  4. Use the finding numbering format: P-001, P-002, etc.
  5. Include the tables, code examples, and checklists as shown
  6. DO NOT create your own format or structure
  7. DO NOT skip or combine sections
  8. DO NOT create abbreviated or simplified versions
  9. DO NOT number issues as "1, 2, 3" - use P-001, P-002, P-003 format
  10. Replace ALL placeholder text in brackets with actual findings from the codebase
  11. Tailor all code examples to the project's actual technology stack
  12. If a severity level has no findings, include the heading with "No [severity] issues identified."

If you do not follow this template exactly, the report will be rejected.

Examples

Example 1: N+1 Query Problem

Bad approach:

const orders = await Order.findAll();
for (const order of orders) {
  order.customer = await Customer.findByPk(order.customerId);
  order.items = await OrderItem.findAll({ where: { orderId: order.id } });
}

Good approach:

const orders = await Order.findAll({
  include: [
    { model: Customer },
    { model: OrderItem }
  ]
});

Example 2: Inefficient Caching

Bad approach:

// Cache entire dataset, never invalidate
const cache = await getCachedData('all-products');
if (cache) return cache;
const products = await Product.findAll();
await setCachedData('all-products', products, 86400); // 24 hours

Good approach:

// Cache with granular keys and appropriate TTL
const cacheKey = `products:page:${page}:filter:${filter}`;
const cache = await getCachedData(cacheKey);
if (cache) return cache;

const products = await Product.findAll({ where: filter, limit: 20, offset: page * 20 });
await setCachedData(cacheKey, products, 300); // 5 minutes

// Invalidate on product updates
await invalidateCachePattern('products:*');

Example 3: Event Loop Blocking (Node.js)

Bad approach:

app.get('/api/report', (req, res) => {
  const data = fs.readFileSync('/large-file.csv', 'utf8'); // blocks event loop
  const parsed = JSON.parse(hugeJsonString); // blocks event loop for large payloads
  const result = expensiveComputation(parsed); // CPU-bound, blocks all concurrent requests
  res.json(result);
});

Good approach:

import { Worker } from 'worker_threads';

app.get('/api/report', async (req, res) => {
  const stream = fs.createReadStream('/large-file.csv', 'utf8');
  const parsed = await parseJsonStream(stream); // streaming parse
  // Offload CPU-intensive work to worker thread
  const result = await runInWorker('./compute-worker.js', parsed);
  res.json(result);
});

Example 4: Unoptimized Asset Loading

Bad approach:

<!-- Loading full-size images for all screen sizes -->
<img src="/images/hero-4k.jpg" alt="Hero image">

Good approach:

<!-- Responsive images with lazy loading and modern formats -->
<picture>
  <source
    type="image/avif"
    srcset="/images/hero-mobile.avif 640w, /images/hero-desktop.avif 1920w"
    sizes="100vw"
  >
  <source
    type="image/webp"
    srcset="/images/hero-mobile.webp 640w, /images/hero-desktop.webp 1920w"
    sizes="100vw"
  >
  <img
    src="/images/hero-desktop.jpg"
    srcset="/images/hero-mobile.jpg 640w, /images/hero-desktop.jpg 1920w"
    sizes="100vw"
    alt="Hero image"
    loading="lazy"
    decoding="async"
  >
</picture>

Best Practices

  1. Measure Before and After: Never optimize without establishing baseline metrics. Use profiling tools to identify actual bottlenecks, then validate improvements with measurements.

  2. Optimize the Critical Path: Focus on the most-used features and flows first. A 50% improvement on a feature used by 80% of users has more impact than a 90% improvement on a rarely-used feature.

  3. Consider Total Cost: Evaluate optimizations holistically - faster code that uses 10x more memory or is 5x harder to maintain may not be a good trade-off.

  4. Use Appropriate Tools: Leverage browser dev tools, database query analyzers, profilers, and APM tools to identify bottlenecks scientifically rather than guessing.

  5. Implement Progressive Enhancement: Optimize for the common case while gracefully handling edge cases. Don't sacrifice reliability for speed.

  6. Monitor in Production: Performance in development often differs from production. Implement real user monitoring (RUM) to track actual user experience.

  7. Set Performance Budgets: Establish and enforce performance budgets for page weight, load time, and critical metrics. Prevent performance regression through automated checks.

  8. Document Trade-offs: When implementing complex optimizations, document the reasoning, expected benefits, and any maintenance considerations for future developers.

Quality Assurance Checklist

Before recommending any optimization, verify:

  • Have baseline metrics been established?
  • Does the optimization address a real bottleneck, not premature optimization?
  • Will the solution work under production load conditions?
  • Have potential bugs or edge cases been considered?
  • Is the impact on code readability and maintainability acceptable?
  • Can the improvement be validated through testing?
  • Are monitoring metrics defined to track ongoing effectiveness?
  • Is there a rollback plan if the optimization causes regressions?
  • Has the optimization been considered under realistic data volumes (not just dev datasets)?
  • Are error/exception paths handled correctly in the optimized code?

Common Performance Anti-Patterns

Proactively identify these common issues:

Database Anti-Patterns

  • N+1 queries (missing eager loading or batched queries)
  • Missing indexes on filtered/joined columns
  • Using SELECT * instead of specific columns
  • Fetching all records without pagination
  • Executing queries in loops
  • Leaked connections from missing disposal in error paths

Frontend Anti-Patterns

  • Loading all JavaScript upfront (no code splitting)
  • Large, unoptimized images (wrong format, no responsive sizes)
  • Synchronous, render-blocking scripts
  • Layout shifts from unsized images/embeds (poor CLS)
  • Excessive re-renders (React: missing memoization; Vue: unnecessary reactive dependencies; Angular: default change detection on large component trees)
  • Memory leaks from uncleared intervals/listeners/subscriptions
  • Over-hydration in SSR apps (shipping unnecessary JS to the client)
  • No bundle analysis (hidden bloat from transitive dependencies)

Caching Anti-Patterns

  • Caching without invalidation strategy
  • Cache keys too granular (low hit rate)
  • Cache keys too broad (stale data)
  • No cache monitoring
  • Caching entire large datasets

API Anti-Patterns

  • No rate limiting
  • Returning excessive data (no field filtering)
  • Missing pagination
  • Synchronous processing of long-running operations
  • No response compression
  • GraphQL: no query depth/cost limiting, missing DataLoader for batching

Concurrency Anti-Patterns

  • Shared mutable state without synchronization
  • Lock ordering violations leading to deadlocks
  • Connection pool exhaustion from leaked connections
  • Event loop blocking with synchronous I/O or CPU-bound work (Node.js)
  • Unbounded concurrent requests to downstream services (missing circuit breakers)

Performance Testing Strategies

To validate performance improvements:

  1. Load Testing: Simulate concurrent users to identify breaking points
  2. Profiling: Use CPU and memory profilers to identify hotspots
  3. Benchmarking: Create reproducible performance tests for critical paths
  4. Real User Monitoring: Track actual user experience in production
  5. Synthetic Monitoring: Automated performance tests from various locations
  6. Bundle Analysis: Regularly audit JavaScript bundle size and composition

Context-Aware Analysis

When project instruction files such as CLAUDE.md, AGENTS.md or Cursor rules provide project-specific context, incorporate:

  • Technology Stack: Identify framework-specific optimization opportunities
  • Usage Patterns: Optimize for actual traffic patterns and user behavior
  • Infrastructure: Consider deployment architecture and resource constraints
  • Performance Requirements: Align optimizations with business SLAs and budgets

Communication Guidelines

When reporting performance findings:

  • Lead with measured impact (seconds, requests, bytes)
  • Provide concrete code examples showing before/after
  • Explain the "why" behind optimizations, not just the "what"
  • Set realistic expectations for performance improvements
  • Acknowledge when existing code is already well-optimized
  • Recommend incremental improvements over risky rewrites

Remember: The goal is to make applications measurably faster while maintaining code quality and reliability. Combine deep technical knowledge with practical engineering judgment to deliver optimizations that matter.

Readme

AI-Performance plugin

Audits a codebase, or one directory, for performance bottlenecks and saves a timestamped report with an impact score for each finding. /performance-audit does the code audit. /performance-ci measures where your GitHub Actions time goes and says which line to change to cut it. Both run in Claude Code, Codex and Cursor.

Limits

/performance-audit reads code. It doesn't run your app, so it can't measure execution time or Core Web Vitals in a browser. Pair it with profiling and load tests. Improvement figures in the report are estimates.

/performance-ci measures GitHub Actions only, through the GitHub CLI (gh). For another CI system, it offers a review of the config with no measured times. Its savings are estimates built from the measured times, and they show how each one was worked out. A change shows its effect only after the new workflow has run on GitHub.

Available skills

/performance-audit

Audits the whole repository by default. To limit the audit to one part of the code, pass a directory path relative to the repository root, for example /performance-audit src/api. The report still goes to docs/performance/ at the repository root. Other text after the command is ignored.

The audit asks no questions while it runs, so you can use it for unattended or scheduled reviews.

/performance-ci

Measures the last 150 completed GitHub Actions runs of the repository in the working directory. It splits every job's time into three parts: waiting for a machine, setup (checkout, installs, cache restore) and the job's own work. Then it lists the slowest jobs and runs nine checks. Each fix comes with the file and line to change and the seconds it saves. Changes that cost money or run fewer tests go in a separate list for you to decide. Nothing changes until you pick the fixes.

ArgumentSetsDefault
runs=NHow many completed runs to measure, up to 1000150
workflow=NAMEOnly one workflow, by its name, file name or IDEvery workflow
branch=NAMEOnly runs on one branchEvery branch
events=allCount every trigger, including schedules and manual runsPull requests, pushes and the merge queue
repo=OWNER/NAMEMeasure another repository you can read, without a checkoutThe repository in the working directory
save=yes or save=noSave the report under docs/performance/yes when a CI report is already saved there

It needs the GitHub CLI, logged in with read access to the repository's Actions (gh auth login), and Python 3. To measure a fix, run it again after the changed workflow has run about ten times.

Installation

Claude Code:

/plugin marketplace add charlesjones-dev/ai-agent-plugins
/plugin install ai-performance@ai-agent-plugins

Codex:

codex plugin marketplace add charlesjones-dev/ai-agent-plugins
codex plugin add ai-performance@ai-agent-plugins

Cursor: add this repository as a team marketplace, or copy this folder to ~/.cursor/plugins/local/ai-performance. See the Cursor install steps.

Install the plugin at user scope to use its commands in every repository.

Usage

# Audit the whole repository
/performance-audit

# Audit one directory
/performance-audit src/api

# Measure the CI time of the repository you're in
/performance-ci

# Measure one workflow over more runs, and save the report
/performance-ci workflow=ci.yml runs=300 save=yes

# Review the generated reports in docs/performance/

Features

/performance-audit

What it looks for
  • N+1 queries: related entities loaded in loops
  • Blocking work: blocking database calls and I/O, and a blocked event loop in Node.js
  • Memory: leaks from closures, listeners that are never removed, large allocations, and resources that are never disposed of
  • Concurrency: race conditions, deadlocks, an exhausted connection pool, and saturated threads or workers
  • Queries: ORM calls that load more than they need, and missing projections
  • Caching: work computed again and again with no cache
  • Databases: missing indexes and expensive queries
  • Frontend: the effect on Core Web Vitals (LCP, INP, CLS), bundle size and rendering
  • GraphQL: no query depth limit, places for a DataLoader, and over-fetching
What each finding includes
  • The file path and line number
  • An impact score from 1.0 to 10.0, with defined severity thresholds
  • The pattern it found
  • The code snippet
  • The cost to performance and scaling
  • How to fix it
  • When to fix it

Reports include 2-4 before/after examples built from code in the findings, each with an estimated improvement.

How it works

The audit scans source files for these patterns, only under the given directory if you pass one, and tailors findings to the detected stack. It groups findings as Critical, High, Medium or Low, and the report ends with a phased optimization roadmap.

/performance-ci

Measurement

A bundled Python script (scripts/ci_timings.py, standard library only) pulls the runs, their jobs and steps, and a sample of logs through gh, with GET requests only. It reports:

  • Time to a CI result per commit, for pull requests, pushes and the merge queue, and the job that most often finishes last
  • Queue, setup and work for every job, as medians and 90th percentiles, with a step-by-step table for the five slowest jobs
  • Machine wait by runner label, the delay before a run's first job, and commits that ran a workflow for both the push and the pull request
  • Runner minutes, rounded up per job the way GitHub bills hosted runners
  • Matrix jobs, such as test shards, and how uneven they are
  • Cache hit and miss lines and test-runner timings from the logs of the slowest jobs
The nine checks
  1. Queueing on the default runners
  2. Slow lint
  3. Slow typechecking
  4. Tests that aren't sharded, or machines that are too small
  5. Every test file reloads the whole app
  6. Slow setup: cache misses, full clones, more parallel tasks than cores
  7. Jobs that don't run in parallel
  8. Every PR runs the full test suite
  9. No local checks before push
The report
  • Findings: free fixes, each with the seconds it costs now, the file and line, the change, the seconds it saves and how that was worked out. Each saving says whether it shortens the wait for a CI result or only saves runner minutes.
  • For You to Decide: changes that cost money (bigger or paid runners, more shards on a private repository), and changes that run fewer or different checks (path filters, affected-only tests, a different linter).
  • Expected Result: the time to a CI result now, after the free fixes, and after every decided item.
  • Changes Since the Last Run: before and after times, when an earlier report is saved.

After the report, it asks which fixes to apply. It applies the free fixes one at a time, biggest first, so each one can be measured. It doesn't commit or push unless you ask.

How it works

The skill reads the project's docs and workflow files, measures the runs with its script, ties each slow step to the file and line that defines it, and runs the nine checks. Logs stay in a temporary folder outside the repository.

Report files

/performance-audit saves its reports to docs/performance/ at the repository root as YYYY-MM-DD-HHMMSS-performance-audit.md (e.g., 2025-10-17-143022-performance-audit.md). The timestamp keeps two audits from the same day apart.

/performance-ci saves its report there as YYYY-MM-DD-HHMMSS-ci-audit.md when you pass save=yes, or when an earlier CI report is already there.

Plugin details

  • Name: AI-Performance
  • Version: 2.1.1
  • License: MIT
  • Author: Charles Jones

Credits

/performance-ci is inspired by a post by Vox (Voxyz_ai on X) with a prompt for a CI audit. It follows the post's approach: split each job's time into queue, setup and work, check nine causes, and report before changing anything. Its text and measurement script are original.

Contributing

Bug reports and fixes are welcome. See CONTRIBUTING.md.

License

MIT License. See LICENSE.

Details

Marketplace
charlesjones-dev/claude-code-plugins-dev
Source
plugins/ai-performance
Author
Charles Jones
Category
Community
Keywords
ai, performance, optimization, analysis, bottleneck, scalability, ci, github-actions, skills
Listed since
Apr 7, 2026

More from charlesjones-dev/claude-code-plugins-dev

All 17

Similar to ai-performance

More Code Review & Quality