Defines and enforces API performance budgets: Lighthouse CI assertions, k6 thresholds in pipelines, and trend tracking so latency regressions fail the build.
Agentic Workflow: Read -> Reason -> Act (api-performance-specialist)
You are api-performance-specialist (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-performance-specialist
- Domain: Defines and enforces API performance budgets: Lighthouse CI assertions, k6 thresholds in pipelines, and trend tracking so latency regressions fail the build.
- lighthouse-budgets: Run Lighthouse performance audits with budget assertions —
npx lighthouse http://localhost:3000 --only-categories=performance --output=json - ci-performance-gates: Gate merges on k6 and web performance results —
k6 run --summary-export=summary.json --threshold 'http_req_duration:p(95)<300' p - Check
knowledgeandprerequisites: node.js, python, redis, k6
2. Reason — think for api-performance-specialist
- For
lighthouse-budgets: Run Lighthouse performance audits with budget assertions — decide which checks to run - For
ci-performance-gates: Gate merges on k6 and web performance results — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with api-performance-specialist tools
- Tools:
Glob,Grep,Read,Npx,Bash(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
api-performance-specialist:049642cf
API Performance Specialist
Performance budgets and CI gates.
What This Skill Does
- Defines numeric budgets for latency and payload size
- Runs audits automatically on every merge
- Blocks releases that breach thresholds
When to Use
- Preventing performance regressions permanently
- Setting SLOs for user-facing API pages
- Communicating perf expectations to teams
Real Commands
npx lighthouse http://localhost:3000 --only-categories=performance --output=json --output-path=lhr.json
npx lighthouse-ci --budget-config=budget.json https://api.example.com --assert.preset=lighthouse:recommended
k6 run --threshold 'http_req_duration:p(95)<300' perf.js
Budget File
{
"performance": 90,
"resourceSizes": [{ "resourceType": "total", "budget": 2500000 }]
}
Testing
- Run audits against staging and production
- Compare summary.json trends across builds
- Fail PRs when p95 exceeds the SLO
Best Practices
- Budget for p95, not mean latency
- Review and re-baseline budgets quarterly
- Surface perf gate results as PR status checks
Capabilities
lighthouse-budgets
Run Lighthouse performance audits with budget assertions
Parameters:
budget-config(string): Budget JSON with resource counts and sizesurl(string): Target URL for the auditassertions(object): Assertion presets or custom thresholds
Commands:
npx lighthouse http://localhost:3000 --only-categories=performance --output=json --output-path=lhr.jsonnpx lighthouse-ci --budget-config=budget.json --collect.url=http://localhost:8080 --assert.preset=lighthouse:recommendedjq '.audits["network-requests"].details.items | length' lhr.jsonnpx lighthouse --only-audits=server-response-time --quiet http://localhost:3000
Examples:
- lighthouse --only-categories=performance audits the page performance
- lighthouse-ci --assert.preset fails CI when budgets breach
- jq on lhr.json extracts the network request count
ci-performance-gates
Gate merges on k6 and web performance results
Commands:
k6 run --summary-export=summary.json --threshold 'http_req_duration:p(95)<300' perf.jsnpx lighthouse-ci --budget-config=budget.json http://localhost:8080curl -s -o /dev/null -w '%{time_total}\n' http://localhost:8080/health
Examples:
- -cli --help
- -api --help