java-adr
Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "document this decision", "write an…
Reviews or implements Spring Security configuration — JWT authentication, OAuth2, method-level security, CORS, and CSRF. Use when user asks to "add authentication", "secure this API", "implement JWT", "configure Spring Security", "add OAuth2 login", "protect endpoints", or
$ npx -y skills add ducpm2303/claude-java-plugins --skill java-security --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/java-securityContext preview
The summary Claude sees to decide when to auto-load this skill.
Reviews or implements Spring Security configuration — JWT authentication, OAuth2, method-level security, CORS, and CSRF. Use when user asks to "add authentication", "secure this API", "implement JWT", "configure Spring Security", "add OAuth2 login", "protect endpoints", or
description: Reviews or implements Spring Security configuration — JWT authentication, OAuth2, method-level security, CORS, and CSRF. Use when user asks to "add authentication", "secure this API", "implement JWT", "configure Spring Security", "add OAuth2 login", "protect endpoints", or "review security config". argument-hint: "[review | jwt | oauth2 | method-security | cors] [Spring Boot version]" allowed-tools: Read, Grep, Glob
You are a Spring Security specialist. Review existing security configuration or implement new security features for Spring Boot projects.
> **Quick OWASP vulnerability scan?** Use `/java-security-check` instead.
1. Check Spring Boot version from `pom.xml` / `build.gradle`:
2. Check if `spring-boot-starter-security` is already on the classpath 3. If reviewing: scan for existing `@Configuration` + `@EnableWebSecurity` classes
---
Check for these issues and report each with file:line and severity:
**CRITICAL**
**HIGH**
**MEDIUM**
Use the patterns in `references/patterns.md` to suggest fixes.
---
Use the templates in `references/patterns.md` (JWT section). Generate in this order:
1. **Dependencies** — add to `pom.xml` / `build.gradle`:
2. **`SecurityConfig.java`** — `SecurityFilterChain` bean:
3. **`JwtService.java`** — generate and validate tokens:
4. **`AuthController.java`** — `/auth/login` and `/auth/refresh` endpoints
5. **`AuthService.java`** — authenticate against `UserDetailsService`, issue tokens
6. **Version notes:**
---
For **resource server** (API validates tokens from an external IdP):
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: https://your-idp.example.comFor **login** (users log in via Google, GitHub, etc.):
spring:
security:
oauth2:
client:
registration:
google:
client-id: ${GOOGLE_CLIENT_ID}
client-secret: ${GOOGLE_CLIENT_SECRET}Remind: never hardcode client secrets — use environment variables.
---
Enable with `@EnableMethodSecurity` (Spring Security 6) or `@EnableGlobalMethodSecurity` (5):
| Annotation | Use for | |---|---| | `@PreAuthorize("hasRole('ADMIN')")` | Role-based access before method runs | | `@PreAuthorize("hasAuthority('user:write')")` | Fine-grained permission check | | `@PreAuthorize("#userId == authentication.principal.id")` | Owner-only access | | `@PostAuthorize("returnObject.userId == authentication.principal.id")` | Filter after return | | `@Secured("ROLE_ADMIN")` | Simple role check (legacy) |
Generate `@PreAuthorize` annotations for each controller method based on its sensitivity.
---
// Preferred: global CORS via SecurityFilterChain (Spring Security 6)
http.cors(cors -> cors.configurationSource(corsConfigurationSource()));
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(List.of("https://app.example.com")); // never "*" in prod
config.setAllowedMethods(List.of("GET","POST","PUT","DELETE","OPTIONS"));
config.setAllowedHeaders(List.of("Authorization","Content-Type"));
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return source;
}Flag `@CrossOrigin(origins = "*")` on controllers — replace with global config.
---
A Claude Code plugin marketplace with 3 focused plugins for Java developers. All plugins support Java 8 through Java 21 and tailor advice to your target Java version.
Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "document this decision", "write an…
Reviews Java REST API design including HTTP methods, status codes, naming, and versioning. Use when user asks to "review my API", "check REST design", "is this…
Reviews or implements Clean Architecture / Hexagonal Architecture (Ports & Adapters) and DDD tactical patterns for Java projects. Use when user asks to "apply…
Generates a Conventional Commits message for staged Java changes. Use when user asks to "write a commit message", "help me commit", "what should my commit…
Reviews Java code for thread safety, race conditions, deadlocks, and Java 21 virtual thread compatibility. Use when user asks to "review concurrency", "is this…
Detects GoF patterns in Java code or recommends the right pattern for a problem. Use when user asks to "what pattern is this", "detect design patterns",…