agentleFS
soujavasoujava/agent-skills/skills/microprofile-server/SKILL.md

microprofile-server

Skill10 starsChanged 4 months agoMITView on GitHub

Stack-specific coding rules for long-running Java MicroProfile / Jakarta EE server applications, covering JAX-RS resources, CDI, JSON-P, Bean Validation, MicroProfile Config, health/metrics, persistence integration, testing (unit/integration/system), and Maven project conventions. Use whenever creating, generating, scaffolding, writing, migrating, troubleshooting, or reviewing MicroProfile or Jakarta EE server code. This skill is architecture-neutral — compose it with `sdd4j-bce`, `sdd4j-package-by-feature`, `sdd4j-package-by-layer`, or another architecture skill when the project or user specifies an architecture. Also use this skill when the user mentions MicroProfile, Jakarta EE, JAX-RS, Payara, OpenLiberty, Quarkus with MicroProfile, Helidon, WildFly, or similar long-running Java server runtimes. Not for serverless deployments, one-off Java CLI applications, or Spring Boot services.

The file

Show its rules and text

We split this skill into the rules it gives an agent

72 rules. About 0 are common, 57 are distinctive, and 15 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈57

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 15

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    when no architecture is specified, infer and preserve the existing project organization instead of introducing BCE, package-by-feature, or …

    line 9
  2. Distinctive:

    prefer dependencies in this order: Java SE, MicroProfile APIs, Jakarta EE APIs, and implementations already present in the project

    line 13
  3. Distinctive:

    avoid adding dependencies for problems already solved by MicroProfile, Jakarta EE, Java SE, or the existing project stack

    line 14
  4. Distinctive:

    do not mix multiple JAX-RS/REST implementations unless the existing project already does so deliberately

    line 15
  5. Very specific:

    ask before changing Maven pom.xml, build files, dependency versions, Java version, MicroProfile/Jakarta EE version, or plugin configuration

    line 16
  6. Distinctive:

    prefer a MicroProfile BOM or platform BOM when one is already in use.

    line 17
  7. Distinctive:

    treat MicroProfile / Jakarta EE as the application stack, not as the architecture

    line 20
  8. Distinctive:

    do not rename packages, introduce architectural layers, or reorganize code solely because this skill is active

    line 22
  9. Distinctive:

    when adding new code, place it where equivalent MicroProfile / Jakarta EE components already live

    line 23
  10. Distinctive:

    when no convention exists, choose the smallest clear structure for the requested change and avoid committing the project to a broad …

    line 24
  11. Distinctive:

    keep framework annotations at application entry points, web/API resources, configuration, adapters, and persistence integration points.

    line 25
  12. Distinctive:

    place JAX-RS resources, REST clients, health checks, schedulers, messaging listeners, external API clients, and protocol adapters according …

    line 28
  13. Distinctive:

    keep resources coarse-grained and free of business logic.

    line 30
  14. Distinctive:

    do not implement business logic in JAX-RS resources.

    line 33
  15. Very specific:

    put transaction boundaries on the project's service/application/use-case methods according to the existing convention.

    line 34
  16. Distinctive:

    avoid calling repositories or persistence directly from resources except for trivial generated code explicitly requested by the user

    line 35
  17. Very specific:

    use CDI scopes such as @ApplicationScoped, @RequestScoped, @Dependent, or the project's custom stereotypes for injectable components

    line 39
  18. Distinctive:

    keep application methods independent of HTTP, servlet, resource, and JSON serialization details

    line 40
  19. Distinctive:

    prefer constructor injection when the project style allows it.

    line 42
  20. Distinctive:

    avoid leaking MicroProfile or Jakarta EE framework concerns into domain code unless the project already follows an active-record or …

    line 43
  21. Distinctive:

    if a relation exists in the database, the entity model must carry a corresponding reference, id field, or association.

    line 50
  22. Distinctive:

    place repositories, entity managers, data sources, and persistence integration near the aggregate, feature, service, or persistence package …

    line 54
  23. Distinctive:

    use JPA, Jakarta Data, or the project's chosen persistence technology consistently

    line 55
  24. Distinctive:

    do not expose JPA or persistence-specific types directly in JAX-RS resources unless the existing API contract already exposes them

    line 56
  25. Distinctive:

    prefer explicit query methods or small custom queries over broad generic repository use in business logic

    line 57
  26. Very specific:

    use explicit exceptions such as BadRequestException, NotFoundException, ForbiddenException, etc.

    line 62
  27. Very specific:

    keep exception mapping centralized through ExceptionMapper providers for reusable APIs

    line 64
  28. Distinctive:

    use JSON-P as the default JSON mechanism in MicroProfile applications.

    line 67
  29. Very specific:

    when using JSON-P, record entities should ship with a toJSON() method returning JsonObject and a static fromJSON(JsonObject) factory

    line 69
  30. Distinctive:

    keep JSON-P mapping in the boundary/web layer.

    line 70
  31. Distinctive:

    use JSON-B or custom mapping only when the project already uses it or the MicroProfile implementation favors it

    line 71
  32. Distinctive:

    use Jakarta Bean Validation on request DTOs for syntactic request validation

    line 74
  33. Distinctive:

    place business validation in application/domain code so it remains independent of HTTP and can be tested without JAX-RS

    line 75
  34. Very specific:

    use @Valid at resource method parameters when consuming validated request bodies or parameters

    line 76
  35. Distinctive:

    do not use validation annotations as the only enforcement for domain invariants that must hold outside HTTP requests

    line 77
  36. Very specific:

    use MicroProfile Config (@ConfigProperty or ConfigProvider) consistently with the existing project

    line 80
  37. Very specific:

    prefer typed configuration interfaces or CDI beans over scattered @ConfigProperty fields when more than one related property is used

    line 81
  38. Distinctive:

    keep environment-specific values in environment variables, profiles, or deployment configuration, not hardcoded in source

    line 82
  39. Distinctive:

    do not introduce new config namespaces, property files, or profiles without checking existing conventions first

    line 83
  40. Distinctive:

    avoid reading configuration directly from deep domain code.

    line 84
  41. Distinctive:

    use MicroProfile Health for health checks, MicroProfile Metrics for application metrics, and OpenTelemetry / MicroProfile Telemetry for …

    line 87
  42. Distinctive:

    create custom health checks near the component, feature, adapter, or integration whose health they expose

    line 88
  43. Distinctive:

    create metrics with MicroProfile Metrics or an OpenTelemetry-compatible naming scheme

    line 89
  44. Distinctive:

    avoid high-cardinality metric tags such as user ids, request ids, emails, or raw URLs

    line 90
  45. Distinctive:

    use MicroProfile JWT Auth, Jakarta Security, or the project's existing security mechanism when authentication or authorization is needed

    line 94
  46. Distinctive:

    keep authorization decisions close to resources, handlers, or application use cases.

    line 95
  47. Very specific:

    prefer declarative security (@RolesAllowed, @PermitAll, @DenyAll) on JAX-RS resources when it improves readability and testability

    line 96
  48. Distinctive:

    do not disable authentication, authorization, CORS, or security globally unless the project context explicitly requires it and the user …

    line 97
  49. Distinctive:

    never add secrets, tokens, passwords, or private keys to source files or test fixtures

    line 98
  50. Distinctive:

    write unit tests for application/domain behavior without starting the CDI container when possible

    line 101
  51. Very specific:

    write JAX-RS slice tests with the project's test tooling (e.g.

    line 102
  52. Distinctive:

    write persistence slice tests when verifying repository/query behavior

    line 103
  53. Distinctive:

    write integration tests only when the CDI container, configuration, wiring, or end-to-end behavior is the subject under test

    line 104
  54. Distinctive:

    do not overuse mocks; prefer smaller unit tests or focused slices when possible

    line 105
  55. Very specific:

    create system tests as a separate Maven module ending with -st when the project already has that convention or when the service is tested …

    line 110
  56. Distinctive:

    use MicroProfile REST Client interfaces for testing JAX-RS resources

    line 111
  57. Very specific:

    do not use RestAssured unless the project already standardizes on it.

    line 116
  58. Very specific:

    do not create new @RegisterRestClient(configKey, ...) declarations.

    line 117
  59. Distinctive:

    follow links in JavaDoc to external specifications (MicroProfile, Jakarta EE, Java SE) and use them for code generation

    line 121
  60. Distinctive:

    use popular technical terms from the Java SE, MicroProfile, and Jakarta EE ecosystems as examples in unit tests and JavaDoc

    line 122
  61. Distinctive:

    write brief, to-the-point README.md files for advanced developers

    line 125
  62. Distinctive:

    use precise and concise language.

    line 126
  63. Distinctive:

    do not include detailed project structure file/folder listings.

    line 127
  64. Distinctive:

    do not list every REST endpoint in READMEs.

    line 128
  65. Distinctive:

    if modules are listed, provide links

    line 129
  66. Distinctive:

    do not use the term "Orchestrates".

    line 130
  67. Distinctive:

    do not create or change files on opening existing projects.

    line 134
  68. Distinctive:

    do not generate code initially in an empty project unless the user explicitly asks to scaffold or implement something

    line 135
  69. Distinctive:

    always inspect existing package, test, build, and dependency conventions before adding code

    line 136
  70. Distinctive:

    keep changes minimal and aligned with the project's current MicroProfile / Jakarta EE versions

    line 137
  71. Distinctive:

    do not migrate between MicroProfile or Jakarta EE major versions unless the user explicitly requests a migration

    line 138
  72. Very specific:

    always ask before changing pom.xml

    line 139

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Composition

  • compose with java-conventions for all language-level Java rules (syntax, style, naming, visibility, interfaces/classes, methods/lambdas, streams/collections, exceptions, comments/JavaDoc)
  • compose with an architecture skill when architecture is specified or already present, such as sdd4j-bce, sdd4j-package-by-feature, or sdd4j-package-by-layer
  • when no architecture is specified, infer and preserve the existing project organization instead of introducing BCE, package-by-feature, or package-by-layer by default
  • this skill specializes only the MicroProfile / Jakarta EE server stack and does not restate language-level Java or architecture-level rules

