跳到正文
cccskills
免费在 GitHub 公开中文介绍

java-diagnostics

使用 JDK 诊断工具,根据症状排查 Java 应用的高 CPU、内存不足和响应延迟。选择合适的数据采集方式并逐步缩小原因,同时说明采集开销和敏感数据的处理要求。

原文查看原文说明

Symptom-first runtime diagnostics for JVM applications using JDK tools: jcmd, jstack, jmap, jstat, JFR, GC logs, async-profiler, Native Memory Tracking, and Eclipse MAT. Use when a Java app has high CPU, memory leaks or OutOfMemoryError, slow startup, deadlocks or thread starvation, long GC pauses, native memory growth, or slow requests. Includes permission tiers for safe use.

实测评分 未实测

查看安装方法

适用场景

  • 排查 Java 进程的 CPU 高占用
  • 调查内存泄漏或 OutOfMemoryError
  • 检查死锁和响应延迟
  • 分析 GC 长时间暂停的原因

中文介绍

功能

本技能根据症状选择合适的诊断方法,排查 Java 应用的 CPU 高占用、内存问题、启动缓慢和响应延迟。它会使用 jcmd 和 jstack 查看线程信息,通过 jstat 和 GC 日志检查内存回收情况;必要时进一步使用 JFR 或 async-profiler 记录运行状态。建议多次采集数据,并结合另一种信息来源验证原因假设。

适用场景

当 Java 应用运行缓慢或负载异常,而你不确定应该采集哪些信息时,可以使用本技能。它也涵盖死锁和 Java 堆外内存增长的排查。修复后,可以用相同方法重新测量并比较变化。

使用示例

  • “请根据线程信息调查 CPU 使用率很高的 Java 进程。”
  • “整理缩小 OutOfMemoryError 原因范围所需的数据采集步骤。”

注意事项

诊断工具应以目标 JVM 所属的同一操作系统用户身份运行。记录或连接操作需要用户同意;在生产环境诊断则需要明确指示。堆转储可能包含敏感信息,应在本地分析,不要分享,并在之后删除。采集时还需留意应用暂停和可用磁盘空间。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好分级说明同意和开销,并要求转储文件本地分析后删除。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足列出 JDK 工具及可选工具,但安装说明不完整。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月25日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(9)

  • SKILL.md7.2 KB
  • references/async-profiler.md3.0 KB
  • references/containers.md1.7 KB
  • references/gc.md1.6 KB
  • references/heap.md3.0 KB
  • references/jcmd-basics.md1.9 KB
  • references/jfr.md2.3 KB
  • references/native-memory.md1.5 KB
  • references/thread-dumps.md3.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Java Diagnostics

Pick the lightest tool that answers the question, starting from the symptom.

Permission tiers (obey them)

TierToolsRule
1. Read-onlyjps -l, jcmd <pid> help/VM.version/VM.flags/Thread.print, jstat, jstack, reading logsMay run after stating the exact command. Class histograms (jcmd <pid> GC.class_histogram, jmap -histo, jmap -histo:live) are NOT Tier 1: they run heap inspection at a safepoint and can pause application threads on a large heap, so treat them as Tier 2 (consent, stated overhead). The default forms and -histo:live additionally force a full GC; -all=true / jmap -histo skip the full GC but still pause during the scan (and count unreachable objects).
2. Recording / attachJFR (JFR.start, -XX:StartFlightRecording), async-profiler, NMT (-XX:NativeMemoryTracking), enabling GC logsRequires user consent. State duration and expected overhead (JFR default profile is about 1-2%; async-profiler depends on mode; NMT summary roughly 5-10%, detail more) before running.
3. Intrusive / sensitiveHeap dumps (GC.heap_dump, jmap -dump), jhsdb, commands that print JVM arguments or system properties (jps -v/-lv/-m, bare jcmd, VM.system_properties, VM.command_line, jinfo, ps aux on a Java process; they can expose secrets, redact output), JDWP with suspend, anything on productionRequires explicit consent, a stated target path, free-disk check (a dump is about the size of the used heap), and a stated pause. Heap dumps contain secrets (passwords, tokens, personal data). Never share or upload them; redaction is NOT a reliable safeguard. Analyze locally and delete afterwards.

Never run Tier 2 or Tier 3 commands against production unless the user explicitly instructs it. Run diagnostic tools as the same OS user as the target JVM. Prefer reproducing on dev or staging.

Decision table

SymptomFirst stepThenReference
High CPUThread dumps x3 (Tier 1) + top -H to map hot native thread ids to nidJFR or async-profiler CPU flame graph (Tier 2)threads, jfr, async-profiler
Memory leak / OOMjstat -gcutil, GC.class_histogram -all=true twice, minutes apart (Tier 2: safepoint pause even with -all=true; without it a full GC too; get consent on production)Heap dump + Eclipse MAT (Tier 3) or JFR OldObjectSample (Tier 2)heap, gc
Slow startup-Xlog:class+load, framework startup/condition reports, timestamped logsJFR from start, async-profiler wall-clockjfr, async-profiler
Deadlock / thread starvationjcmd <pid> Thread.print (reports deadlocks), compare dumps over timeVirtual threads: Thread.dump_to_filethreads
GC pausesGC log (-Xlog:gc*) and jstat -gcJFR GC events; tune collector/heapgc
Native memory growth (RSS grows, heap does not)Compare RSS vs heap; enable NMT, jcmd VM.native_memory baseline / summary.diff (Tier 2)async-profiler nativemem or allocator toolsnmt, containers
Slow requestsTracing/metrics and logs first; Actuator or Dev UI (see below)JFR (socket/file/lock events), async-profiler wall-clockjfr, async-profiler
JVM crash / hang, no tools respondhs_err_pid*.log, core dumpjhsdb (Tier 3)basics

Start with jps/jcmd basics to identify the target JVM and confirm which JDK version is running.

Workflow

  1. Capture the symptom precisely (when, how often, since which change, JDK version, container limits).
  2. Choose the tier needed; state the command, its overhead, and output location, and get consent for Tier 2/3.
  3. Collect data to a dedicated directory, with timestamps. Prefer several samples over one.
  4. Form a hypothesis from the data, then confirm with a second source (for example a thread dump plus a flame graph).
  5. Fix, re-measure with the same method, and clean up artifacts (dumps, recordings).

Application-level insights (optional)

JDK tools see the JVM; some questions (which endpoint, which SQL query, which bean) are easier at the application level. Optional options, in order of preference:

  • Spring Boot Actuator (metrics, health, loggers, httpexchanges) and Quarkus Dev UI / Micrometer metrics are built in and need no extra tool. Expose Actuator endpoints minimally; For heapdump and threaddump, follow the policy in the spring-observability skill: never expose them over public HTTP; the only exception is a temporary, user-consented window with authentication, TLS and network restriction, removed afterwards.
  • BootUI (https://github.com/jdubois/boot-ui , https://www.julien-dubois.com/boot-ui/): a local-only developer console with an opt-in MCP server for Spring Boot and Quarkus. Optional. Its skill can be installed with gh skill install jdubois/boot-ui skills/bootui.

If considering BootUI:

  • Ask the user for consent before adding any dependency or installing the skill.
  • Use it in a local/dev profile only; never expose it on a network, and never enable its heap dump, thread dump endpoints or MCP server in production.
  • Check the capability and version first (read its README for the supported Spring Boot / Quarkus versions) instead of assuming features.

Follow the project's own documentation for usage; this skill does not reproduce it.

Containers

See containers for attaching tools inside containers, -XX:MaxRAMPercentage, and cgroup memory limits.

References

Official docs (prefer them over this skill for the JDK in use; change 21 to your version): jcmd https://docs.oracle.com/en/java/javase/21/docs/specs/man/jcmd.html, jfr https://docs.oracle.com/en/java/javase/21/docs/specs/man/jfr.html, JFR guide https://docs.oracle.com/en/java/javase/21/jfr/introduction-jdk-flight-recorder.html, troubleshooting guide https://docs.oracle.com/en/java/javase/21/troubleshoot/, async-profiler releases https://github.com/async-profiler/async-profiler/releases.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

扫描现有项目的代码与配置,生成涵盖技术栈、结构、架构、规范、集成、测试和风险的七份文档。为结论标注文件依据和未知项,并指出计划描述与实际实现的差异。

  • 了解陌生代码库
  • 准备项目交接文档
  • 对照设计资料与实际实现
github/awesome-copilot4万2026年10月24日 更新

acreadiness-assess

免费有简介

使用AgentRC评估代码仓库对AI智能体的准备情况,并生成可独立打开的HTML报告。查看九个方面的评分和优先改进建议,也可按组织自定评分政策。

  • 引入AI智能体前检查准备情况
  • 根据评估结果安排改进优先级
  • 按组织自定政策评分
github/awesome-copilot4万2026年10月24日 更新

使用AgentRC分析项目代码中的语言、框架和开发惯例,生成或更新AI编程代理的指令文件。可集中写入一个文件,也可按主题和项目区域拆分,并在写入前预览改动。

  • 创建VS Code Copilot指令
  • 将开发规则变更写入指令
  • 按单体仓库区域整理规则
github/awesome-copilot4万2026年10月24日 更新

acreadiness-policy

免费有简介

按团队或组织标准调整AgentRC准备度评估。可选择或创建JSON策略,调整检查权重、停用无关检查、设置通过率,并在CI流程中设定自动检查门槛。

  • 制定组织共用的评估标准
  • 只评估AI相关的准备情况
  • 调整特定检查项的权重
github/awesome-copilot4万2026年10月24日 更新

ad-campaign-analyzer

免费有简介

分析你提供的广告成效数据,找出浪费支出和表现较好的广告,并整理暂停、加预算或继续测试的候选项。还可比较不同平台、评估A/B测试差异,并提出预算调整建议。

  • 找出应暂停的广告或关键词
  • 发现适合增加预算的广告系列
  • 判断A/B测试的数据是否足够
github/awesome-copilot4万2026年10月24日 更新

为指定代码文件添加学习注释,解释语法、编程概念和设计选择;可按读者水平调整讲解深度和重复频率,并保持文件结构、编码与语法。

  • 为现有代码添加初学者说明
  • 解释语法或设计选择的原因
  • 按读者经验调整注释内容
github/awesome-copilot4万2026年10月24日 更新

查看 github 的全部技能

报告此技能的问题