Home › Java › Quarkus rules

Quarkus rules

Cursor rules for Quarkus 3 services in Java: Quarkus REST, Panache, config mapping, Dev Services, and native-friendly code.

CursorJava

How to use

Save this as .cursor/rules/quarkus.mdc in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.cursor/rules/quarkus.mdcDownload  
---
description: Quarkus conventions
globs: ["src/main/java/**/*.java","src/main/resources/application.properties"]
alwaysApply: false
---

# Quarkus 3

- Run with `./mvnw quarkus:dev` (live reload, Dev Services start databases/brokers in containers). Test with `./mvnw verify`.
- REST endpoints with Quarkus REST (`@Path`, `@GET`, `@POST`) returning DTO `record`s; validate with Hibernate Validator (`@Valid`, constraint annotations). Map errors with `@ServerExceptionMapper`.
- Beans are CDI: `@ApplicationScoped` services with constructor injection. Avoid `@Singleton` unless you need eager, unproxied beans.
- Persistence with Hibernate ORM Panache: entities or repositories (`PanacheRepository<Order>`), queries like `find("status", Status.OPEN).page(0, 50)`. Writes inside `@Transactional` service methods.
- Schema via Flyway migrations (`src/main/resources/db/migration`), not `drop-and-create` outside dev.
- Config with `@ConfigMapping(prefix = "app")` interfaces; secrets from env or a vault, profiles via `%dev.`/`%prod.` prefixes.
- Use Quarkus extensions (`quarkus ext add rest-client-jackson`) instead of raw libraries when one exists.
- Keep code native-image friendly: avoid runtime reflection and dynamic class loading; register with `@RegisterForReflection` when needed.
- Blocking vs reactive: be consistent per endpoint; annotate `@Blocking`/`@NonBlocking` when mixing, and never block the event loop.
- Health and metrics via `smallrye-health` and Micrometer.

## Done when
`./mvnw verify` passes with `@QuarkusTest` tests (REST Assured for endpoints).

More: all Java rules · all Cursor rules

Related rules

Java + Gradle Copilot path instructions

Path-specific Copilot instructions for Java 25 LTS code built with Gradle: records, null safety, and JUnit 5 tests.

GitHub CopilotJava

Cloudflare Agents SDK rules

Cursor rules for stateful AI agents on Cloudflare (agents package): Durable Object state, SQL, scheduling, and WebSockets.

CursorCloudflare Workers / Hono

Django Ninja API rules

Cursor rules for Django Ninja APIs on Django 5.2: routers, Pydantic schemas, auth, async views, and tests.

CursorDjango

Django REST Framework rules

Cursor rules for Django 5 + Django REST Framework APIs: serializers, viewsets, permissions, and query performance.

CursorDjango

Fastify 5 API rules

Cursor rules for Fastify 5 APIs in TypeScript: plugins and encapsulation, JSON schema validation, hooks, and inject tests.

CursorNode.js / TypeScript

Go gRPC service rules

Cursor rules for gRPC services in Go with protobuf, buf for codegen and linting, interceptors, and status errors.

CursorGo

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.