com um clique
java
Modern Java practices: design, errors, concurrency, security, testing, tooling. Targets Java 21 LTS baseline; Java 25 LTS features called out explicitly. Use when writing or reviewing Java code.
Menu
Modern Java practices: design, errors, concurrency, security, testing, tooling. Targets Java 21 LTS baseline; Java 25 LTS features called out explicitly. Use when writing or reviewing Java code.
Docker best practices: image security, build efficiency, runtime hardening, Compose, local tooling (Colima, OrbStack). Use when writing or reviewing Dockerfiles and Compose files.
AWS best practices: IAM, secrets, networking, security, compute, IaC, ops. Use when building, reviewing, or modifying AWS resources.
GCP best practices: IAM, secrets, networking, security, compute, IaC, ops. Use when building, reviewing, or modifying GCP resources.
Idiomatic Go 1.25 practices: errors, interfaces, concurrency, generics, testing, security, tooling. Use when writing or reviewing Go code.
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
Kubernetes best practices: security, workloads, networking, config, operations, GitOps. Use when writing or reviewing K8s manifests and configurations.
final fields, no setters unless mutation requiredswitch expressions over theminstanceof (16+): if (obj instanceof String s) — no explicit castnull in public APIs. Optional<T> for absent values. Never Optional as field typeObjects.requireNonNull(param, "param") at method entry for non-null enforcementException or Throwable except at boundaries (HTTP handler, queue consumer)Closeable. No manual finally close blocksvar where type is obvious from right-hand side. Not to obscure typesStream.toList() (16+) over Collectors.toList()List.of(), Map.of(), Set.of() for immutable collections. List.copyOf() for defensive copySequencedCollection, getFirst(), getLast() over index hacksswitch expressions over statements. Pattern matching in switch (21+) with exhaustive coveragecatch (IOException _), case Point(int x, _)if (obj instanceof Point(int x, int y))stream.gather(...) for custom intermediate operationsinstanceof checks before casts eliminated — use pattern matching everywhereThread.ofVirtual().start(...) or Executors.newVirtualThreadPerTaskExecutor(). Use for I/O-bound worksynchronized or Object.wait/notify with virtual threads — use java.util.concurrent primitives or structured concurrencyStructuredTaskScope for fan-out with automatic cancellation and error propagationScopedValue over ThreadLocal for virtual thread-safe immutable contextCompletableFuture for async pipelines without virtual threads. Avoid get() without timeoutExecutorService always in try-with-resources (19+) or explicitly shut downvolatile only when you understand happens-beforeThread.sleep() in production logic. No busy-wait loops@NotNull, @Size, etc.) at API boundariesSecureRandom for tokens and secrets. Never java.util.RandomSSLException and continuegovulncheck equivalent: OWASP Dependency-Check or Snyk in CI. Fail on critical CVEsAES/GCM over AES/CBCML-KEM, ML-DSA) — evaluate for long-lived key materialSystem.out.println in productionERROR for actionable failures, WARN for degraded state, INFO for lifecycle events, DEBUG for dev onlylog.debug("user={}", userId) — never string concat in log argsWARN or INFO. Stack traces at ERROR only@ParameterizedTest for data-driven casesThread.sleep() in tests. Awaitility for async assertions@Nested for grouping related test cases within one classsrc/test, integration tests in src/integrationTest (Gradle) or profiles (Maven)libs.versions.toml)google-java-format or palantir-java-format enforced in CI. No style debatesSpotBugs + Find Security Bugs plugin. Checkstyle for style enforcementErrorProne compiler plugin for correctness checks at compile timeArchUnit for architectural rules: enforce layer boundaries, naming conventions in testssdkman or .sdkmanrc for team-consistent JDK version. Pin distribution (Temurin preferred)StringBuilder for string concat in loops. String.join() for fixed listsArrayList over LinkedList for most cases. ArrayDeque over Stack or LinkedList as queueList.copyOf() / Map.copyOf() create truly immutable snapshots. Use over Collections.unmodifiableList