En
Skill JohnRothan/Anthropic-Java-Skills/skills/alibaba-java-coding-guidelines/en
Java books distilled into Claude Agent Skills — bilingual (简体中文 / English) skills for writing and reviewing Java code. First skill: Alibaba Java Development Manual (Huangshan Edition).
npx -y skills add JohnRothan/Anthropic-Java-Skills --skill enAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Alibaba Java Development Manual (Huangshan Edition) coding standards. Use this skill whenever you write, review, refactor, or evaluate any Java code — covering naming conventions, constant definitions, code formatting, OOP rules, date/time, collection handling, concurrency and multithreading, control statements, comments, exception handling, logging, unit testing, security, MySQL table/index/SQL/ORM design, and application-layering project structure. Whether or not the user explicitly mentions "Alibaba spec / P3C / Huangshan / development manual", proactively apply the rules and severity levels here for any task that produces or vets Java code (e.g. "write a Java class / Service / DAO", "review this Java", "is this code compliant?", "create a MySQL table", "help me name this", "handle exceptions and logging").
SKILL.md
8.0 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
Alibaba Java Development Manual (Huangshan Edition) — Coding Standards
This skill turns Alibaba's official Java Development Manual (Huangshan Edition) into actionable
guidance for writing and reviewing Java code. It spans seven dimensions: programming specification,
exception & logging, unit testing, security, MySQL database, project structure, and design. The full
text is split by dimension under references/. Use the high-frequency cheat sheet below to cover
common cases, and read the matching reference file when you need the details of a specific dimension.
Severity levels (always reflect these in your output)
Every rule carries a severity tag. When resolving conflicts or giving advice, prioritize by:
- [Mandatory] — must be followed unconditionally. Violations seed failures, security holes, or maintainability debt. Never violate when writing; always flag as a blocker when reviewing.
- [Recommended] — strongly advised. Adopt unless there is a solid reason not to; raise as an improvement suggestion in review.
- [Reference] — a good practice for reference; adopt as appropriate for your team.
How to use
When writing Java code
- Before coding, skim the "High-frequency mandatory rules" cheat sheet below so you don't trip on naming, POJOs, null-safety, collections, concurrency, SQL, and other common pitfalls.
- When a task centers on one dimension (e.g. writing a DAO/table → MySQL; a concurrency utility →
Concurrency), read the matching
references/file before writing, to get the details right. - After producing code, self-check: are any [Mandatory] rules violated? If you deviate from a [Recommended] rule for readability, state the reason.
When reviewing / evaluating Java code
- Check against the relevant dimension's rules and classify findings by severity: [Mandatory] violation = must fix, [Recommended] violation = suggested improvement.
- Cite the rule source for each comment where possible (e.g. "Naming rule 9 [Mandatory]: POJO
boolean fields take no
isprefix") so the author can understand and verify it. - Pair each problem with a positive-example fix — don't just say "non-compliant".
High-frequency mandatory rules (covers the most common cases without opening a reference file)
Naming
- Class names
UpperCamelCase; methods/params/members/localslowerCamelCase; constantsUPPER_SNAKE_CASE. - No mixing Pinyin with English, no Chinese names; no leading/trailing
_or$; no sloppy abbreviations. - POJO boolean fields take no
isprefix (usedeleted, notisDeleted), or some frameworks fail serialization. - Abstract classes start with
Abstract/Base; exception classes end withException; test classes end withTest. - Package names all lowercase and singular; Service/DAO interface implementations use the
Implsuffix.
Constants & types
- No magic values inline;
longliterals use uppercaseL(e.g.2L). - POJO fields and RPC params/returns must use wrapper types; locals use primitives.
- Compare Integer wrapper values with
equals; compareBigDecimalwithcompareTo(); nevernew BigDecimal(double)— usenew BigDecimal("0.1")orBigDecimal.valueOf(). - Don't compare floats directly with
==. Store monetary amounts as integers in the smallest currency unit. - POJOs set no default field values; must implement
toString(); overrides must carry@Override.
Collections
- The result of
Arrays.asList()cannot be add/remove'd; check emptiness withisEmpty(), notsize()==0. - Use
Collection.toArray(new T[0]); don't remove/add inside aforeach(useIteratoror concurrent containers). - If you override
equals, also overridehashCode; iterate withMap.entrySet, not keySet with a second lookup. - Converting a collection to a
Map: a null value causes NPE;Collectors.toMapthrows on duplicate keys.
Concurrency
- Thread pools must not be created via
Executors; usenew ThreadPoolExecutor(...)with an explicit queue and rejection policy to avoid OOM. - Threads/thread pools must be named (
ThreadFactory);SimpleDateFormatis not thread-safe — useDateTimeFormatter. - Lock in a consistent order to avoid deadlock; use atomics/locks for concurrent updates;
remove()ThreadLocalafter use.
Control statements / OOP
- Each
switchcasemustbreak/returnor comment the fall-through; must have adefault. if/else/for/whilealways use braces, even for a single line; avoid nesting deeper than 3 levels (guard clauses / state pattern).- Call
equalsfrom a constant or known-non-null object ("x".equals(param)).
Exceptions & logging
- Don't catch
RuntimeException(e.g.NullPointerException/IndexOutOfBounds) in place of a pre-check; check beforehand. - Don't wrap large unrelated blocks in
try-catch; don't merelyprintStackTraceor swallow in catch; release resources infinally(or try-with-resources). - Log via the SLF4J facade with placeholders
logger.info("id={}", id), not string concatenation; log context and stack trace for exceptions.
MySQL (when writing DDL/SQL/entities)
- Tables require
id(bigint unsigned, auto-increment PK),gmt_create,gmt_modified; table/column names lowercase snake_case, no reserved words. - Yes/no fields named
is_xxx(unsigned tinyint, 1 yes / 0 no). - Use
decimalfor fractional types; neverfloat/doublefor money;varcharover 5000 → usetextin a separate table. - Use parameter binding to prevent injection;
count(*)for row counts; see the reference for pagination, indexing, left-wildcardlikedefeating indexes, etc.
The cheat sheet is a high-frequency reminder, not the whole standard. For specific details, edge cases, and positive/counter examples, read the matching reference file below.
Reference index (read on demand)
| Dimension | File | When to read |
|---|---|---|
| Programming | references/01-programming.md | Naming, constants, formatting, OOP, date/time, collections, concurrency, control statements, comments, front/back-end, misc — the main reference for writing or reviewing any Java code |
| Exception & Logging | references/02-exception-and-logging.md | Designing error codes, exception-handling strategy, logging conventions |
| Unit Testing | references/03-unit-testing.md | Writing or reviewing unit tests (AIR / BCDE principles, etc.) |
| Security | references/04-security.md | User input, authorization, SQL injection, XSS/CSRF, file upload, masking, sensitive data |
| MySQL Database | references/05-mysql-database.md | Table creation, index design, SQL statements, ORM/MyBatis mapping |
| Project Structure | references/06-project-structure.md | Application layering (DO/DTO/VO, Manager layer), second-party dependencies, server config |
| Design | references/07-design.md | Architecture- and design-level conventions |
| Glossary | references/08-glossary.md | Look up terms like POJO/DO/DTO/CAS/IDE when you need to confirm a meaning |
Each reference file keeps the official rules' severity tags and positive/counter examples, so you can cite "rule X [Mandatory/Recommended/Reference]" directly.
What ships with it: 8 files
163.5 KB alongside SKILL.md
references/
- 01-programming.md81.0 KB
- 02-exception-and-logging.md18.0 KB
- 03-unit-testing.md6.1 KB
- 04-security.md4.1 KB
- 05-mysql-database.md18.8 KB
- 06-project-structure.md13.1 KB
- 07-design.md11.0 KB
- 08-glossary.md11.4 KB
Gives 0 of the 12 instructions most databases sql skills give in ~1.7k tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnsin 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- review the cheat sheet before writing code
- check produced code against mandatory rules
- state the reason for deviating from recommended rules
- cite the rule source for each review comment
- pair each review problem with a positive example
- create thread pools using ThreadPoolExecutor explicitly
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.