Dependencies

  • prefer dependencies in this order: Java SE, MicroProfile APIs, Jakarta EE APIs, and implementations already present in the project
  • avoid adding dependencies for problems already solved by MicroProfile, Jakarta EE, Java SE, or the existing project stack
  • do not mix multiple JAX-RS/REST implementations unless the existing project already does so deliberately
  • ask before changing Maven pom.xml, build files, dependency versions, Java version, MicroProfile/Jakarta EE version, or plugin configuration
  • prefer a MicroProfile BOM or platform BOM when one is already in use; do not introduce a second platform version unless the user approves

Architecture Fit

  • treat MicroProfile / Jakarta EE as the application stack, not as the architecture
  • preserve the architecture already used by the project, including package-by-feature, package-by-layer, BCE, hexagonal, clean, modular monolith, or a local convention
  • do not rename packages, introduce architectural layers, or reorganize code solely because this skill is active
  • when adding new code, place it where equivalent MicroProfile / Jakarta EE components already live
  • when no convention exists, choose the smallest clear structure for the requested change and avoid committing the project to a broad architecture prematurely
  • keep framework annotations at application entry points, web/API resources, configuration, adapters, and persistence integration points; avoid leaking transport or framework concerns into domain code unless the project already follows a framework-centric model

Web/API Entry Points

  • place JAX-RS resources, REST clients, health checks, schedulers, messaging listeners, external API clients, and protocol adapters according to the existing architecture
  • name JAX-RS resources in plural after the resource they expose, e.g. SpeakersResource rather than SpeakerResource
  • keep resources coarse-grained and free of business logic; validate and translate HTTP input, then delegate to application services, handlers, or use cases
  • declare @Consumes and @Produces at the class level where it clarifies the resource contract; prefer JSON (jakarta.ws.rs.core.MediaType.APPLICATION_JSON)
  • return jakarta.ws.rs.core.Response when status, headers, or empty responses matter; return DTOs or entities directly only for straightforward successful responses
  • do not implement business logic in JAX-RS resources; delegate instead
  • put transaction boundaries on the project's service/application/use-case methods according to the existing convention; when the transaction is intentionally tied to a request or entry point, place it on the resource or entry-point method instead
  • avoid calling repositories or persistence directly from resources except for trivial generated code explicitly requested by the user

