java

Enforces Java coding standards for class design, control flow, exceptions, and readability.

Updated Sep 20, 2026
One-click install
npx skills add https://github.com/aascer39/codeagent --skill java-aascer39
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: java
Source: https://github.com/aascer39/codeagent/tree/main/.agents/skills/java
Command: npx skills add https://github.com/aascer39/codeagent --skill java-aascer39

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When AI agents write or refactor Java code, they often produce overly clever, deeply nested, or hard-to-maintain implementations. This Skill defines a single, enforceable set of Java language-level rules so every generated class, method, and control flow stays readable, testable, and consistent with the project's conventions. ## Core Features & Use Cases - Code Design Rules: Enforces single-responsibility classes and methods, bans God Classes, limits method length, and caps control-flow and loop nesting at three levels. - Readability Constraints: Prohibits nested ternaries, show-off Stream chains, peek-based side effects, Optional abuse, magic numbers, and meaningless comments; requires full Javadoc contracts on every method. - Exception & Safety Standards: Forbids swallowing exceptions, requires preserving cause context, bans hardcoded secrets, System.out logging, and reflection used to shortcut clear code. - Use Case: When an agent is asked to add a cancel-order endpoint to a service, it applies these rules to split responsibilities across Service and Mapper classes, use enums for status, write Guard Clauses instead of nested ifs, and document every method's contract. ## Quick Start Ask the agent to write or refactor a Java class, and it will apply these Java language and code design rules to the implementation.

Frequently Asked Questions about java

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Java coding standards on AI-generated code?▼

Define explicit rules for class responsibility, method length, nesting depth, and exception handling that the agent must follow when writing or refactoring Java. This Skill provides those rules plus pre-generation reuse checks and a post-generation self-check checklist.

What Java code style rules improve readability of generated code?▼

Key rules include banning nested ternary operators, limiting control-flow and loop nesting to three levels, capping Stream chains at three to four operations, avoiding Optional abuse, and replacing magic numbers with named constants or enums.

Does this Skill cover Spring, database, or logging configuration?▼

No. It only governs Java language-level and framework-agnostic code design. Spring bean wiring, MySQL schema and SQL, Redis semantics, logging output, and configuration secrets are delegated to separate dedicated skills.

When can Java coding rules be violated with an exception?▼

A rule may be bypassed only with a concrete technical reason: identify the violated rule, explain why simpler alternatives fail, and confirm no maintainability harm. Convenience or shorter code is never a valid justification, and user confirmation is required.

Why should agents avoid Map<String, Object> for business data?▼

Map<String, Object> hides type information and causes runtime errors. The rules require explicit types such as AgentExecutionContext, AgentTask, ToolCall, and ExecutionStatus so the Java type system expresses business concepts and catches errors at compile time.