create-unit-test
About
This skill helps developers create and run unit tests that follow project-specific architecture, naming conventions, and file location guidelines. It focuses on analyzing code to identify test cases while enforcing the use of Robolectric for Android components and preferring Fakes over Mocks. Use it when you need to ensure new tests are consistent with existing project standards and practices.
Quick Install
Claude Code
Recommended/plugin add https://github.com/majiayu000/claude-skill-registrygit clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/create-unit-testCopy and paste this command in Claude Code to install this skill
Documentation
Create Unit Test
This skill guides the creation of unit tests to ensuring consistency and correctness.
Workflow
-
Analyze and Plan:
- Goal: Understand what needs testing.
- Action: Examine the source code.
- Action: Identify "happy path" cases (core functionality).
- Action: Identify "error cases" and "edge cases" based on likelihood.
- Action: Do not suggest implementation details unless asked; focus on behavior.
-
Setup Test File:
- Naming:
[OriginalClassName]Test.kt. - Location:
[module]/src/test/java/[package/path]/. - Runner: If testing Android components, you MUST use Robolectric.
- Mocking: Prefer creating Fakes over Mocks or patches. Use Mocks only if Fakes are too complex.
- Naming:
-
Implement Tests:
- Write clear, descriptive test methods.
- Follow the "Arrange-Act-Assert" pattern.
- Ensure all resources (strings, themes) are properly mocked or provided via Robolectric.
-
Run Tests:
- Command:
./gradlew :[module]:testDebugUnitTest - Example:
./gradlew :database:testDebugUnitTest - Tip: Before any commit, run
./gradlew testDebugUnitTestto ensure everything passes.
- Command:
-
Handle Failures:
- Goal: Diagnose and fix issues.
- Action: If a test fails, locate the full error report.
- Path:
[module]/build/test-results/testDebugUnitTest/TEST-[package.name.TestClassName].xml. - Example:
app/build/test-results/testDebugUnitTest/TEST-com.anysoftkeyboard.janus.app.MainActivityTest.xml.
Guidelines
- Consistency: Always place tests in the
testsource set, notandroidTest(unless specifically writing instrumentation tests, which is rare for this skill). - Reliability: Avoid flaky tests. Ensure deterministic behavior.
GitHub Repository
Related Skills
content-collections
MetaThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
creating-opencode-plugins
MetaThis skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.
evaluating-llms-harness
TestingThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
langchain
MetaLangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.
