Token导航 LogoToken导航TokenDH.com
开发规范只读github未标认证来源可访问许可证需确认审计通过

java-best-practices-debug-analyzerJava 最佳实践调试分析器

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

336

周安装

14

GitHub Stars

1

下载量

112
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:java-best-practices-debug-analyzer(Java 最佳实践调试分析器)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/java-best-practices-debug-analyzer
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill java-best-practices-debug-analyzer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill java-best-practices-debug-analyzer

简介

用于辅助 Java 项目开发、面向对象设计和 Spring 生态集成。

  • 适合分析类结构、设计接口、整理服务分层或生成测试代码。
  • 使用时需结合项目已有架构、包结构和依赖版本,避免仅按教程修改代码。
  • 涉及数据库、事务或并发配置时,应先确认运行环境和回归测试范围。
  • java-best-practices-debug-analyzer 属于开发规范类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Works with Java exception logs, thread dumps, heap dumps, and error messages.

Java Debug Analyzer

Table of Contents

Purpose

Analyzes Java runtime issues, exceptions, stack traces, thread dumps, and performance problems to identify root causes and provide actionable solutions. Helps debug common Java errors, memory leaks, concurrency issues, and performance bottlenecks.

When to Use

Use this skill when you need to:

  • Debug Java runtime exceptions (NullPointerException, ClassNotFoundException, etc.)
  • Analyze stack traces to find root causes
  • Investigate memory leaks (OutOfMemoryError)
  • Debug performance issues (slow responses, high CPU/memory)
  • Analyze thread dumps for deadlocks or thread contention
  • Diagnose ClassNotFoundException or NoClassDefFoundError
  • Troubleshoot database connection issues
  • Debug concurrency problems (race conditions, deadlocks)
  • Investigate production errors from logs
  • Root cause analysis for Java application failures

Quick Start

Provide any Java error, exception, or log and receive root cause analysis:

# Analyze a stack trace
Analyze this Java stack trace: [paste stack trace]

# Debug an exception in logs
Debug the errors in application.log

# Analyze thread dump
Analyze the thread dump in thread-dump.txt

Instructions

Step 1: Identify Problem Type

Classify the issue to apply appropriate analysis:

Exception Categories:

  • Runtime exceptions (NullPointerException, ClassCastException, etc.)
  • Checked exceptions (IOException, SQLException, etc.)
  • Custom application exceptions
  • Framework exceptions (Spring, Hibernate, etc.)

Performance Issues:

  • Slow response times
  • High CPU usage
  • High memory consumption
  • Thread contention

Resource Issues:

  • Memory leaks
  • Connection pool exhaustion
  • File handle leaks
  • Thread starvation

Configuration Issues:

  • ClassNotFoundException/NoClassDefFoundError
  • Dependency conflicts
  • Property misconfiguration

Step 2: Analyze Stack Traces

Extract critical information from stack traces:

Key Elements to Identify:

  1. Exception type - What went wrong
  2. Exception message - Why it happened
  3. Caused by chain - Root cause
  4. First application frame - Where in your code
  5. Framework frames - Context of execution
  6. Suppressed exceptions - Additional context

Analysis Pattern:

Read stack trace from bottom to top:
1. Find "Caused by" at the bottom (root cause)
2. Identify the first frame in YOUR code
3. Understand the context from framework frames
4. Look for patterns (repeated exceptions, timing)

Step 3: Diagnose Common Exceptions

NullPointerException

Root Causes:

  • Uninitialized object reference
  • Method returning null not handled
  • Optional not checked
  • Missing null checks in chain calls

Analysis Steps:

  1. Identify exact line from stack trace
  2. Examine variables on that line
  3. Trace back to where null originated
  4. Check method contracts (should it return null?)

Example Analysis:

// Stack trace shows:
Exception in thread "main" java.lang.NullPointerException
    at com.example.UserService.getEmail(UserService.java:45)

// Line 45 is:
String email = user.getEmail().toLowerCase();

