test-slice

test-slice is a skill for Claude Code, Codex from ShipWithAI/shipwithai-plugins. It costs 106 tokens per session (810 once invoked), scanned A, original, MIT.

A scaffolding guide for focused Spring tests that load only one application layer. `@DataJpaTest` checks database-related code, while `@WebMvcTest` checks web controllers; `@SpringBootTest` loads the full application.

In plain words
What is it for?
Use it to create persistence tests, controller tests, or full integration tests when behavior crosses multiple layers.
Why use it?
Narrow tests start faster and make failures easier to trace to the affected layer.

Skill for Claude CodeCodex

Part of the shipwithai-java-backend-toolkit plugin — 11 skills, 1 agent shipped together

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.

agentmods
npx agentmods add skills/shipwithai/shipwithai-plugins/test-slice
Any agent
npx skills add ShipWithAI/shipwithai-plugins --skill test-slice
Clone the repo
git clone --depth 1 https://github.com/ShipWithAI/shipwithai-plugins

Made for: Claude Code, Codex.

Or install shipwithai-java-backend-toolkit, the plugin that ships this one along with the rest of its 11 skills, 1 agent.

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 test-slice

README.md
[![agentmods](https://agentmods.dev/badge/skills/shipwithai/shipwithai-plugins/test-slice.svg)](https://agentmods.dev/skills/shipwithai/shipwithai-plugins/test-slice)
Your own site
<a href="https://agentmods.dev/skills/shipwithai/shipwithai-plugins/test-slice"><img src="https://agentmods.dev/badge/skills/shipwithai/shipwithai-plugins/test-slice.svg" alt="Measured on agentmods" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 810 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00106 $0.00810
Opus 5 $0.00053 $0.00405
Sonnet 5 $0.00021 $0.00162
Haiku 4.5 $0.00011 $0.00081

Measured 3d ago against content hash d01101d3b69d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-slice 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 3d 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.

plugins/java-backend-toolkit/skills/test-slice/SKILL.md · 63 lines

How it starts

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

Test Slice — Scaffold

A slice test loads only the beans for one layer, so it's fast and its failure points straight at that layer. Use the narrowest slice that still proves the behavior; only escalate to @SpringBootTest when the test genuinely spans layers (then see the integration-test skill for the Testcontainers full-stack case).

Step 1 — Pick the slice

  • @DataJpaTest — repositories, entity mappings, custom queries. Loads JPA only, each test runs in a transaction rolled back at the end. Embedded DB by default; point it at real Postgres with @AutoConfigureTestDatabase(replace = NONE) + Testcontainers.
  • @WebMvcTest(XController.class) — controller routing, JSON, validation, status codes, error mapping. Loads the MVC layer only; the service is a mock.
  • Full @SpringBootTest — only when the behavior crosses controller → service → repository in one flow. Heavier; don't default to it.

Step 2 — Detect conventions

  • Test framework: JUnit 5 + AssertJ assumed; match Mockito/Hamcrest if the project differs.
  • Mock annotation by version: @MockitoBean (Spring Boot 3.4+) vs @MockBean (≤ 3.3, deprecated in 3.4). Check the Boot version and use the right one.
  • Mirror the existing src/test/java package layout and naming (*Test under Surefire).

Step 3 — Render templates

From assets/, substitute {{PACKAGE}}, {{ENTITY}}, {{ENTITY_LOWER}}:

  • DataJpaTest.java.tmpl<pkg>/{{ENTITY}}RepositoryTest.java — autowires the repository + TestEntityManager, asserts with AssertJ.
  • WebMvcTest.java.tmpl<pkg>/{{ENTITY}}ControllerTest.javaMockMvc drives the controller, @MockitoBean {{ENTITY}}Service stubs the dependency, jsonPath checks the body.

Step 4 — Report

Created:
  src/test/java/.../<Entity>RepositoryTest.java   (@DataJpaTest, rolls back per test)
  src/test/java/.../<Entity>ControllerTest.java    (@WebMvcTest, MockMvc + mocked service)

State which slice(s) you generated and which mock annotation matches the Boot version.

Read the full file on GitHub · 63 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 63 lines · 106 tokens per session scan A d01101d3b69d

Subscribe to this mod's changes

test-slice is a skill published in the GitHub repository ShipWithAI/shipwithai-plugins (10 stars, last pushed 21d ago), licensed MIT. It adds 106 tokens to every session and 810 once invoked, about $0.0005 per session on Opus 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-08-31.

Related

Other skills, from other repositories