/major:app-performancefrom major
Measures and fixes slow apps by analyzing resource-call timings, CPU/memory usage, chatty queries, and cache strategy. Activates on performance complaints like lag, timeouts, or scaling needs.
Ships in major. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Measure, fix the largest cost, measure again. Never tune from a reading of the code alone: in production the time is almost always in a few resource calls, and the numbers say which.
Work in the app's mounted sandbox (load app-builder to mount it). Below, sandbox_* means mcp__plugin_major_major__sandbox_*, and major commands run through sandbox_bash in /workspace/app.
These facts decide which fixes work:
/api; the whole app in an older Next.js app) as one Node process. A new app gets 0.1 CPU and 128 MiB of memory. Autoscaling doubles a limit after CPU stays above 85% of it for five minutes, or after an out-of-memory kill, so short bursts never trigger it.Ask which page or action is slow if the user has not said. Then collect all three:
Resource operations. major resource invocations --days 7 returns every operation the deployed app ran, sorted by total time: operationKey, calls, p50Ms, p95Ms, totalMs, errorRate, resourceSubtype, and callSite (filePath, line, sourceText). Add --slow to keep only operations over 500 ms p95, and --environment coding-session for preview traffic. p50Ms and p95Ms cover the data source only, not the round trip around it.
Compute. mcp__plugin_major_major__get_app_scaling with the applicationId returns the current CPU and memory limits, whether autoscaling and scale-to-zero are on, recent scaling events (cpu_high, oom), and usage against the limits.
The slow route itself. Time the backend route the slow screen calls in the preview: curl -s -o /dev/null -w '%{time_total}\n' http://localhost:3002/api/<path> (the dev backend listens on 3002; in an older Next.js app, http://localhost:3000/<path>). Run it three times and ignore the first, which can be cold. The preview runs in development mode on a much larger machine, so compare runs with each other, never with production. To see where a route spends its time, wrap its steps in console.time / console.timeEnd, read them with major app logs --preview, and remove them before committing.
Match what you measured to one of these. Rank by totalMs: an operation the user never complained about can still be what saturates the app.
| What you see | Cause | Fix |
|---|---|---|
High calls, low p50Ms, high totalMs | A query inside a loop, or a poll | Batch it; slow or merge the poll |
p95Ms near 10,000 (or another round number) with a non-zero errorRate | The query hits its timeout | Fix the query; do not just raise timeoutMs |
SQL operation with high p50Ms | Missing index, or too many rows read | EXPLAIN, then index or narrow |
Several operations with the same calls, each slow | One page running a group of queries | Run them in parallel, then cache |
Warehouse (Snowflake, BigQuery) or third-party API with high p50Ms | The source is slow by nature | Cache or snapshot; nothing in the query will fix it |
p95Ms many times p50Ms | Depends on the parameters, or a cold source | Find the slow parameter values in major app logs |
| Route is slow but its operations are fast | Calls awaited one after another, CPU-heavy work, or a huge payload | Parallelize, move work into SQL, send less |
CPU at its limit, or cpu_high / oom events | The pod is too small | Resize (step 5) |
| First request after a quiet period is slow, later ones fast | Scale-to-zero is on and the app was asleep | Turn it off (step 5) |
SQL. Run the statement from callSite.sourceText through mcp__resources__postgresql_query with EXPLAIN (ANALYZE, BUFFERS) and realistic parameters. Only do this for a SELECT: EXPLAIN ANALYZE executes the statement. Look for sequential scans on large tables and for row estimates far from the actual counts.
mcp__plugin_major_major__run_migration with CREATE INDEX CONCURRENTLY. On an external database, give the user the statement and let its owner run it; never change an external schema yourself.SELECT *.WHERE id > $1 ORDER BY id LIMIT $2), not OFFSET.Chatty calls. Replace a query per item with one query: WHERE id = ANY($1), or a JOIN. For an API without a batch endpoint, fetch once and index the result by id in memory.
Sequential calls. Start independent calls together with Promise.all. Keep at most 8 in flight to one database.
Polling. A count polled every few seconds by every open tab adds up to tens of thousands of calls a day. Lengthen the interval, stop polling while the tab is hidden, and return everything one screen polls from a single route.
Rendering.
useEffect waits on another. Give each screen one /api route that loads its data in one pass on the backend.React.lazy and a dynamic import(), so they stay out of the first bundle.Long work. Anything that takes more than a few seconds for good reason (exports, syncs, AI calls) should not block a page load. Move it into a workflow (load workflow-builder) and show its status.
Cache when the source is slow by nature or the same result is read far more often than it changes. Fix a bad query first; a cache over a missing index only hides it until the cache expires.
Agree the staleness with the user before writing any cache. Use AskUserQuestion, one question per data set, naming the screen and the data:
Do not pick a lifetime yourself, and do not cache data whose answers you do not have. Data that differs by user must be keyed by that user or left uncached: a shared cache hands one person's rows to the next.
Then choose the cache by lifetime. references/caching.md has the code for each.
| Acceptable staleness | Cache |
|---|---|
| None, but the same call repeats within one request | Load once per request |
| Seconds to an hour | In-process cache with a time limit |
| An hour or more, or the source takes many seconds | Snapshot table refreshed on a schedule |
| The user's own browser, a few seconds to minutes | Cache-Control: private on a GET route |
In an older Next.js app, Next.js's own data caches (unstable_cache, "use cache", a page-level revalidate) do not work around resource calls; see the reference.
Whenever cached data can be more than a minute old, show its age on the screen.
More CPU or memory helps only when the pod itself is the limit. It does nothing for a slow query: that time is spent waiting on the data source.
Resize when get_app_scaling shows CPU regularly near its limit, cpu_high or oom events, or when the work is truly CPU-bound (generating files, parsing big payloads, server-rendering large pages in a Next.js app) and step 3 has already moved what it could into SQL.
mcp__plugin_major_major__set_app_scaling takes the applicationId and any of cpuLimit, memoryLimit, autoscalingEnabled, scaleToZero.
Repeat the measurement that showed the problem. Time the route again in the preview, exercise it a few times, and compare major resource invocations --environment coding-session --days 1 with the earlier numbers. Lint, commit and push as app-builder describes. Production numbers only move after a deploy and some real traffic; say so instead of claiming a result you have not seen.
Report to the user:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub major-technology/cli --plugin major13 skills in this plugin
/agent-builderCreate and configure a Major agent — a versioned two-file bundle (agent.jsonc + prompt.md) edited on a sandbox — what each field means, how to research connectors and applications before writing the prompt, and the edit/validate/save/publish lifecycle./app-builderCreate and edit Major apps — full-stack apps with a Vite + React frontend, a Hono backend under /api, and a live preview — how to create or mount an app sandbox and edit through the workspace tools./debug-issueUse this skill when the user asks to debug, investigate, inspect for bugs, fix an issue, or says the app is broken, failing, wrong, blank, errored, or not working. Also use it when you observe a concrete existing failure yourself, including runtime errors, failed tool/API calls, browser console errors, app errors, app logs, actual visual regressions, failing lint/tests/builds, deployment issues, bad data, auth issues, or flaky behavior. Do not use this skill for forward-looking UX polish requests like "make the UX nicer" or "improve the design" unless the user identifies a specific existing broken behavior or regression to verify./file-builderCreate and edit Major Files — static pages (HTML plus CSS, JS, JSON, images, fonts, markdown) with their data written in, made in minutes with no backend or deploy — and the sandbox-based edit/validate/save/publish lifecycle. Use for anything static the user will read or share with colleagues, such as a report, briefing, explainer, or one-off chart, or to change an existing File. A page that needs fresh data, saves input, or runs compute is an app instead./new-projectUse this skill when the user is building a brand new app for the first time. Guides connector setup, data layer understanding, and initial planning./skill-builderCreate and manage Major agent skills — versioned file bundles (SKILL.md + references + scripts) that an attached agent loads on demand — and the sandbox-based edit/validate/save/publish lifecycle.Other plugins' skills for the same job