// Diagnosis: Either user is null OR user.getEmail() returns null
// Solution: Add null checks or use Optional
String email = Optional.ofNullable(user)
    .map(User::getEmail)
    .map(String::toLowerCase)
    .orElse("no-email");

ClassNotFoundException / NoClassDefFoundError

Difference:

  • ClassNotFoundException: Class not found at runtime (missing in classpath)
  • NoClassDefFoundError: Class was present at compile time but missing at runtime

Root Causes:

  • Missing dependency in pom.xml/build.gradle
  • Dependency version conflict
  • Wrong classpath configuration
  • JAR not packaged correctly

Analysis Steps:

  1. Identify the missing class name
  2. Check if dependency is declared
  3. Verify dependency scope (runtime vs compile)
  4. Check for version conflicts (mvn dependency:tree)

OutOfMemoryError

Types:

  • Java heap space - Object allocation failed
  • GC overhead limit exceeded - Too much time in GC
  • Unable to create new native thread - Thread exhaustion
  • Metaspace - Class metadata exhaustion

Analysis Steps:

  1. Identify OOM type from message
  2. Check heap size configuration (-Xmx)
  3. Look for memory leak patterns
  4. Analyze heap dump if available

Step 4: Analyze Thread Dumps

Understand thread states and identify issues:

Thread States:

  • RUNNABLE - Executing or ready to execute
  • BLOCKED - Waiting for monitor lock
  • WAITING - Waiting indefinitely (Object.wait())
  • TIMED_WAITING - Waiting with timeout (Thread.sleep())
  • TERMINATED - Thread finished execution

Red Flags:

  • Multiple threads BLOCKED on same lock (contention)
  • Many threads in WAITING state (possible deadlock)
  • Threads holding locks for long time
  • Repeated stack patterns (infinite loops)

Deadlock Detection Pattern:

Look for:
1. Thread A: waiting to lock <0x123> held by Thread B
2. Thread B: waiting to lock <0x456> held by Thread A

Step 5: Diagnose Performance Issues

High CPU:

  • Look for infinite loops in thread dumps
  • Check for inefficient algorithms (nested loops)
  • Examine regex patterns (catastrophic backtracking)
  • Verify GC frequency (excessive GC)

High Memory:

  • Large collections not cleared
  • Static references preventing GC
  • Memory leaks from listeners/callbacks
  • Caching without size limits

Slow Queries:

  • Missing database indexes
  • N+1 query problems
  • Large result sets
  • Missing query optimization

Step 6: Provide Root Cause and Solution

Output Format:

## Problem Summary
[Brief description of the issue]

## Root Cause
[Detailed explanation of why this happened]

## Evidence
[Stack traces, log excerpts, analysis data]

## Solution
[Step-by-step fix]

## Prevention
[How to avoid this in the future]

Supporting Files

FilePurpose
examples/debug-examples.mdComprehensive debugging examples (NullPointerException, ClassNotFoundException, OutOfMemoryError)

Requirements

  • Java development experience
  • Understanding of stack traces
  • Familiarity with Java exceptions
  • Basic knowledge of JVM internals (for memory/thread issues)

Red Flags to Avoid

  • Do not ignore root causes - treat symptoms only temporarily
  • Do not skip stack trace analysis - every line contains clues
  • Do not assume - verify with evidence from logs/code
  • Do not provide generic solutions - tailor to specific error
  • Do not forget prevention - suggest long-term fixes
  • Do not ignore thread dumps - they reveal concurrency issues
  • Do not overlook memory patterns - heap dumps show object retention

Notes

  • Always analyze the full stack trace, not just the first line
  • Root cause is often several frames deep in the stack
  • Consider the context: production load, data volume, timing
  • Memory issues often have delayed manifestations
  • Thread dumps require comparing multiple snapshots
  • ClassNotFoundException vs NoClassDefFoundError are different issues
  • Performance problems often stem from inefficient algorithms or database queries

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.87%
按下载量换算40

Claude

29.53%
按下载量换算33

Cursor

17.78%
按下载量换算20

Gemini CLI

8.97%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills