cc-java-dev

Enforces Java and Spring Boot coding conventions covering naming, concurrency, validation, and testing.

1.0k|109|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/doccker/cc-use-exp --skill cc-java-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cc-java-dev
Source: https://github.com/doccker/cc-use-exp/tree/main/.codex/skills/cc-java-dev
Command: npx skills add https://github.com/doccker/cc-use-exp --skill cc-java-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Java and Spring Boot codebases frequently suffer from recurring defects: N+1 queries, lost updates from read-modify-write races, silently ignored DTO fields, bean naming conflicts, and @Transactional annotations that fail due to self-invocation. This Skill gives the AI a concrete, example-driven rulebook so generated or reviewed Java code avoids these pitfalls from the start.

Core Features & Use Cases

  • Coding Conventions: Naming rules, class member ordering, Lombok-based DTO standards, parameterized logging, and JUnit 5 test structure.
  • Concurrency & Database Safety: Atomic update SQL, optimistic locking, unique-index fallbacks for get-or-create, batch query patterns to eliminate N+1, and Redis+DB consistency strategies.
  • Spring Boot Traps: Constructor injection, circular dependency prevention, self-invocation proxy failures, pagination index alignment, and bean name collision diagnosis.
  • Use Case: When asked to implement a batch stock-deduction endpoint, the AI applies @Valid input constraints, Redis atomic decrement with compensation, and avoids IN-clause queries over 500 parameters.

Quick Start

Ask the AI to write or review a Spring Boot service method, such as implementing a concurrent-safe points balance update with proper validation and tests.

Frequently Asked Questions about cc-java-dev

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

FAQPage Schema
How do I prevent N+1 queries in Spring Data JPA?

Move repository calls out of loops by collecting IDs first, then running one batch query like findByIdIn, and matching results in memory via a Map. This reduces N database round-trips to one.

How to safely update account balance in Java with concurrency?

Avoid read-modify-write in Java code. Use an atomic SQL update such as UPDATE SET balance = balance + :delta, or add a @Version field for optimistic locking, with a unique index as the final guard.

Why does @Transactional not work when calling a method in the same class?

Spring annotations work through AOP proxies, so this.method() bypasses the proxy and @Transactional is ignored. Fix it with self-injection using @Lazy, or move the method to a separate bean.

Why does RestTemplate POST fail with 412 against WeChat APIs?

RestTemplate's default HttpURLConnection has compatibility issues with some CDN layers on POST requests, returning 412 or 403 with an empty body. Switch to java.net.http.HttpClient or configure Apache HttpClient via HttpComponentsClientHttpRequestFactory.

What causes 'no qualifying bean of type' when the bean clearly exists?

A common hidden cause is a @Bean(name=...) colliding with a @Service class's default bean name, so the wrong type gets registered. Rename the bean (e.g., XxxThreadPool) instead of enabling allow-bean-definition-overriding.