Application Logic

  • implement procedural business logic and application use cases in the project's existing service/application/use-case location
  • use CDI scopes such as @ApplicationScoped, @RequestScoped, @Dependent, or the project's custom stereotypes for injectable components
  • keep application methods independent of HTTP, servlet, resource, and JSON serialization details
  • let application methods express use cases in domain terms rather than transport terms
  • prefer constructor injection when the project style allows it; field injection is acceptable when the project or framework conventions require it
  • avoid leaking MicroProfile or Jakarta EE framework concerns into domain code unless the project already follows an active-record or framework-centric model

Domain And Data Model

  • maintain domain objects, data classes, JPA entities, value objects, enums, and domain behavior in the project's existing model/domain/entity location
  • entities maintain state and corresponding behavior
  • model stable value objects as records or enums when appropriate
  • direct references across independent modules, features, or components are allowed when they fit the existing architecture, but aim for maximal cohesion and minimal coupling
  • if a relation exists in the database, the entity model must carry a corresponding reference, id field, or association; the DB schema is the source of truth when it already exists
  • excessive cross-module references or shared configuration are refactoring signals; split, merge, or rebalance responsibilities to restore cohesion

Repositories And Persistence

  • place repositories, entity managers, data sources, and persistence integration near the aggregate, feature, service, or persistence package that owns the persistent concept according to the existing architecture
  • use JPA, Jakarta Data, or the project's chosen persistence technology consistently
  • do not expose JPA or persistence-specific types directly in JAX-RS resources unless the existing API contract already exposes them
  • prefer explicit query methods or small custom queries over broad generic repository use in business logic

