perforge
v0.1.1
Published
The full-stack performance skill for AI coding agents — measure, diagnose, fix, and statistically prove every millisecond. Ships its own CLI: scanner, Lighthouse runner, load tester, bundle analyzer, and before/after significance testing.
Maintainers
Readme
⚒ perforge
The full-stack performance skill for AI coding agents. Measure → diagnose → fix → statistically prove every millisecond.
Most performance skills are checklists: the agent reads tips, edits code, and says it's faster. perforge ships the instruments. Your agent takes a baseline, finds the bottleneck, changes one thing, re-measures under identical conditions, and keeps the change only if a Mann–Whitney U test says it actually helped. Every win lands in a PERF_LEDGER.md with the evidence attached.
$ npx perforge compare baseline after-hero-preload # example output
Metric Before After Δ median 95% CI of Δ p Verdict
──────────────── ─────── ─────── ──────────────── ───────────────── ─────── ─────────────────────
LCP 3.41s 2.18s −1.23s (-36.1%) −1.31s … −1.12s 0.0079 improved
LCP · load delay 1.02s 0.04s −980ms (-96.1%) −1.01s … −0.95s 0.0079 improved
CLS 0.002 0.002 ±0.000 (0.0%) ±0.000 … ±0.000 1.0000 no significant change
Perf score 71 89 +18 (+25.4%) +16 … +20 0.0079 improvedInstall
npx perforge install # auto-detects your agents and installs the skill into each
npx perforge install -a all # every supported agent
npx perforge install -g # into your home directory (all projects)Also works with the skills ecosystem and Claude Code plugins:
npx skills add ameenmv/perforge
/plugin marketplace add ameenmv/perforge # inside Claude CodeThen just ask: "make this app faster", "why is /api/orders slow?", "audit our Core Web Vitals", or "review this PR for performance".
| Agent | Skill directory |
|---|---|
| Claude Code | .claude/skills/perforge |
| Codex · Cursor · universal | .agents/skills/perforge |
| GitHub Copilot | .github/skills/perforge |
| Gemini CLI | .gemini/skills/perforge |
| Windsurf | .windsurf/skills/perforge |
| OpenCode | .opencode/skills/perforge |
What makes it different
| | perforge | Typical performance skills |
|---|---|---|
| Ships its own measurement tooling | ✅ Lighthouse runner, HTTP load tester, bundle analyzer | ❌ relies on whatever the agent has, or nothing |
| Repeated runs + significance testing | ✅ Mann–Whitney U (exact for small n), bootstrap CI, noise warnings | ❌ single run, or no measurement |
| LCP broken into sub-parts per run | ✅ TTFB / load delay / load duration / render delay | ❌ |
| Rules that are also a scanner | ✅ 85 rules, 40 auto-detected with file:line, SARIF output | ❌ prose only |
| Full stack | ✅ browser → framework → Node/Python/Go/PHP → SQL/Mongo → cache/CDN | ❌ usually frontend or one framework |
| Frameworks | React/Next, Vue/Nuxt, Svelte/Kit, Angular, Astro, Solid, Qwik | often one |
| Persistent evidence trail | ✅ PERF_LEDGER.md | ❌ |
| Honesty built in | ✅ "no significant change" and "regressed" are first-class verdicts | ❌ |
The loop your agent follows
0 Scope ─ 1 Detect ─ 2 Baseline ─ 3 Diagnose ─ 4 Fix ONE thing ─ 5 Verify ─ 6 Record ─ 7 Report
▲ │
└──────── next change, new baseline ──────┘The doctrine lives in skills/perforge/SKILL.md. Stack-specific playbooks live in references/. The rule library is in rules/.
CLI
Everything the agent uses, you can use too. Every command takes --json.
npx perforge detect # stack fingerprint + which playbooks apply + how to run a prod build
npx perforge scan --min-impact high # static audit (findings = hypotheses until measured)
npx perforge scan --sarif perforge.sarif --fail-on critical # for GitHub code scanning / CI
npx perforge measure web http://localhost:3000 -l baseline # 5 Lighthouse runs, mobile
npx perforge measure web http://localhost:3000 -l baseline-d -p desktop -n 10
npx perforge measure http http://localhost:3000/api/orders -l api -c 20 -d 15s
npx perforge bundle # sizes raw/gzip/brotli, top packages via source maps, duplicates, budgets
npx perforge compare baseline after --markdown # paste-ready PR table
npx perforge compare baseline after --ledger "Preload hero image"
npx perforge rules --stack nuxt # browse the rule libraryRuns are stored as raw samples in .perforge/runs/*.json (self-gitignored). Comparing runs with different conditions (preset, concurrency, tool version) triggers a warning instead of a silent apples-to-oranges result.
Requirements: Node ≥ 20. measure web needs Chrome/Chromium and downloads Lighthouse on first use (or uses your local install; override with --lighthouse or PERFORGE_LIGHTHOUSE).
Scanner scope
By default scan skips code that never ships: tests, specs, fixtures, mocks, stories, seeds, migrations, and generated code. It also honours .gitignore and .perforgeignore. Use --include-tests to scan everything. Add prototypes, design exports, and vendored code to .perforgeignore:
prototype/
design-exports/Scanner suppressions
el.addEventListener('touchmove', handler) // perforge-ignore js-passive-listeners
// perforge-ignore-next-line
const data = readFileSync(configPath)Rule library
85 rules across Core Web Vitals, images, fonts, bundles, runtime JS, CSS, network, caching, React/Next, Vue/Nuxt, Svelte, Angular, Astro, Node, databases, Python, Go and PHP. Each one is a Markdown file with frontmatter (impact, metrics, stacks, optional detector), a fix with before/after code, and how to verify it. A few:
| Rule | Impact |
|---|---|
| img-lcp-not-lazy — never lazy-load the LCP image | CRITICAL |
| img-raster-in-svg — base64 photos hidden inside "SVG" files (27 MB → 300 KB in a real case) | CRITICAL |
| db-n-plus-one — queries in loops, including Promise.all(map(async…)) | CRITICAL |
| js-yield-long-tasks — scheduler.yield() patterns for INP | CRITICAL |
| py-async-blocking — requests/time.sleep inside async def | CRITICAL |
| nuxt-fetch-double — top-level await $fetch runs on server and client | HIGH |
| react-server-components — push "use client" to the leaves | HIGH |
| node-blocking-crypto — bcrypt.compareSync freezing the event loop | HIGH |
Full list: skills/perforge/rules/INDEX.md.
Contributing a rule
- Copy
rules/_template.mdtorules/<category>-<name>.md. - If it's greppable, add a
detectblock, put a positive case intests/fixtures/bad/and make suretests/fixtures/good/stays clean. npm test && npm run build— tests enforce valid regexes, Fix/Verify sections, working cross-references, and that every detector fires.
Safety
- perforge never load-tests anything you didn't point it at. The skill tells agents never to load-test production or third-party hosts without explicit permission.
- Risky changes (index migrations, caches that could serve stale or cross-user data) are proposed to you before they're applied.
License
MIT © Ameen. Grew out of ameenmv/performance, the Frontend Performance Playbook.
