Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Desarrollo guiado por pruebas para Spring Boot usando JUnit 5, Mockito, MockMvc, Testcontainers y JaCoCo. Usar al agregar funcionalidades, corregir bugs o refactorizar.
.claude/skills/affaan-m-springboot-tdd/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 22% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 26% | 0% |
适用于 Spring Boot 服务、覆盖率 80%+(单元 + 集成)的 TDD 指南。
java@ExtendWith(MockitoExtension.class) class MarketServiceTest { @Mock MarketRepository repo; @InjectMocks MarketService service; @Test void createsMarket() { CreateMarketRequest req = new CreateMarketRequest("name", "desc", Instant.now(), List.of("cat")); when(repo.save(any())).thenAnswer(inv -> inv.getArgument(0)); Market result = service.create(req); assertThat(result.name()).isEqualTo("name"); verify(repo).save(any()); } }
模式:
@ParameterizedTest 处理变体java@WebMvcTest(MarketController.class) class MarketControllerTest { @Autowired MockMvc mockMvc; @MockBean MarketService marketService; @Test void returnsMarkets() throws Exception { when(marketService.list(any())).thenReturn(Page.empty()); mockMvc.perform(get("/api/markets")) .andExpect(status().isOk()) .andExpect(jsonPath("$.content").isArray()); } }
java@SpringBootTest @AutoConfigureMockMvc @ActiveProfiles("test") class MarketIntegrationTest { @Autowired MockMvc mockMvc; @Test void createsMarket() throws Exception { mockMvc.perform(post("/api/markets") .contentType(MediaType.APPLICATION_JSON) .content(""" {"name":"Test","description":"Desc","endDate":"2030-01-01T00:00:00Z","categories":["general"]} """)) .andExpect(status().isCreated()); } }
java@DataJpaTest @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) @Import(TestContainersConfig.class) class MarketRepositoryTest { @Autowired MarketRepository repo; @Test void savesAndFinds() { MarketEntity entity = new MarketEntity(); entity.setName("Test"); repo.save(entity); Optional<MarketEntity> found = repo.findByName("Test"); assertThat(found).isPresent(); } }
@DynamicPropertySource 连接,将 JDBC URL 注入 Spring 上下文Maven 片段:
xml<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.14</version> <executions> <execution> <goals><goal>prepare-agent</goal></goals> </execution> <execution> <id>report</id> <phase>verify</phase> <goals><goal>report</goal></goals> </execution> </executions> </plugin>
assertThat)jsonPathassertThatThrownBy(...)javaclass MarketBuilder { private String name = "Test"; MarketBuilder withName(String name) { this.name = name; return this; } Market build() { return new Market(null, name, MarketStatus.ACTIVE); } }
mvn -T 4 test 或 mvn verify./gradlew test jacocoTestReport记住:保持测试快速、隔离且确定。测试行为,而非实现细节。
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | pass→pass | 14,403 | 11,271 | -22% | 1 | 1 | 0% | 2,802 | 3,423 | +22% | 0 | 0 | — |
case-01 | fail→fail | 19,145 | 18,615 | -3% | 1 | 1 | 0% | 4,366 | 5,437 | +25% | 0 | 0 | — |
case-02 | pass→pass | 10,607 | 8,655 | -18% | 1 | 1 | 0% | 2,204 | 2,769 | +26% | 0 | 0 | — |
case-04 | pass→pass | 8,990 | 7,404 | -18% | 1 | 1 | 0% | 1,827 | 2,517 | +38% | 0 | 0 | — |
case-05 | fail→pass | 12,407 | 11,028 | -11% | 1 | 1 | 0% | 2,460 | 3,297 | +34% | 0 | 0 | — |
case-06 | fail→pass | 11,177 | 9,391 | -16% | 1 | 1 | 0% | 2,265 | 3,004 | +33% | 0 | 0 | — |
case-07 | pass→pass | 11,635 | 9,746 | -16% | 1 | 1 | 0% | 2,487 | 3,125 | +26% | 0 | 0 | — |
case-08 | pass→pass | 11,078 | 13,637 | +23% | 1 | 1 | 0% | 2,138 | 3,440 | +61% | 0 | 0 | — |
case-09 | pass→pass | 8,602 | 3,339 | -61% | 1 | 1 | 0% | 1,634 | 1,670 | +2% | 0 | 0 | — |
case-10 | pass→pass | 9,097 | 6,465 | -29% | 1 | 1 | 0% | 1,793 | 2,204 | +23% | 0 | 0 | — |
case-11 | pass→pass | 15,783 | 14,363 | -9% | 1 | 1 | 0% | 3,249 | 4,037 | +24% | 0 | 0 | — |
case-12 | pass→pass | 8,542 | 7,291 | -15% | 1 | 1 | 0% | 1,558 | 2,219 | +42% | 0 | 0 | — |
case-13 | pass→pass | 12,441 | 1,565 | -87% | 1 | 1 | 0% | 2,065 | 1,272 | -38% | 0 | 0 | — |
case-14 | fail→pass | 9,526 | 5,563 | -42% | 1 | 1 | 0% | 1,473 | 1,959 | +33% | 0 | 0 | — |
case-15 | fail→fail | 12,215 | 10,248 | -16% | 1 | 1 | 0% | 2,157 | 3,045 | +41% | 0 | 0 | — |
case-16 | pass→pass | 11,143 | 11,671 | +5% | 1 | 1 | 0% | 1,868 | 3,110 | +66% | 0 | 0 | — |
case-17 | pass→pass | 14,445 | 12,362 | -14% | 1 | 1 | 0% | 2,822 | 3,351 | +19% | 0 | 0 | — |
case-18 | pass→pass | 11,144 | 11,590 | +4% | 1 | 1 | 0% | 1,725 | 3,039 | +76% | 0 | 0 | — |
case-19 | pass→pass | 10,331 | 12,983 | +26% | 1 | 1 | 0% | 2,143 | 3,854 | +80% | 0 | 0 | — |
case-20 | pass→pass | 10,157 | 10,085 | -1% | 1 | 1 | 0% | 1,978 | 2,956 | +49% | 0 | 0 | — |
case-21 | pass→pass | 17,853 | 14,548 | -19% | 1 | 1 | 0% | 3,526 | 4,209 | +19% | 0 | 0 | — |
case-22 | pass→pass | 9,476 | 9,163 | -3% | 1 | 1 | 0% | 1,789 | 2,778 | +55% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.