/qa-ai-assisted:ai-test-generatorfrom qa-ai-assisted
Generates tests from acceptance criteria using an LLM, scores each test case for confidence, and batches uncertain cases for human review. Useful for converting user stories into test code.
Ships in qa-ai-assisted. 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.
This skill provides an augmentation framework for converting acceptance criteria (ACs) into test code: AI generates, the team curates. Generated tests are scored for confidence and reviewed adversarially before merge.
# input/cart-promo.yaml
spec_source: "stories/LIN-1234.md"
acceptance_criteria:
- id: AC-1.1
description: "Valid promo 'WELCOME10' reduces subtotal by 10%"
inputs:
cart_total: 24.99
promo_code: "WELCOME10"
expected:
subtotal_after: 22.49
message: "Code applied"
- id: AC-1.2
description: "Expired promo shows error 'This code has expired'"
inputs:
cart_total: 24.99
promo_code: "EXPIRED50"
expected:
subtotal_after: 24.99
error: "This code has expired"
Generate one test per AC. Core loop below; full script with helpers and the project-conventions injection is in references/generation-and-scoring.md.
# scripts/ai-gen.py
import openai
system = ("Generate one test per AC in {framework} using the project's test "
"conventions (inject docs/test-code-conventions.md). Specific "
"assertions only - no .toBeTruthy() / .toBeDefined(). If an AC can't "
"be satisfied with the given inputs, mark CONFIDENCE: low and say why.")
for ac in input_yaml['acceptance_criteria']:
response = openai.chat.completions.create(
model='gpt-4',
messages=[
{'role': 'system', 'content': system.format(framework='jest')},
{'role': 'user', 'content': f"{ac['id']}: {ac['description']} | "
f"inputs {ac['inputs']} -> {ac['expected']}"},
],
)
open(f"tests/generated/{ac['id']}.test.js", 'w').write(
response.choices[0].message.content)
Before scoring, verify that generated test files parse and compile. Failing tests caught here should be flagged as CONFIDENCE: low automatically.
# For TypeScript projects
npx tsc --noEmit
# For Python projects
python -m py_compile path/to/generated_test.py
# For JavaScript projects (syntax check)
node --check path/to/generated_test.js
Any file that fails compilation is immediately downgraded: subtract 50 from its score before applying the heuristics in Step 4.
Per generated test, compute a confidence score. The rubric is the core of the
skill; its parsing helpers (extract_imports, module_exists,
extract_test_name) are in
references/generation-and-scoring.md.
def score(test_code, ac):
score = 100
if 'CONFIDENCE: low' in test_code: # LLM's own confidence
score -= 40
weak = ['.toBeTruthy()', '.toBeDefined()', '.toBeFalsy()', '.toContain(']
score -= sum(20 for m in weak if m in test_code) # vague matchers
for imp in extract_imports(test_code): # hallucinated imports
if not module_exists(imp):
score -= 30
name = extract_test_name(test_code).lower() # generic naming
if any(g in name for g in ['works', 'should', 'test 1', 'placeholder']):
score -= 15
return max(0, score)
| Score | Action |
|---|---|
| 80-100 | High-confidence - review can be quick. |
| 50-79 | Medium - careful review required. |
| <50 | Low - likely needs rewrite or rejection. |
## AI-generated tests - `<spec>`
**Generated:** N tests
**High-confidence:** M (review: spot-check 2-3)
**Medium-confidence:** K (review each)
**Low-confidence:** L (likely rewrite)
### High-confidence (4)
(test code blocks with confidence scores)
### Medium-confidence (3)
(blocks with confidence scores + flagged issues)
### Low-confidence (2)
(blocks with confidence scores + recommend manual rewrite)
### Hand-off
Review each generated test for:
- Hallucinated APIs / functions / constants
- Weak assertions (assert on specific expected values, not just truthiness)
- Missing setup / teardown
- Redundancy with existing tests
After curation: merge.
Spec → Generate → Validate → Score → Review → (rewrite | merge | reject)
↓
Lessons fed back into prompt
The team's prompt evolves: when the LLM keeps producing
.toBeTruthy(), add an explicit prohibition. When it hallucinates
an API, add an example of the real API.
LLM calls have cost and rate limits. Pattern:
cart.applyDiscount() when the real method
is cart.applyPromo(). Review catches this.ai-spec-coverage-mapper - sister skill: maps existing tests to spec sections.gherkin-from-stories (in the qa-bdd plugin, ATDD mode) - non-AI alternative for AC-to-test conversion.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub testland/qa --plugin qa-ai-assisted3 skills in this plugin
/ai-spec-coverage-mapperUse when a spec and a test suite both exist but nobody can say which requirements are covered, before a release sign-off, an audit or planning test effort. Uses an LLM to map existing tests to spec sections, outputs a coverage matrix per spec ID and names the gaps. It does not write new tests./model-based-test-graph-authorUse when a complex stateful flow (checkout, onboarding, multi-step wizard) needs systematic model-based coverage that ad-hoc tests miss. Builds a state-machine model, checks it is complete, picks a coverage criterion, generates covering paths and turns them into a curated test suite.2 plugins ship this exact skill · first indexed Nov 12, 2026
Other plugins' skills for the same job