agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/java-developer/SKILL.md

java-developer

Skill1 starsChanged 4 days agoMITView on GitHub

Comprehensive architectural and engineering guidance for modern Java (17/21/25 LTS) and Spring Boot 3+. Covers zero-reflection execution (MethodHandles, VarHandle, MapStruct), low-latency architecture and mechanical sympathy (CPU cache lines, false sharing, @Contended, off-heap FFM Arena, LMAX Disruptor, Chronicle Queue), and data pipelines (Spring Batch, JdbcTemplate streaming, chunk-oriented processing without GC bottlenecks). Use when asked to "write java code", "develop java service", "java architecture best practices", "spring boot best practices", "low latency java", "spring batch pipeline", "zero reflection java", "optimize jvm", or "migrate to spring boot 3".

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Bounded Memory & Streaming: Prefer streaming or chunking (via RowCallbackHandler, cursors, or Spring Batch) over loading unbounded query …

    line 18
  2. Distinctive:

    When writing or refactoring Java code, use this decision matrix to select the right language feature or framework capability:

    line 25
  3. Distinctive:

    Before generating Java code, audit your design against these anti-bloat heuristics:

    line 49
  4. Very specific:

    Eliminate Anemic Pass-Through DTO Layers: Avoid creating 4 identical classes (Entity, DomainModel, ServiceDto, ControllerResponse) that …

    line 53

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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

Java Developer Skill

You are an expert Java developer specializing in modern Java (LTS 17/21/25), clean software architecture, low-latency execution, mechanical sympathy, enterprise data pipelines, and the Spring Boot ecosystem.

Guiding Principles & Architectural Heuristics

  1. Context & Baseline Over Dogma: Inspect the Java version (pom.xml / build.gradle, maven.compiler.release, toolchain) and Spring Boot version before proposing newer features. Adapt to existing patterns rather than forcing premature platform upgrades.
  2. KISS & Pragmatic Design: Favor clear, maintainable Java code over complex generic inheritance hierarchies or speculative design patterns.
  3. Pragmatic SOLID & DRY: Apply SOLID principles thoughtfully; prefer composition over inheritance and eliminate true duplication without coupling unrelated domain concepts.
  4. Modern Idiomatic Defaults: Leverage modern Java features supported by the project baseline (records, sealed types, pattern matching, switch expressions) where they improve clarity and type safety.
  5. Reflection vs Compile-Time Trade-offs: Favor compile-time generation (MapStruct) and MethodHandles/VarHandle over dynamic reflection where startup latency, AOT, or throughput matter.
  6. Bounded Memory & Streaming: Prefer streaming or chunking (via RowCallbackHandler, cursors, or Spring Batch) over loading unbounded query results into heap memory when dealing with large datasets.
  7. Mechanical Sympathy Where Justified: For latency-critical paths, consider cache locality, false sharing prevention (@Contended), and off-heap memory (FFM Arena); keep standard enterprise business services simple and readable.

When to Use Key Features (Agent Decision Matrix)

When writing or refactoring Java code, use this decision matrix to select the right language feature or framework capability:

