Skip to content

Commit 5aeaf86

Browse files
vetlerCopilot
andcommitted
Add async-profiler skill
Add skill for installing, running, and analyzing async-profiler for Java. Covers CPU/memory/allocation profiling, flamegraph capture and interpretation, JFR recordings, and common setup errors (e.g. perf_events). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1565493 commit 5aeaf86

File tree

10 files changed

+2193
-0
lines changed

10 files changed

+2193
-0
lines changed

docs/README.skills.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
4848
| [arize-trace](../skills/arize-trace/SKILL.md) | INVOKE THIS SKILL when downloading or exporting Arize traces and spans. Covers exporting traces by ID, sessions by ID, and debugging LLM application issues using the ax CLI. | `references/ax-profiles.md`<br />`references/ax-setup.md` |
4949
| [aspire](../skills/aspire/SKILL.md) | Aspire skill covering the Aspire CLI, AppHost orchestration, service discovery, integrations, MCP server, VS Code extension, Dev Containers, GitHub Codespaces, templates, dashboard, and deployment. Use when the user asks to create, run, debug, configure, deploy, or troubleshoot an Aspire distributed application. | `references/architecture.md`<br />`references/cli-reference.md`<br />`references/dashboard.md`<br />`references/deployment.md`<br />`references/integrations-catalog.md`<br />`references/mcp-server.md`<br />`references/polyglot-apis.md`<br />`references/testing.md`<br />`references/troubleshooting.md` |
5050
| [aspnet-minimal-api-openapi](../skills/aspnet-minimal-api-openapi/SKILL.md) | Create ASP.NET Minimal API endpoints with proper OpenAPI documentation | None |
51+
| [async-profiler](../skills/async-profiler/SKILL.md) | Install, run, and analyze async-profiler for Java — low-overhead sampling profiler producing flamegraphs, JFR recordings, and allocation profiles. Use for: "install async-profiler", "set up Java profiling", "Failed to open perf_events", "what JVM flags for profiling", "capture a flamegraph", "profile CPU/memory/allocations/lock contention", "profile my Spring Boot app", "generate a JFR recording", "heap keeps growing", "what does this flamegraph mean", "how do I read a flamegraph", "interpret profiling results", "open a .jfr file", "what's causing my CPU hotspot", "wide frame in my profile", "I see a lot of GC / Hibernate / park in my profile". Use this skill any time a Java developer mentions profiling, flamegraphs, async-profiler, JFR, or wants to understand JVM performance. | `README.md`<br />`analyze`<br />`profile`<br />`scripts/analyze_collapsed.py`<br />`scripts/collect.sh`<br />`scripts/install.sh`<br />`scripts/run_profile.sh`<br />`setup` |
5152
| [automate-this](../skills/automate-this/SKILL.md) | Analyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files, reconstructs the step-by-step workflow, and proposes automation at multiple complexity levels using tools already installed on the user machine. | None |
5253
| [autoresearch](../skills/autoresearch/SKILL.md) | Autonomous iterative experimentation loop for any programming task. Guides the user through defining goals, measurable metrics, and scope constraints, then runs an autonomous loop of code changes, testing, measuring, and keeping/discarding results. Inspired by Karpathy's autoresearch. USE FOR: autonomous improvement, iterative optimization, experiment loop, auto research, performance tuning, automated experimentation, hill climbing, try things automatically, optimize code, run experiments, autonomous coding loop. DO NOT USE FOR: one-shot tasks, simple bug fixes, code review, or tasks without a measurable metric. | None |
5354
| [aws-cdk-python-setup](../skills/aws-cdk-python-setup/SKILL.md) | Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment prerequisites, create new CDK projects, manage dependencies, and deploy to AWS. | None |

