guillemroca/agent-skills-android/test-driven-development
Claude Code and agent skill by guillemroca/agent-skills-android
- community
Checking that the SKILL.md file is still in the repository.
Use when implementing new features or fixing bugs. Write tests before implementation following Red-Green-Refactor. Covers JUnit5, MockK, Compose test rules, and the Prove-It pattern for bugs.
Install
npx vskill@latest install guillemroca/agent-skills-android/test-driven-developmentSKILL.md
The same SKILL.md was published earlier as guillemroca/agent-skills-android/test-driven-development.
Test-Driven Development
Overview
Write tests before implementation. The Red-Green-Refactor cycle — write a failing test (RED), write minimal code to pass (GREEN), improve the code without changing behavior (REFACTOR) — produces code that is correct by construction and has comprehensive test coverage from the start.
When to Use
- Implementing any new feature or behavior
- Fixing any bug (use the Prove-It pattern)
- Adding new business logic to ViewModels, use cases, or repositories
- Before refactoring (establish a test safety net first)
Skip when: Purely cosmetic UI changes with no behavioral logic.
Core Process
Red-Green-Refactor Cycle
RED: Write a Failing Test
- Write the test first — describe what the code should do:
- Run the test — it must fail (
./gradlew test)
- If it passes immediately, the test doesn't test what you think
GREEN: Write Minimal Code to Pass
- Implement just enough to make the test pass:
- Run the test — it must pass
- Don't add code "you'll need later" — only what the test demands
REFACTOR: Improve Without Changing Behavior
- Clean up while tests stay green:
- Extract common patterns
- Improve naming
- Reduce duplication
- Run tests after every change
The Prove-It Pattern (Bug Fixes)
- For every bug, prove it exists before fixing:
Test Pyramid
Testing Patterns by Layer
- ViewModel tests:
- Repository tests (integration):
- Room DAO tests:
Best Practices
- State over interactions — assert on outcomes, not method calls
- DAMP over DRY — each test should be self-contained and readable
- Prefer real > fakes > stubs > mocks — mock only at system boundaries
- Descriptive names — test names read like behavior specifications
- Use `runTest` — for coroutine testing with
TestDispatcher - Use `advanceUntilIdle()` — not
delay()orThread.sleep()
Common Rationalizations
| Shortcut | Why It Fails | |
|---|---|---|
| "I'll write tests after the code works" | You won't. And tests written after are weaker — they verify what you built, not what you intended. | |
| "TDD is slow" | TDD prevents debugging. Net time is less. | |
| "This is too simple to test" | Simple code becomes complex code. Tests catch the transition. | |
| "Mocking is too complex for this" | If it's hard to mock, the design has too many dependencies. TDD surfaces this. | |
| "The test passed on the first try, so it's good" | A test that never failed may not test what you think. Make it fail first. |
Red Flags
- Code written before tests
- Tests that pass immediately (never saw RED)
Thread.sleepor hardcoded delays in tests- Tests that depend on execution order
- Mocking internal classes (mock boundaries only)
- No tests for error/edge cases
@Ignoreor@Disabledtests without issue references
Verification
- [ ] Tests written BEFORE implementation (Red-Green-Refactor)
- [ ] Every test seen failing before passing
- [ ] Bug fixes use the Prove-It pattern
- [ ]
./gradlew testpasses (all unit tests) - [ ] Test names describe behavior, not implementation
- [ ] No
Thread.sleepin tests (useadvanceUntilIdle) - [ ] Test pyramid proportions reasonable (~80/15/5)
- [ ] Edge cases and error paths covered
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/test-driven-development/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/guillemroca/agent-skills-android/test-driven-development)