agentleFS
RidhuanDEVRidhuanDEV/claude-skills/shadow-perf/SKILL.md

shadow-perf

Skill1 starsChanged yesterdayMITView on GitHub

Pre-UAT Performance & Load Testing Gate. Use ONLY when entering the Pre-UAT/Staging performance gate or when explicitly asked for k6 load/stress/spike testing or SQL EXPLAIN ANALYZE profiling. Do NOT use automatically during feature coding.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When the Monarch invokes /shadow-perf before UAT:

    line 27
  2. Very specific:

    Run the generator script against the project's openapi.yaml:

    line 30
  3. Very specific:

    Read endpoints (GET) represent ~70–80% of traffic weight and write endpoints (POST/PUT/PATCH) represent ~20–30%.

    line 35
  4. Very specific:

    Use the shadow_db MCP (run_readonly_query) to run EXPLAIN on the top high-traffic queries:

    line 40
  5. Very specific:

    Check for Seq Scan / ALL full-table scans on tables with $> 1,000$ rows, missing composite indexes on (tenant_id, status, created_at), and …

    line 43
  6. Very specific:

    Verify all list endpoints enforce bounded pagination (limit <= 100).

    line 46
  7. Very specific:

    Verify response compression (gzip / brotli / zstd) and static asset Cache-Control headers.

    line 47
  8. Very specific:

    Profile First: Never guess bottlenecks — capture CPU/heap flamegraphs or EXPLAIN (ANALYZE, BUFFERS) before changing code or indexes.

    line 51
  9. Very specific:

    Write a concise report in docs/perf/PRE-UAT-PERFORMANCE-REPORT.md documenting:

    line 53

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “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

Shadow Perf (/shadow-perf) — Pre-UAT Load Testing (k6) & Bottleneck Profiler

[!IMPORTANT] STRICT EXECUTION GATE (PRE-UAT ONLY): Do NOT trigger /shadow-perf automatically while developing/coding features (during mode). Execute /shadow-perf ONLY when:

  1. Feature development is complete and the system enters the Pre-UAT / Staging Readiness Gate, OR
  2. The Monarch explicitly invokes /shadow-perf or asks for load testing / performance profiling.

1. Local Reference & Generator Tools

  • references/K6-OPENAPI-PATTERNS.md — Production k6 load testing patterns (SharedArray, state correlation across endpoints, VU token caching, and SLO pass/fail thresholds).
  • references/SQL-AND-RUNTIME-PROFILING.md — PostgreSQL & MySQL EXPLAIN ANALYZE bottleneck diagnosis, composite index tuning, N+1 detection, and runtime memory/CPU profiling.
  • scripts/openapi_to_k6_scaffold.mjs — Automated CLI generator that reads a project's openapi.yaml / openapi.json (generated by /shadow-api) and creates a complete Pre-UAT k6 test suite (01-smoke.k6.js, 02-load-pre-uat.k6.js, 03-stress-spike.k6.js).

2. Pre-UAT Execution Workflow

When the Monarch invokes /shadow-perf before UAT:

Step 1: Generate Pre-UAT k6 Load Test Suite from openapi.yaml

Run the generator script against the project's openapi.yaml:

node "d:\Ridhuan Ngoding Moment\SKILL\shadow-perf\scripts\openapi_to_k6_scaffold.mjs" --spec openapi.yaml --out tests/perf

Then customize the generated tests/perf/02-load-pre-uat.k6.js so that:

  • Read endpoints (GET) represent ~70–80% of traffic weight and write endpoints (POST/PUT/PATCH) represent ~20–30%.
  • Dynamic resource IDs created in POST steps are correlated into downstream GET/PATCH steps.
  • Realistic test accounts/payloads are loaded via SharedArray so Virtual Users do not all hit a single cached DB row.

Step 2: Database Query Bottleneck Audit (shadow_db MCP)

Use the shadow_db MCP (run_readonly_query) to run EXPLAIN on the top high-traffic queries:

  • PostgreSQL: EXPLAIN (ANALYZE, BUFFERS) SELECT ...
  • MySQL / MariaDB: EXPLAIN FORMAT=JSON SELECT ... Check for Seq Scan / ALL full-table scans on tables with $> 1,000$ rows, missing composite indexes on (tenant_id, status, created_at), and unpaginated queries lacking LIMIT.

Step 3: API & Frontend Payload Audit

  • Verify all list endpoints enforce bounded pagination (limit <= 100).
  • Verify response compression (gzip / brotli / zstd) and static asset Cache-Control headers.
  • For web frontends, verify bundle chunk splitting and Core Web Vitals (LCP < 2.5s, INP < 200ms, CLS < 0.1).

Step 4: Profiling Before Optimization, Variance & Regression Baseline

  • Profile First: Never guess bottlenecks — capture CPU/heap flamegraphs or EXPLAIN (ANALYZE, BUFFERS) before changing code or indexes.
  • Run-to-Run Variance & Longitudinal Baseline: Execute >= 3 warm runs per benchmark, report p50/p95/p99 plus variance/spread across runs, and enforce a strict no-regression comparison against the previous Pre-UAT baseline.
  • Write a concise report in docs/perf/PRE-UAT-PERFORMANCE-REPORT.md documenting:
    • Target VU concurrency & RPS vs measured p50, p95, p99 latency, error rate (%), and run-to-run variance.
    • SQL indexes added or N+1 queries eliminated.
    • Readiness verdict (PASS FOR UAT or TUNING REQUIRED).

3. Execution Approval & Intent Boundary (L3 / L4)

  • Generating k6 scaffolds (--out) or read-only local EXPLAIN is L0/L1, whereas executing k6 load/stress/soak/spike runs is strictly L3: RESOURCE_INTENSIVE (and L4: HIGH_IMPACT on staging/production/unknown environments). NEVER execute load or stress benchmarks without explicit action-specific 7-part Monarch approval (shadow-monarch/scripts/execution_approval_gate.py).

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.