java-developer
Skill1 starsChanged 3 months agoMITView on GitHub
Generates modern Java code and provides architectural guidance for Java 8 through 25. Trigger when writing or modernising Java, or for best practices on immutability, records, sealed types, pattern matching, switch expressions, Optional vs null, JSpecify nullness annotations, var, text blocks, instance main methods, unnamed variables, module imports, Javadoc and Markdown doc comments, exceptions and resource management, JPMS modules, bean generation, data-oriented programming, virtual threads and carrier pinning, structured concurrency with StructuredTaskScope and Joiner, ScopedValue versus ThreadLocal, static analysis and formatting with javac lint, Error Prone, NullAway and google-java-format, Google Java Style, or version migration.
3 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- nainishshafi/developer-productivity-skillstheir own version, first seen Nov 8, 2026
- zhijunio/skillsedited, first seen Oct 11, 2026
- apache/grails-coretheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- zhijunio/skills★ 025% same
Wrote their own version · 2
- apache/grails-core★ 2.9ksame name
- nainishshafi/developer-productivity-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Step 1: Read the build config - authoritative, not the installed JDK.
- Very specific: line 30
Step 2: Run java -version. If the installed JDK is older than the configured release, say so - the code will not compile.
- Distinctive: line 32
Step 3: Only generate features available in that release.
- Distinctive: line 36
Read java-versions.md for the Java 8 hall pass and OpenRewrite migration.
- Distinctive: line 40
Treat immutability as the first design decision, not a later refinement.
- Distinctive: line 54
Use records to express AND (a bundle of components) and sealed types to express OR (a constrained choice of subtypes).
- Very specific: line 62
Read these before working with instanceof or a switch over types.
- Very specific: line 110
Best Practices Checklist: All 35 practices in one scannable list, plus the three top tips and which rules are gated by the JDK or tool …
“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.
Files
Java Developer Guidelines
Covers the language changes from Java 8 to Java 25.
- Always determine the project's Java version and build tool before giving guidance. Available features vary enormously between 8, 11, 17, 21 and 25 - advice that is correct on 25 will not compile on 17.
- Apply these defaults when generating code: favour immutability, prefer the arrow expression form of
switch, useOptionalon public return types, go all in onvarfor locals. Where the surrounding code conflicts, match the surrounding code and raise the conflict - do not silently mix styles. - A new feature is not automatically a best practice. Some post-Java-8 features should be avoided in application code - JPMS modules, module import declarations, label-form switches. Each reference states a verdict; follow it rather than hedging.
- After generating code, compile it and run the tests with the project's build tool (
mvn -q verify,./gradlew build). Do not skip this - patterns, sealed exhaustiveness and record component nullability fail at compile time in subtle ways. - Prefer a tool to a rule. Before writing prose about a defect, check whether
javac -Xlint, Error Prone or a formatter already catches it - three of this skill's headline rules have an on-by-default check with a suggested fix. See enforcement.md. Note that javac's default lint is nearly silent, so-Xlint:all -Werroris a precondition for most of it.
Every reference carries a ## Version notes section stating what differs across Java 8 to 25, and a ## Gotchas list of the specific mistakes agents make in that area. Read the gotchas even when skimming. Every version floor in those sections was established by compiling the idiom at each release with javac --release, not from documentation; the consolidated table is in java-versions.md.
Determining the Java Version
Step 1. Read the build config - authoritative, not the installed JDK. Maven: maven.compiler.release, or source/target. Gradle: java.toolchain.languageVersion, sourceCompatibility, options.release. Also .sdkmanrc, .tool-versions, .java-version, CI workflows.
Step 2. Run java -version. If the installed JDK is older than the configured release, say so - the code will not compile.
Step 3. Only generate features available in that release. If a recommendation needs a newer version, state which and give the version-appropriate alternative. Never silently generate Java 21 code for a Java 17 project.
Step 4. New projects: latest LTS (Java 25), and set release rather than source/target.
Read java-versions.md for the Java 8 hall pass and OpenRewrite migration.
Immutability
Treat immutability as the first design decision, not a later refinement. Consult these references:
- Immutability: Final classes and fields, keeping mutability inside a single source file, naming mutable variables to make them stand out in code review, and preferring composition over inheritance. Read immutability.md
- Immutable Collections:
List.of/Set.of/Map.of, Guava's immutable collections,Collections.unmodifiable*, and the iteration-order randomisation inSet.of/Map.ofthat silently creates flaky tests. Read immutable-collections.md
Optional and Null
These are two halves of one policy: Optional states absence on a return type, annotations state it everywhere Optional must not go. Read both.
- Optional and Null: Why
Optionalbelongs on public return types but not on parameters or fields, whyisPresent()/isEmpty()are a code smell, using theOptionalAPI as fluently as the Stream API, thein(Optional)loop idiom, and why future null-restricted types (String?/String!) will not replaceOptional. Read optional-and-null.md - Nullness Annotations: JSpecify
@Nullable/@NonNull/@NullMarked/@NullUnmarked, why type-use placement changes the meaning (@Nullable String[]versusString @Nullable []), that javac never reads these so nothing is checked until NullAway runs, NullAway's JDK requirements, and where Spring Framework 7 sits. Read nullness.md
Records, Beans and Sealed Types
Use records to express AND (a bundle of components) and sealed types to express OR (a constrained choice of subtypes). Consult these references:
- Records: What a record generates, compact constructor validation, why arrays and mutable components defeat the point of a record, preferring simple types, and the risk of
toString()leaking sensitive data. Read records.md - Beans vs Records: Why "Java beans" are not JavaBeans, the bean/record cliff edge, why records do not replace beans, and why generated beans (Immutables, Joda-Beans, Lombok) are preferable to hand-written ones. Read beans-vs-records.md
- Sealed Types: Modelling constrained choices, how sealing enables exhaustive
switch, and keeping hierarchies simple (sealed interface at the root, avoidnon-sealed). Read sealed-types.md
Pattern Matching
Read these before working with instanceof or a switch over types. Treat a pattern as the test/extract/bind construct it is, not as shorter instanceof syntax - the nesting rules and the null interaction depend on it.
- Patterns: The test/extract/bind fusion, type patterns, the modern
equalsidiom, patterns inswitch, the match-all pattern_, and where patterns may appear in future. Read patterns.md - Record Patterns: Destructuring records, arbitrary pattern nesting, the subtle rule that decides whether a component pattern can match
null, and usingvarinside record patterns to make narrowing visible. Read record-patterns.md
Switch
- Switch: The six kinds of
switch(label vs arrow, statement vs expression, exhaustive vs not), why the label forms should be ignored entirely, always preferring the arrow expression form, who is responsible for exhaustiveness in a statement switch, andcase null. Read switch.md
var
- var: Why local variable type inference should be adopted wholesale rather than sparingly, the parallel with lambda parameter inference, naming variables for the data rather than the type, and the
Optsuffix convention forOptionallocals. Read var.md
Exceptions and Resources
- Exceptions and Resources: Never swallowing an exception, always attaching the cause, restoring the interrupt flag, which of
NullPointerException/IllegalArgumentException/IllegalStateExceptionto throw, try-with-resources over try/finally and whyfinallyloses the real exception,finalize()being deprecated for removal andCleaneras its backstop, and modelling expected failure as a sealed type instead. Read exceptions-and-resources.md
Smaller Language Features
The reference carries a per-feature verdict table - adopt, adopt for scripts only, or avoid. Follow it rather than adopting on novelty.
- Smaller Features: Text blocks (and the SQL injection trap they invite), unnamed variables
_, instancemainmethods and compact source files, and module import declarations (avoid). Read smaller-features.md - Javadoc: Where Javadoc is required, the summary fragment rule,
{@return}for accessors,{@snippet}in place of<pre>{@code}, Markdown doc comments///, documenting record components with@param, and the rule that all three tags are gated by the javadoc tool version rather than--release. Read javadoc.md
Modules (JPMS)
- Modules: Why modules were essential to the JDK's own evolution, why they see little adoption in applications, the pain of publishing a modular library, and the fact that module boundaries are only enforced on the module path. Read modules.md
Data-Oriented Programming
- Data-Oriented Programming: How records, sealed types, patterns and enums combine into a single design style; where records belong in a typical system (JSON in, database out); validating at the boundaries; and why this is a whole-system commitment rather than a local refactor. Read data-oriented-programming.md
Beyond the Language
- Modern APIs: Stream gatherers, virtual threads, and the Foreign Function & Memory API - when each is genuinely worth reaching for. Read modern-apis.md
- Structured Concurrency and Scoped Values: What virtual threads do not fix, the measured cost of
synchronizedpinning before Java 24, theStructuredTaskScopeAPI as Java 25 redesigned it (and why every pre-25 snippet has to be rewritten), writing aJoiner, andScopedValueas the only context mechanism that survives afork(). Read structured-concurrency.md
Performance
- Performance is a separate skill, and deliberately so. This skill covers writing correct modern Java; it does not diagnose a slow application, choose a garbage collector, size a heap, or read a profile. For any of that - a symptom to triage, GC pauses, an
OutOfMemoryError, high CPU, slow startup, JVM flag selection, benchmarking with JMH, or the measured cost of allocation, collections, strings, I/O and synchronisation - usejava-performance-developer. Two rules from it are worth carrying into ordinary code review here: never recommend a JVM flag without the measurement that justifies it, and keep what is safe to apply blind (buffer your I/O, size your collections, hoist aStringBuilderout of a loop) separate from what needs evidence first (heap sizing, collector choice, pool sizing, every-XXflag).
Enforcement and Style
- Enforcement: Which tool actually checks each rule in this skill.
javac -Xlintis nearly silent by default and the useful keys are all off; Error Prone'sStatementSwitchToExpressionSwitch,PatternMatchingInstanceofandMissingOverridemechanise three of this skill's rules; a formatter retires every layout question; and an honest list of what nothing enforces. Read enforcement.md - Google Style Deltas: The Google Java Style Guide is the baseline for this skill's style rules. This file records the five places the skill departs from it and why, the three rules routinely misquoted as conflicts, and a measured note on how little the guide says about anything else in this skill. Read google-style-deltas.md
Checklist
- Best Practices Checklist: All 35 practices in one scannable list, plus the three top tips and which rules are gated by the JDK or tool version rather than by
release. Use this for review passes over existing code. Read checklist.md
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
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.

