Skip to content
Back to skills

Rules Java

ASecurity

ANVIL coding rules for java code (**/*.java, **/*.kt, **/*Test.java, **/*Tests.java): Java Security, Java / Kotlin, Java Testing.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentrustjavakotlinshellsqlreacttestingdatabasesecurity

Works with

  • cli

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill rules-java --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rules Java?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rules Java
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-rules-java/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-java)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rules-java
description: "ANVIL coding rules for java code (**/*.java, **/*.kt, **/*Test.java, **/*Tests.java): Java Security, Java / Kotlin, Java Testing."
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# ANVIL rules: java

Follow these rules for java code (**/*.java, **/*.kt, **/*Test.java, **/*Tests.java).

## Java Security

# Java Security

- Never deserialize untrusted byte streams with `ObjectInputStream`; prefer schema-validated JSON and disable DTDs/external entities (`XXE`) on XML parsers.
- Use `PreparedStatement` or bound JPA query parameters exclusively; never concatenate user input into SQL, JPQL, or `ProcessBuilder` shell strings.
- Use `SecureRandom` and `MessageDigest.isEqual` for cryptographic tokens and MAC checks, never `java.util.Random` or `Arrays.equals`.
- Canonicalize file paths (`Path.normalize().toRealPath()`) inside allowed roots and avoid logging Authorization headers or credentials.

## Java / Kotlin

# Java / Kotlin

- try-with-resources for all closeables; `Optional` for absent return values.
- Constructor injection; immutable value objects.
- No blocking calls in reactive or coroutine code paths.

## Java Testing

# Java Testing

- Use JUnit 5 with `@ParameterizedTest` instead of copy-pasted test methods.
- Inject clocks (`java.time.Clock`) and fake HTTP/repository clients rather than hitting live networks or wall clocks.
- Use AssertJ or JUnit `assertAll` for clear failure diagnostics, and `@TempDir` for filesystem cleanup.
- Isolate slow database or integration suites with `*IT.java` or tags so fast unit checks finish quickly.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.