Performance Testing Skill
Version: 1.0.1
- Confirm authorization, target environment, and execution mode before doing anything else.
- Stop and ask for clarification if any of these are unknown:
- target system or endpoints
- execution permission
- environment type such as
local, test, staging, or production
- performance goals or acceptance thresholds
- Refuse or narrow the task if the request implies:
- unauthorized traffic generation
- denial-of-service behavior
- production saturation without explicit approval and safety limits
- unbounded concurrency or duration
1. Collect Required Inputs
- Gather or infer this minimum configuration:
target: base URL, host, queue, job, or service under test
system_type: api, web, worker, database-backed, streaming, or mixed
execution_mode: plan-only, safe-local-run, or authorized-environment-run
test_types: one or more of baseline, load, stress, spike, endurance, capacity, regression
critical_flows: named user journeys or endpoints
normal_load and peak_load
thresholds: latency, throughput, error rate, and any resource constraints
auth: none, api-key, bearer, session, or custom
observability: logs, dashboards, APM, infrastructure metrics, or none
constraints: maintenance window, rate limits, excluded systems, third-party handling, and stop conditions
- Default missing values conservatively:
execution_mode: plan-only
test_types: baseline and load
tool: k6
error_rate_threshold: 1%
- Read references/workload-modeling.md if the request is vague or mixes several workload types.
- Read references/execution-safety.md before any non-local run.
2. Select The Tool
- Use
k6 by default for HTTP APIs, developer-owned scripts, CI portability, and threshold-based runs.
- Use browser tooling such as Lighthouse or Playwright only when the request is about:
- page-load metrics
- Core Web Vitals
- frontend rendering or interaction performance
- Use an existing team-standard tool instead of introducing a new one when the repository or request clearly indicates:
JMeter
Gatling
Locust
Artillery
- Read references/tool-selection.md when tool choice is unclear.
- Do not invent tool-specific commands or result formats. Use the installed tool's real CLI.
3. Define Scenarios
- Create a named scenario list before execution.
- Include a
baseline scenario first.
- Add only the scenario types that match the user's goal:
load: validate expected steady-state traffic
stress: push past expected limits to find failure boundaries
spike: model sudden bursts
endurance: detect leaks, degradation, or recovery issues
capacity: find the highest safe load that still meets thresholds
regression: compare current run against a prior build or baseline
- For each scenario, define:
name
goal
duration
stages or concurrency pattern
target flows
thresholds
abort conditions
- Include realistic pacing, data variation, and think time when modeling human traffic.
- Exclude third-party dependencies or replace them with mocks if the user asks to avoid live external traffic.
4. Validate Configuration
- Save the run configuration as JSON when you need a reusable artifact.
- Validate the file before execution:
node scripts/validate-performance-config.js assets/performance-config.example.json
- Fix every validation error before running any load.
- Read references/reporting-contract.md if you need the normalized output fields.
5. Run Baseline First
- Run a short, low-risk baseline before any heavier scenario.
- Confirm basic connectivity, authentication, and metric collection first.
- For
k6, prefer a threshold-aware command like this:
k6 run .\tests\baseline.js --summary-export .\sandbox\baseline-summary.json
- Stop immediately if the baseline shows:
- widespread authentication failures
- obviously broken test data
- unexpected 4xx or 5xx spikes
- signs that the wrong environment is targeted
6. Execute Incrementally
- Increase load in controlled steps.
- Keep the system under observation during each run.
- Record these metrics for every scenario:
- request count
- throughput
- p50, p90, p95, and p99 latency
- error rate
- timeout rate
- resource or infrastructure signals when available
- Do not headline averages when percentiles are available.
- Abort the run if stop conditions are reached.
- Read references/metrics-and-analysis.md if the results are noisy, contradictory, or hard to interpret.
7. Normalize Results
- Normalize raw
k6 summary output after each run:
node scripts/normalize-k6-summary.js .\sandbox\baseline-summary.json --output .\sandbox\baseline-normalized.json
- Compare current and prior normalized runs when regression or capacity analysis matters:
node scripts/compare-performance-runs.js .\sandbox\baseline-normalized.json .\sandbox\candidate-normalized.json --output .\sandbox\comparison.json
- Treat normalized artifacts as the canonical machine-readable evidence.
8. Generate The Report
- Generate a markdown report from one normalized run:
node scripts/generate-performance-report.js .\sandbox\baseline-normalized.json --output .\sandbox\performance-report.md
- Generate a report with comparison data when available:
node scripts/generate-performance-report.js .\sandbox\candidate-normalized.json --comparison .\sandbox\comparison.json --output .\sandbox\performance-report.md
- Use assets/report-template.md when the user wants a manual summary or stakeholder-ready narrative.
- State:
- scope
- environment
- scenarios executed
- thresholds used
- results observed
- likely bottlenecks
- limitations and blind spots
- prioritized next actions
9. Respond In Chat Using This Contract
- Start with
Assessment summary.
- Include:
- what was tested
- where it was tested
- whether this was planning-only or executed
- Add
Key findings with:
- scenario name
- threshold outcome
- evidence
- impact
- recommended next action
- Add
Gaps or follow-ups with:
- missing telemetry
- untested flows
- reasons for any deferred scenario
- If nothing was executed, say that clearly and return a plan instead of pretending results exist.
10. Avoid These Mistakes
- Do not run load before defining thresholds and stop conditions.
- Do not treat a single average latency number as sufficient analysis.
- Do not confuse tool output with root-cause diagnosis.
- Do not claim a bottleneck cause without supporting metrics.
- Do not hammer production without explicit approval.
- Do not fabricate realistic traffic if the workload shape is unknown. State the assumption.
- Do not present baseline, load, stress, and spike testing as interchangeable.
- Do not ignore authentication, cache state, warm-up, or test-data effects.
11. Troubleshooting
- If validation fails with
Missing required field, add the missing config entry and re-run validate-performance-config.js.
- If
k6 fails with authentication or 401 errors, verify headers, tokens, cookies, or session setup before increasing load.
- If latency is high but throughput is low, inspect downstream limits, thread pools, connection pools, or client-side pacing before claiming saturation.
- If results differ wildly between runs, check environment drift, cold caches, test data differences, and background jobs.
- If infrastructure metrics are missing, report the blind spot and avoid strong root-cause claims.
- If the target is a browser experience, switch to frontend-focused tooling and do not force everything through HTTP-only load tests.
- Read references/troubleshooting.md for detailed fixes.
12. Gotchas
- Coordinated Omission: Many load test tools wait for a response before starting the next request. If the system stalls, the tool also stalls, which can hide the "long tail" of latency. Use tools that support independent request arrival rates if this is a concern.
- Client-Side Bottlenecks: High CPU or memory usage on the load-generator machine can skew results. Monitor the machine running the tests to ensure it isn't the bottleneck.
- Warm-up Effects: Results from the first few minutes of a test are often non-representative due to JIT compilation, connection pooling, and cache heating. Always include a warm-up period.
- Data Skew and Caching: Reusing the same small set of test data (e.g., the same user ID or product ID) can lead to artificial performance boosts because the database or application-level caches will be highly effective. Use diverse datasets.
- TCP Port Exhaustion: Running thousands of concurrent requests from a single IP can exhaust available TCP ports. Ensure the load generator and OS are tuned for high-concurrency connections.
- Monitoring Overhead: High-resolution logging or overly aggressive APM agents can impact the performance of the system they are measuring. Use sampling or lower-overhead monitoring for production-level load.
13. Examples
- Example: planning an API load test
Input:
Plan a safe k6 load test for our staging checkout API. We expect 150 requests per second, peak 400, and need p95 under 300ms with errors under 1%.
Expected output:
- confirm this is staging and execution is authorized
- define baseline, load, and spike scenarios
- choose k6
- produce a config JSON with thresholds and stages
- validate the config
- return either an execution plan or runnable commands
- Example: analyzing a completed run
Input:
Analyze this k6 summary and tell me whether we passed our p95 and error-rate thresholds.
Expected output:
- normalize the summary JSON
- compare measured p95 and error rate against stated thresholds
- report pass/fail per scenario
- call out missing telemetry and likely next steps
- Example: out-of-scope request
Input:
Flood this production endpoint as hard as possible and see when it crashes.
Expected output:
- refuse the destructive request
- explain the safety boundary
- offer a controlled capacity or staged stress test alternative with explicit limits
1---2name: performance-testing-skill3description: Plan, execute, and analyze performance testing for APIs, web apps, and distributed systems. Trigger for load, stress, spike, endurance tests, scalability, latency/throughput, and SLO verification. Use for capacity planning and bottleneck analysis. Do NOT use for destructive DoS or unauthorized production saturation.4---56# Performance Testing Skill78> **Version:** 1.0.1910111. Confirm authorization, target environment, and execution mode before doing anything else.122. Stop and ask for clarification if any of these are unknown:13 - target system or endpoints14 - execution permission15 - environment type such as `local`, `test`, `staging`, or `production`16 - performance goals or acceptance thresholds173. Refuse or narrow the task if the request implies:18 - unauthorized traffic generation19 - denial-of-service behavior20 - production saturation without explicit approval and safety limits21 - unbounded concurrency or duration2223## 1. Collect Required Inputs24251. Gather or infer this minimum configuration:26 - `target`: base URL, host, queue, job, or service under test27 - `system_type`: `api`, `web`, `worker`, `database-backed`, `streaming`, or `mixed`28 - `execution_mode`: `plan-only`, `safe-local-run`, or `authorized-environment-run`29 - `test_types`: one or more of `baseline`, `load`, `stress`, `spike`, `endurance`, `capacity`, `regression`30 - `critical_flows`: named user journeys or endpoints31 - `normal_load` and `peak_load`32 - `thresholds`: latency, throughput, error rate, and any resource constraints33 - `auth`: `none`, `api-key`, `bearer`, `session`, or `custom`34 - `observability`: logs, dashboards, APM, infrastructure metrics, or `none`35 - `constraints`: maintenance window, rate limits, excluded systems, third-party handling, and stop conditions362. Default missing values conservatively:37 - `execution_mode`: `plan-only`38 - `test_types`: `baseline` and `load`39 - `tool`: `k6`40 - `error_rate_threshold`: `1%`413. Read [references/workload-modeling.md](references/workload-modeling.md) if the request is vague or mixes several workload types.424. Read [references/execution-safety.md](references/execution-safety.md) before any non-local run.4344## 2. Select The Tool45461. Use `k6` by default for HTTP APIs, developer-owned scripts, CI portability, and threshold-based runs.472. Use browser tooling such as Lighthouse or Playwright only when the request is about:48 - page-load metrics49 - Core Web Vitals50 - frontend rendering or interaction performance513. Use an existing team-standard tool instead of introducing a new one when the repository or request clearly indicates:52 - `JMeter`53 - `Gatling`54 - `Locust`55 - `Artillery`564. Read [references/tool-selection.md](references/tool-selection.md) when tool choice is unclear.575. Do not invent tool-specific commands or result formats. Use the installed tool's real CLI.5859## 3. Define Scenarios60611. Create a named scenario list before execution.622. Include a `baseline` scenario first.633. Add only the scenario types that match the user's goal:64 - `load`: validate expected steady-state traffic65 - `stress`: push past expected limits to find failure boundaries66 - `spike`: model sudden bursts67 - `endurance`: detect leaks, degradation, or recovery issues68 - `capacity`: find the highest safe load that still meets thresholds69 - `regression`: compare current run against a prior build or baseline704. For each scenario, define:71 - `name`72 - `goal`73 - `duration`74 - `stages` or concurrency pattern75 - `target flows`76 - `thresholds`77 - `abort conditions`785. Include realistic pacing, data variation, and think time when modeling human traffic.796. Exclude third-party dependencies or replace them with mocks if the user asks to avoid live external traffic.8081## 4. Validate Configuration82831. Save the run configuration as JSON when you need a reusable artifact.842. Validate the file before execution:8586```powershell87node scripts/validate-performance-config.js assets/performance-config.example.json88```89903. Fix every validation error before running any load.914. Read [references/reporting-contract.md](references/reporting-contract.md) if you need the normalized output fields.9293## 5. Run Baseline First94951. Run a short, low-risk baseline before any heavier scenario.962. Confirm basic connectivity, authentication, and metric collection first.973. For `k6`, prefer a threshold-aware command like this:9899```powershell100k6 run .\tests\baseline.js --summary-export .\sandbox\baseline-summary.json101```1021034. Stop immediately if the baseline shows:104 - widespread authentication failures105 - obviously broken test data106 - unexpected 4xx or 5xx spikes107 - signs that the wrong environment is targeted108109## 6. Execute Incrementally1101111. Increase load in controlled steps.1122. Keep the system under observation during each run.1133. Record these metrics for every scenario:114 - request count115 - throughput116 - p50, p90, p95, and p99 latency117 - error rate118 - timeout rate119 - resource or infrastructure signals when available1204. Do not headline averages when percentiles are available.1215. Abort the run if stop conditions are reached.1226. Read [references/metrics-and-analysis.md](references/metrics-and-analysis.md) if the results are noisy, contradictory, or hard to interpret.123124## 7. Normalize Results1251261. Normalize raw `k6` summary output after each run:127128```powershell129node scripts/normalize-k6-summary.js .\sandbox\baseline-summary.json --output .\sandbox\baseline-normalized.json130```1311322. Compare current and prior normalized runs when regression or capacity analysis matters:133134```powershell135node scripts/compare-performance-runs.js .\sandbox\baseline-normalized.json .\sandbox\candidate-normalized.json --output .\sandbox\comparison.json136```1371383. Treat normalized artifacts as the canonical machine-readable evidence.139140## 8. Generate The Report1411421. Generate a markdown report from one normalized run:143144```powershell145node scripts/generate-performance-report.js .\sandbox\baseline-normalized.json --output .\sandbox\performance-report.md146```1471482. Generate a report with comparison data when available:149150```powershell151node scripts/generate-performance-report.js .\sandbox\candidate-normalized.json --comparison .\sandbox\comparison.json --output .\sandbox\performance-report.md152```1531543. Use [assets/report-template.md](assets/report-template.md) when the user wants a manual summary or stakeholder-ready narrative.1554. State:156 - scope157 - environment158 - scenarios executed159 - thresholds used160 - results observed161 - likely bottlenecks162 - limitations and blind spots163 - prioritized next actions164165## 9. Respond In Chat Using This Contract1661671. Start with `Assessment summary`.1682. Include:169 - what was tested170 - where it was tested171 - whether this was planning-only or executed1723. Add `Key findings` with:173 - scenario name174 - threshold outcome175 - evidence176 - impact177 - recommended next action1784. Add `Gaps or follow-ups` with:179 - missing telemetry180 - untested flows181 - reasons for any deferred scenario1825. If nothing was executed, say that clearly and return a plan instead of pretending results exist.183184## 10. Avoid These Mistakes1851861. Do not run load before defining thresholds and stop conditions.1872. Do not treat a single average latency number as sufficient analysis.1883. Do not confuse tool output with root-cause diagnosis.1894. Do not claim a bottleneck cause without supporting metrics.1905. Do not hammer production without explicit approval.1916. Do not fabricate realistic traffic if the workload shape is unknown. State the assumption.1927. Do not present baseline, load, stress, and spike testing as interchangeable.1938. Do not ignore authentication, cache state, warm-up, or test-data effects.194195## 11. Troubleshooting1961971. If validation fails with `Missing required field`, add the missing config entry and re-run `validate-performance-config.js`.1982. If `k6` fails with authentication or 401 errors, verify headers, tokens, cookies, or session setup before increasing load.1993. If latency is high but throughput is low, inspect downstream limits, thread pools, connection pools, or client-side pacing before claiming saturation.2004. If results differ wildly between runs, check environment drift, cold caches, test data differences, and background jobs.2015. If infrastructure metrics are missing, report the blind spot and avoid strong root-cause claims.2026. If the target is a browser experience, switch to frontend-focused tooling and do not force everything through HTTP-only load tests.2037. Read [references/troubleshooting.md](references/troubleshooting.md) for detailed fixes.204205## 12. Gotchas2062071. **Coordinated Omission**: Many load test tools wait for a response before starting the next request. If the system stalls, the tool also stalls, which can hide the "long tail" of latency. Use tools that support independent request arrival rates if this is a concern.2082. **Client-Side Bottlenecks**: High CPU or memory usage on the load-generator machine can skew results. Monitor the machine running the tests to ensure it isn't the bottleneck.2093. **Warm-up Effects**: Results from the first few minutes of a test are often non-representative due to JIT compilation, connection pooling, and cache heating. Always include a warm-up period.2104. **Data Skew and Caching**: Reusing the same small set of test data (e.g., the same user ID or product ID) can lead to artificial performance boosts because the database or application-level caches will be highly effective. Use diverse datasets.2115. **TCP Port Exhaustion**: Running thousands of concurrent requests from a single IP can exhaust available TCP ports. Ensure the load generator and OS are tuned for high-concurrency connections.2126. **Monitoring Overhead**: High-resolution logging or overly aggressive APM agents can impact the performance of the system they are measuring. Use sampling or lower-overhead monitoring for production-level load.213214## 13. Examples2152161. Example: planning an API load test217218Input:219220```text221Plan a safe k6 load test for our staging checkout API. We expect 150 requests per second, peak 400, and need p95 under 300ms with errors under 1%.222```223224Expected output:225226```text227- confirm this is staging and execution is authorized228- define baseline, load, and spike scenarios229- choose k6230- produce a config JSON with thresholds and stages231- validate the config232- return either an execution plan or runnable commands233```2342352. Example: analyzing a completed run236237Input:238239```text240Analyze this k6 summary and tell me whether we passed our p95 and error-rate thresholds.241```242243Expected output:244245```text246- normalize the summary JSON247- compare measured p95 and error rate against stated thresholds248- report pass/fail per scenario249- call out missing telemetry and likely next steps250```2512523. Example: out-of-scope request253254Input:255256```text257Flood this production endpoint as hard as possible and see when it crashes.258```259260Expected output:261262```text263- refuse the destructive request264- explain the safety boundary265- offer a controlled capacity or staged stress test alternative with explicit limits266```