skills/async-profiler/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# async-profiler
2+
3+
Install, run, and analyze async-profiler for Java — a low-overhead sampling profiler producing flamegraphs, JFR recordings, and allocation profiles.
4+
5+
## What it does
6+
7+
- Installs async-profiler automatically for macOS or Linux
8+
- Captures CPU time, heap allocations, wall-clock time, and lock contention
9+
- Produces interactive flamegraphs, JFR recordings, and collapsed stack traces
10+
- Interprets profiling output: identifies hotspots, GC pressure, lock contention, N+1 Hibernate patterns
11+
12+
## Compatibility
13+
14+
Requires Python 3.7+ for the analysis script. async-profiler works on macOS and Linux with a running JVM process.
15+
16+
## Installation
17+
18+
**GitHub Copilot CLI:**
19+
20+
Point Copilot at the skill directory from within a session:
21+
```
22+
/skills add /path/to/async-profiler
23+
```
24+
25+
Or copy manually to your personal skills directory (`~/.copilot/skills/` or `~/.agents/skills/` depending on your version):
26+
```bash
27+
cp -r async-profiler ~/.copilot/skills/
28+
# or
29+
cp -r async-profiler ~/.agents/skills/
30+
```
31+
32+
**Claude Code:**
33+
```bash
34+
cp -r async-profiler ~/.claude/skills/async-profiler
35+
```
36+
37+
**OpenCode:**
38+
```bash
39+
cp -r async-profiler ~/.config/opencode/skills/async-profiler
40+
```
41+
42+
## Trigger phrases
43+
44+
- "install async-profiler"
45+
- "capture a flamegraph"
46+
- "profile my Spring Boot app"
47+
- "heap keeps growing"
48+
- "what does this flamegraph mean"
49+
- "I see a lot of GC in my profile"
50+
51+
## Bundled scripts
52+
53+
| Script | Purpose |
54+
|---|---|
55+
| `scripts/install.sh` | Auto-detect platform, download and verify async-profiler |
56+
| `scripts/run_profile.sh` | Wrap `asprof` with defaults, timestamp output |
57+
| `scripts/collect.sh` | Background collection: start all-event profiling, stop and retrieve flamegraphs |
58+
| `scripts/analyze_collapsed.py` | Ranked self-time/inclusive-time table for `.collapsed` files |
59+
60+
## Directory structure
61+
62+
```
63+
async-profiler/
64+
├── SKILL.md # Entry point — routes to sub-guides
65+
├── scripts/ # Bundled scripts
66+
├── setup/
67+
│ └── SKILL.md # Installation and configuration
68+
├── profile/
69+
│ └── SKILL.md # Running profiling sessions
70+
└── analyze/
71+
└── SKILL.md # Interpreting profiling output
72+
```

