gen-ut
Generate standard unit tests for one or more target classes in Apache ShardingSphere; use unified rules to make target classes reach 100% class/line/branch coverage and pass quality gates.
Install
mkdir -p .claude/skills/gen-ut && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2956" && unzip -o skill.zip -d .claude/skills/gen-ut && rm skill.zipInstalls to .claude/skills/gen-ut
About this skill
Generate Unit Tests
Input Conventions
Required inputs:
- Target class list (fully-qualified class names are recommended).
Optional inputs:
- Module name (limits Maven command scope).
- Test class list (for targeted execution only; does not limit in-place updates for related test classes).
Default completion level:
- Unless the user explicitly waives or lowers the target, requests such as "add tests" remain bound to
R10-Acompletion criteria (including default coverage and quality gates).
Missing input handling:
- Note: this section only describes entry handling; final decisions follow
R7/R10. - Missing target classes: enter
R10-INPUT_BLOCKED. - Missing test classes: auto-discover with the
TargetClassName + Testconvention. - No related test classes: create
<TargetClassName>Testin the resolved module test source set. - Cannot resolve
<ResolvedTestModules>: enterR10-INPUT_BLOCKEDand request additional module scope.
Terms
<ResolvedTestClass>: one fully-qualified test class or a comma-separated list of test classes.<ResolvedTestFileSet>: editable file set (space-separated in shell commands), containing only related test files and required test resources.<ResolvedTestModules>: comma-separated Maven module list used by scoped verification commands.<ResolvedTargetClasses>: one fully-qualified production class or a comma-separated list of target classes from user input.Target-class coverage scope: for each target class, aggregate coverage for the target binary class and all binary classes whose names start with<targetBinaryName>$(including member/anonymous/local classes).Related test classes: existingTargetClassName + Testclasses resolvable within the same module's test scope.Assertion differences: distinguishable assertions in externally observable results or side effects.Necessity reason tag: fixed-format tag for retention reasons, usingKEEP:<id>:<reason>, recorded in the "Implementation and Optimization" section of the delivery report.Baseline quality summary: one pre-edit diagnostic run that combines rule scanning, candidate summary, and coverage evidence for the current scope.Verification snapshot digest: content hash over<ResolvedTestFileSet>used to decide whether a previous green verification result is still reusable.Gate reuse state: persisted mapping from logical gate names (for exampletarget-test,coverage,rule-scan) to the latest green digest for that gate.Latest green target-test digest: compatibility alias for thetarget-testentry inGate reuse state.Consolidated hard-gate scan: one script execution that enforcesR8,R14, and all file-content-basedR15rules while still reporting results per rule.
Module resolution order:
- If the user explicitly provides modules, use them first.
- Otherwise, resolve by searching upward for the nearest parent
pom.xmlfrom<ResolvedTestFileSet>paths. - Otherwise, resolve by searching upward for the nearest parent
pom.xmlfrom target class source paths.
Mandatory Constraints
-
Norm levels:
MUST(required),SHOULD(preferred),MAY(optional). -
Definition source principle: mandatory constraints are defined only in this
R1-R15section; other sections only provide term/workflow/command descriptions and must not add, override, or relaxR1-R15. -
R1:MUSTcomply withAGENTS.mdandCODE_OF_CONDUCT.md; rule interpretation should prioritize corresponding clauses and line-number evidence inCODE_OF_CONDUCT.md. -
R2: test types and naming- Non-parameterized scenarios
MUSTuse JUnit@Test. - Data-driven scenarios
MUSTuse JUnit@ParameterizedTest(name = "{0}")with@MethodSource+Arguments. - Parameterized test method signatures
MUSTusefinal String nameas the first parameter. - Parameterized tests
MUST NOTuseConsumer(includingjava.util.function.Consumerand its generic forms) in method signatures or scenario-transport arguments. - Each parameterized test
MUSTprovide at least 3Argumentsrows; fewer than 3 is a violation andMUSTbe converted to non-parameterized@Test. - Parameterized tests
MUST NOTintroduce new nested type declarations (member/local helperclass/interface/enum/record) for scenario transport; useArgumentsrows plus existing or JDK types instead. MUST NOTuse@RepeatedTest.- Test method naming
MUSTfollowCODE_OF_CONDUCT.md: use theassertprefix; when a single test uniquely covers a production method, useassert<MethodName>.
- Non-parameterized scenarios
-
R3: change and execution scope- Edit scope
MUSTbe limited to<ResolvedTestFileSet>. - Path scope
MUSTbe limited tosrc/test/javaandsrc/test/resources. MUST NOTmodify production code or generated directories (such astarget/).MUST NOTmodify other test files to fix failures outside scope; if scope expansion is needed,MUSTbe explicitly approved by the user in the current turn.MUST NOTuse destructive git operations (for example,git reset --hard,git checkout --).
- Edit scope
-
R4: branch list and mapping- Before coding,
MUSTenumerate branches/paths of target public methods and build branch-to-test mappings. - Branch mapping scope
MUSTexclude Lombok-generated methods without custom logic. - By default, one branch/path maps to one test method.
- Whether to keep additional tests on the same branch is determined by
R13.
- Before coding,
-
R5: test granularity- Each test method
MUSTcover only one scenario. - Each test method
MUSTcall the target public method at most once; additional assertions are allowed in the same scenario. - For parameterized tests, each
ArgumentsrowMUSTrepresent one independent scenario and one branch/path mapping unit forR4. - For parameterized tests,
Argumentsrow countMUSTbe greater than or equal to 3. - Tests
MUSTexercise behavior through public methods only. - Coverage-relevant invocations of target public methods
MUSTappear in test method bodies together with assertions for the externally observable result of that invocation. - Helper methods and
@MethodSourceprovidersMUST NOTinvoke target public methods merely to warm caches, precompute coverage, or otherwise execute target behavior without assertions in the same test method body. - Public production methods with business logic
MUSTbe covered with dedicated test methods. - For interface targets, only
defaultpublic methods are required test targets by default, and non-defaultpublic methodsMUST NOTbe tested unless the user explicitly requests them in the current turn. - Dedicated test targets
MUSTfollow theR4branch-mapping exclusion scope.
- Each test method
-
R6: SPI, Mock, and reflection- For interface
defaultmethods, this rule overrides SPI instantiation requirements inR6: testsMUSTuse MockitoCALLS_REAL_METHODSto invoke real default implementations, and this path does not require SPI-bypass justification. - If the class under test can be obtained via SPI,
MUSTinstantiate by default withTypedSPILoader/OrderedSPILoader(or database-specific loaders), andMUSTkeep the resolved instance as a test-class-level field (global variable) by default. - SPI metadata accessor methods
TypedSPI#getType,OrderedSPI#getOrder, andgetTypeClassare default no-test-required targets. - For these accessors, tests
MUST NOTbe added by default; they are allowed only when the user explicitly requests tests for them in the current turn. - If such tests are added without explicit request, they
MUSTbe removed before completion. - If not instantiated via SPI,
MUSTrecord the reason before implementation. - Test dependencies
SHOULDuse Mockito mocks by default. - Reflection access
MUSTusePlugins.getMemberAccessor(), and field access only.
- For interface
-
R7: related test class strategy- If related test classes already exist,
MUSTupdate in place and fill missing coverage first. - If no related test class exists,
MUSTcreate<TargetClassName>Test. - If the user explicitly provides a test class list, it is only used as execution filtering input and
MUST NOTreplace the "in-place update of related test classes" strategy. - Deletion/merge of coverage-equivalent tests is determined by
R13.
- If related test classes already exist,
-
R8: parameterized optimization (enabled by default)MUSTrun pre-implementation candidate analysis and output anR8-CANDIDATESrecord (target public method, candidate count, decision, and evidence).MUSTreport the mergeable method set and merge candidate count.- Candidates meeting all conditions below are considered "high-fit for parameterization":
- A. target public method and branch skeleton are consistent;
- B. scenario differences mainly come from input data;
- C. assertion skeleton is consistent, or only declared assertion differences exist;
- D. parameter sample count is at least 3;
- E. parameterized test body does not require dispatch logic via
switch.
- "Declared assertion differences" means differences explicitly recorded in the delivery report.
- If a candidate requires
switchin a@ParameterizedTestbody to distinguish argument rows, it is not high-fit andMUST NOTbe refactored to parameterized form. - High-fit candidates
MUSTbe refactored directly to parameterized form. - For high-fit candidates, a "do not recommend refactor" conclusion is allowed only when refactoring causes significant readability/diagnosability regression, and the exception
MUSTinclude aNecessity reason tagwith concrete evidence. - Parameter construction
MUSTuseArguments + @MethodSource. MUSTprovide either a "recommend refactor" or "do not recommend refactor" conclusion with reasons for each candidate; when no candidates exist,MUSToutput "no candidates + decision reason".- If high-fit candidates exist but neither p
Content truncated.
More by apache
View all skills by apache →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversConnect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Create modern React UI components instantly with Magic AI Agent. Integrates with top IDEs for fast, stunning design and
Connect Supabase projects to AI with Supabase MCP Server. Standardize LLM communication for secure, efficient developmen
Empower your Unity projects with Unity-MCP: AI-driven control, seamless integration, and advanced workflows within the U
Transform Figma designs into high-quality code with AI. Seamless figma to code and figma to html workflows for efficient
Generate and edit images with Stability AI's powerful ai image generator using advanced Stable Diffusion models for stun
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.