From unity-coding-skills
Reviews existing test code for conformance to test-design and test-writing guides, detects over-promoted internal tests, and produces a refinement plan. Invoke as /refine-tests <path>.
How this skill is triggered — by the user, by Claude, or both
Slash command
/unity-coding-skills:refine-tests [path][path]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Reviews existing test code for conformance to the test-designing-guide and test-writing-guide, detects `[Category("Internal")]` tests over-promoted for testability and moves them to the public seam (demoting now-unneeded `internal` methods to `private`), then produces a refinement plan.
Reviews existing test code for conformance to the test-designing-guide and test-writing-guide, detects [Category("Internal")] tests over-promoted for testability and moves them to the public seam (demoting now-unneeded internal methods to private), then produces a refinement plan.
This skill requires plan mode. Before doing anything else, check the current mode:
ExitPlanMode is in the deferred tools list → not in plan mode → stop immediately and tell the user:
"This skill (
/refine-tests) requires plan mode. Enter plan mode first: use/planor press Shift+Tab to toggle."
ExitPlanMode is NOT in the deferred tools list (i.e., directly callable) → in plan mode → proceed.This skill is for refining existing tests for conformance to the guides. If the request is out of scope, redirect:
/plan-feature instead/fix-bug insteadOne or more target path arguments. Each may be a single test file, a directory (resolved recursively to its test files), or a glob. Resolve the argument(s) to the concrete set of test files to review before proceeding.
Launch Explore agent(s) to read the target test file(s) and the production code they exercise. Reading the production code is necessary to judge layer-appropriateness and structural-vs-spec-based issues.
Load the test-designing-guide and test-writing-guide skills. Apply all rules that are verifiable from the test code alone — no requirements document is available.
The following sections of test-designing-guide require requirements input or production-design changes and are out of scope:
Produce a Findings list. Each finding records:
Compare the target test files against each other and against other tests in the same test class.
A true duplicate has both of the following in common with another test:
Do NOT flag tests that share only one:
For each true duplicate pair, append a Finding to the Findings list from Step 2:
Exception — defer to Step 4: If one test in a duplicate pair is [Category("Internal")] and the other is a public-seam test, do not apply the name-quality tiebreaker here. Do not delete the public-seam test on naming grounds. Defer the pair to Step 4, which always keeps the public-seam test.
Test through the same seam production code uses. A [Category("Internal")] test exercises an internal method directly. For each such test in the targets, append Findings via two passes. Overriding rule: never trade coverage for a tidier seam; when in doubt, keep the test (and keep internal).
Layer scope: This step operates within the unit test layer only. Tests marked [Category("Integration")] or [Category("VisualVerification")] run under different execution contexts and are not candidates for a covering test — do not consider them when searching for a public-seam test that covers the same scenario.
Pass 1 — classify each [Category("Internal")] test:
Pass 2 — visibility sweep: for each internal method whose direct internal test goes away in Pass 1 (deleted via 1 or moved via 2c), search the whole solution for usages (internal is visible cross-assembly via InternalsVisibleTo — check other production and test assemblies, not just files in scope):
#if UNITY_INCLUDE_TESTS, test now gone → Finding: remove the dead seam.internal access → Finding: demote the method to private (do not break any #if conditional compilation).internal use → leave it internal; no Finding.Pass 2 Findings change production code — record the file path + method explicitly.
Read the critical test files. Confirm the proposed changes in the Findings list are consistent with each other and that each change preserves what the test verifies. Also cross-check duplicate findings (Step 3) against conformance findings (Step 2): a test slated for rename must not also be the redundant side of a duplicate finding. For seam-redundancy findings (Step 4): confirm each moved test still asserts the same observable outcome through the public seam, and each demotion / seam-removal finding has no remaining cross-assembly internal user.
Assemble the plan file with these sections:
${CLAUDE_SKILL_DIR}/assets/refine-workflow-template.md and paste its full contents verbatim as the body of this sectionnpx claudepluginhub nowsprinting/unity-coding-skills --plugin unity-coding-skillsEnforces test quality principles including Arrange-Act-Assert structure, single behavior per test, and meaningful naming when writing or reviewing test code.
Reviews test files for bug-catching quality, grading on six dimensions like assertion depth, input coverage, mock health with actionable scorecard.
Analyzes code for test coverage gaps and edge cases, then produces a standalone test plan. Does not write test code or refine existing plans.