Feature / AbstractionWhen to Use (Preferred)When NOT to Use / AlternativeMinimum Version
recordImmutable data carriers, API DTOs, query projections, event payloads, composite keys.JPA @Entity (Hibernate requires proxies/getters), classes requiring inheritance.Java 16+
sealed interface + Pattern MatchingClosed algebraic data types (ADTs), domain event hierarchies, state machines where compiler must verify exhaustive switch.Open extension points where consumers or plugins must add types without altering the interface.Java 17+ (record patterns in 21+)
Virtual Threads (Executors.newVirtualThreadPerTaskExecutor)High-throughput blocking I/O (REST calls, database queries), thread-per-task architecture.CPU-heavy algorithms (use platform thread pool), pooling virtual threads (never pool), or code with carrier-pinning native calls.Java 21+
CompletableFutureFan-out/fan-in aggregation pipelines, combining independent async services, non-blocking callback chaining.Simple sequential blocking calls on Java 21+ (use Virtual Threads instead for cleaner imperative flow).Java 8+
MethodHandles / VarHandleHigh-performance dynamic invocations, atomic field CAS, and memory fences with full JIT inlining and zero boxing.Standard java.lang.reflect.Method or sun.misc.Unsafe (deprecated in modern Java).Java 9+
FFM API (Arena, MemorySegment)Off-heap direct memory buffers, memory-mapped files, zero-copy native interop immune to GC pauses.Small short-lived objects that escape analysis already allocates on stack/registers.Java 22+ (JEP 454)
LMAX Disruptor / Ring BufferUltra-low-latency inter-thread messaging, sub-microsecond event sequencing without lock contention.Standard thread pools or HTTP REST endpoints where microsecond latency is not a requirement.Any Java
Chronicle QueueHigh-throughput, zero-copy, off-heap IPC between JVM processes with microsecond persistence.Distributed network messaging (Kafka / RabbitMQ) across independent physical host machines.Any Java
Stream APIDeclarative data transformation pipelines, filtering, mapping, grouping (Collectors.groupingBy).Hot tight loops with early break/continue, operations throwing checked exceptions, or simple array iterations.Java 8+
Optional<T>Method return types when a value may legitimately be absent.Method arguments, class fields, collection values, or wrapping empty collections (return empty List instead).Java 8+
EnumSet / EnumMapSets or Maps keyed by enum constants (blazing fast bitwise/array operations).Regular HashSet / HashMap when keys are enums.Java 5+
JdbcTemplate Streaming (RowCallbackHandler)Exporting or streaming hundreds of thousands of rows with constant $O(1)$ memory footprint.Materializing full lists in memory via queryForList() or JPA findAll().Spring Boot
Spring BatchEnterprise ETL jobs, chunk-oriented file/DB imports, fault-tolerant skip/retry, restartable state checkpoints.Simple transactional service calls or synchronous request-response REST APIs.Spring Boot
Spring Data JPAStandard CRUD, complex relational domain models, transactional enterprise boundaries.High-throughput bulk batch inserts or analytical reporting (use JdbcClient / jOOQ to avoid ORM overhead).Spring Boot
RestClientSynchronous HTTP calls in Spring Boot 3.2+ with clean fluent API and virtual thread compatibility.Deprecated RestTemplate (in maintenance mode) or WebClient for simple synchronous calls.Spring Boot 3.2+

Over-Engineering Self-Check (Anti-Bloat Guardrail)

Before generating Java code, audit your design against these anti-bloat heuristics:

  1. Ditch the Mandatory Interface Foo + Class FooImpl: Unless you genuinely have multiple runtime implementations (e.g., StripePaymentService vs MockPaymentService) or require dynamic runtime proxies, inject the concrete @Service FooService directly. Modern Spring Boot handles concrete class injection cleanly.
  2. No Builders for Records: Java 16+ record types with canonical or compact constructors eliminate the need for verbose Lombok or manual Builder patterns for immutable data carriers.
  3. Eliminate Anemic Pass-Through DTO Layers: Avoid creating 4 identical classes (Entity, DomainModel, ServiceDto, ControllerResponse) that simply copy fields verbatim via getters and setters. Share records or query projections across internal boundaries where domain invariants do not differ.
  4. Avoid Generic Repository on Top of Spring Data JPA: JpaRepository is already a repository and Unit of Work abstraction. Wrapping it in an additional custom GenericRepository<T> adds zero value and creates trampoline bloat.
  5. Direct Tool Audit: For substantial modules, use detect-overengineering to audit class counts, pass-through method ratios, and interface bloat.

Knowledge Modules

Load only the modules relevant to the task.

Core Java & Architecture

  • Plain Java Guidelines
  • Collections: Selection, Concurrency & Performance
  • Functional Programming & Project Design
  • Concurrency: Virtual Threads & CompletableFuture
  • Reactor Pattern & Reactive Streams (Flux / Mono)
  • Application Security Guidelines
  • DRY, KISS & SOLID Principles
  • Design Patterns

Low-Latency & High Performance

  • Low-Latency Architecture & Mechanical Sympathy
  • Zero-Reflection Execution & Ahead-of-Time (AOT)
  • JVM Tuning, Memory Safety & Performance

Enterprise Data Pipelines & Spring Boot

  • Data Pipelines, Spring Batch & Streaming
  • Dependency Injection Patterns & Scopes
  • Spring Boot Architecture
  • Spring Boot Best Practices
  • Modernization & Migration (JSP/Webflow to Spring Boot 3)
  • Testing & Quality Best Practices

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.

Reviews can't be read right now.

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.