write-unit-tests
Skill by stripe
Guides an AI assistant in writing unit tests and fake test implementations for stripe-android. It covers scenario helpers, Turbine interaction tracking and Flow testing, and Truth assertions.
Install write-unit-tests
Built from the published package, never by AI.
git clone --depth 1 https://github.com/stripe/stripe-android /tmp/stripe-android && mkdir -p ~/.claude/skills && cp -r /tmp/stripe-android/.agents/skills/write-unit-tests ~/.claude/skills/write-unit-testsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/stripe/stripe-android /tmp/stripe-android && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/stripe-android/.agents/skills/write-unit-tests ~/.gemini/antigravity-cli/skills/write-unit-testsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The write-unit-tests skill gives an AI assistant rules for writing and structuring unit tests in the stripe-android repository. Fakes are named FakeClassName, kept internal, and placed in the test source set. Every observed fake interaction is tracked with Turbine, and each fake is validated after the test block runs.
The skill also describes a runScenario helper for shared setup, Google Truth assertions that focus on meaningful fields, and Turbine's test API for Flow and StateFlow emissions. It covers coroutine tests with real NetworkRule or OkHttp I/O, including timeouts and avoiding Thread.sleep. It is aimed at developers contributing tests to stripe-android. It points to related skills for parameterized, Compose and network tests.
Written from the project's SKILL.md and checked against it.
What it can do
- Fake collaboratorsCreates internal FakeClassName test doubles with sensible constructor defaults.
- Turbine interaction trackingRecords every fake call, callback and lifecycle event through Turbine channels.
- Scenario helperSets up shared test state with a runScenario function and a Scenario class.
- Flow testingTests Flow and StateFlow emissions with Turbine's test block and awaitItem.
- Truth assertionsWrites assertions with Google Truth, preferring field-level checks where they fit.
- Concurrency with real I/OGuides coroutine tests using runTest, async, latches and timeouts for network calls.
What you need
- The stripe-android repository
- Turbine testing library
- Google Truth assertion library
Try asking
- Write a unit test for my repository using a FakeRepository and runScenario.
- Create an internal fake for this interface that tracks calls with Turbine.
- Test the StateFlow emissions of this ViewModel with Turbine.
Good to know
- Written for the stripe-android codebase and its test source layout.
- If a collaborator cannot be faked cleanly, the skill says to propose a testability seam first.
- Network tests must avoid Thread.sleep and give latch waits a timeout.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/write-unit-tests/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md6 KB
Alternatives to write-unit-tests
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
write-unit-tests: common questions
What testing libraries does this skill use?
The skill uses Turbine for tracking fake interactions and Flow emissions, and Google Truth for assertions.
Where should fake classes go in stripe-android?
Fakes should be internal and placed in the test source set, named with a Fake prefix.
Does the skill cover parameterized or Compose tests?
It does not cover them directly, but it links to separate skills for parameterized tests, Compose UI tests and NetworkRule integration tests.
How do I install write-unit-tests?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is write-unit-tests free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is write-unit-tests safe to use?
It scores 81 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to write-unit-tests?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
