/confit:confit-component-testsfrom confit
Generates ConfIT component test definitions and WireMock interactions from a developer's controller, handlers, and outbound clients. For in-process tests with mocked dependencies.
Ships in confit. 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; scripts run unread.
Written by the developer, from their own code, while the service still runs on their machine or CI. Two inputs: the controller, and the mocks behind it. Nothing else is needed and nothing else should be read.
Setting up the suite itself is a different job — use confit-suite-setup.
bash <this skill>/scripts/reference-path.sh
It prints the ConfIT repository root, <root>. Everything below is relative to it. If it exits
non-zero, stop: the install is broken. Do not write tests from memory — the DSL and matcher set
move between releases.
Then open the target project's suite.config.yaml:
component: → continue here.integration: → wrong skill. Integration suites cannot mock; hand over to
confit-integration-tests.confit-suite-setup first.Note whether component.mock.url is set. Without it no mock server runs, and every outbound call
will hit the real dependency.
Read one or two neighbouring files in TestCase/ before writing anything — match the project's
own file numbering, tag vocabulary and error-body shape. The house style beats any example.
Identify the controller or endpoint under test: named by the developer, or located in the repo.
Read it for the contract — routes, methods, request DTOs, response types, status codes. Expand
route tokens; a class-level [Route("api/[Controller]")] on OrderController means /api/order.
Do not derive scope from git diff by default. The change may already be pushed and the tests
written on a later branch. Use the diff only when the developer says "test what I just changed".
This is the half of the job that no spec could give you. Follow controller → handler → outbound client, and extract for every outbound call: method, path, query params, headers, body.
On the way, note the branch points — the conditions under which the handler throws or returns
an error. They are usually driven by what a dependency returned, which is what makes error
tests writable at all. In ConfIT's own example, CreateUserCommandHandler throws
BadRequestException("Invalid Email.") when any of three dependency checks comes back
isValid: false; the test for that 400 drives it by changing the mock response, not the
request body.
Then confirm the dependency's base-URL config key actually resolves to mock.url in the test
settings. If it does not, every component test silently calls the real service and may pass for
the wrong reason — that is a suite-setup defect, so hand it over.
Full procedure, including what to do when there is no source to read:
references/mock-discovery.md.
For the endpoints on that controller:
4xx the controller itself owns (missing resource, invalid input)5xx or a timeout from a stubbed dependency. This is the matrix
entry that only component tests can have; integration cannot force it.Show the list and get one confirmation before writing files. Do not generate a wall of tests unasked.
Field reference, matcher decision order and an index of which example file demonstrates which
feature: references/writing-tests.md.
Component-specific instincts:
ForCommand/AppLauncher), where the launched process may point at a real,
persistent store.name, email, age; reach for semantic/ignore only for genuinely server-generated
fields such as an id or a timestamp. Fixed literal test data is fine under the same condition —
do not copy that habit into an integration suite, and do not assume it here without checking.
When freshness is not confirmed, use the same run-unique-data approach as integration tests
(confit-integration-tests' references/state-and-data.md).mock: block of the same test. Reuse a repeated response body with a YAML
anchor rather than restating it.python3 <root>/tools/check-testcases.py <path to test project>
Catches what ConfIT would otherwise raise at load time or on first failure: a response with no
expected body, depends: naming an unknown or later test, unresolvable {{variables}}, unknown
or malformed matcher names, unregistered test files.
Then run the suite. Every new test file needs a <None Update> entry with
<CopyToOutputDirectory>Always</CopyToOutputDirectory>, or it will not exist at runtime and the
theory will simply not see it.
When a test fails, work the mock angle first — it is the most common cause in this mode. See
"Diagnosing" in references/writing-tests.md.
An AppLauncher suite runs the app as an external process, which may be Go, Node, Python or anything else. The controller-reading step becomes "find the route declaration in whatever framework this is" — the shape of the job does not change: find the route, find the handler, find the outbound calls.
When the source is unreadable or absent, skip straight to the traffic-observation loop in
references/mock-discovery.md. It watches HTTP rather than code, so it works in any language.
references/mock-discovery.md — trace the call path, branch points, the narrowest-match
rule, and the observation loop for when there is no source.references/writing-tests.md — DSL field table, matcher decision order, the example index,
and diagnosing failures.<root>/example/README.md — what in the examples is structural and what is demo-specific.<root>/doc/ — test-file-format.md, matchers-and-patterns.md, mock-interactions.md,
graphql-support.md for depth.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub techygarg/confit --plugin confit3 skills in this plugin
/confit-integration-testsThis skill should be used when someone asks to "write API tests for our deployed service", "here's our OpenAPI/Swagger spec, write tests", "test the staging/QA environment", "write integration tests", "convert this Postman collection to ConfIT", "add end-to-end API tests", "point the suite at a different environment", or when adding or editing test definitions in a ConfIT suite whose config has an `integration:` section. Black box: works from a spec, a collection or a live endpoint plus a token, assuming no access to the service's source code. For tests written against your own code with mocked dependencies, use confit-component-tests instead./confit-suite-setupThis skill should be used when the user asks to "set up ConfIT", "add ConfIT to my project", "create a component test suite", "scaffold integration tests", "wire up suite.config.yaml", "add a ConfIT test project", "configure the ConfIT fixture", "run my API tests against QA", or when a ConfIT suite fails to start — no tests discovered, config not found, mock server not reachable, auth not applied. Routes to ConfIT's own working reference suites for the chosen startup mode (in-process, command/AppLauncher, integration), then adapts them to the target project.Other plugins' skills for the same job