Exceptions And HTTP Errors

  • represent domain failures with domain/application exceptions, not HTTP-specific exceptions in application or domain code
  • map exceptions to HTTP status codes using JAX-RS ExceptionMapper or by throwing JAX-RS WebApplicationException subclasses
  • use explicit exceptions such as BadRequestException, NotFoundException, ForbiddenException, etc. for the matching HTTP status; prefer these over constructing Response objects inline
  • for custom exceptions, inherit from WebApplicationException when they are intentionally HTTP-facing
  • keep exception mapping centralized through ExceptionMapper providers for reusable APIs

JSON Serialization

  • use JSON-P as the default JSON mechanism in MicroProfile applications; prefer JSON-P over JSON-B unless the project already uses JSON-B or JSON-B is a better fit
  • map JSON at the web/API edge to request/response DTOs or command/query objects; do not bind external API shapes directly to rich domain entities unless the API is intentionally internal
  • when using JSON-P, record entities should ship with a toJSON() method returning JsonObject and a static fromJSON(JsonObject) factory
  • keep JSON-P mapping in the boundary/web layer; convert to/from domain objects in the boundary or application layer
  • use JSON-B or custom mapping only when the project already uses it or the MicroProfile implementation favors it

Validation

  • use Jakarta Bean Validation on request DTOs for syntactic request validation
  • place business validation in application/domain code so it remains independent of HTTP and can be tested without JAX-RS
  • use @Valid at resource method parameters when consuming validated request bodies or parameters
  • do not use validation annotations as the only enforcement for domain invariants that must hold outside HTTP requests

Configuration

  • use MicroProfile Config (@ConfigProperty or ConfigProvider) consistently with the existing project
  • prefer typed configuration interfaces or CDI beans over scattered @ConfigProperty fields when more than one related property is used
  • keep environment-specific values in environment variables, profiles, or deployment configuration, not hardcoded in source
  • do not introduce new config namespaces, property files, or profiles without checking existing conventions first
  • avoid reading configuration directly from deep domain code; inject typed configuration into CDI-managed components or adapters that need it

