用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Arete-Consortium/ai-skills --skill profile命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Intelligent CI failure diagnosis and guided remediation for GitHub Actions, GitLab CI, and local builds
Pre-execution mapping of codebases, document collections, or problem spaces. Runs BEFORE any Gorgon workflow to give all agents shared situational awareness
Investigative methodology for analyzing document collections — provenance analysis, anomaly detection, redaction detection, and cross-document validation
正在显示 SKILL.md
| name | profile |
| description | Performance Profiling Guide |
| lifecycle | experimental |
Profile code performance and identify bottlenecks.
/profile path/to/script.py # Profile Python script
/profile --memory # Memory profiling
/profile --flame # Generate flame graph
/profile cargo run # Profile Rust binary
# Profile and save stats
python -m cProfile -o profile.stats script.py
# View stats
python -c "
import pstats
p = pstats.Stats('profile.stats')
p.sort_stats('cumulative').print_stats(20)
"
# Add @profile decorator to functions
@profile
def slow_function():
...
# Run with kernprof
# kernprof -l -v script.py
from memory_profiler import profile
@profile
def memory_heavy():
...
# Run: python -m memory_profiler script.py
# Profile running process
py-spy record -o profile.svg --pid 12345
# Profile script
py-spy record -o profile.svg -- python script.py
# Install flamegraph
cargo install flamegraph
# Profile
cargo flamegraph --bin myapp
# With perf directly
perf record --call-graph=dwarf ./target/release/myapp
perf report
heaptrack ./target/release/myapp
heaptrack_gui heaptrack.myapp.*.gz
# Performance Profile: [Script/Binary]
## Summary
| Metric | Value |
|--------|-------|
| Total Time | 5.23s |
| Peak Memory | 256 MB |
| Hottest Function | `process_data` (45%) |
## Top 10 Functions by Time
| Function | Calls | Total Time | % |
|----------|-------|------------|---|
| process_data | 1000 | 2.35s | 45% |
| parse_json | 5000 | 1.12s | 21% |
| db_query | 100 | 0.89s | 17% |
## Flame Graph

## Bottleneck Analysis
### 1. `process_data` - 45% of time
**Issue**: Nested loops with O(n²) complexity
**Location**: module.py:123
**Current**:
```python
for item in items:
for other in items: # O(n²)
if item.matches(other):
...
Suggested Fix:
item_index = {item.key: item for item in items} # O(n)
for item in items:
if item.key in item_index: # O(1) lookup
...
Expected Improvement: ~10x for large datasets
load_all_dataIssue: Loading entire file into memory Fix: Use streaming/chunked reading
process_data loopparse_json resultsdb_query calls
## Instructions for Claude
When /profile is invoked:
1. **Identify target** - Script, function, or binary
2. **Choose profiler** - CPU, memory, or both
3. **Run profiling** - Capture performance data
4. **Analyze results** - Find hotspots
5. **Generate visualizations** - Flame graphs if possible
6. **Identify bottlenecks** - Top time consumers
7. **Analyze complexity** - O(n) issues
8. **Suggest optimizations** - Concrete code changes
9. **Estimate improvement** - Expected speedup