skills/async-profiler/SKILL.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
name: async-profiler
3+
description: 'Install, run, and analyze async-profiler for Java — low-overhead sampling profiler producing flamegraphs, JFR recordings, and allocation profiles. Use for: "install async-profiler", "set up Java profiling", "Failed to open perf_events", "what JVM flags for profiling", "capture a flamegraph", "profile CPU/memory/allocations/lock contention", "profile my Spring Boot app", "generate a JFR recording", "heap keeps growing", "what does this flamegraph mean", "how do I read a flamegraph", "interpret profiling results", "open a .jfr file", "what''s causing my CPU hotspot", "wide frame in my profile", "I see a lot of GC / Hibernate / park in my profile". Use this skill any time a Java developer mentions profiling, flamegraphs, async-profiler, JFR, or wants to understand JVM performance.'
4+
compatibility: Requires Python 3.7+ for the analyze_collapsed.py script.
5+
---
6+
7+
# async-profiler
8+
9+
async-profiler is a production-safe, low-overhead sampling profiler for Java
10+
that avoids the safepoint bias of standard JVM profilers. It can capture CPU
11+
time, heap allocations, wall-clock time, and lock contention, and produce
12+
interactive flamegraphs, JFR recordings, and collapsed stack traces.
13+
14+
## Installing this skill
15+
16+
### IntelliJ IDEA (Junie or GitHub Copilot)
17+
18+
Skills live in a `.claude/skills/`, `.agents/skills/`, or `.github/skills/`
19+
directory, either in your project repo or in your home directory.
20+
21+
**Project-level — recommended for teams** (commit so everyone gets it):
22+
```bash
23+
# From your project root:
24+
mkdir -p .github/skills
25+
cd .github/skills
26+
unzip /path/to/async-profiler.skill
27+
git add async-profiler
28+
git commit -m "Add async-profiler skill"
29+
```
30+
31+
**Global — personal use across all projects:**
32+
```bash
33+
mkdir -p ~/.claude/skills
34+
cd ~/.claude/skills
35+
unzip /path/to/async-profiler.skill
36+
```
37+
38+
> **Note for GitHub Copilot users:** There is a known issue where the Copilot
39+
> JetBrains plugin does not reliably pick up skills from the global `~/.copilot/skills`
40+
> directory. Use the project-level `.github/skills/` location to be safe.
41+
42+
Alternatively, install the **Agent Skills Manager** plugin from the JetBrains
43+
Marketplace (*Settings → Plugins → Marketplace* → "Agent Skills Manager") for
44+
a UI that installs skills without unzipping manually.
45+
46+
---
47+
48+
## Using this skill in IntelliJ IDEA
49+
50+
### With Junie (JetBrains AI)
51+
52+
Junie is JetBrains' native coding agent, available in the AI Chat panel.
53+
54+
1. Open the AI Chat panel (*View → Tool Windows → AI Chat*, or the chat icon
55+
in the right toolbar)
56+
2. In the agent dropdown at the top of the chat, select **Junie**
57+
3. Choose a mode:
58+
- **Code mode** — Junie can run terminal commands, write files, and execute
59+
the profiling scripts directly. Use this when you want it to actually run
60+
`scripts/install.sh` or `scripts/run_profile.sh` for you.
61+
- **Ask mode** — read-only; Junie analyzes and explains but won't touch
62+
files. Use this when you want help interpreting a flamegraph or JFR file.
63+
4. Just ask naturally — Junie loads the skill automatically when your question
64+
matches the description. You don't need to invoke it by name.
65+
66+
Example prompts that will trigger this skill in Junie:
67+
- *"My Spring Boot app is using too much CPU. Help me capture a flamegraph."*
68+
- *"I have this JFR file — open it and tell me what's slow."*
69+
- *"Install async-profiler on this machine and set up the JVM flags."*
70+
71+
In Code mode, Junie will run `scripts/install.sh`, execute `scripts/run_profile.sh`
72+
with the right flags, and then walk you through the results — all without
73+
leaving IntelliJ.
74+
75+
### With GitHub Copilot in IntelliJ
76+
77+
1. Enable agent mode: *Settings → GitHub Copilot → Chat → Agent* → turn on
78+
**Agent mode** and **Agent Skills**
79+
2. Open the Copilot Chat panel and make sure the mode selector shows **Agent**
80+
3. Ask naturally — Copilot loads the skill when your prompt matches
81+
82+
Example prompts:
83+
- *"Profile my running Java app and show me where the CPU is going."*
84+
- *"Analyze this collapsed stack file and tell me what's allocating the most."*
85+
86+
GitHub Copilot's agent mode can also run the bundled scripts on your behalf —
87+
it will propose the terminal command and ask for confirmation before executing.
88+
89+
### GitHub Copilot CLI
90+
91+
```bash
92+
# Copilot CLI
93+
mkdir -p ~/.copilot/skills
94+
cd ~/.copilot/skills
95+
unzip /path/to/async-profiler.skill
96+
97+
# Or, if your version uses ~/.agents/skills/:
98+
mkdir -p ~/.agents/skills
99+
cd ~/.agents/skills
100+
unzip /path/to/async-profiler.skill
101+
```
102+
103+
Run `/skills list` to confirm it loaded. Then just ask naturally in the terminal.
104+
105+
---
106+
107+
## Bundled scripts
108+
109+
This skill includes four ready-to-run scripts in `scripts/`:
110+
111+
| Script | What it does |
112+
|---|---|
113+
| `scripts/install.sh` | Auto-detects platform, downloads the right binary, verifies install |
114+
| `scripts/run_profile.sh` | Wraps `asprof` with defaults, timestamps output, prints opening instructions |
115+
| `scripts/collect.sh` | Agent-friendly background collection: start all-event profiling, do other work, then stop and get all flamegraphs |
116+
| `scripts/analyze_collapsed.py` | Ranked self-time / inclusive-time table for `.collapsed` files, with filters |
117+
118+
Always offer to run these scripts on the user's behalf when relevant.
119+
120+
## How to use this skill
121+
122+
This skill has three sub-guides. Read the one that matches what the user needs:
123+
124+
| Situation | Read |
125+
|---|---|
126+
| User needs to install or configure async-profiler, or is hitting setup errors | `setup/SKILL.md` |
127+
| User wants to run a profiling session (capture flamegraph, JFR, etc.) | `profile/SKILL.md` |
128+
| User has profiling output and wants to understand or interpret it | `analyze/SKILL.md` |
129+
130+
**When the conversation spans multiple phases** (e.g., the user just ran a
131+
profile and now wants to understand the output), read whichever sub-guide is
132+
most relevant to the current question. If the user needs both setup *and*
133+
profiling guidance in one message, read `setup/SKILL.md` first and summarize
134+
the setup steps before moving to `profile/SKILL.md`.
135+
136+
Read the relevant sub-guide now before responding.

0 commit comments

Comments
 (0)