Skip to content
Back to skills

Spring Feature

ASecurity

Checklist for adding a backend endpoint or feature slice end to end (migration → entity → repository → service → DTO records → controller → errors → tests → OpenAPI). Use whenever adding or changing a REST endpoint in backend/.

  • 30 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 8, 2026
developmentsqlspringapibackendsecurity

Works with

  • api

Security analysis

A100/100

Scanned November 8, 2026

npx -y skills add majiayu000/claude-skill-registry-data --skill spring-feature --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spring Feature?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spring Feature
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-spring-feature/badge)](https://www.skillsdirectory.com/skills/majiayu000-spring-feature)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: spring-feature
description: Checklist for adding a backend endpoint or feature slice end to end (migration → entity → repository → service → DTO records → controller → errors → tests → OpenAPI). Use whenever adding or changing a REST endpoint in backend/.
argument-hint: "<METHOD /api/v1/path and purpose>"
---

# /spring-feature: add a backend slice

Follow `backend/CLAUDE.md`. Work top to bottom. Skip steps that don't apply, and say which ones you skipped.

1. **Contract first.** Write the request/response record shapes and status codes, and confirm them with the user if they're non-trivial.
2. **Migration** (if schema changes): new `V{n}__*.sql`. Add indexes for the query you're about to write. Update `docs/DATA_MODEL.md`.
3. **Entity**: protected no-arg constructor, meaningful constructor, getters, intention-revealing methods, `@ManyToOne(fetch = LAZY)`,
   `@Enumerated(EnumType.STRING)`.
4. **Repository**: user-scoped finders (`findByIdAndUserId`). Use a projection record for read-heavy or aggregate queries.
5. **Service**: package-private unless another feature needs it. `@Transactional` / `@Transactional(readOnly = true)`.
   Map entity → DTO here. Throw domain exceptions (`XNotFoundException`) for the advice to translate.
6. **DTOs**: records with Bean Validation annotations on requests. Use a static `from(Entity)` factory on the response record, or a small mapper method in the service.
7. **Controller**: thin. `@Valid @RequestBody`, authenticated user via `@AuthenticationPrincipal` (once auth exists).
   Use 201 + `Location` for creates and 204 for empty responses.
8. **Errors**: new exception types registered in the global `@RestControllerAdvice` → `ProblemDetail`.
9. **Tests**:
   - pure logic → plain JUnit
   - controller → `@WebMvcTest` (happy path, validation 400, not-found 404, and 401/403 once auth exists)
   - repository/native SQL → `@DataJpaTest` + Testcontainers
   - one `@SpringBootTest` happy path if the slice crosses modules
10. **Security check**: is every query scoped by user? Is anything sensitive logged or returned?
11. **OpenAPI**: check `/v3/api-docs` looks right, and remind the user to run `npm run gen:api` in mobile.
12. Run `./mvnw verify` and report results.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.