Observability

  • use MicroProfile Health for health checks, MicroProfile Metrics for application metrics, and OpenTelemetry / MicroProfile Telemetry for tracing when available
  • create custom health checks near the component, feature, adapter, or integration whose health they expose
  • create metrics with MicroProfile Metrics or an OpenTelemetry-compatible naming scheme
  • avoid high-cardinality metric tags such as user ids, request ids, emails, or raw URLs
  • log at application edges for incoming/outgoing integration events and in application services for meaningful business milestones; do not log sensitive data

Security

  • use MicroProfile JWT Auth, Jakarta Security, or the project's existing security mechanism when authentication or authorization is needed
  • keep authorization decisions close to resources, handlers, or application use cases; do not scatter role checks through domain entities
  • prefer declarative security (@RolesAllowed, @PermitAll, @DenyAll) on JAX-RS resources when it improves readability and testability
  • do not disable authentication, authorization, CORS, or security globally unless the project context explicitly requires it and the user agrees
  • never add secrets, tokens, passwords, or private keys to source files or test fixtures

Testing

  • write unit tests for application/domain behavior without starting the CDI container when possible
  • write JAX-RS slice tests with the project's test tooling (e.g. @ExtendWith(WeldJunit5AutoExtension.class), Arquillian, or implementation-specific test frameworks) when verifying resource behavior
  • write persistence slice tests when verifying repository/query behavior
  • write integration tests only when the CDI container, configuration, wiring, or end-to-end behavior is the subject under test
  • do not overuse mocks; prefer smaller unit tests or focused slices when possible
  • integration tests should follow the project's naming convention; when there is no convention, use *IT for integration tests and keep unit tests as *Test
  • execute relevant tests after every meaningful change unless the user explicitly activates demo/showtime mode

System Tests

  • create system tests as a separate Maven module ending with -st when the project already has that convention or when the service is tested as a deployed process
  • use MicroProfile REST Client interfaces for testing JAX-RS resources
  • REST client interfaces live in src/main/java of the -st module; test classes live in src/test/java of the -st module
  • name client interfaces after the resource with a Client suffix (e.g. GreetingsResource -> GreetingsResourceClient)
  • use @RegisterRestClient(configKey = "service_uri")
  • system tests end with IT suffix
  • do not use RestAssured unless the project already standardizes on it; prefer MicroProfile REST Client or JDK HttpClient
  • do not create new @RegisterRestClient(configKey, ...) declarations; reuse the existing client configuration pattern
  • execute system tests after major service changes when feasible

JavaDoc And Examples

  • follow links in JavaDoc to external specifications (MicroProfile, Jakarta EE, Java SE) and use them for code generation
  • use popular technical terms from the Java SE, MicroProfile, and Jakarta EE ecosystems as examples in unit tests and JavaDoc

README Guidelines

  • write brief, to-the-point README.md files for advanced developers
  • use precise and concise language; avoid generic adjectives like "simple" or "lightweight"
  • do not include detailed project structure file/folder listings; high-level module descriptions are acceptable
  • do not list every REST endpoint in READMEs; link to OpenAPI/API docs when present
  • if modules are listed, provide links
  • do not use the term "Orchestrates"; use more specific alternatives

Project Management

  • on opening existing projects, load AGENTS.md if present before making changes
  • do not create or change files on opening existing projects; stop after initialization and wait for instructions when the user only asked to inspect or initialize
  • do not generate code initially in an empty project unless the user explicitly asks to scaffold or implement something
  • always inspect existing package, test, build, and dependency conventions before adding code
  • keep changes minimal and aligned with the project's current MicroProfile / Jakarta EE versions
  • do not migrate between MicroProfile or Jakarta EE major versions unless the user explicitly requests a migration
  • always ask before changing pom.xml

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.