mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-19 23:33:07 +08:00
feat: add Quarkus handling
Adds Quarkus handling across the Java skill/reviewer surface, with maintainer follow-up fixes for duplicate catalog entries, required skill sections, localized snippet structure, and current main alignment.\n\nValidation run locally on the final PR head:\n- NODE_PATH=/Users/affoon/GitHub/ECC/everything-claude-code/node_modules node scripts/ci/validate-install-manifests.js\n- NODE_PATH=/Users/affoon/GitHub/ECC/everything-claude-code/node_modules node scripts/ci/validate-skills.js\n- NODE_PATH=/Users/affoon/GitHub/ECC/everything-claude-code/node_modules node scripts/ci/catalog.js --text\n- npx --yes markdownlint-cli docs/ECC-2.0-GA-ROADMAP.md\n- git diff --check\n- NODE_PATH=/Users/affoon/GitHub/ECC/everything-claude-code/node_modules node tests/run-all.js (2324 passed, 0 failed)
This commit is contained in:
@@ -87,7 +87,7 @@ There are 7 selectable category groups below. The detailed confirmation lists th
|
||||
```
|
||||
Question: "Which skill categories do you want to install?"
|
||||
Options:
|
||||
- "Framework & Language" — "Django, Laravel, Spring Boot, Go, Python, Java, Frontend, Backend patterns"
|
||||
- "Framework & Language" — "Django, Laravel, Spring Boot, Quarkus, Go, Python, Java, Frontend, Backend patterns"
|
||||
- "Database" — "PostgreSQL, ClickHouse, JPA/Hibernate patterns"
|
||||
- "Workflow & Quality" — "TDD, verification, learning, security review, compaction"
|
||||
- "Research & APIs" — "Deep research, Exa search, Claude API patterns"
|
||||
@@ -101,7 +101,7 @@ Options:
|
||||
|
||||
For each selected category, print the full list of skills below and ask the user to confirm or deselect specific ones. If the list exceeds 4 items, print the list as text and use `AskUserQuestion` with an "Install all listed" option plus "Other" for the user to paste specific names.
|
||||
|
||||
**Category: Framework & Language (21 skills)**
|
||||
**Category: Framework & Language (25 skills)**
|
||||
|
||||
| Skill | Description |
|
||||
|-------|-------------|
|
||||
@@ -119,9 +119,13 @@ For each selected category, print the full list of skills below and ask the user
|
||||
| `frontend-slides` | Zero-dependency HTML presentations, style previews, and PPTX-to-web conversion |
|
||||
| `golang-patterns` | Idiomatic Go patterns, conventions for robust Go applications |
|
||||
| `golang-testing` | Go testing: table-driven tests, subtests, benchmarks, fuzzing |
|
||||
| `java-coding-standards` | Java coding standards for Spring Boot: naming, immutability, Optional, streams |
|
||||
| `java-coding-standards` | Java coding standards for Spring Boot and Quarkus: naming, immutability, Optional, streams, CDI |
|
||||
| `python-patterns` | Pythonic idioms, PEP 8, type hints, best practices |
|
||||
| `python-testing` | Python testing with pytest, TDD, fixtures, mocking, parametrization |
|
||||
| `quarkus-patterns` | Quarkus architecture, Camel messaging, CDI services, Panache data access |
|
||||
| `quarkus-security` | Quarkus security: JWT/OIDC, RBAC, input validation, secrets management |
|
||||
| `quarkus-tdd` | Quarkus TDD with JUnit 5, Mockito, REST Assured, Camel testing |
|
||||
| `quarkus-verification` | Quarkus verification: build, static analysis, tests, native compilation |
|
||||
| `springboot-patterns` | Spring Boot architecture, REST API, layered services, caching, async |
|
||||
| `springboot-security` | Spring Security: authn/authz, validation, CSRF, secrets, rate limiting |
|
||||
| `springboot-tdd` | Spring Boot TDD with JUnit 5, Mockito, MockMvc, Testcontainers |
|
||||
@@ -275,6 +279,7 @@ grep -rn "skills/" $TARGET/skills/
|
||||
Some skills reference others. Verify these dependencies:
|
||||
- `django-tdd` may reference `django-patterns`
|
||||
- `laravel-tdd` may reference `laravel-patterns`
|
||||
- `quarkus-tdd` may reference `quarkus-patterns`
|
||||
- `springboot-tdd` may reference `springboot-patterns`
|
||||
- `continuous-learning-v2` references `~/.claude/homunculus/` directory
|
||||
- `python-testing` may reference `python-patterns`
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
---
|
||||
name: java-coding-standards
|
||||
description: "Java coding standards for Spring Boot services: naming, immutability, Optional usage, streams, exceptions, generics, and project layout."
|
||||
description: "Java coding standards for Spring Boot and Quarkus services: naming, immutability, Optional usage, streams, exceptions, generics, CDI, reactive patterns, and project layout. Automatically applies framework-specific conventions."
|
||||
origin: ECC
|
||||
---
|
||||
|
||||
# Java Coding Standards
|
||||
|
||||
Standards for readable, maintainable Java (17+) code in Spring Boot services.
|
||||
Standards for readable, maintainable Java (17+) code in Spring Boot and Quarkus services.
|
||||
|
||||
## When to Activate
|
||||
## When to Use
|
||||
|
||||
- Writing or reviewing Java code in Spring Boot projects
|
||||
- Writing or reviewing Java code in Spring Boot or Quarkus projects
|
||||
- Enforcing naming, immutability, or exception handling conventions
|
||||
- Working with records, sealed classes, or pattern matching (Java 17+)
|
||||
- Reviewing use of Optional, streams, or generics
|
||||
- Structuring packages and project layout
|
||||
- **[QUARKUS]**: Working with CDI scopes, Panache entities, or reactive pipelines
|
||||
|
||||
## How It Works
|
||||
|
||||
### Framework Detection
|
||||
|
||||
Before applying standards, determine the framework from the build file:
|
||||
|
||||
- Build file contains `quarkus` → apply **[QUARKUS]** conventions
|
||||
- Build file contains `spring-boot` → apply **[SPRING]** conventions
|
||||
- Neither detected → apply shared conventions only
|
||||
|
||||
## Core Principles
|
||||
|
||||
@@ -22,6 +33,13 @@ Standards for readable, maintainable Java (17+) code in Spring Boot services.
|
||||
- Immutable by default; minimize shared mutable state
|
||||
- Fail fast with meaningful exceptions
|
||||
- Consistent naming and package structure
|
||||
- **[QUARKUS]**: Favor build-time over runtime processing; avoid runtime reflection where possible
|
||||
|
||||
## Examples
|
||||
|
||||
The sections below show concrete Spring Boot, Quarkus, and shared Java examples
|
||||
for naming, immutability, dependency injection, reactive code, exceptions,
|
||||
project layout, logging, configuration, and tests.
|
||||
|
||||
## Naming
|
||||
|
||||
@@ -36,6 +54,12 @@ public Market findBySlug(String slug) {}
|
||||
|
||||
// PASS: Constants: UPPER_SNAKE_CASE
|
||||
private static final int MAX_PAGE_SIZE = 100;
|
||||
|
||||
// PASS: [QUARKUS] JAX-RS resources named as *Resource, not *Controller
|
||||
public class MarketResource {}
|
||||
|
||||
// PASS: [SPRING] REST controllers named as *Controller
|
||||
public class MarketController {}
|
||||
```
|
||||
|
||||
## Immutability
|
||||
@@ -49,14 +73,33 @@ public class Market {
|
||||
private final String name;
|
||||
// getters only, no setters
|
||||
}
|
||||
|
||||
// PASS: [QUARKUS] Panache active-record entities use public fields (Quarkus convention)
|
||||
@Entity
|
||||
public class Market extends PanacheEntity {
|
||||
public String name;
|
||||
public MarketStatus status;
|
||||
// Panache generates accessors at build time; public fields are idiomatic here
|
||||
}
|
||||
|
||||
// PASS: [QUARKUS] Panache MongoDB entities
|
||||
@MongoEntity(collection = "markets")
|
||||
public class Market extends PanacheMongoEntity {
|
||||
public String name;
|
||||
public MarketStatus status;
|
||||
}
|
||||
```
|
||||
|
||||
## Optional Usage
|
||||
|
||||
```java
|
||||
// PASS: Return Optional from find* methods
|
||||
// [SPRING]
|
||||
Optional<Market> market = marketRepository.findBySlug(slug);
|
||||
|
||||
// [QUARKUS] Panache
|
||||
Optional<Market> market = Market.find("slug", slug).firstResultOptional();
|
||||
|
||||
// PASS: Map/flatMap instead of get()
|
||||
return market
|
||||
.map(MarketResponse::from)
|
||||
@@ -75,6 +118,77 @@ List<String> names = markets.stream()
|
||||
// FAIL: Avoid complex nested streams; prefer loops for clarity
|
||||
```
|
||||
|
||||
## Dependency Injection
|
||||
|
||||
```java
|
||||
// PASS: [SPRING] Constructor injection (preferred over @Autowired on fields)
|
||||
@Service
|
||||
public class MarketService {
|
||||
private final MarketRepository marketRepository;
|
||||
|
||||
public MarketService(MarketRepository marketRepository) {
|
||||
this.marketRepository = marketRepository;
|
||||
}
|
||||
}
|
||||
|
||||
// PASS: [QUARKUS] Constructor injection
|
||||
@ApplicationScoped
|
||||
public class MarketService {
|
||||
private final MarketRepository marketRepository;
|
||||
|
||||
@Inject
|
||||
public MarketService(MarketRepository marketRepository) {
|
||||
this.marketRepository = marketRepository;
|
||||
}
|
||||
}
|
||||
|
||||
// PASS: [QUARKUS] Package-private field injection (acceptable in Quarkus — avoids proxy issues)
|
||||
@ApplicationScoped
|
||||
public class MarketService {
|
||||
@Inject
|
||||
MarketRepository marketRepository;
|
||||
}
|
||||
|
||||
// FAIL: [SPRING] Field injection with @Autowired
|
||||
@Autowired
|
||||
private MarketRepository marketRepository; // use constructor injection
|
||||
|
||||
// FAIL: [QUARKUS] @Singleton when interception or lazy init is needed
|
||||
@Singleton // non-proxyable — use @ApplicationScoped instead
|
||||
public class MarketService {}
|
||||
```
|
||||
|
||||
## Reactive Patterns [QUARKUS]
|
||||
|
||||
```java
|
||||
// PASS: Return Uni/Multi from reactive endpoints
|
||||
@GET
|
||||
@Path("/{slug}")
|
||||
public Uni<Market> findBySlug(@PathParam("slug") String slug) {
|
||||
return Market.find("slug", slug)
|
||||
.<Market>firstResult()
|
||||
.onItem().ifNull().failWith(() -> new MarketNotFoundException(slug));
|
||||
}
|
||||
|
||||
// PASS: Non-blocking pipeline composition
|
||||
public Uni<OrderConfirmation> placeOrder(OrderRequest req) {
|
||||
return validateOrder(req)
|
||||
.chain(valid -> persistOrder(valid))
|
||||
.chain(order -> notifyFulfillment(order));
|
||||
}
|
||||
|
||||
// FAIL: Blocking call inside a Uni/Multi pipeline
|
||||
public Uni<Market> find(String slug) {
|
||||
Market m = Market.find("slug", slug).firstResult(); // BLOCKING — breaks event loop
|
||||
return Uni.createFrom().item(m);
|
||||
}
|
||||
|
||||
// FAIL: Subscribing more than once to a shared Uni
|
||||
Uni<Market> shared = fetchMarket(slug);
|
||||
shared.subscribe().with(m -> log(m));
|
||||
shared.subscribe().with(m -> cache(m)); // double subscribe — use Uni.memoize()
|
||||
```
|
||||
|
||||
## Exceptions
|
||||
|
||||
- Use unchecked exceptions for domain errors; wrap technical exceptions with context
|
||||
@@ -85,6 +199,34 @@ List<String> names = markets.stream()
|
||||
throw new MarketNotFoundException(slug);
|
||||
```
|
||||
|
||||
### Centralised Exception Handling
|
||||
|
||||
```java
|
||||
// [SPRING]
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(MarketNotFoundException.class)
|
||||
public ResponseEntity<ErrorResponse> handle(MarketNotFoundException ex) {
|
||||
return ResponseEntity.status(404).body(ErrorResponse.from(ex));
|
||||
}
|
||||
}
|
||||
|
||||
// [QUARKUS] Option A: ExceptionMapper
|
||||
@Provider
|
||||
public class MarketNotFoundMapper implements ExceptionMapper<MarketNotFoundException> {
|
||||
@Override
|
||||
public Response toResponse(MarketNotFoundException ex) {
|
||||
return Response.status(404).entity(ErrorResponse.from(ex)).build();
|
||||
}
|
||||
}
|
||||
|
||||
// [QUARKUS] Option B: @ServerExceptionMapper (RESTEasy Reactive)
|
||||
@ServerExceptionMapper
|
||||
public RestResponse<ErrorResponse> handle(MarketNotFoundException ex) {
|
||||
return RestResponse.status(Status.NOT_FOUND, ErrorResponse.from(ex));
|
||||
}
|
||||
```
|
||||
|
||||
## Generics and Type Safety
|
||||
|
||||
- Avoid raw types; declare generic parameters
|
||||
@@ -94,7 +236,9 @@ throw new MarketNotFoundException(slug);
|
||||
public <T extends Identifiable> Map<Long, T> indexById(Collection<T> items) { ... }
|
||||
```
|
||||
|
||||
## Project Structure (Maven/Gradle)
|
||||
## Project Structure
|
||||
|
||||
### [SPRING] Maven/Gradle
|
||||
|
||||
```
|
||||
src/main/java/com/example/app/
|
||||
@@ -110,6 +254,24 @@ src/main/resources/
|
||||
src/test/java/... (mirrors main)
|
||||
```
|
||||
|
||||
### [QUARKUS] Maven/Gradle
|
||||
|
||||
```
|
||||
src/main/java/com/example/app/
|
||||
config/ # @ConfigMapping, @ConfigProperty beans, Producers
|
||||
resource/ # JAX-RS resources (not "controller")
|
||||
service/
|
||||
repository/ # PanacheRepository implementations (if not using active record)
|
||||
domain/ # JPA/Panache entities, MongoDB entities
|
||||
dto/
|
||||
util/
|
||||
mapper/ # MapStruct mappers (if used)
|
||||
src/main/resources/
|
||||
application.properties # Quarkus convention (YAML supported with quarkus-config-yaml)
|
||||
import.sql # Hibernate auto-import for dev/test
|
||||
src/test/java/... (mirrors main)
|
||||
```
|
||||
|
||||
## Formatting and Style
|
||||
|
||||
- Use 2 or 4 spaces consistently (project standard)
|
||||
@@ -124,24 +286,98 @@ src/test/java/... (mirrors main)
|
||||
- Magic numbers → named constants
|
||||
- Static mutable state → prefer dependency injection
|
||||
- Silent catch blocks → log and act or rethrow
|
||||
- **[QUARKUS]**: `@Singleton` where `@ApplicationScoped` is intended — breaks proxying and interception
|
||||
- **[QUARKUS]**: Mixing `quarkus-resteasy-reactive` and `quarkus-resteasy` (classic) — pick one stack
|
||||
- **[QUARKUS]**: Panache active-record + repository pattern in the same bounded context — pick one
|
||||
|
||||
## Logging
|
||||
|
||||
```java
|
||||
// [SPRING] SLF4J
|
||||
private static final Logger log = LoggerFactory.getLogger(MarketService.class);
|
||||
log.info("fetch_market slug={}", slug);
|
||||
log.error("failed_fetch_market slug={}", slug, ex);
|
||||
|
||||
// [QUARKUS] JBoss Logging (default, zero-cost at build time)
|
||||
private static final Logger log = Logger.getLogger(MarketService.class);
|
||||
log.infof("fetch_market slug=%s", slug);
|
||||
log.errorf(ex, "failed_fetch_market slug=%s", slug);
|
||||
|
||||
// [QUARKUS] Alternative: simplified logging with @Inject
|
||||
@Inject
|
||||
Logger log; // CDI-injected, scoped to declaring class
|
||||
```
|
||||
|
||||
## Null Handling
|
||||
|
||||
- Accept `@Nullable` only when unavoidable; otherwise use `@NonNull`
|
||||
- Use Bean Validation (`@NotNull`, `@NotBlank`) on inputs
|
||||
- **[QUARKUS]**: Apply `@Valid` on `@BeanParam`, `@RestForm`, and request body parameters
|
||||
|
||||
## Configuration
|
||||
|
||||
```java
|
||||
// [SPRING] @ConfigurationProperties
|
||||
@ConfigurationProperties(prefix = "market")
|
||||
public record MarketProperties(int maxPageSize, Duration cacheTtl) {}
|
||||
|
||||
// [QUARKUS] @ConfigMapping (type-safe, build-time validated)
|
||||
@ConfigMapping(prefix = "market")
|
||||
public interface MarketConfig {
|
||||
int maxPageSize();
|
||||
Duration cacheTtl();
|
||||
}
|
||||
|
||||
// [QUARKUS] Simple values with @ConfigProperty
|
||||
@ConfigProperty(name = "market.max-page-size", defaultValue = "100")
|
||||
int maxPageSize;
|
||||
```
|
||||
|
||||
## Testing Expectations
|
||||
|
||||
### Shared
|
||||
- JUnit 5 + AssertJ for fluent assertions
|
||||
- Mockito for mocking; avoid partial mocks where possible
|
||||
- Favor deterministic tests; no hidden sleeps
|
||||
|
||||
### [SPRING]
|
||||
- `@WebMvcTest` for controller slices, `@DataJpaTest` for repository slices
|
||||
- `@SpringBootTest` reserved for full integration tests
|
||||
- `@MockBean` for replacing beans in Spring context
|
||||
|
||||
### [QUARKUS]
|
||||
- Plain JUnit 5 + Mockito for unit tests (no `@QuarkusTest`)
|
||||
- `@QuarkusTest` reserved for CDI integration tests
|
||||
- `@InjectMock` for replacing CDI beans in integration tests
|
||||
- Dev Services for database/Kafka/Redis — avoid manual Testcontainers setup when Dev Services suffice
|
||||
- `@QuarkusTestResource` for custom external service lifecycle
|
||||
|
||||
```java
|
||||
// [SPRING] Controller test
|
||||
@WebMvcTest(MarketController.class)
|
||||
class MarketControllerTest {
|
||||
@Autowired MockMvc mockMvc;
|
||||
@MockBean MarketService marketService;
|
||||
}
|
||||
|
||||
// [QUARKUS] Integration test
|
||||
@QuarkusTest
|
||||
class MarketResourceTest {
|
||||
@InjectMock
|
||||
MarketService marketService;
|
||||
|
||||
@Test
|
||||
void should_return_404_when_market_not_found() {
|
||||
given().when().get("/markets/unknown").then().statusCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
// [QUARKUS] Unit test (no CDI, no @QuarkusTest)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class MarketServiceTest {
|
||||
@Mock MarketRepository marketRepository;
|
||||
@InjectMocks MarketService marketService;
|
||||
}
|
||||
```
|
||||
|
||||
**Remember**: Keep code intentional, typed, and observable. Optimize for maintainability over micro-optimizations unless proven necessary.
|
||||
|
||||
@@ -68,7 +68,7 @@ Before analyzing the prompt, detect the current project context:
|
||||
- `go.mod` → Go
|
||||
- `pyproject.toml` / `requirements.txt` → Python
|
||||
- `Cargo.toml` → Rust
|
||||
- `build.gradle` / `pom.xml` → Java / Kotlin / Spring Boot
|
||||
- `build.gradle` / `pom.xml` → Java / Kotlin (then check for `quarkus` in build file → Quarkus, or `spring-boot` → Spring Boot)
|
||||
- `Package.swift` → Swift
|
||||
- `Gemfile` → Ruby
|
||||
- `composer.json` → PHP
|
||||
@@ -134,7 +134,8 @@ Map intent + scope + tech stack (from Phase 0) to specific ECC components.
|
||||
|------------|--------------|-------|
|
||||
| Python / Django | django-patterns, django-tdd, django-security, django-verification, python-patterns, python-testing | python-reviewer |
|
||||
| Go | golang-patterns, golang-testing | go-reviewer, go-build-resolver |
|
||||
| Spring Boot / Java | springboot-patterns, springboot-tdd, springboot-security, springboot-verification, java-coding-standards, jpa-patterns | code-reviewer |
|
||||
| Spring Boot / Java | springboot-patterns, springboot-tdd, springboot-security, springboot-verification, java-coding-standards, jpa-patterns | java-reviewer |
|
||||
| Quarkus / Java | quarkus-patterns, quarkus-tdd, quarkus-security, quarkus-verification, java-coding-standards, jpa-patterns | java-reviewer |
|
||||
| Kotlin / Android | kotlin-coroutines-flows, compose-multiplatform-patterns, android-clean-architecture | kotlin-reviewer |
|
||||
| TypeScript / React | frontend-patterns, backend-patterns, coding-standards | code-reviewer |
|
||||
| Swift / iOS | swiftui-patterns, swift-concurrency-6-2, swift-actor-persistence, swift-protocol-di-testing | code-reviewer |
|
||||
|
||||
Reference in New Issue
Block a user