test-generator
Generates compilable test source code that triggers Konveyor analyzer rule patterns. Use when test data is needed for kantra rule validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generates compilable test source code that triggers Konveyor analyzer rule patterns. Use when test data is needed for kantra rule validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generates Konveyor analyzer migration rules from a migration guide (URL, file path, or pasted text). Use when the user wants to create Konveyor rules, migrate an application, or convert a migration guide into analyzer rules.
Extracts migration patterns from a guide and produces validated Konveyor analyzer rules. Use when processing guide sections to identify API changes, class relocations, and behavioral differences.
Generate Konveyor analyzer migration rules from a migration guide (URL, file path, or pasted text). Use when the user wants to create Konveyor rules, migrate an application, or convert a migration guide into analyzer rules.
Generate Konveyor analyzer migration rules with test generation and validation from a migration guide (URL, file path, or pasted text). Use when the user wants to create tested Konveyor rules with full validation.
One-stop eval for generated Konveyor migration rules. Runs the deterministic eval (quality scores, app coverage, overlap detection) and the LLM judge (per-rule accuracy, coherence, gap analysis) in a single invocation. Optionally fixes issues it finds.
Fixes failing test data so rules pass kantra tests, with built-in verify loop. Use when kantra tests fail and test data needs diagnosis and repair.
| name | test-generator |
| description | Generates compilable test source code that triggers Konveyor analyzer rule patterns. Use when test data is needed for kantra rule validation. |
You generate test application source code that triggers Konveyor analyzer rules. The test code must be compilable and must contain code that EXACTLY matches each rule's when condition pattern.
rules_dir — Directory containing rule YAML filestests_dir — Directory containing scaffolded test structuregroups — (optional) List of groups to generate. If provided, skip scaffold and manifest steps. If omitted, run scaffold first and read manifest.json to get the full group list. Each group has:
name — Group namedata_dir — Path to group's data directoryrule_ids — Rule IDs in this groupfiles — Files to generate (path + purpose)groups_completed — Number of groups processedfiles_written — Number of files writtensuspected_kantra_limitations — (optional) List of objects {rule_id, reason} where Maven Central confirmed no plain-semver version exists for the artifact. The rule is still written as java.dependency; this signals the orchestrator to pre-classify these rules for the validator.| Operation | Pattern | Purpose |
|---|---|---|
| shell | go run ./cmd/scaffold * | Create test directories (standalone invocation) |
| shell | go mod * | Resolve Go module dependencies |
| shell | go doc * | Look up Go API signatures |
| shell | curl -s "https://search.maven.org/solrsearch/select*" | Look up real artifact versions on Maven Central for java.dependency test data |
| read | output/** | Read rule YAML and scaffold manifest |
| read | agents/test-generator/references/** | Read test data guide |
| read | agents/test-generator/references/languages/** | Read language-specific test data guide |
| write | output/** | Write test source files |
| edit | output/** | Fix test files during compilation |
Do NOT use python, python3, node, or any scripting language runtime. This is a Go project. Only run commands listed in this permissions table. Every unnecessary shell command triggers a permission prompt that blocks the autonomous pipeline.
Read these before starting:
references/test-data-common.md — Shared test data contract: goal, requirements, source API rule, output format, manifest.json structure, XML sanitizationreferences/languages/<language>/test-data-guide.md — Language-specific project structure, condition matching table, dependency resolution, compilation checkreferences/templates/<language>/ — Minimal build/source templates. Start from templates, then inject rule snippets.groups provided)If groups was provided in the inputs, skip to step 3 — scaffold and manifest were already handled.
Otherwise, run the CLI to create test structure and manifest:
go run ./cmd/scaffold --rules <rules-dir> --output <tests-dir>
This creates:
.test.yaml files (kantra test definitions)manifest.json describing what source files to generateThe manifest tells you exactly what files to generate. All paths are relative to tests_dir:
{
"language": "java",
"groups": [
{
"name": "web",
"data_dir": "data/web",
"test_file": "web.test.yaml",
"rule_count": 3,
"providers": ["java"],
"files": [
{"path": "data/web/pom.xml", "file_type": "xml", "purpose": "build"},
{"path": "data/web/src/main/java/com/example/Application.java", "file_type": "java", "purpose": "source"}
],
"rule_ids": ["rule-00010", "rule-00020", "rule-00030"]
}
]
}
Always join tests_dir with each files[].path when writing: <tests_dir>/<files[].path>. Do NOT write files relative to the current working directory — they will land at the repo root instead of inside output/<migration>/tests/.
For each group:
rule_ids from the rules directorywhen condition to understand what pattern must be matchedreferences/templates/<language>/ and write them to <tests_dir>/<files[].path>{{RULE_SNIPPETS}})build) to <tests_dir>/<path> and source file (purpose: source) to <tests_dir>/<path>Source code requirements:
when conditionpattern field from the rule YAML verbatim as your import/type/annotation. Never use the target (new) API path.// Rule: <ruleID>Dependency version requirements for java.dependency rules:
For every java.dependency rule, query Maven Central before writing any version into pom.xml. Never rely on training-data guesses for version strings.
Step A — Parse groupId and artifactId from the rule's when.java.dependency.name field:
The name uses dot notation — the artifactId is the last hyphen-containing segment (e.g. org.spockframework.spock-spring → g:org.spockframework, a:spock-spring).
Step B — Query Maven Central:
curl -s "https://search.maven.org/solrsearch/select?q=g:%22<groupId>%22+AND+a:%22<artifactId>%22&core=gav&rows=20&wt=json"
Parse .response.docs[].v for the list of published versions.
Step C — Select a version:
upperbound, at or above lowerbound)^\d+\.\d+\.\d+$)Step D — If no plain-semver version qualifies:
Do NOT fabricate a version (e.g. do not write 2.3.0 for a Spock artifact that only publishes 2.3-groovy-4.0). Do NOT switch to builtin.xml. Record the rule ID in suspected_kantra_limitations with reason "no_plain_semver_version_on_maven_central" and omit the <version> tag (BOM-managed fallback) if the BOM manages it, or omit the dependency entirely and note it in a comment.
Step E — If Maven Central returns no results:
Record in suspected_kantra_limitations with reason "artifact_not_found_on_maven_central".
When an artifact was discontinued before the target version (e.g., hibernate-proxool was dropped in Hibernate 6): query MC to find the last published version under the rule's groupId. Use that version if it is plain semver.
How the analyzer matches each condition type: See references/languages/<language>/test-data-guide.md for the full matching rules per condition type. Getting this wrong is the #1 cause of test failures.
See references/languages/<language>/test-data-guide.md for per-language dependency resolution rules. The key constraints:
mvn compile or any Maven command — kantra resolves dependencies by parsing pom.xml directlygo mod tidy (do NOT run go mod vendor — vendored deps cause false positives in go.referenced analysis)Do NOT run sanitize. The orchestrator handles this after all test-gen agents complete.
Return the path to the tests directory to the orchestrator.
On fix iterations, the orchestrator provides:
When fixing:
If the test code has compilation errors:
go doc <package> to get actual function signatures