Reviewed by 20X · No signed release verified
- Works with (as stated by the author)
- Claude Code, Cursor
Review details
- Human review
- Review recorded for these files
- Limited checks
- Limited checks recorded (v2.1.0)
- Source
- Source not verified
A verified signature checks published file bytes against a trusted publisher’s signed manifest. It does not verify safety, authorship, rights or assistant use.
Declarations and limited checks do not guarantee safety or sharing rights. Review the files before use. Access that the author has not stated is unknown.
How to use it
- 1Save the file under ~/.claude/rules/ (all projects) or .claude/rules/ inside a project.
- 2Remove any sections that don't apply to your work.
- 3Start a new Claude Code session so the rule is loaded.
Community results
0 reportsNo one has shared a result yet.
1 file. Filenames and raw files are in Technical details.
paths:
- "**/*.java"
Java Coding Style
This file extends common/coding-style.md with Java-specific content.
Formatting
- google-java-format or Checkstyle (Google or Sun style) for enforcement
- One public top-level type per file
- Consistent indent: 2 or 4 spaces (match project standard)
- Member order: constants, fields, constructors, public methods, protected, private
Immutability
- Prefer
recordfor value types (Java 16+) - Mark fields
finalby default — use mutable state only when required - Return defensive copies from public APIs:
List.copyOf(),Map.copyOf(),Set.copyOf() - Copy-on-write: return new instances rather than mutating existing ones
// GOOD — immutable value type
public record OrderSummary(Long id, String customerName, BigDecimal total) {}
// GOOD — final fields, no setters
public class Order {
private final Long id;
private final List<LineItem> items;
public List<LineItem> getItems() {
return List.copyOf(items);
}
}
Naming
Follow standard Java conventions:
PascalCasefor classes, interfaces, records, enumscamelCasefor methods, fields, parameters, local variablesSCREAMING_SNAKE_CASEforstatic finalconstants- Packages: all lowercase, reverse domain (
com.example.app.service)
Modern Java Features
Use modern language features where they improve clarity:
- Records for DTOs and value types (Java 16+)
- Sealed classes for closed type hierarchies (Java 17+)
- Pattern matching with
instanceof— no explicit cast (Java 16+) - Text blocks for multi-line strings — SQL, JSON templates (Java 15+)
- Switch expressions with arrow syntax (Java 14+)
- Pattern matching in switch — exhaustive sealed type handling (Java 21+)
// Pattern matching instanceof
if (shape instanceof Circle c) {
return Math.PI * c.radius() * c.radius();
}
// Sealed type hierarchy
public sealed interface PaymentMethod permits CreditCard, BankTransfer, Wallet {}
// Switch expression
String label = switch (status) {
case ACTIVE -> "Active";
case SUSPENDED -> "Suspended";
case CLOSED -> "Closed";
};
Optional Usage
- Return
Optional<T>from finder methods that may have no result - Use
map(),flatMap(),orElseThrow()— never callget()withoutisPresent() - Never use
Optionalas a field type or method parameter
// GOOD
return repository.findById(id)
.map(ResponseDto::from)
.orElseThrow(() -> new OrderNotFoundException(id));
// BAD — Optional as parameter
public void process(Optional<String> name) {}
Error Handling
- Prefer unchecked exceptions for domain errors
- Create domain-specific exceptions extending
RuntimeException - Avoid broad
catch (Exception e)unless at top-level handlers - Include context in exception messages
public class OrderNotFoundException extends RuntimeException {
public OrderNotFoundException(Long id) {
super("Order not found: id=" + id);
}
}
Streams
- Use streams for transformations; keep pipelines short (3-4 operations max)
- Prefer method references when readable:
.map(Order::getTotal) - Avoid side effects in stream operations
- For complex logic, prefer a loop over a convoluted stream pipeline
References
See skill: java-coding-standards for full coding standards with examples.
See skill: jpa-patterns for JPA/Hibernate entity design patterns.
Latest changes
Initial reviewed release.
Version history
v1.0.0
Initial reviewed release.
File access pausedFile verification
- File integrity
No signed release verified for this version.
This checks published bytes, not safety, authorship, rights or assistant use.
Full compatibility
As stated by the author: Claude Code, Cursor
Included files
1 filecoding-style.md
markdownPublic file access is temporarily paused.
Use in your own tool
Save this resource and connect your assistant in the Use with flow before copying a test request.
Related resources
Dart/Flutter Coding Style (ECC)
Dart/Flutter-specific coding style: formatting tools, idioms, immutability, error handling, and naming.
Claude Code, Cursor
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Nov 11
Cypress E2E Testing Rules
Cypress end-to-end testing conventions: selectors, commands, fixtures, and flake prevention.
Cursor
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Nov 11
Karpathy-Inspired Coding Guidelines (CLAUDE.md)
Four behavioral rules that stop AI coding agents from over-engineering, guessing, and making unrelated edits.
Claude Code
- Rating
- Not rated
- Recorded downloads in the past 90 days
- 0
- Updated
- Oct 3