perf-skill 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.claude-plugin/README.md +53 -0
  2. package/.claude-plugin/marketplace.json +58 -0
  3. package/.claude-plugin/plugin.json +40 -0
  4. package/CLAUDE.md +164 -0
  5. package/README.md +128 -109
  6. package/SKILL.md +86 -130
  7. package/dist/cli/init.d.ts +19 -3
  8. package/dist/cli/init.d.ts.map +1 -1
  9. package/dist/cli/init.js +107 -10
  10. package/dist/cli/init.js.map +1 -1
  11. package/dist/cli/main.js +72 -49
  12. package/dist/cli/main.js.map +1 -1
  13. package/dist/cli/platforms.d.ts +28 -0
  14. package/dist/cli/platforms.d.ts.map +1 -0
  15. package/dist/cli/platforms.js +238 -0
  16. package/dist/cli/platforms.js.map +1 -0
  17. package/dist/cli/template.d.ts +16 -0
  18. package/dist/cli/template.d.ts.map +1 -0
  19. package/dist/cli/template.js +157 -0
  20. package/dist/cli/template.js.map +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +71 -36
  23. package/dist/index.js.map +1 -1
  24. package/dist/llm/client.d.ts +6 -0
  25. package/dist/llm/client.d.ts.map +1 -1
  26. package/dist/llm/client.js +11 -2
  27. package/dist/llm/client.js.map +1 -1
  28. package/dist/llm/index.d.ts +1 -1
  29. package/dist/llm/index.d.ts.map +1 -1
  30. package/dist/llm/index.js +1 -1
  31. package/dist/llm/index.js.map +1 -1
  32. package/dist/skill/handler.d.ts +7 -0
  33. package/dist/skill/handler.d.ts.map +1 -1
  34. package/dist/skill/handler.js +24 -1
  35. package/dist/skill/handler.js.map +1 -1
  36. package/dist/skill/manifest.d.ts +4 -0
  37. package/dist/skill/manifest.d.ts.map +1 -1
  38. package/dist/skill/manifest.js +60 -39
  39. package/dist/skill/manifest.js.map +1 -1
  40. package/dist/types.d.ts +2 -0
  41. package/dist/types.d.ts.map +1 -1
  42. package/package.json +12 -9
  43. package/dist/server/http.d.ts +0 -27
  44. package/dist/server/http.d.ts.map +0 -1
  45. package/dist/server/http.js +0 -285
  46. package/dist/server/http.js.map +0 -1
  47. package/dist/server/utils.d.ts +0 -15
  48. package/dist/server/utils.d.ts.map +0 -1
  49. package/dist/server/utils.js +0 -71
  50. package/dist/server/utils.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ # perf-skill for Claude Marketplace
2
+
3
+ This directory contains the Claude Marketplace plugin configuration for perf-skill.
4
+
5
+ ## Files
6
+
7
+ - `plugin.json` - Main plugin manifest defining skills, installation, and compatibility
8
+ - `marketplace.json` - Marketplace listing metadata (description, category, triggers)
9
+
10
+ ## Publishing to Claude Marketplace
11
+
12
+ ### Prerequisites
13
+
14
+ 1. Ensure the npm package is published: `npm publish`
15
+ 2. Verify the SKILL.md is included in the npm package
16
+ 3. Test the installation: `npx perf-skill init --ai claude`
17
+
18
+ ### Submission
19
+
20
+ 1. Visit [Claude Marketplace Developer Portal](https://claude.ai/marketplace/developer)
21
+ 2. Submit this repository for review
22
+ 3. The marketplace will validate:
23
+ - Plugin manifest schema
24
+ - Installation process
25
+ - Skill file structure
26
+ - Documentation quality
27
+
28
+ ### Local Testing
29
+
30
+ ```bash
31
+ # Install locally for testing
32
+ npx perf-skill init --ai claude --scope project
33
+
34
+ # Verify skill installation
35
+ cat .claude/skills/perf-skill/SKILL.md
36
+ ```
37
+
38
+ ## Trigger Configuration
39
+
40
+ The `marketplace.json` defines when Claude should suggest this skill:
41
+
42
+ - **File patterns**: `*.pb.gz`, `*.pprof`
43
+ - **Keywords**: profile, pprof, cpu, heap, memory, performance, slow, bottleneck
44
+ - **Intents**: "analyze profile", "why is my app slow", "compare performance"
45
+
46
+ ## Version Sync
47
+
48
+ Keep `version` in `plugin.json` synchronized with `package.json` version.
49
+
50
+ ## Support
51
+
52
+ - Issues: https://github.com/skillsland/perf-skill/issues
53
+ - Documentation: https://github.com/skillsland/perf-skill#readme
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://claude.ai/plugins/v1/marketplace.schema.json",
3
+ "listing": {
4
+ "name": "perf-skill",
5
+ "tagline": "AI-powered pprof profile analysis",
6
+ "shortDescription": "Convert CPU and heap profiles to structured evidence for performance optimization",
7
+ "longDescription": "perf-skill is a deterministic evidence generator for pprof profiles. It converts .pb.gz CPU and heap profiles into structured Markdown and JSON, enabling AI agents to provide optimization recommendations based on factual evidence.\n\n## Features\n\n- **Analyze** - Convert profiles to structured hotspot reports\n- **Diff** - Compare two profiles to find regressions\n- **Profile** - Capture CPU and heap profiles from Node.js apps\n- **Evidence-first** - Produces structured data for AI agents to interpret\n\n## Use Cases\n\n- Identify CPU bottlenecks in Node.js applications\n- Find memory leaks and allocation hotspots\n- Compare before/after profiles to verify optimizations\n- Generate evidence for performance code reviews",
8
+ "category": "developer-tools",
9
+ "subcategory": "performance",
10
+ "icon": "chart-line",
11
+ "screenshots": [],
12
+ "documentation": "https://github.com/skillsland/perf-skill#readme",
13
+ "support": {
14
+ "url": "https://github.com/skillsland/perf-skill/issues",
15
+ "email": null
16
+ },
17
+ "pricing": {
18
+ "type": "free"
19
+ },
20
+ "stats": {
21
+ "installs": 0,
22
+ "rating": null,
23
+ "reviews": 0
24
+ }
25
+ },
26
+ "triggers": {
27
+ "filePatterns": [
28
+ "*.pb.gz",
29
+ "*.pprof"
30
+ ],
31
+ "keywords": [
32
+ "profile",
33
+ "pprof",
34
+ "cpu",
35
+ "heap",
36
+ "memory",
37
+ "performance",
38
+ "slow",
39
+ "bottleneck",
40
+ "hotspot",
41
+ "optimize",
42
+ "regression"
43
+ ],
44
+ "intents": [
45
+ "analyze profile",
46
+ "why is my app slow",
47
+ "compare performance",
48
+ "find memory leak",
49
+ "cpu profiling",
50
+ "heap analysis"
51
+ ]
52
+ },
53
+ "requirements": {
54
+ "runtime": "node",
55
+ "minVersion": "20.0.0",
56
+ "dependencies": []
57
+ }
58
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://claude.ai/plugins/v1/plugin.schema.json",
3
+ "name": "perf-skill",
4
+ "version": "0.3.0",
5
+ "description": "Performance profile evidence extractor - Convert pprof CPU and heap profiles to structured Markdown and JSON for AI-powered performance analysis",
6
+ "author": "skillsland",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/skillsland/perf-skill",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/skillsland/perf-skill.git"
12
+ },
13
+ "keywords": [
14
+ "performance",
15
+ "profiling",
16
+ "pprof",
17
+ "cpu",
18
+ "heap",
19
+ "memory",
20
+ "optimization",
21
+ "analysis",
22
+ "node.js",
23
+ "evidence"
24
+ ],
25
+ "skills": [
26
+ {
27
+ "name": "perf-skill",
28
+ "path": ".claude/skills/perf-skill/SKILL.md",
29
+ "description": "Analyze pprof CPU and heap profiles to identify performance bottlenecks"
30
+ }
31
+ ],
32
+ "install": {
33
+ "type": "npm",
34
+ "package": "perf-skill",
35
+ "postInstall": "npx perf-skill init --ai claude"
36
+ },
37
+ "compatibility": {
38
+ "claude": ">=1.0.0"
39
+ }
40
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,164 @@
1
+ # CLAUDE.md - Developer Guide for perf-skill
2
+
3
+ This document provides guidelines for AI agents and developers working with the perf-skill codebase.
4
+
5
+ ## Project Overview
6
+
7
+ perf-skill is an AI skill that converts pprof CPU and heap profiles (.pb.gz) into structured Markdown and JSON evidence. It follows a **deterministic, evidence-first** design philosophy - the tool produces factual data without AI dependencies, while AI agents can optionally enhance the output with recommendations.
8
+
9
+ ## Repository Structure
10
+
11
+ ```
12
+ perf-skill/
13
+ ├── src/
14
+ │ ├── cli/ # CLI implementation
15
+ │ │ ├── main.ts # CLI entry point
16
+ │ │ ├── init.ts # Skill installation logic
17
+ │ │ ├── platforms.ts # Multi-platform configurations
18
+ │ │ └── template.ts # Template rendering engine
19
+ │ ├── parser/ # pprof parsing logic
20
+ │ ├── renderer/ # Markdown/JSON output
21
+ │ ├── profile/ # Node.js profiling
22
+ │ └── index.ts # Library exports
23
+ ├── test/ # Test files
24
+ ├── SKILL.md # Main skill definition
25
+ ├── .claude-plugin/ # Claude Marketplace configs
26
+ ├── package.json
27
+ └── README.md
28
+ ```
29
+
30
+ ## Key Commands
31
+
32
+ ### Development
33
+
34
+ ```bash
35
+ # Build
36
+ npm run build
37
+
38
+ # Run CLI in development
39
+ npm run cli -- analyze profile.pb.gz
40
+
41
+ # Run tests
42
+ npm test
43
+
44
+ # Lint
45
+ npm run lint
46
+ ```
47
+
48
+ ### CLI Usage
49
+
50
+ ```bash
51
+ # Analyze a profile
52
+ npx perf-skill analyze cpu.pb.gz -o report.md
53
+
54
+ # Compare profiles
55
+ npx perf-skill diff base.pb.gz current.pb.gz
56
+
57
+ # Profile and analyze a Node.js app
58
+ npx perf-skill run app.js --duration 10s
59
+
60
+ # Install skill for a platform
61
+ npx perf-skill init --ai cursor
62
+ npx perf-skill init --ai claude
63
+ npx perf-skill init --ai all
64
+ ```
65
+
66
+ ## Architecture Decisions
67
+
68
+ ### Evidence-First Design
69
+
70
+ - The core analyzer produces structured data without AI
71
+ - LLM integration is optional (via `--ai` flag)
72
+ - All outputs are reproducible and deterministic
73
+
74
+ ### Multi-Platform Support
75
+
76
+ The `init` command supports 13+ AI platforms:
77
+ - Claude, Cursor, Windsurf, Copilot, Kiro
78
+ - Codex, Qoder, Roo Code, Gemini, Trae
79
+ - OpenCode, Continue, CodeBuddy
80
+
81
+ Each platform has its own configuration in `src/cli/platforms.ts`.
82
+
83
+ ### Template System
84
+
85
+ Platform-specific skill files are generated from:
86
+ 1. Base `SKILL.md` content
87
+ 2. Platform configuration (frontmatter, sections)
88
+ 3. Template engine in `src/cli/template.ts`
89
+
90
+ ## Contributing Guidelines
91
+
92
+ ### Code Style
93
+
94
+ - Use TypeScript strict mode
95
+ - Follow existing patterns for error handling
96
+ - Add tests for new features
97
+ - Update SKILL.md for user-facing changes
98
+
99
+ ### Testing
100
+
101
+ ```bash
102
+ # Run all tests
103
+ npm test
104
+
105
+ # Run specific test file
106
+ node --test --import tsx test/parser.test.ts
107
+ ```
108
+
109
+ ### Pull Request Process
110
+
111
+ 1. Create feature branch from `main`
112
+ 2. Make changes with descriptive commits
113
+ 3. Ensure tests pass: `npm test`
114
+ 4. Ensure lint passes: `npm run lint`
115
+ 5. Update documentation if needed
116
+ 6. Submit PR with clear description
117
+
118
+ ## Common Tasks
119
+
120
+ ### Adding a New Platform
121
+
122
+ 1. Add platform to `AI_PLATFORMS` array in `src/cli/platforms.ts`
123
+ 2. Add configuration to `PLATFORM_CONFIGS` object
124
+ 3. Test installation: `npm run cli -- init --ai <platform>`
125
+
126
+ ### Updating SKILL.md
127
+
128
+ 1. Edit the root `SKILL.md` file
129
+ 2. Test rendering: `npm run cli -- init --ai claude --dry-run`
130
+ 3. Verify frontmatter is valid YAML
131
+
132
+ ### Publishing
133
+
134
+ ```bash
135
+ # Bump version
136
+ npm version patch|minor|major
137
+
138
+ # Publish to npm
139
+ npm publish
140
+
141
+ # Sync Claude Marketplace
142
+ # - Update version in .claude-plugin/plugin.json
143
+ # - Submit to marketplace for review
144
+ ```
145
+
146
+ ## Debugging
147
+
148
+ ### Common Issues
149
+
150
+ 1. **Profile parsing fails**: Check file is valid gzip-compressed protobuf
151
+ 2. **Source code not included**: Verify `--source-dir` path exists
152
+ 3. **Platform install fails**: Check directory permissions
153
+
154
+ ### Verbose Mode
155
+
156
+ ```bash
157
+ npx perf-skill analyze profile.pb.gz --verbose
158
+ ```
159
+
160
+ ## Security Considerations
161
+
162
+ - Profile data may contain sensitive information
163
+ - Use `--redact` (default) to sanitize paths
164
+ - Never commit real profiles to the repository
package/README.md CHANGED
@@ -4,14 +4,23 @@
4
4
  [![npm version](https://badge.fury.io/js/perf-skill.svg)](http://badge.fury.io/js/perf-skill)
5
5
  ![license](https://img.shields.io/npm/l/perf-skill)
6
6
 
7
- AI‑assisted pprof toolkit for CPU/heap profiles: convert .pb.gz/.pprof to structured Markdown, compare profiles for regressions, and optionally generate evidence‑backed recommendations.
7
+ **Deterministic** pprof evidence extractor for CPU/heap profiles: convert .pb.gz/.pprof to structured Markdown and JSON, compare profiles for regressions, and produce evidence that any AI agent can use for optimization recommendations.
8
+
9
+ ## Philosophy
10
+
11
+ This tool follows the "evidence generator" pattern:
12
+
13
+ 1. **Deterministic by default** — All operations produce consistent, reproducible output without external API calls
14
+ 2. **LLM-agnostic** — The tool produces structured evidence (hotspots, call paths, metrics); the host agent (Claude, Cursor, etc.) performs reasoning
15
+ 3. **No network by default** — No data leaves your machine unless you explicitly enable AI analysis with `--ai`
16
+ 4. **Skill-ready** — Designed to work as a Claude Skill / Cursor Agent Skill that provides facts for the agent to interpret
8
17
 
9
18
  ## Features
10
19
 
11
- - **Convert**: Transform pprof profiles to structured Markdown
12
- - **Analyze**: Get AI-powered optimization recommendations
13
- - **Diff**: Compare two profiles to find regressions
14
- - **Multi-format**: Library, CLI, and HTTP API
20
+ - **Convert** (default): Transform pprof profiles to structured Markdown and JSON evidence
21
+ - **Analyze**: Optionally get AI-powered recommendations with `--ai` flag
22
+ - **Diff**: Compare two profiles to find regressions and improvements
23
+ - **Multiple interfaces**: Library API and CLI for direct integration
15
24
 
16
25
  ## Installation
17
26
 
@@ -25,32 +34,56 @@ Or run directly with npx:
25
34
  npx perf-skill analyze profile.pb.gz
26
35
  ```
27
36
 
37
+ ### AI Platform Integration
38
+
39
+ Install perf-skill as a skill for your preferred AI coding assistant:
40
+
41
+ ```bash
42
+ # Claude Code / Claude Desktop
43
+ npx perf-skill init --ai claude
44
+
45
+ # Cursor
46
+ npx perf-skill init --ai cursor
47
+
48
+ # GitHub Copilot
49
+ npx perf-skill init --ai copilot
50
+
51
+ # All supported platforms at once
52
+ npx perf-skill init --ai all
53
+ ```
54
+
55
+ See [Supported Platforms](#supported-platforms) for the full list.
56
+
28
57
  ## Quick Start
29
58
 
30
59
  ### CLI Usage
31
60
 
32
61
  ```bash
33
- # Convert profile to markdown (fast, no LLM)
34
- perf-skill convert cpu.pb.gz -o report.md
62
+ # Analyze profile structured evidence (default, no LLM, no network)
63
+ perf-skill analyze cpu.pb.gz -o report.md
64
+
65
+ # Analyze with explicit AI recommendations (requires API key)
66
+ perf-skill analyze cpu.pb.gz --ai -o report.md
35
67
 
36
- # Full analysis with AI recommendations
37
- perf-skill analyze cpu.pb.gz --mode analyze
68
+ # Convert-only command (always deterministic)
69
+ perf-skill convert cpu.pb.gz -o report.md
38
70
 
39
- # Profile a Node entry (CPU, 10s) and analyze
71
+ # Profile a Node entry (CPU, 10s) evidence output
40
72
  perf-skill run slow.mjs --duration 10s
41
73
 
74
+ # Profile with AI recommendations
75
+ perf-skill run slow.mjs --duration 10s --ai
76
+
42
77
  # CPU + Heap profiling (separate reports)
43
78
  perf-skill run slow.mjs --heap --output cpu.md --heap-output heap.md
44
79
 
45
80
  # Compare two profiles
46
81
  perf-skill diff base.pb.gz current.pb.gz -o diff.md
47
82
 
48
- # Start HTTP server
49
- perf-skill server --port 3000
50
-
51
- # Install SKILL.md for Cursor (user or project)
52
- perf-skill init --cursor
53
- perf-skill init --cursor --scope project
83
+ # Install skill for your AI platform
84
+ perf-skill init --ai claude
85
+ perf-skill init --ai cursor --scope project
86
+ perf-skill init --ai all # Install to all supported platforms
54
87
 
55
88
  # Install SKILL.md to a custom directory
56
89
  perf-skill init ./skills/perf-skill
@@ -59,14 +92,15 @@ perf-skill init ./skills/perf-skill
59
92
  ### Programmatic Usage
60
93
 
61
94
  ```typescript
62
- import { analyze, diff } from "perf-skill-skill";
95
+ import { analyze, diff } from "perf-skill";
63
96
 
64
- // Convert only (no LLM)
65
- const result = await analyze("cpu.pb.gz", { mode: "convert-only" });
66
- console.log(result.markdown);
67
- console.log(result.hotspots);
97
+ // Default: deterministic evidence extraction (no LLM, no network)
98
+ const result = await analyze("cpu.pb.gz");
99
+ console.log(result.markdown); // Structured Markdown report
100
+ console.log(result.hotspots); // Array of hotspot objects
101
+ console.log(result.raw.llmStatus); // "skipped" - no LLM was invoked
68
102
 
69
- // Full analysis with AI recommendations
103
+ // Explicit AI analysis (requires API key)
70
104
  const fullResult = await analyze("cpu.pb.gz", {
71
105
  mode: "analyze",
72
106
  context: {
@@ -76,8 +110,9 @@ const fullResult = await analyze("cpu.pb.gz", {
76
110
  },
77
111
  });
78
112
  console.log(fullResult.recommendations);
113
+ console.log(fullResult.raw.llmStatus); // "success" or "failed"
79
114
 
80
- // Compare two profiles
115
+ // Compare two profiles (always deterministic)
81
116
  const diffResult = await diff("base.pb.gz", "current.pb.gz", {
82
117
  normalize: "scale-to-base-total",
83
118
  });
@@ -85,43 +120,27 @@ console.log(diffResult.regressions);
85
120
  console.log(diffResult.improvements);
86
121
  ```
87
122
 
88
- ### HTTP API
89
-
90
- ```bash
91
- # Start server
92
- perf-skill server
93
-
94
- # Start server with security overrides
95
- perf-skill server --no-cors --no-helmet --rate-limit --rate-limit-max 120 --rate-limit-window-ms 60000
96
-
97
- # Analyze profile
98
- curl -X POST http://localhost:3000/v1/pprof/analyze \
99
- -F "file=@cpu.pb.gz"
100
-
101
- # Compare profiles
102
- curl -X POST http://localhost:3000/v1/pprof/diff \
103
- -F "base=@base.pb.gz" \
104
- -F "current=@current.pb.gz"
105
- ```
106
-
107
123
  ## CLI Options
108
124
 
109
125
  ### `perf-skill analyze <profile.pb.gz>`
110
126
 
111
- | Option | Description | Default |
112
- | ---------------------- | ------------------------------------------------ | ---------- |
113
- | `-f, --format` | Output format: `summary`, `detailed`, `adaptive` | `adaptive` |
114
- | `-t, --type` | Profile type: `cpu`, `heap`, `auto` | `auto` |
115
- | `-o, --output` | Output markdown file | stdout |
116
- | `-j, --json` | Output JSON results file | - |
117
- | `-m, --mode` | `convert-only` or `analyze` | `analyze` |
118
- | `-s, --source-dir` | Source directory for code context | - |
119
- | `--max-hotspots` | Maximum hotspots to show | `10` |
120
- | `--llm-provider` | LLM provider: `openai`, `anthropic`, etc. | `openai` |
121
- | `--llm-model` | LLM model name | `gpt-5.2` |
122
- | `--service` | Service name for context | - |
123
- | `--scenario` | Scenario description | - |
124
- | `--redact/--no-redact` | Redact sensitive information | `true` |
127
+ | Option | Description | Default |
128
+ | ---------------------- | ------------------------------------------------ | -------------- |
129
+ | `-f, --format` | Output format: `summary`, `detailed`, `adaptive` | `adaptive` |
130
+ | `-t, --type` | Profile type: `cpu`, `heap`, `auto` | `auto` |
131
+ | `-o, --output` | Output markdown file | stdout |
132
+ | `-j, --json` | Output JSON results file | - |
133
+ | `-m, --mode` | `convert-only` or `analyze` | `convert-only` |
134
+ | `--ai` | Enable AI-powered recommendations (requires key) | `false` |
135
+ | `-s, --source-dir` | Source directory for code context | - |
136
+ | `--max-hotspots` | Maximum hotspots to show | `10` |
137
+ | `--llm-provider` | LLM provider: `openai`, `anthropic`, etc. | `openai` |
138
+ | `--llm-model` | LLM model name | `gpt-5.2` |
139
+ | `--service` | Service name for context | - |
140
+ | `--scenario` | Scenario description | - |
141
+ | `--redact/--no-redact` | Redact sensitive information | `true` |
142
+
143
+ > **Note:** By default, `analyze` produces deterministic evidence output (no LLM). Use `--ai` to explicitly enable AI recommendations.
125
144
 
126
145
  ### `perf-skill run <entry> [entryArgs...]`
127
146
 
@@ -139,7 +158,8 @@ curl -X POST http://localhost:3000/v1/pprof/diff \
139
158
  | `-t, --type` | Profile type: `cpu`, `heap`, `auto` | `auto` |
140
159
  | `-o, --output` | Output markdown file | stdout |
141
160
  | `-j, --json` | Output JSON results file | - |
142
- | `-m, --mode` | `convert-only` or `analyze` | `analyze` |
161
+ | `-m, --mode` | `convert-only` or `analyze` | `convert-only` |
162
+ | `--ai` | Enable AI-powered recommendations (requires key) | `false` |
143
163
  | `-s, --source-dir` | Source directory for code context | - |
144
164
  | `--max-hotspots` | Maximum hotspots to show | `10` |
145
165
  | `--llm-provider` | LLM provider: `openai`, `anthropic`, etc. | `openai` |
@@ -150,6 +170,8 @@ curl -X POST http://localhost:3000/v1/pprof/diff \
150
170
 
151
171
  When `--heap` is enabled and `--output` is omitted, `perf-skill` writes `cpu.md` and `heap.md` instead of printing to stdout.
152
172
 
173
+ > **Note:** By default, `run` produces deterministic evidence output (no LLM). Use `--ai` to explicitly enable AI recommendations.
174
+
153
175
  ### `perf-skill profile <entry> [entryArgs...]`
154
176
 
155
177
  | Option | Description | Default |
@@ -173,14 +195,49 @@ When `--heap` is enabled and `--output` is omitted, `perf-skill` writes `cpu.md`
173
195
 
174
196
  ### `perf-skill init [target]`
175
197
 
176
- Install the bundled `SKILL.md` to a target directory or Cursor skills folder.
198
+ Install the `SKILL.md` to a target directory or AI platform.
199
+
200
+ | Option | Description | Default |
201
+ | -------------- | -------------------------------------- | --------- |
202
+ | `-a, --ai` | Target AI platform (see below) | - |
203
+ | `-c, --cursor` | Install into Cursor (legacy) | `false` |
204
+ | `--scope` | Installation scope: `user` or `project`| `project` |
205
+ | `-f, --force` | Overwrite existing `SKILL.md` | `false` |
206
+ | `--dry-run` | Show destination without writing files | `false` |
207
+ | `--offline` | Use bundled assets only | `false` |
208
+
209
+ #### Supported Platforms
210
+
211
+ | Platform | Command | Install Location |
212
+ | ----------- | ------------------------------- | --------------------------------------- |
213
+ | Claude | `--ai claude` | `.claude/skills/perf-skill/SKILL.md` |
214
+ | Cursor | `--ai cursor` | `.cursor/skills/perf-skill/SKILL.md` |
215
+ | Windsurf | `--ai windsurf` | `.windsurf/skills/perf-skill/SKILL.md` |
216
+ | Copilot | `--ai copilot` | `.github/copilot/perf-skill.md` |
217
+ | Kiro | `--ai kiro` | `.kiro/skills/perf-skill/SKILL.md` |
218
+ | Codex | `--ai codex` | `.codex/skills/perf-skill/SKILL.md` |
219
+ | Qoder | `--ai qoder` | `.qodo/skills/perf-skill/SKILL.md` |
220
+ | Roo Code | `--ai roocode` | `.roo/skills/perf-skill/SKILL.md` |
221
+ | Gemini | `--ai gemini` | `.gemini/skills/perf-skill/SKILL.md` |
222
+ | Trae | `--ai trae` | `.trae/skills/perf-skill/SKILL.md` |
223
+ | OpenCode | `--ai opencode` | `.opencode/skills/perf-skill/SKILL.md` |
224
+ | Continue | `--ai continue` | `.continue/skills/perf-skill/SKILL.md` |
225
+ | CodeBuddy | `--ai codebuddy` | `.codebuddy/skills/perf-skill/SKILL.md` |
226
+ | **All** | `--ai all` | Installs to all platforms |
227
+
228
+ ```bash
229
+ # Install for Claude
230
+ npx perf-skill init --ai claude
231
+
232
+ # Install for Cursor (project scope)
233
+ npx perf-skill init --ai cursor --scope project
177
234
 
178
- | Option | Description | Default |
179
- | -------------- | -------------------------------------- | ------- |
180
- | `-c, --cursor` | Install into Cursor skills folder | `false` |
181
- | `--scope` | Cursor scope: `user` or `project` | `user` |
182
- | `-f, --force` | Overwrite existing `SKILL.md` | `false` |
183
- | `--dry-run` | Show destination without writing files | `false` |
235
+ # Install for all supported platforms
236
+ npx perf-skill init --ai all
237
+
238
+ # Preview installation without writing
239
+ npx perf-skill init --ai cursor --dry-run
240
+ ```
184
241
 
185
242
  ## Output Formats
186
243
 
@@ -209,9 +266,9 @@ Full context with call trees and source code.
209
266
 
210
267
  Summary with drill-down sections and anchor links for navigation.
211
268
 
212
- ## AI Recommendations
269
+ ## AI Recommendations (Optional)
213
270
 
214
- When using `--mode analyze`, the tool generates structured recommendations:
271
+ When using `--ai` (or `--mode analyze`), the tool invokes an LLM to generate structured recommendations:
215
272
 
216
273
  ```typescript
217
274
  interface Recommendation {
@@ -226,6 +283,8 @@ interface Recommendation {
226
283
 
227
284
  All recommendations must reference evidence from the profile (function names, percentages, locations).
228
285
 
286
+ > **Note:** For Skill/Agent usage, it is recommended to let the host agent (Claude, Cursor, etc.) generate recommendations based on the deterministic evidence output. This keeps the tool LLM-agnostic and allows the agent to apply its own reasoning.
287
+
229
288
  ## Profile Diff
230
289
 
231
290
  Compare two profiles to identify performance regressions:
@@ -288,12 +347,6 @@ writeFileSync("heap.pb.gz", gzipSync(heapProfile.encode()));
288
347
  | `LLM_RETRY_DELAY_MS` | Base retry delay in ms |
289
348
  | `LOG_LEVEL` | Logging level: `debug`, `info`, `warn`, `error` |
290
349
  | `LOG_FORMAT` | Log format: `text`, `json` |
291
- | `CORS_ENABLED` | Enable CORS (`true`/`false`) |
292
- | `CORS_ORIGIN` | CORS origin(s), comma-separated or `*` |
293
- | `HELMET_ENABLED` | Enable Helmet (`true`/`false`) |
294
- | `RATE_LIMIT_ENABLED` | Enable rate limiting (`true`/`false`) |
295
- | `RATE_LIMIT_MAX` | Rate limit max requests per window |
296
- | `RATE_LIMIT_WINDOW_MS` | Rate limit window size in ms |
297
350
 
298
351
  Example:
299
352
 
@@ -331,47 +384,13 @@ By default, the tool redacts:
331
384
 
332
385
  Disable with `--no-redact` or `redact: false`.
333
386
 
334
- ### Server Mode
335
-
336
- In HTTP server mode:
337
-
338
- - Source code inclusion is disabled by default
339
- - File size limits are enforced
340
- - Only `.pb.gz` files are accepted
341
-
342
- Security defaults (configurable via env or server options):
343
-
344
- - CORS enabled (set `CORS_ENABLED=false` to disable)
345
- - Helmet enabled (set `HELMET_ENABLED=false` to disable)
346
- - Rate limiting enabled (default 60 req/min, set `RATE_LIMIT_ENABLED=false` or `RATE_LIMIT_MAX=0` to disable)
347
-
348
- Server CLI flags (override env defaults):
349
-
350
- - `--cors/--no-cors`
351
- - `--cors-origin <origin>` (comma-separated or `*`)
352
- - `--helmet/--no-helmet`
353
- - `--rate-limit/--no-rate-limit`
354
- - `--rate-limit-max <n>`
355
- - `--rate-limit-window-ms <ms>`
356
-
357
- ServerOptions (programmatic):
358
-
359
- ```typescript
360
- const server = await createServer({
361
- enableCors: true,
362
- corsOrigin: "https://example.com",
363
- enableHelmet: true,
364
- enableRateLimit: true,
365
- rateLimitMax: 60,
366
- rateLimitWindowMs: 60_000,
367
- });
368
- ```
369
-
370
387
  ## Requirements
371
388
 
372
389
  - Node.js >= 22.6.0
373
- - For AI analysis: API key for OpenAI, Anthropic, or compatible provider
374
390
  - CPU profiling uses bundled `@datadog/pprof` (native module) on supported platforms
391
+ - **Optional:** For AI recommendations (`--ai`), an API key for OpenAI, Anthropic, or compatible provider
392
+
393
+ > **No API key required for default usage.** The tool produces complete, actionable evidence without any external dependencies.
375
394
 
376
395
  ## API Reference
377
396