# Create Project-Ready Unit Tests

Unit tests often drift from project conventions and become hard to maintain. This skill gives Claude, Codex, and Claude Code a focused workflow for creating reliable tests that match Android and Kotlin project standards.

## Install

```bash
npx skillstore add anysoftkeyboard/create-unit-test
```

## Metadata

- Status: approved
- Slug: anysoftkeyboard-create-unit-test
- Skillstore revision: r1
- Version status: missing
- Tree hash: dcc164268ef117716d5d0fa5d4a0a2c8eda831e4cda1906bb231469339c8ba7b
- Author: AnySoftKeyboard
- GitHub username: AnySoftKeyboard
- License: MIT
- Repository: https://github.com/AnySoftKeyboard/janus/tree/main/.claude/skills/create-unit-test
- Ref: 7db9b9f06e0ab79c575b58bc48c4d8dc9849f424
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/anysoftkeyboard-create-unit-test
- Manifest: https://skillstore.pages.dev/api/skills/anysoftkeyboard-create-unit-test/manifest

## Capabilities

- Guides analysis of source behavior before writing tests.
- Defines Kotlin test file naming and test source-set placement.
- Recommends Robolectric for Android component unit tests.
- Encourages fakes before mocks for maintainable test design.
- Provides Gradle commands for running module and project test suites.
- Points to Gradle XML test reports for failure diagnosis.

## Use Cases

- Add tests for a new Kotlin class: Create a matching test file, choose useful happy path and edge cases, and run the correct Gradle test task.
- Standardize testing work across contributors: Give assistants and team members the same rules for test names, locations, fakes, Robolectric, and reliability.
- Diagnose failing unit tests: Use Gradle test output and XML reports to locate failures and guide focused fixes.

## Prompt Templates

### Create a basic unit test

```
Use the create-unit-test skill to add unit tests for this class. Focus on observable behavior, use the correct test file location, and run the module test task.
```

### Cover edge and error cases

```
Use the create-unit-test skill to identify happy path, edge case, and error case tests for this source file. Implement the most valuable cases and explain any skipped cases.
```

### Test Android component behavior

```
Use the create-unit-test skill to write a Robolectric unit test for this Android component. Provide resources or fakes as needed and keep the test deterministic.
```

### Repair and validate failing tests

```
Use the create-unit-test skill to run the relevant Gradle unit tests, inspect the failure report, fix the test or source issue, and rerun the test task until it passes.
```

## Limitations

- Does not provide a complete testing framework or reusable test utilities.
- Assumes a Gradle-based Android or Kotlin project structure.
- Does not cover rare instrumentation tests in detail.
- Requires the assistant to inspect source code before selecting test cases.

## Best Practices

- Start by understanding behavior and test outcomes before choosing implementation details.
- Prefer fakes over mocks when they keep the test simpler and more realistic.
- Run the smallest relevant Gradle test task first, then the broader suite before commit.

## Anti Patterns

- Do not place unit tests in androidTest unless the task is specifically instrumentation testing.
- Do not write tests that depend on timing, external services, or nondeterministic state.
- Do not suggest source implementation details when the request only asks for test behavior.

## Security Audit

- Audited at: 2026-07-09T01:42:01.721\+00:00
- Summary: The static findings are false positives caused by Markdown backticks around filenames, paths, Gradle commands, and testing terminology. No prompt injection, data exfiltration, unsafe networking, credential access, or malicious intent was found in SKILL.md.

## Stats

- Views: 181
- Downloads: 8
- Favorites: 0
- Popularity score: 0
