lang-java
Skill5 starsChanged 46 days agoMITView on GitHub
use this when writing, reviewing, or testing Java — *.java, pom.xml, build.gradle. language only; not a Spring skill. do not use for Kotlin (load lang-kotlin).
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-safetySkill
- golang-securitySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-cppSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-js-tsSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-sqlSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Do not add a second build tool.
- Very specific: line 33
Never return null for a collection.
- Very specific: line 35
Prefer final locals when the file already does.
- Very specific: line 48
Prefer java.util.concurrent over home-rolled wait/notify.
- Distinctive: line 51
No unsynchronized shared mutable state.
- Distinctive: line 58
Test doubles at I/O boundaries.
- Distinctive: line 64
No leaked persistence entities across a module boundary.
- Distinctive: line 69
No string-built SQL or process commands.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Java
Language guide. No Spring / Jakarta religion. No scripts/.
Process skills that may load with this one: load-with list.
Iron law
Nulls are explicit. Resources close themselves. Dependencies point inward.
Tooling / verify
# one of these, as the repo does
mvn -q test
gradle testDo not add a second build tool. Read the surefire/gradle test output.
Idioms a linter misses
- Records / sealed types when the language level allows and the type is data.
- Try-with-resources for every
AutoCloseable. - Constructor injection. Do not
newa service inside another service if the module already injects. - Never return
nullfor a collection; return empty. equalsandhashCodetogether. Prefer records.- Prefer
finallocals when the file already does. No clever var shadowing. java.timeoverDate/Calendarfor new code.
Errors
- Specific exceptions. Wrap with cause. Do not catch
Exceptionto return null. - Checked exceptions: do not punch them through a listener that cannot declare them — map at the boundary.
Concurrency
- Prefer
java.util.concurrentover home-rolled wait/notify. - Virtual threads: only if the project already uses them or the language level is there and you Ask first before flipping a thread model.
- No unsynchronized shared mutable state.
synchronizedonthisis usually the wrong lock object for public types.
Testing
- JUnit as the repo uses it. Assert on behavior, not log strings.
- Test doubles at I/O boundaries. Do not mock the type under test.
PR review
- New public API: null contract documented or non-null by type
(
Optionalonly when absence is the point). - No leaked persistence entities across a module boundary.
- Module / package cycles.
Security
- No string-built SQL or process commands.
Runtime.exec/ProcessBuilder: argument list, not a shell string.- No
ObjectInputStream/ Java serialization of untrusted bytes. - Paths stay inside an allowlisted root.
Always
- Try-with-resources.
- Empty collections, not null lists.
- Tests for the new branch.
Ask first
- Bumping the language level.
- Adding Spring / Jakarta annotations in a non-Spring module.
- Switching thread model to virtual threads.
Never
- Empty
catch (Exception e) {}. - Public mutable static state.
- Raw types.
Runtime.execwith concatenated input.
Red flags
- "I'll null-check it at every call"
- "Spring will wire it" on a type that is not a bean
- "it's just a static Map"
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.

