/test-writing:phpunit-unit-test-writingfrom test-writing
Generates PHPUnit unit tests for Shopware 6 source classes with an automated workflow: category detection, test generation, MCP-driven review, and inline fix loop until tests pass.
Ships in test-writing. 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.
Orchestrates the complete workflow for generating and reviewing Shopware 6 unit tests.
Execute immediately. Report work AFTER completion, never before.
Process the complete workflow (Generate → Coverage Exclusion → Review → Fix → Report) for that one file.
Process files sequentially — one file at a time:
FOR EACH source file:
1. Generate test (wait for completion)
2. Review test (wait for completion)
3. Fix loop if needed (wait for completion)
4. Mark file complete
5. Collapse intermediate state to compact summary
THEN proceed to next file
After each file completes all phases, collapse intermediate state (generation details, review iterations, fix attempts) to a compact summary before proceeding to the next file. This prevents context growth on multi-file runs.
Never modify:
src/** — Source codetests/integration/** — Integration tests (out of scope)tests/unit/**Conditional modification (user confirmation required):
phpunit.xml.dist — Only adding <file> entries to <exclude> section, only during Phase 2Identify the source class requiring tests
Invoke generation skill:
Skill(test-writing:phpunit-unit-test-generation) with source: {source_class_path}
Parse response for:
test_path: Location of generated test filestatus: SUCCESS | PARTIAL | FAILED | SKIPPEDcategory: A | B | C | D | E (test complexity category)skip_type: coverage_excluded | no_logic (only when SKIPPED)Decision:
skip_type: coverage_excluded → Report reason to user, end workflowskip_type: no_logic → Proceed to Phase 2 (Coverage Exclusion Offer)Update workflow state on SUCCESS/PARTIAL:
TodoWrite([
{content: "Generate unit tests", status: "completed", activeForm: "Generating unit tests"},
{content: "Review unit tests", status: "in_progress", activeForm: "Reviewing unit tests"}
])
Entry condition: Generator returned SKIPPED with skip_type: no_logic.
Source files with no testable logic still appear as 0% in coverage reports unless excluded. This phase offers to add them to phpunit.xml.dist so coverage reports only show files that actually need testing.
phpunit.xml.dist from the project root (fallback: phpunit.xml)<exclude> section within <coverage>/<source> (or <source>){source_path} was skipped — no testable logic detected ({reason}).
Add it to phpunit.xml.dist coverage exclusions so it doesn't show as uncovered?
Options: "Yes, exclude from coverage" / "No, skip"<exclude> section exists → Use Edit to add <file>{relative_path}</file> before </exclude><exclude> section → Use Edit to insert <exclude><file>{relative_path}</file></exclude> before </source>coverage_excluded: truecoverage_excluded: falseDo NOT prompt per file. Instead, collect all skip_type: no_logic files across the batch. After all files complete their workflow phases, present a single batch prompt:
X files were skipped — no testable logic detected.
Add them to phpunit.xml.dist coverage exclusions?
- src/Core/Content/Product/ProductEntity.php (Pure accessor)
- src/Core/Content/Category/CategoryCollection.php (Simple collection)
Options: "Yes, exclude all from coverage" / "No, skip"
If approved, add all <file> entries in a single Edit operation.
MUST execute when generator returned SUCCESS or PARTIAL. Never skip.
Invoke reviewing skill:
Agent(
agent: "test-writing:test-reviewer",
prompt: "Invoke Skill(test-writing:phpunit-unit-test-reviewing) for {test_path}. Return the structured report."
)
Parse response:
status: PASS | NEEDS_ATTENTION | ISSUES_FOUND | FAILEDerrors: Remaining must-fix rules (mandatory compliance failures)warnings: Remaining should-fix rules (optional improvements)Decision:
| Status | Action |
|---|---|
| PASS | Proceed to Phase 6 (Final Report) with status COMPLIANT |
| NEEDS_ATTENTION | Proceed to Phase 4 (Fix Loop) for warnings, then Phase 5 for any unresolved |
| ISSUES_FOUND | Proceed to Phase 4 (Fix Loop) |
| FAILED | Report failure reason, end workflow |
Entry condition: Review returned ISSUES_FOUND (has must-fix errors).
The loop continues until ALL errors are resolved — both tool validation errors AND semantic review errors (must-fix rules from reviewing skill).
FOR iteration 1 to 4:
1. Apply ALL fixes from review report errors (Edit tool)
2. Run validation tools (code style, static analysis, tests)
3. Re-invoke reviewing skill to check for remaining issues
4. Track issue history for oscillation
5. Check exit conditions (PASS = 0 errors from review AND tools)
↓
Return final result
For each must-fix rule with suggested fix from the review report:
suggested fix using Edit tool — in full, every sub-action it specifies, not re-summarized, narrowed, or reinterpreted{rule_id, location, attempted: true, applied: true/false, reason: null}If a suggested fix looks wrong, do not silently substitute a partial fix — apply it as given and let the re-review and oscillation/escalation handling (Steps 3–5) catch the problem.
Priority order when fixes conflict:
Run code style fix, static analysis, and tests on {test_path}. Fix any errors before continuing.
Agent(
agent: "test-writing:test-reviewer",
prompt: "Invoke Skill(test-writing:phpunit-unit-test-reviewing) for {test_path}. Return the structured report."
)
Spawns test-reviewer agent → returns updated report with errors/warnings.
Maintain issue history for oscillation detection:
issue_history:
- iteration: 1
issues: ["{rule_id}:45", "{rule_id}:67"]
- iteration: 2
issues: ["{rule_id}:12"]
- iteration: 3
issues: ["{rule_id}:45"] # same rule:line returned — oscillation!
Oscillation Detection:
{rule_id}:{line_number} per iteration| Condition | Action |
|---|---|
| Review returns 0 errors AND tools pass | Exit with status: PASS |
| Oscillation detected | Handle per references/oscillation-handling.md |
| Same errors 2x consecutively | Exit as stuck loop with remaining errors |
| Iteration 4 reached with errors remaining | Exit with status: ISSUES_FOUND |
PASS Criteria (all must be met):
ISSUES_FOUND means must-fix rules could not be resolved within 4 iterations — these are mandatory compliance failures.
If warnings remain after error correction:
Provide comprehensive summary. See references/report-formats.md for templates.
Include:
If skill invocation fails:
Workflow Aborted
Required skill `[name]` could not be invoked.
Please ensure the plugin is properly configured and try again.
Do not attempt to manually generate or review tests if skills fail.
If test-writing:phpunit-unit-test-generation returns FAILED:
If SKIPPED with skip_type: coverage_excluded:
If SKIPPED with skip_type: no_logic:
Common failure reasons:
src/ directoryIf fix loop exits with ISSUES_FOUND after max iterations:
Common failure reasons:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
phpunit, shopware-6, unit-testing, test-generation, mcp-driven-review
11 skills in this plugin
/phpunit-integration-test-generationUse this skill when the user asks to generate, write, or create integration tests for a Shopware 6 source class whose contract requires wired-up code — phrases like "generate integration tests for X", "write an integration test for this controller", "test this indexer", "create an integration test for the message handler". Detects supported integration patterns (controller/route, scheduled-task, message-handler, indexer, DAL-persistence flow, multi-service coordinator) and applies a template producing an INTEGRATION-001..008-compliant test using IntegrationTestBehaviour against the real DAL, container, and HTTP/messaging. When the source class is unit-shape (no persistence, no kernel state, no wiring under test), returns SKIPPED and points at phpunit-unit-test-writing. Do NOT activate for unit tests or migration tests (use phpunit-migration-test-generation)./phpunit-integration-test-reviewingInternal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent./phpunit-integration-to-unit-migratingUse this skill ONLY when the user explicitly requests an audit, migration, or evaluation of whether a Shopware integration test belongs in the unit suite — trigger phrases like "audit integration tests", "migrate integration tests to unit", "is this an integration test or a unit test", "evaluate integration tests for migration", "should this be a unit test instead". Audits tests under tests/integration/ for misplacement and migrates load-bearing-free tests to tests/unit/ using one of six codified refactoring patterns. NOT invoked automatically by reviewing skills — phpunit-integration-test-reviewing emits a placement smoke-alarm hint pointing here, but the user must invoke this skill explicitly to run the deep audit.npx claudepluginhub shopwarelabs/ai-coding-tools --plugin test-writingOther plugins' skills for the same job