/qa-test-environment:feature-flag-test-harnessfrom qa-test-environment
Builds a test harness that runs the same suite under multiple OpenFeature flag combinations using an in-memory provider, reports results per combination as CI matrix shards.
Ships in qa-test-environment. 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.
A test that hits the production flag service is non-deterministic by definition - the answer depends on whoever toggled the flag last. And a test that asks "did we test the feature with the flag off?" needs both runs side by side.
This skill builds a harness that:
The skill's reference architecture targets OpenFeature because it standardizes the SDK across LaunchDarkly, Flagsmith, ConfigCat, self-hosted, etc. - the harness works identically against any provider (openfeature-overview).
If the team has only one or two flags and a flat "always on for
test" config works, this skill is overkill - set the test
environment's flag values once in setup and stop there.
fail-fast: false on the matrix so every failing
combination surfaces in one run, not just the first.Per feature-toggles, flags fall into four categories with different test needs:
| Category | Lifespan | Dynamism | Test combinations needed |
|---|---|---|---|
| Release toggle | Days - weeks | Static at deploy | OFF (current) and ON (new behavior). 2 runs. |
| Experiment toggle | Days - weeks | Per-request dynamic | One run per variant (A / B / control). |
| Ops toggle | Long-lived | Per-request dynamic | ON (normal) and OFF (degraded / kill). |
| Permissioning toggle | Years | Per-request dynamic | One run per relevant user cohort. |
For experiment and permissioning toggles, the harness simulates each cohort by seeding the EvaluationContext (feature-toggles).
Don't run all 2^N combinations. Author marks the interactions worth testing:
# tests/flag-matrix.yaml
flags:
new_checkout: { kind: release, test: [off, on] }
promo_codes: { kind: release, test: [off, on] }
ranking_experiment: { kind: experiment, variants: [control, treatment_a, treatment_b] }
payment_kill_switch: { kind: ops, test: [on, off] } # off = degraded
interactions:
# The author asserts these flag pairs interact; run their combinations explicitly.
- [new_checkout, promo_codes]
# Ranking experiment doesn't interact with checkout; don't bloat the matrix.
The harness enumerates every flag's variants individually plus the listed interaction tuples, never the full 2^N product. See the Worked example for the run count this schema yields.
Wire the in-memory provider so the suite reads flag values from
FLAGS_JSON instead of the production service (Node shown; Python and
Java variants in the reference):
// tests/harness/flag-harness.ts
import { OpenFeature, InMemoryProvider } from '@openfeature/server-sdk';
export function withFlags(flags: Record<string, unknown>) {
return OpenFeature.setProviderAndWait(new InMemoryProvider(
Object.fromEntries(Object.entries(flags).map(([k, v]) => [k, {
defaultVariant: 'configured', variants: { configured: v }, disabled: false,
}])),
));
}
// beforeAll(() => withFlags(JSON.parse(process.env.FLAGS_JSON || '{}')));
Generate one shard per combination, then feed the JSON to the CI matrix:
python scripts/gen-flag-matrix.py tests/flag-matrix.yaml # -> JSON array of {name, flags}
gen-flag-matrix.py source, CI matrix YAML, result aggregation,
and the PR / nightly cadence split:
references/matrix-and-ci.md.A checkout team ships new_checkout (release) and promo_codes
(release) behind flags, runs a ranking_experiment (control /
treatment_a / treatment_b), and guards payments with a
payment_kill_switch (ops). They author tests/flag-matrix.yaml
exactly as in Step 1 and declare the one interaction that matters:
[new_checkout, promo_codes].
gen-flag-matrix.py enumerates 9 single-flag runs (2 + 2 + 3 + 2)
plus 4 interaction runs (new_checkout × promo_codes) = 13 shards,
not the 24 of the full 2^N product. Each shard boots the suite with
the in-memory provider pinned to that combination via FLAGS_JSON,
so no run touches the production flag service.
CI runs all 13 shards in parallel with fail-fast: false. The
aggregated matrix shows promo_codes=on red at checkout.spec.ts:42
and ranking_experiment=treatment_b red at cart.spec.ts:18, while
the baseline and every other combination pass. The team reads two
flag-specific failures in one glance instead of re-running to find
the second.
The full anti-pattern table (2^N blowup, hitting the prod provider,
asserting flag value instead of behavior, fail-fast: true, missing
baseline row) and the harness's limitations (no targeting rules,
author-declared interactions, per-request dynamism, matrix-size
bound) are in
references/anti-patterns-and-limits.md.
getBooleanValue / getStringValue
/ getNumberValue / getObjectValue signatures + default-value
behavior.testcontainers,
docker-compose-tests - the surrounding stack the harness drives
per combination.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
feature-flags, test-harness, openfeature, ci-matrix, integration-testing
npx claudepluginhub testland/qa --plugin qa-test-environment4 skills in this plugin
/docker-compose-testsUse when tests need the app plus several real services (database, cache, queue) started together. Writes a compose.test.yaml with healthcheck-ordered startup, per-job project names for parallel CI, --wait and --exit-code-from gating, and clean teardown with volumes removed./playwright-fixture-builderUse for any question or task about sharing setup across Playwright tests, including reusing login, copy-pasted beforeEach blocks, and test users that collide between parallel workers. Builds test.extend fixtures with the right test or worker scope, setup and teardown, and per-worker isolation for login, database or feature-flag setup./testcontainersUse when integration tests need a real database, message broker or browser (Postgres, Redis, Kafka, Selenium) in a container, or when containerized tests are flaky: a fixed sleep waiting for a service, a container reported ready before it accepts connections, parallel tests sharing one container's data, or network teardown errors. Starts throwaway containers from inside the test process with Testcontainers (Java, Node.js, Python, Go, .NET, Ruby and more), wiring the container lifecycle, mapped host ports, wait strategies (port, log, HTTP, SQL), networks, Ryuk cleanup and the experimental withReuse for local dev.2 plugins ship this exact skill · first indexed Nov 12, 2026
Other plugins' skills for the same job