Skip to content

Commit 899d988

Browse files
authored
feat(skills): add validation and security skills for Spring Boot, Quarkus, and Micronaut (#688)
* feat(skills): add framework validation and security skills Add six new framework skills for Spring Boot, Quarkus, and Micronaut to cover validation and security separately, and register them in the skills inventory for generation. Made-with: Cursor * feat(skills): regenerate generated skills for new framework rules Publish generated skill outputs for the six new framework validation/security definitions so the skills/ tree stays in sync with skills-generator sources. Made-with: Cursor * feat(skills): expand framework validation and security reference examples Add exhaustive good/bad examples across Spring Boot, Quarkus, and Micronaut validation and security skill references; regenerate published reference markdown under skills/. Made-with: Cursor * feat(skills): improve examples in validation and security reference files - 303: expand error handler for ConstraintViolationException and HandlerMethodValidationException (Spring 6.1+); use .toList() - 304: add SecurityFilterChain oauth2ResourceServer wiring; add AccessDeniedHandler (403) alongside AuthenticationEntryPoint (401) - 403: use .toList(); note Quarkus built-in validation response - 404: add ForbiddenException mapper (403) alongside NotAuthorizedException - 503: add comment to nested-validation bad-example; use HttpResponse.badRequest() and .toList() in exception handler - 504: update to HttpRequestAuthenticationProvider for Micronaut 4; distinguish 401 vs 403 via isForbidden() in AuthorizationException handler - Regenerate skills/ markdown Made-with: Cursor * feat(skills): refine framework validation and security examples Tighten validation and security examples across Spring Boot, Quarkus, and Micronaut so the guidance is more framework-accurate and copy-paste friendly. Made-with: Cursor * refactor(skills): update Spring Boot references to version 4 Made-with: Cursor * feat(skills): add validation and security skills to inventory template Made-with: Cursor * feat(agents): sync framework coders with new validation and security skills Made-with: Cursor * feat(skills): expand framework validation and security triggers Update the six new framework skills with richer descriptions and additional trigger phrases, then regenerate SKILL.md outputs to keep generated artifacts aligned. Made-with: Cursor * docs(readme): add spring cloud vs kubernetes reference link Add an additional reference URL in the Further Reading section to compare Spring Cloud microservices and Kubernetes. Made-with: Cursor * docs(agents): add framework version baseline guidance Document default supported major versions for Spring Boot, Quarkus, and Micronaut, and require confirmation before applying legacy major-version patterns. Made-with: Cursor
1 parent 819f349 commit 899d988

42 files changed

Lines changed: 4439 additions & 42 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/agents/robot-micronaut-coder.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Apply guidance from these Skills when relevant:
2525

2626
- `@501-frameworks-micronaut-core`: Micronaut core (bootstrap, DI, config, scheduling, shutdown)
2727
- `@502-frameworks-micronaut-rest`: Micronaut REST APIs
28+
- `@503-frameworks-micronaut-validation`: Micronaut validation (Bean Validation, custom constraints, error payloads)
29+
- `@504-frameworks-micronaut-security`: Micronaut security (authn/authz, endpoint protection, secure defaults)
2830
- `@511-frameworks-micronaut-jdbc`: programmatic JDBC (DataSource, SQL, transactions)
2931
- `@512-frameworks-micronaut-data`: Micronaut Data (repositories, entities, generated SQL)
3032
- `@513-frameworks-micronaut-db-migrations-flyway`: Micronaut DB migrations (Flyway)

.cursor/agents/robot-quarkus-coder.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Apply guidance from these Skills when relevant:
2424

2525
- `@401-frameworks-quarkus-core`: Quarkus core
2626
- `@402-frameworks-quarkus-rest`: Quarkus REST APIs
27+
- `@403-frameworks-quarkus-validation`: Quarkus validation (Bean Validation, custom constraints, error mapping)
28+
- `@404-frameworks-quarkus-security`: Quarkus security (authn/authz annotations, endpoint protection, secure defaults)
2729
- `@411-frameworks-quarkus-jdbc`: Quarkus JDBC
2830
- `@412-frameworks-quarkus-panache`: Quarkus Panache
2931
- `@413-frameworks-quarkus-db-migrations-flyway`: Quarkus DB migrations (Flyway)

.cursor/agents/robot-spring-boot-coder.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@ Apply guidance from these Skills when relevant:
2424

2525
- `@301-frameworks-spring-boot-core`: Spring Boot core
2626
- `@302-frameworks-spring-boot-rest`: Spring Boot REST APIs
27+
- `@303-frameworks-spring-boot-validation`: Spring Boot validation (Bean Validation, groups, custom validators, error responses)
28+
- `@304-frameworks-spring-boot-security`: Spring Boot security (SecurityFilterChain, authn/authz, secure defaults)
29+
- `@311-frameworks-spring-jdbc`: Spring JDBC
2730
- `@312-frameworks-spring-data-jdbc`: Spring Data JDBC
2831
- `@313-frameworks-spring-db-migrations-flyway`: Flyway database migrations
2932
- `@142-java-functional-programming`: Functional programming patterns
3033
- `@143-java-functional-exception-handling`: Exception handling patterns
31-
- `@130-java-testing-strategies`: Testing Strategies
32-
- `@301-frameworks-spring-boot-core`: Spring Boot Core
33-
- `@302-frameworks-spring-boot-rest`: Spring Boot REST
34-
- `@311-frameworks-spring-jdbc`: Spring Boot JDBC
35-
- `@312-frameworks-spring-data-jdbc`; Spring Boot Data JDBC
36-
- `@313-frameworks-spring-db-migrations-flyway`; Spring Boot DB migrations (Flyway)
34+
- `@130-java-testing-strategies`: Testing strategies
3735
- `@321-frameworks-spring-boot-testing-unit-tests`: Spring Boot unit testing
3836
- `@322-frameworks-spring-boot-testing-integration-tests`: Spring Boot integration testing
3937
- `@323-frameworks-spring-boot-testing-acceptance-tests`: Spring Boot acceptance testing

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ You are an expert Java developer and technical writer for this project.
1616
- **Rule pipeline:** XML → XInclude → XSLT → Markdown cursor rules
1717
- **Site generator:** JBake 2.7.0 with FreeMarker templates → GitHub Pages
1818

19+
### Framework version baseline
20+
21+
- **Spring Boot:** Target **4.0.x** by default;
22+
- **Quarkus:** Target the current **3.x** line by default;
23+
- **Micronaut:** Target the current **4.x** line by default;
24+
1925
## Change workflow
2026

2127
This project uses **OpenSpec** for structured change management and planning:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Java uses JEPs (JDK Enhancement Proposals) to describe new language and platform
135135
- [https://github.com/vercel-labs/skills/issues](https://github.com/vercel-labs/skills/issues)
136136
- [https://openjdk.org/jeps/0](https://openjdk.org/jeps/0)
137137
- [https://jbake.org/docs/latest/](https://jbake.org/docs/latest/)
138+
- https://developers.redhat.com/blog/2016/12/09/spring-cloud-for-microservices-compared-to-kubernetes
138139

139140
## Other developments
140141

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<prompt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd"
4+
id="303-frameworks-spring-boot-validation">
5+
<metadata>
6+
<author>Juan Antonio Breña Moral</author>
7+
<version>0.15.0-SNAPSHOT</version>
8+
<license>Apache-2.0</license>
9+
<description>Use when you need to design, review, or improve validation in Spring Boot applications — including Bean Validation on request DTOs, @Valid/@Validated at API boundaries, constraint groups, custom constraints, @ConfigurationProperties validation, nested DTO validation, and consistent validation error handling. This should trigger for requests such as Add validation support in Spring Boot; Review Spring Boot validation rules; Improve request validation in Spring Boot REST APIs; Add custom Bean Validation constraints in Spring Boot; Validate configuration properties in Spring Boot.</description>
10+
</metadata>
11+
12+
<title>Spring Boot Validation Guidelines</title>
13+
<goal><![CDATA[
14+
Apply Spring Boot validation best practices at API boundaries.
15+
16+
**What is covered in this Skill?**
17+
18+
- Bean Validation annotations on DTOs and command models
19+
- @Valid / @Validated on controllers and method parameters
20+
- Validation groups for create/update workflows
21+
- Custom constraint annotations and validators
22+
- Consistent 400 error responses for validation failures
23+
24+
**Scope:** Apply recommendations based on the reference rules and good/bad examples.
25+
]]></goal>
26+
27+
<constraints>
28+
<constraints-description>Before applying validation changes, ensure the project compiles. After improvements, run full verification.</constraints-description>
29+
<constraint-list>
30+
<constraint>**MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change</constraint>
31+
<constraint>**SAFETY**: If compilation fails, stop immediately</constraint>
32+
<constraint>**VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements</constraint>
33+
<constraint>**BEFORE APPLYING**: Read the reference for detailed rules and examples</constraint>
34+
</constraint-list>
35+
</constraints>
36+
37+
<triggers>
38+
<trigger-list>
39+
<trigger>Add validation support in Spring Boot</trigger>
40+
<trigger>Review Spring Boot validation rules</trigger>
41+
<trigger>Improve request validation in Spring Boot REST APIs</trigger>
42+
<trigger>Add custom Bean Validation constraints in Spring Boot</trigger>
43+
<trigger>Validate configuration properties in Spring Boot</trigger>
44+
<trigger>Improve nested DTO validation in Spring Boot</trigger>
45+
</trigger-list>
46+
</triggers>
47+
48+
<steps>
49+
<step number="1"><step-title>Read reference and assess project context</step-title><step-content>Read `references/303-frameworks-spring-boot-validation.md` and inspect the current project setup before proposing changes.</step-content></step>
50+
<step number="2"><step-title>Gather scope and decide target improvements</step-title><step-content>Identify requested outcomes, constraints, and the minimum safe set of changes to apply.</step-content></step>
51+
<step number="3"><step-title>Apply framework-aligned changes</step-title><step-content>Implement or refactor validation-related configuration/code following the reference patterns and project conventions.</step-content></step>
52+
<step number="4"><step-title>Run verification and report results</step-title><step-content>Execute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.</step-content></step>
53+
</steps>
54+
</prompt>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<prompt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd"
4+
id="304-frameworks-spring-boot-security">
5+
<metadata>
6+
<author>Juan Antonio Breña Moral</author>
7+
<version>0.15.0-SNAPSHOT</version>
8+
<license>Apache-2.0</license>
9+
<description>Use when you need to design, review, or improve security in Spring Boot applications — including SecurityFilterChain, OAuth2/JWT resource server patterns, form login basics, method security (@PreAuthorize), CSRF and CORS for APIs, session fixation, security headers, exception handling, password encoding, and sensitive-data-safe logging. This should trigger for requests such as Add Spring Boot security support; Review Spring Boot security configuration; Improve API authorization in Spring Boot; Add JWT resource server security in Spring Boot; Harden Spring Boot security headers and CSRF settings.</description>
10+
</metadata>
11+
12+
<title>Spring Boot Security Guidelines</title>
13+
<goal><![CDATA[
14+
Apply Spring Boot security best practices with secure-by-default API boundaries.
15+
16+
**What is covered in this Skill?**
17+
18+
- Spring Security configuration and SecurityFilterChain setup
19+
- Authentication and authorization policies for endpoints
20+
- Method-level security (@PreAuthorize / @Secured)
21+
- Principle of least privilege for roles and scopes
22+
- Secure error handling and denial responses
23+
- Sensitive data handling in logs and responses
24+
25+
**Scope:** Apply recommendations based on the reference rules and good/bad examples.
26+
]]></goal>
27+
28+
<constraints>
29+
<constraints-description>Before applying security changes, ensure the project compiles. After improvements, run full verification.</constraints-description>
30+
<constraint-list>
31+
<constraint>**MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change</constraint>
32+
<constraint>**SAFETY**: If compilation fails, stop immediately</constraint>
33+
<constraint>**VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements</constraint>
34+
<constraint>**BEFORE APPLYING**: Read the reference for detailed rules and examples</constraint>
35+
</constraint-list>
36+
</constraints>
37+
38+
<triggers>
39+
<trigger-list>
40+
<trigger>Add Spring Boot security support</trigger>
41+
<trigger>Review Spring Boot security configuration</trigger>
42+
<trigger>Improve API authorization in Spring Boot</trigger>
43+
<trigger>Add JWT resource server security in Spring Boot</trigger>
44+
<trigger>Harden Spring Boot security headers and CSRF settings</trigger>
45+
<trigger>Implement method security with @PreAuthorize in Spring Boot</trigger>
46+
</trigger-list>
47+
</triggers>
48+
49+
<steps>
50+
<step number="1"><step-title>Read reference and assess project context</step-title><step-content>Read `references/304-frameworks-spring-boot-security.md` and inspect the current project setup before proposing changes.</step-content></step>
51+
<step number="2"><step-title>Gather scope and decide target improvements</step-title><step-content>Identify requested outcomes, constraints, and the minimum safe set of changes to apply.</step-content></step>
52+
<step number="3"><step-title>Apply framework-aligned changes</step-title><step-content>Implement or refactor security-related configuration/code following the reference patterns and project conventions.</step-content></step>
53+
<step number="4"><step-title>Run verification and report results</step-title><step-content>Execute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.</step-content></step>
54+
</steps>
55+
</prompt>

skills-generator/src/main/resources/skill-indexes/311-skill.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
<author>Juan Antonio Breña Moral</author>
77
<version>0.15.0-SNAPSHOT</version>
88
<license>Apache-2.0</license>
9-
<description>Use when you need to write or review programmatic JDBC with Springincluding JdbcClient (Spring Framework 6.1+) as the default API, JdbcTemplate only where batch/streaming APIs require JdbcOperations, NamedParameterJdbcTemplate for legacy named-param code, parameterized SQL, RowMapper mapping to records, batch operations, transactions, safe handling of generated keys, DataAccessException handling, read-only transactions, streaming large result sets, and @JdbcTest slice testing. This should trigger for requests such as Review Java code for Spring JDBC (JdbcTemplate, JdbcClient, NamedParameterJdbcTemplate); Apply best practices for Spring JDBC data access in Java code; Detect and fix SQL injection risks in JDBC code; Improve transaction boundaries or exception handling for JDBC operations.</description>
9+
<description>Use when you need to write or review programmatic JDBC with Spring — including JdbcClient (Spring Framework 7+) as the default API, JdbcTemplate only where batch/streaming APIs require JdbcOperations, NamedParameterJdbcTemplate for legacy named-param code, parameterized SQL, RowMapper mapping to records, batch operations, transactions, safe handling of generated keys, DataAccessException handling, read-only transactions, streaming large result sets, and @JdbcTest slice testing. This should trigger for requests such as Review Java code for Spring JDBC (JdbcTemplate, JdbcClient, NamedParameterJdbcTemplate); Apply best practices for Spring JDBC data access in Java code; Detect and fix SQL injection risks in JDBC code; Improve transaction boundaries or exception handling for JDBC operations.</description>
1010
</metadata>
1111

12-
<title>Spring JDBCJdbcClient (Spring Framework 6.1+)</title>
12+
<title>Spring JDBC — JdbcClient (Spring Framework 7+)</title>
1313
<goal><![CDATA[
1414
Apply Spring JDBC guidelines with JdbcClient as the default; use JdbcTemplate / NamedParameterJdbcTemplate only for legacy code or APIs not covered by JdbcClient (batch updates, KeyHolder, RowCallbackHandler streaming).
1515
1616
**What is covered in this Skill?**
1717
1818
- Parameterized SQL (never concatenate user input)
19-
- JdbcClient fluent API (Spring Framework 6.1+) — preferred for queries and updates
19+
- JdbcClient fluent API (Spring Framework 7+) — preferred for queries and updates
2020
- Named parameters via JdbcClient; NamedParameterJdbcTemplate for legacy migration
2121
- RowMapper, query(Class), and records
2222
- Batch operations and generated keys (JdbcTemplate / JdbcOperations where needed)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<prompt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd"
4+
id="403-frameworks-quarkus-validation">
5+
<metadata>
6+
<author>Juan Antonio Breña Moral</author>
7+
<version>0.15.0-SNAPSHOT</version>
8+
<license>Apache-2.0</license>
9+
<description>Use when you need to design, review, or improve validation in Quarkus applications — including Bean Validation on JAX-RS resources, @Valid on parameters and CDI beans, constraint groups, @ConfigMapping validation, custom constraints, nested DTO validation, and ExceptionMapper-based error mapping. This should trigger for requests such as Add validation support in Quarkus; Review Quarkus validation rules; Improve request validation in Quarkus REST APIs; Add custom validation constraints in Quarkus; Validate Quarkus @ConfigMapping properties.</description>
10+
</metadata>
11+
12+
<title>Quarkus Validation Guidelines</title>
13+
<goal><![CDATA[
14+
Apply Quarkus validation best practices at REST boundaries.
15+
16+
**What is covered in this Skill?**
17+
18+
- Bean Validation annotations on DTOs and command models
19+
- @Valid and boundary validation in Jakarta REST resources
20+
- Validation groups and custom constraints
21+
- Validation error mapping for client-safe responses
22+
- Consistent handling of invalid inputs across endpoints
23+
24+
**Scope:** Apply recommendations based on the reference rules and good/bad examples.
25+
]]></goal>
26+
27+
<constraints>
28+
<constraints-description>Before applying validation changes, ensure the project compiles. After improvements, run full verification.</constraints-description>
29+
<constraint-list>
30+
<constraint>**MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change</constraint>
31+
<constraint>**SAFETY**: If compilation fails, stop immediately</constraint>
32+
<constraint>**VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements</constraint>
33+
<constraint>**BEFORE APPLYING**: Read the reference for detailed rules and examples</constraint>
34+
</constraint-list>
35+
</constraints>
36+
37+
<triggers>
38+
<trigger-list>
39+
<trigger>Add validation support in Quarkus</trigger>
40+
<trigger>Review Quarkus validation rules</trigger>
41+
<trigger>Improve request validation in Quarkus REST APIs</trigger>
42+
<trigger>Add custom validation constraints in Quarkus</trigger>
43+
<trigger>Validate Quarkus @ConfigMapping properties</trigger>
44+
<trigger>Improve validation error mapping with ExceptionMapper in Quarkus</trigger>
45+
</trigger-list>
46+
</triggers>
47+
48+
<steps>
49+
<step number="1"><step-title>Read reference and assess project context</step-title><step-content>Read `references/403-frameworks-quarkus-validation.md` and inspect the current project setup before proposing changes.</step-content></step>
50+
<step number="2"><step-title>Gather scope and decide target improvements</step-title><step-content>Identify requested outcomes, constraints, and the minimum safe set of changes to apply.</step-content></step>
51+
<step number="3"><step-title>Apply framework-aligned changes</step-title><step-content>Implement or refactor validation-related configuration/code following the reference patterns and project conventions.</step-content></step>
52+
<step number="4"><step-title>Run verification and report results</step-title><step-content>Execute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.</step-content></step>
53+
</steps>
54+
</prompt>

0 commit comments

Comments
 (0)