Skip to content

drafael/coding-harness / skills/write-tests

write-tests

Verified

Write unit, integration, component, and end-to-end tests for code. Use when the user asks to "write tests", "add tests", "add test coverage", or "create test cases" for functions, services, components, CLIs, or user flows.

FileKindSize
README.mdmarkdown1.3 KB
SKILL.mdskill md3.6 KB
references/bun-test.mdmarkdown4.5 KB
references/jest.mdmarkdown4.7 KB
references/junit.mdmarkdown1.6 KB
references/node-test.mdmarkdown4.1 KB
references/playwright.mdmarkdown5.7 KB
references/typescript.mdmarkdown5.7 KB
references/vitest.mdmarkdown4.4 KB

references/junit.md

View on GitHub

## JUnit

Use the **java-coder** skill, but the instructions from this file take precedence over it for writing tests only

**Assertions**
- Always use AssertJ — never raw JUnit assertions

**Imports**
- Always use **static imports** for static methods, including but not limited to:
  - `org.assertj.core.api.Assertions.assertThat`, `org.assertj.core.api.Assertions.assertThatThrownBy`
  - `org.mockito.ArgumentMatchers.any`, `org.mockito.ArgumentMatchers.eq`
  - `org.mockito.Mockito.mock`, `org.mockito.Mockito.spy`, `org.mockito.Mockito.when`, `org.mockito.Mockito.verify`
  - `org.mockito.Mockito.doReturn`, `org.mockito.Mockito.doThrow`

**Naming**
- Test methods: `{methodName}_{precondition}_{expectedOutcome}`
- `@DisplayName`: human-readable sentence describing the scenario; never echo the method name
- The instance of the class under test: always `subject`

**Structure**
- Prefer straight-line test-case bodies: split scenarios when parameters select different actions or assertion paths. Retain parameterization when flow and assertions remain uniform.
- Conditions needed for cleanup, polling, or synchronization helpers are allowed; this is not a blanket ban on conditional syntax.
- Prefer `@InjectMocks` over constructing the tested class manually in `@BeforeEach`
- Prefer `var` for locals initialized by a constructor or builder call
- Extract expected values into named constants only when they appear in multiple test cases; inline single-use values

**Scope**
- Only test business logic and services — never write tests for JPA/Hibernate entities, DTOs, `@Configuration` beans, or Spring Data repositories

finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall