init command installs the ap-query skill template into your coding agent’s skill directory, enabling agents to profile and analyze Java applications autonomously.
Usage
What it does
Theinit command:
- Detects or downloads async-profiler - Finds
asprofon your system or offers to download it - Renders the skill template - Embeds
ap-queryandasprofpaths into the skill file - Installs to agent directory - Writes
SKILL.mdto your agent’s skill location
Installation modes
Global installation (recommended)
Install for all projects:~/.claude/skills/jfr/SKILL.mdCodex: Installs to
~/.codex/skills/jfr/SKILL.md (or $CODEX_HOME)
Project-local installation
Install for the current project only:.claude/skills/jfr/SKILL.mdCodex: Installs to
.agents/skills/jfr/SKILL.md
Flags
Explicit path to
asprof binary. Skips auto-detection and interactive prompt.Install to current directory instead of home directory.
Overwrite existing skill files without prompting.
Install only for Claude Code (
.claude/skills/jfr/).Install only for Codex (
.codex/skills/jfr/ global, .agents/skills/jfr/ project).Dump rendered skill to stdout instead of installing. Useful for piping into custom agents.
async-profiler detection
Theinit command attempts to find asprof in this order:
- Explicit
--asprofflag - Use the provided path - PATH search - Look for
asprofin$PATH - Common locations - Check
/usr/local/bin,~/.ap-query/, etc. - Interactive download - Offer to download async-profiler to
~/.ap-query/
init will still create the skill but agents won’t be able to profile until you install async-profiler manually.
Examples
Standard setup
Install for both Claude Code and Codex globally:Project-specific setup
Install for this project only (commits.claude/ or .agents/ to version control):
Custom async-profiler location
Specify async-profiler path explicitly:Preview skill content
Print the rendered skill without installing:Force reinstall
Overwrite existing skill (useful after updating ap-query):Updating skills
After runningap-query update to upgrade the binary, skills are automatically regenerated if they were previously installed globally. For project-local skills, re-run ap-query init --project --force to update them.
Agent usage
Once installed, ask your agent:- Identify the Java process
- Profile with
asprof - Analyze with
ap-query info,hot,tree,trace, etc. - Provide actionable optimization recommendations
Troubleshooting
Skill not activating
Skill not activating
Some agents auto-activate skills based on context (e.g., profiling keywords). If not, explicitly mention “use ap-query” or “analyze with the profiling skill.”
Permission denied on skill directory
Permission denied on skill directory
Check directory permissions for
~/.claude/ or ~/.codex/. Create manually if needed:Agent uses old skill version
Agent uses old skill version
After updating ap-query, force reinstall:Restart your agent if it caches skills.
See also
- Agent integration guide - Complete workflow and examples
- Installation - Initial setup instructions
- update - Update ap-query and regenerate skills