.claude/skills/write-ui-tests/SKILL.md
Use when writing or modifying UI/Compose instrumented tests in the Alkaa project — triggers on tasks like "add a UI test", "test this composable", "add instrumented test", "test this screen behavior".
npx skillsauth add igorescodro/alkaa write-ui-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
UI tests in Alkaa test Compose and UI behavior in isolation — not integration tests. Composables must be stateless to make testing straightforward: pass all state and callbacks as parameters, then assert on the semantic tree.
Tests live in: features/<feature>/src/commonTest/kotlin/com/escodro/<feature>/presentation/instrumented/
AlkaaTest(), @OptIn(ExperimentalTestApi::class) on class → see references/SETUP.md= runComposeUiTest { } for each testComposeUiTest; always wrap with AlkaaThemePreview → see references/SETUP.md@AfterTest → see references/SETUP.mdreferences/SETUP.mdSnake_case, two accepted forms:
test_emptyViewIsShown()when_view_is_opened_then_empty_view_is_shown()No camelCase, no backtick names.
| Rule | Details |
|------|---------|
| Always wrap | Wrap composable in AlkaaThemePreview |
| Resource strings | getString(Res.string.xyz) inside uiTest or runComposeUiTest — never hardcode |
| One scenario per test | Split different states into separate @Test functions |
| useUnmergedTree = true | When nodes are inside merged semantics |
| @IgnoreOnDesktop | For tests not applicable on desktop |
| @AfterTest cleanup | Call clean() on every fake |
| Given/When/Then | Always add the three comment blocks |
| Mistake | Fix |
|---------|-----|
| Testing a stateful composable directly | Extract a stateless Content composable and test that |
| Using mocks for domain interfaces | Create a fake implementing the interface |
| Hardcoding UI strings | Use getString(...) inside uiTest or runComposeUiTest |
| Testing multiple scenarios in one test | Split into separate @Test functions |
| Missing @AfterTest cleanup | Add tearDown() calling clean() on every fake |
| Forgetting AlkaaThemePreview wrapper | Always wrap composable |
| Omitting Given/When/Then comments | Always add the three comment blocks |
development
A skill for reviewing Android code before it is pushed to production.
documentation
Use when writing a new ViewModel or modifying an existing one in the Alkaa project. Triggers on tasks like "add a ViewModel", "create VM for X screen", "implement state handling", or "connect use case to UI".
testing
Use when writing or modifying unit tests in the Alkaa project — triggers on tasks like "add a test", "write tests for X", "test this ViewModel", "cover this use case with tests", or "add unit test coverage".
documentation
Use when a new feature needs to persist data locally in Alkaa — triggers on tasks like "add database support", "create a new table", "store this data in SQLDelight", or when write-feature Phase 2 requires a new entity in the local database.