java-dev

参考来源: Google Java Style Guide、阿里巴巴 Java 开发手册

doccker/cc-use-expUpdated Jun 16, 2026

Works with

Claude CodeCursorClineWindsurfCodexGooseGitHub CopilotZed

2

total installs

2

this week

520

GitHub stars

0

upvotes

Install Skill

Run in your terminal

$npx skills add https://github.com/doccker/cc-use-exp --skill java-dev

2

installs

2

this week

520

stars

Installation Guide

How to use java-dev on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your machine
  • Node.js 16+ with npm — verify with node --version
  • Active project directory where you want to add java-dev
2

Run the install command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/doccker/cc-use-exp --skill java-dev

Fetches java-dev from doccker/cc-use-exp and configures it for Cursor.

3

Select Cursor when prompted

The CLI shows a list of agents. Use arrow keys and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ────────────────
│ · Cline · Codex · Goose · Windsurf
│ ●Cursor(selected)
│ · Cursor · Aider · Continue
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/java-dev

Restart Cursor to activate java-dev. Access via /java-dev in your agent's command palette.

Security Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.

Documentation

Java 开发规范

参考来源: Google Java Style Guide、阿里巴巴 Java 开发手册


工具链

# Maven
mvn clean compile                    # 编译
mvn test                             # 运行测试
mvn verify                           # 运行所有检查

# Gradle
./gradlew build                      # 构建
./gradlew test                       # 运行测试

命名约定

类型 规则 示例
包名 全小写,域名反转 com.example.project
类名 大驼峰,名词/名词短语 UserService, HttpClient
方法名 小驼峰,动词开头 findById, isValid
常量 全大写下划线分隔 MAX_RETRY_COUNT
布尔返回值 is/has/can 前缀 isActive(), hasPermission()

类成员顺序

public class Example {
    // 1. 静态常量
    public static final String CONSTANT = "value";

    // 2. 静态变量
    private static Logger logger = LoggerFactory.getLogger(Example.class);

    // 3. 实例变量
    private Long id;

    // 4. 构造函数
    public Example() { }

    // 5. 静态方法
    public static Example create() { return new Example(); }

    // 6. 实例方法(公共 → 私有)
    public void doSomething() { }
    private void helperMethod() { }

    // 7. getter/setter(或使用 Lombok)
}

DTO/VO 类规范

规则 说明
❌ 禁止手写 getter/setter DTO、VO、Request、Response 类一律使用 Lombok
✅ 使用 @Data 普通 DTO
✅ 使用 @Value 不可变 DTO
✅ 使用 @Builder 字段较多时配合使用
⚠️ Entity 类慎用 @Data JPA Entity 的 equals/hashCode 会影响 Hibernate 代理
// ❌ 手写 getter/setter
public class UserDTO {
    private Long id;
    private String name;
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    // ... 大量样板代码
}

// ✅ 使用 Lombok
@Data
public class UserDTO {
    private Long id;
    private String name;
}

批量查询规范

规则 说明
❌ 禁止 IN 子句超过 500 个参数 SQL 解析开销大,执行计划不稳定
✅ 超过时分批查询 每批 500,合并结果
✅ 封装通用工具方法 避免每处手写分批逻辑
// ❌ 1700 个 ID 一次查询
List<User> users = userRepository.findByIdIn(allIds); // IN 子句过长

// ✅ 分批查询工具方法
public static <T, R> List<R> batchQuery(List<T> params, int batchSize,
                                         Function<List<T>, List<R>> queryFn) {
    List<R> result = new ArrayList<>();
    for (int i = 0; i < params.size(); i += batchSize) {
        List<T> batch = params.subList(i, Math.min(i + batchSize, params.size()));
        result.addAll(queryFn.apply(batch));
    }
    return result;
}

// 使用
List<User> users = batchQuery(allIds, 500, ids -> userRepository.findByIdIn(ids));

N+1 查询防范

规则 说明
❌ 禁止循环内调用 Repository/Mapper stream/forEach/for 内每次迭代触发一次查询
✅ 循环外批量查询,结果转 Map 查询次数从 N 降为 1(或 distinct 数)
// ❌ N+1:循环内逐行查询 count
records.forEach(record -> {
    long count = deviceRepo.countByDeviceId(record.getDeviceId()); // 每条触发一次查询
    record.setDeviceCount(count);
});

// ✅ 循环外批量查询 + Map 查找
List<String> deviceIds = records.stream()
    .map(Record::getDeviceId).distinct().collect(Collectors.toList());
Map<String, Long> countMap = deviceRepo.countByDeviceIdIn(deviceIds).stream()
    .collect(Collectors.toMap(CountDTO::getDeviceId, CountDTO::getCount));
records.forEach(r -> r.setDeviceCount(countMap.getOrDefault(r.getDeviceId(), 0L)));

常见 N+1 场景及修复模式:

场景 循环内(❌) 循环外(✅)
count repo.countByXxx(id) repo.countByXxxIn(ids)Map<id, count>
findById repo.findById(id) repo.findByIdIn(ids)Map<id, entity>
exists repo.existsByXxx(id) repo.findXxxIn(ids)Set<id> + set.contains()

并发安全规范

规则 说明
❌ 禁止 read-modify-write 先读余额再写回,并发下丢失更新
❌ 禁止 check-then-act 无兜底 先检查再操作,并发下条件失效
✅ 使用原子更新 SQL UPDATE SET balance = balance + :delta WHERE id = :id
✅ 或使用乐观锁 @Version 字段 + 重试机制
✅ 唯一索引兜底 防重复插入的最后防线
// ❌ read-modify-write 竞态条件
PointsAccount account = accountRepo.findById(id);
account.setBalance(account.getBalance() + points); // 并发时丢失更新
accountRepo.save(account);

// ✅ 方案一:原子更新 SQL
@Modifying
@Query("UPDATE PointsAccount SET balance = balance + :points WHERE id = :id")
int addBalance(@Param("id") Long id, @Param

List & Monetize Your Skill

Submit your Claude Code skill and start earning

Get started →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Steps

  1. 1Install skill using provided installation command
  2. 2Test with simple use case relevant to your work
  3. 3Evaluate output quality and relevance
  4. 4Iterate on prompts to improve results
  5. 5Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use when

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid when

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Related Skills

Reviews

4.841 reviews
  • A
    Ava ThomasDec 28, 2024

    Keeps context tight: java-dev is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • G
    Ganesh MohaneDec 12, 2024

    Useful defaults in java-dev — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • L
    Li OkaforDec 12, 2024

    java-dev has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • H
    Henry DialloDec 4, 2024

    I recommend java-dev for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • K
    Kaira VermaNov 27, 2024

    We added java-dev from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Z
    Zara AndersonNov 23, 2024

    Solid pick for teams standardizing on skills: java-dev is focused, and the summary matches what you get after install.

  • W
    William AbebeNov 19, 2024

    Registry listing for java-dev matched our evaluation — installs cleanly and behaves as described in the markdown.

  • R
    Rahul SantraNov 3, 2024

    java-dev has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • K
    Kiara MalhotraNov 3, 2024

    Useful defaults in java-dev — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • P
    Pratham WareOct 22, 2024

    Solid pick for teams standardizing on skills: java-dev is focused, and the summary matches what you get after install.

showing 1-10 of 41

1 / 5

Discussion

Comments — not star reviews
  • No comments yet — start the thread.