AGENT SKILL

quarkus-resource

Generate a Quarkus RESTEasy Reactive @Path resource with DTOs, @RegisterForReflection, ExceptionMapper, and @QuarkusTest unit tests.

License 许可
MIT
最近更新
2026-10-27
Stars
★ 0
Forks
1

01 前言 Front Matter

name
quarkus-resource
model
sonnet
visibility
public
description
Generate a Quarkus RESTEasy Reactive @Path resource with DTOs, @RegisterForReflection, ExceptionMapper, and @QuarkusTest unit tests.
allowed-tools
[ "Read", "Write", "Edit", "Bash", "Skill" ]
context-budget
light
requires-capabilities
[ "web.quarkus.framework" ]

03 SKILL.md 正文

Skill: Quarkus Resource Generator

Purpose

Generates a complete Quarkus inbound adapter (resource) layer following the hexagonal architecture pattern. Produces:

  1. JAX-RS @Path resource class (RESTEasy Reactive)
  2. Request/Response DTOs (record types with @RegisterForReflection)
  3. Static mapper class
  4. ExceptionMapper<RuntimeException> (or extends existing)
  5. @QuarkusTest unit tests

Triggers

  • /quarkus-resource <ResourceName> [--operations GET,POST,DELETE] — generate full resource for a resource
  • /quarkus-resource <ResourceName> --crud — generate standard CRUD
  • /quarkus-resource <ResourceName> --read-only — generate GET endpoints only

Parameters

Parameter Required Description
ResourceName Yes PascalCase resource name (e.g., Merchant, Transaction)
--operations No Comma-separated HTTP methods (default: all)
--crud No GET list, GET by id, POST, PUT, DELETE
--read-only No GET list and GET by id only
--path No Override API path (default: /api/v1/{resource-name-plural})
--port No Port interface name (default: {ResourceName}ManagementPort)

Workflow

Step 1 — Read Project Context

Read existing conventions:

  • knowledge/stack-patterns/quarkus/index.md — Quarkus patterns
  • knowledge/layer-templates.md — Layer template patterns
  • knowledge/architecture-hexagonal.md — Hexagonal architecture conventions
  • Existing resources in src/main/java/**/adapter/inbound/ for naming conventions

Step 2 — Generate DTOs

// src/main/java/{package}/adapter/inbound/rest/{ResourceName}Request.java
@RegisterForReflection
public record {ResourceName}Request(
    @NotBlank @Size(max = N) String field1,
    @NotNull Type field2
) {}

// src/main/java/{package}/adapter/inbound/rest/{ResourceName}Response.java
@RegisterForReflection
public record {ResourceName}Response(Long id, String field1, Type field2) {}

Step 3 — Generate Mapper

// src/main/java/{package}/adapter/inbound/rest/{ResourceName}DtoMapper.java
public final class {ResourceName}DtoMapper {
    private {ResourceName}DtoMapper() {}

    public static {DomainType} toDomain({ResourceName}Request request) { ... }
    public static {ResourceName}Response toResponse({DomainType} domain) { ... }
}

Step 4 — Generate Resource

Follow knowledge/stack-patterns/quarkus/index.md §4 RESTEasy Reactive pattern:

// src/main/java/{package}/adapter/inbound/rest/{ResourceName}Resource.java
@Path("{path}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class {ResourceName}Resource {
    // @Inject constructor injection of port
    // Endpoints per --operations with @Transactional on writes
}

Step 5 — Generate/Update ExceptionMapper

Check if SimulatorExceptionMapper (or similar) exists in adapter/inbound/rest/:

  • If exists: add missing switch cases for domain exceptions
  • If not exists: generate new @Provider ExceptionMapper<RuntimeException> following §4 pattern

Step 6 — Generate Tests

// src/test/java/{package}/adapter/inbound/rest/{ResourceName}ResourceTest.java
@QuarkusTest
class {ResourceName}ResourceTest {
    @InjectMock {ResourceName}ManagementPort port;

    // RestAssured-based tests per endpoint per scenario
}

Output Checklist

  • [ ] DTOs are records with @RegisterForReflection
  • [ ] Validation annotations on request fields (@NotBlank, @NotNull, @Size)
  • [ ] @Transactional on POST/PUT/DELETE endpoints
  • [ ] Constructor injection with @Inject (not field injection)
  • [ ] HTTP status codes correct: 200 GET, 201 POST with Response.status(201), 204 DELETE
  • [ ] Switch expression in ExceptionMapper covers all domain exceptions + default
  • [ ] Tests use @QuarkusTest + RestAssured (not @SpringBootTest)
  • [ ] Tests cover: success path, not found (404), conflict (409), validation failure (400)

Knowledge Pack References

  • knowledge/stack-patterns/quarkus/index.md — Quarkus patterns (§4 RESTEasy, exception mapper)
  • knowledge/layer-templates.md — Layer template patterns
  • knowledge/architecture-hexagonal.md — Hexagonal architecture

04 同仓库更多 Skills

review-bench
review-bench/edercnj_ia-dev-environment

x-parallel-eval

Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

parallelism-heuristics

Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-watch-pr-ci

Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-validate-docs

Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-system-architecture

Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.

★ 0
review-bench
review-bench/edercnj_ia-dev-environment

x-update-architecture

Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.

★ 0