MCP HubMCP Hub
スキル一覧に戻る

create-unit-test

majiayu000
更新日 2 days ago
19 閲覧
58
9
58
GitHubで表示
メタtestingdesign

について

このスキルは、開発者がプロジェクト固有のアーキテクチャ、命名規則、ファイル配置ガイドラインに従った単体テストを作成・実行することを支援します。コードを分析してテストケースを特定することに重点を置きながら、AndroidコンポーネントにはRobolectricの使用を強制し、モックよりもフェイクを優先するよう促します。新しいテストが既存のプロジェクト標準や慣行と一貫性を保つ必要がある場合にご利用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/majiayu000/claude-skill-registry
Git クローン代替
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/create-unit-test

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Create Unit Test

This skill guides the creation of unit tests to ensuring consistency and correctness.

Workflow

  1. 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.
  2. 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.
  3. 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.
  4. Run Tests:

    • Command: ./gradlew :[module]:testDebugUnitTest
    • Example: ./gradlew :database:testDebugUnitTest
    • Tip: Before any commit, run ./gradlew testDebugUnitTest to ensure everything passes.
  5. 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 test source set, not androidTest (unless specifically writing instrumentation tests, which is rare for this skill).
  • Reliability: Avoid flaky tests. Ensure deterministic behavior.

GitHub リポジトリ

majiayu000/claude-skill-registry
パス: skills/create-unit-test

関連スキル

content-collections

メタ

This 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

メタ

This 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

テスト

This 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.

スキルを見る

polymarket

メタ

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

スキルを見る