|
| 1 | +--- |
| 2 | +name: java |
| 3 | +description: Umfassende Java-Entwicklungsrichtlinien für Backend-Projekte. Enthält Konventionen, Integrationen (PostgreSQL, Javalin, Jackson, Log4j2), Patterns (Clean Architecture, Repository) und Build-Konfiguration (Maven). Triggers auf Java-Code, REST APIs, Datenbank, jOOQ, Flyway, DTOs, Records, Logging, Properties, Identifiers, Security. |
| 4 | +# GENERIERT aus personal/skills-ref/java/ — nicht hier editieren; Aenderungen gehoeren nach ~/.claude/skills-ref/java/. |
| 5 | +source: personal-provider-ref |
| 6 | +ref-hash: sha256:8a4c909743dc64a6c65624290ae533a0c33027f19ad593362f2e0606491304d9 |
| 7 | +--- |
| 8 | + |
| 9 | +# Java Development Guide |
| 10 | + |
| 11 | +Vollständige Entwicklungsrichtlinien für Java-Backend-Projekte. |
| 12 | + |
| 13 | +## Quick Reference |
| 14 | + |
| 15 | +| Thema | Konvention | |
| 16 | +|-------|------------| |
| 17 | +| **Klassen/Records** | PascalCase, Suffix: `*Dto`, `*Repository`, `*Service` | |
| 18 | +| **Methoden** | camelCase, Prefix: `find*`, `create*`, `update*`, `delete*` | |
| 19 | +| **Private Felder** | `_underscorePrefix` | |
| 20 | +| **Null-Handling** | `Optional<T>` statt null | |
| 21 | +| **Collections** | Eclipse Collections (immutable) | |
| 22 | +| **JSON** | Jackson mit Field-Visibility | |
| 23 | +| **Database** | jOOQ + Flyway + HikariCP | |
| 24 | +| **HTTP Server** | Javalin | |
| 25 | +| **Logging** | Log4j2 + SLF4J (JSON) | |
| 26 | +| **IDs** | UUIDv7 | |
| 27 | +| **Build** | Maven Multi-Module | |
| 28 | + |
| 29 | +## Rules by Priority |
| 30 | + |
| 31 | +### Conventions (Immer anwenden) |
| 32 | + |
| 33 | +| Rule | Impact | Beschreibung | |
| 34 | +|------|--------|--------------| |
| 35 | +| [convention-naming](rules/convention-naming.md) | HIGH | Klassen, Interfaces, Methoden, Variablen | |
| 36 | +| [convention-dtos](rules/convention-dtos.md) | HIGH | Records, Klassen-DTOs, Sealed Classes | |
| 37 | +| [convention-null-handling](rules/convention-null-handling.md) | HIGH | Optional, var, final | |
| 38 | +| [convention-formatting](rules/convention-formatting.md) | MEDIUM | Einrückung, Klammern, Leerzeilen | |
| 39 | +| [convention-imports](rules/convention-imports.md) | MEDIUM | Import-Reihenfolge | |
| 40 | + |
| 41 | +### Integrations (Bei Bedarf) |
| 42 | + |
| 43 | +| Rule | Impact | Beschreibung | |
| 44 | +|------|--------|--------------| |
| 45 | +| [integration-database-postgres](rules/integration-database-postgres.md) | CRITICAL | jOOQ, Flyway, HikariCP, Auditing | |
| 46 | +| [integration-http-server-javalin](rules/integration-http-server-javalin.md) | CRITICAL | REST Endpoints, Exception Handler | |
| 47 | +| [integration-json-jackson](rules/integration-json-jackson.md) | HIGH | ObjectMapper, Annotations, SubTypes | |
| 48 | +| [integration-logging-log4j2](rules/integration-logging-log4j2.md) | HIGH | Structured JSON Logging, MDC | |
| 49 | +| [integration-collections-eclipse](rules/integration-collections-eclipse.md) | HIGH | ImmutableList, ImmutableMap | |
| 50 | +| [integration-identifiers](rules/integration-identifiers.md) | HIGH | UUIDv7, ULID, Codecs | |
| 51 | +| [integration-configuration-properties](rules/integration-configuration-properties.md) | MEDIUM | Typisierte Properties | |
| 52 | +| [integration-http-client-retrofit](rules/integration-http-client-retrofit.md) | MEDIUM | REST Client mit OkHttp | |
| 53 | +| [integration-dependency-injection](rules/integration-dependency-injection.md) | MEDIUM | JUseCase Inject, AspectJ | |
| 54 | +| [integration-security-password4j](rules/integration-security-password4j.md) | MEDIUM | Argon2, BCrypt Hashing | |
| 55 | +| [integration-security-password-policy](rules/integration-security-password-policy.md) | MEDIUM | Passay Validierung | |
| 56 | +| [integration-sqids](rules/integration-sqids.md) | LOW | Kurze URL-sichere IDs | |
| 57 | +| [integration-primitives](rules/integration-primitives.md) | LOW | Bytes, Hashing, Codecs | |
| 58 | +| [integration-filesearch](rules/integration-filesearch.md) | LOW | Dateisystem-Suche | |
| 59 | +| [integration-useragent-parser](rules/integration-useragent-parser.md) | LOW | Browser/OS Erkennung | |
| 60 | +| [integration-ip-geolocation](rules/integration-ip-geolocation.md) | LOW | MaxMind GeoLite2 | |
| 61 | +| [integration-database-dynamodb](rules/integration-database-dynamodb.md) | LOW | AWS DynamoDB | |
| 62 | + |
| 63 | +### Patterns (Architektur) |
| 64 | + |
| 65 | +| Rule | Impact | Beschreibung | |
| 66 | +|------|--------|--------------| |
| 67 | +| [pattern-clean-architecture](rules/pattern-clean-architecture.md) | CRITICAL | UseCases, Domain Layer | |
| 68 | +| [pattern-repository](rules/pattern-repository.md) | HIGH | Interface + jOOQ Implementierung | |
| 69 | + |
| 70 | +### Build (Projekt-Setup) |
| 71 | + |
| 72 | +| Rule | Impact | Beschreibung | |
| 73 | +|------|--------|--------------| |
| 74 | +| [build-maven-multimodule](rules/build-maven-multimodule.md) | HIGH | Parent POM, Module | |
| 75 | +| [build-maven](rules/build-maven.md) | MEDIUM | Single-Module Setup | |
| 76 | +| [build-bootstrap-rest-api](rules/build-bootstrap-rest-api.md) | MEDIUM | REST API Grundgerüst | |
| 77 | + |
| 78 | +## Workflow-Checkliste |
| 79 | + |
| 80 | +### Neues Projekt |
| 81 | + |
| 82 | +- [ ] Maven-Struktur anlegen (Single oder Multi-Module) |
| 83 | +- [ ] `.editorconfig` aus Template kopieren |
| 84 | +- [ ] Dependencies in pom.xml eintragen |
| 85 | +- [ ] log4j2.xml konfigurieren |
| 86 | +- [ ] application.properties anlegen |
| 87 | + |
| 88 | +### Neue Klasse |
| 89 | + |
| 90 | +- [ ] Package-Struktur beachten (feature/{domain}/...) |
| 91 | +- [ ] Naming-Konventionen einhalten |
| 92 | +- [ ] `final` und `var` verwenden |
| 93 | +- [ ] `Optional<T>` statt null |
| 94 | +- [ ] Private Felder mit `_underscorePrefix` |
| 95 | + |
| 96 | +### Neues Feature |
| 97 | + |
| 98 | +- [ ] UseCase mit korrektem Interface anlegen |
| 99 | +- [ ] DTO im api-Package erstellen |
| 100 | +- [ ] Repository-Interface definieren |
| 101 | +- [ ] jOOQ-Implementierung schreiben |
| 102 | +- [ ] Javalin Route registrieren |
| 103 | + |
| 104 | +## Wichtige Hinweise |
| 105 | + |
| 106 | +- **Build zur Verifikation** - immer ueber den Devcontainer: `./dev compile`/`./dev verify` (Baunach), sonst `devcontainer exec --workspace-folder . sh -c 'mvn clean verify'`. **Nie nativ `mvn`/`./mvnw`** — das ist User-only (siehe `~/.claude/CLAUDE.md` → Verbote, [[build]]) |
| 107 | +- **Sandbox deaktivieren** - der Build-Befehl (`./dev` bzw. `devcontainer exec`) immer mit `dangerouslyDisableSandbox: true` ausfuehren (Netzwerkzugriff auf Maven Central, JitPack etc. noetig) |
| 108 | +- **DTOs aus api-Package** - Niemals Repository-Records direkt zurueckgeben |
| 109 | +- **Eclipse Collections** - Immer immutable Collections verwenden |
| 110 | +- **UUIDv7** - Fuer alle neuen IDs verwenden |
| 111 | + |
| 112 | +## References (Templates) |
| 113 | + |
| 114 | +| Template | Beschreibung | |
| 115 | +|----------|--------------| |
| 116 | +| [usecase-template.java](references/usecase-template.java) | UseCase mit Request/Response | |
| 117 | +| [repository-template.java](references/repository-template.java) | Interface + jOOQ-Implementierung | |
| 118 | +| [dto-template.java](references/dto-template.java) | Record DTO mit jOOQ-Konstruktor | |
| 119 | + |
| 120 | +## Ressourcen |
| 121 | + |
| 122 | +- [editorconfig.template](editorconfig.template) - IDE-Konfiguration |
0 commit comments