testing-patterns

testing-patterns is a skill for Claude Code from piomin/claude-ai-spring-boot. It costs 46 tokens per session (3,179 once invoked), scanned A, original, Apache-2.0.

Testing guidance for Spring Boot applications using JUnit 5, Mockito, MockMvc, and Testcontainers. It covers unit tests for one class, tests for one application layer, and integration tests that exercise multiple parts together.

In plain words
What is it for?
Use it to write tests, add test coverage, investigate test failures, and decide between unit, slice, and integration tests for Spring Boot code.
Why use it?
It helps developers choose a test scope and cover both successful and failing cases. It also provides patterns for testing services, controllers, repositories, and full application flows.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the spring-boot-template plugin — 10 skills, 7 agents shipped together

Good fit Use it to write tests, add test coverage, investigate test failures, and decide between unit, slice, and integration tests for Spring Boot code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/piomin/claude-ai-spring-boot/testing-patterns
About the project

piomin/claude-ai-spring-boot is a starter template for creating Spring Boot applications with Claude Code. Developers clone it as a structured foundation when using Claude Code to generate Spring Boot projects.

piomin/claude-ai-spring-boot · 1,473 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add piomin/claude-ai-spring-boot --skill testing-patterns
Clone the repo
git clone --depth 1 https://github.com/piomin/claude-ai-spring-boot

Made for: Claude Code.

Or install spring-boot-template, the plugin that ships this one along with the rest of its 10 skills, 7 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/piomin/claude-ai-spring-boot/testing-patterns/github.svg)](https://agentmods.dev/skills/piomin/claude-ai-spring-boot/testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/piomin/claude-ai-spring-boot/testing-patterns"><img src="https://agentmods.dev/badge/skills/piomin/claude-ai-spring-boot/testing-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/piomin/claude-ai-spring-boot/testing-patterns"><img src="https://agentmods.dev/badge/skills/piomin/claude-ai-spring-boot/testing-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,179 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.03179
Opus 5.5 $0.00018 $0.01272
Sonnet 5.5 $0.00009 $0.00636
Haiku 4.5 $0.00005 $0.00318

Measured 13d ago against content hash 84ee0ab0858d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/testing-patterns/SKILL.md · 428 lines

How it starts

The opening of the file, as written. The whole thing — 428 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Patterns Skill

Testing strategies for Spring Boot applications. Always write both positive and negative test cases.

When to Use

  • "write tests" / "add test coverage" / "test this"
  • Test failures or debugging test issues
  • Choosing between unit, slice, and integration tests

Test Pyramid

Level Annotation Speed Scope When to Use
Unit @ExtendWith(MockitoExtension.class) Fast Single class Business logic in services
Slice @WebMvcTest, @DataJpaTest Medium One layer Controllers, repositories
Integration @SpringBootTest Slow Full app End-to-end flows, cross-layer

Unit Tests (Service Layer)

@ExtendWith(MockitoExtension.class)
class OrderServiceTest {

    @Mock
    private OrderRepository orderRepository;

    @Mock
    private ProductService productService;

    @InjectMocks
    private OrderService orderService;

    // ✅ Positive test
    @Test
    @DisplayName("Should create order with valid items")
    void shouldCreateOrder() {
        // Given
        var request = new OrderRequest(List.of(
            new OrderItem(1L, 2)
        ));
        var product = new Product();
        product.setId(1L);
        product.setPrice(new BigDecimal("10.00"));

        when(productService.findById(1L)).thenReturn(product);
        when(orderRepository.save(any(Order.class))).thenAnswer(inv -> {
            Order o = inv.getArgument(0);
            o.setId(1L);
            return o;
        });

        // When
        Order result = orderService.create(request);

        // Then
        assertThat(result.getId()).isEqualTo(1L);
        verify(orderRepository).save(any(Order.class));
    }

    // ✅ Negative test
    @Test
    @DisplayName("Should throw when product not found")
    void shouldThrowWhenProductNotFound() {
        // Given
        var request = new OrderRequest(List.of(
            new OrderItem(999L, 1)
        ));
        when(productService.findById(999L))
            .thenThrow(new EntityNotFoundException("Product not found"));

        // When & Then
        assertThatThrownBy(() -> orderService.create(request))
            .isInstanceOf(EntityNotFoundException.class)
            .hasMessageContaining("Product not found");

        verify(orderRepository, never()).save(any());
    }

    // ✅ Negative test - empty input
    @Test
    @DisplayName("Should throw when order has no items")
    void shouldThrowWhenNoItems() {
        var request = new OrderRequest(List.of());

        assertThatThrownBy(() -> orderService.create(request))
            .isInstanceOf(IllegalArgumentException.class);
    }
}

Read the full file on GitHub · 428 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago Changed · +2 lines 84ee0ab0858d
  2. 1mo ago Changed · +55 lines 75ee83991770
  3. 1mo ago Changed · +22 lines 9ece648c5d9c
  4. 1mo ago First seen · 349 lines · 46 tokens per session scan A 94eb661c0d07

Subscribe to this mod's changes

testing-patterns is a skill published in the GitHub repository piomin/claude-ai-spring-boot (1,473 stars, last pushed 4d ago), licensed Apache-2.0. It adds 46 tokens to every session and 3,179 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-17.

Related

testing-patterns compared with skills from other repositories

testing-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
testing-patternspiomin/claude-ai-spring-bootSkill1.5k4d agoApache-2.0A46Claude Code
test-runnerPrismer-AI/PrismerCloudSkill1.4k1mo agoMITA59Claude Code
Docker TestcontainersPramodDutta/qaskillsSkill25328d agoMITA42Claude Code, Codex
Android Testingniels-emmer/myaceSkill1yesterdayMITA23Claude Code, Codex
react-testingaps08/fullstack-clean-architectureSkill22mo agoApache-2.0A24Claude Code, Codex
source-command-swarm-testingayushcodes10/echo-memSkill22mo agoApache-2.0A15Claude Code, Codex
source-command-sparc-testerayushcodes10/echo-memSkill22mo agoApache-2.0A18Claude Code, Codex