agentleFS
lodetomasilodetomasi/claude-code-skills-tools/.claude/skills/performance-monitor/SKILL.md

performance-monitor

Skill0 starsChanged 13 months agoMITView on GitHub

Track execution metrics and performance of skills including execution time, memory usage, and success rates

  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 9 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After implementing new skills to establish baselines

    line 13
  2. Distinctive:

    When investigating performance degradation

    line 14
  3. Distinctive:

    When debugging memory issues

    line 17
  4. Distinctive:

    Check for inefficient algorithms (O(n²))

    line 186
  5. Distinctive:

    Look for unnecessary I/O operations

    line 187
  6. Distinctive:

    Check for memory leaks

    line 191
  7. Distinctive:

    Use generators instead of lists

    line 193
  8. Distinctive:

    Add retry logic for transient failures

    line 200
  9. Distinctive:

    Keep last 1000 executions per skill

    line 231

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance Monitor

Overview

Tracks and analyzes performance metrics for Claude Code skills and tools, recording execution time, memory usage, success/failure rates, and generating comprehensive performance reports.

When to Use

  • After implementing new skills to establish baselines
  • When investigating performance degradation
  • For capacity planning and resource optimization
  • During performance optimization cycles
  • When debugging memory issues

Capabilities

1. Metrics Collection

  • Execution time tracking
  • Memory usage monitoring (MB)
  • Success/failure rate recording
  • Timestamp logging
  • Error message capture

2. Statistical Analysis

  • Average/min/max execution times
  • Memory usage patterns
  • Success rate calculations
  • Usage frequency tracking
  • Trend analysis

3. Performance Reporting

  • Summary reports by skill
  • Top slowest skills identification
  • Memory-intensive skill detection
  • Most-used skills ranking
  • Failure rate analysis

Usage

Generate Performance Report

python .claude/skills/performance-monitor/performance-monitor.py report

Run Test Execution with Monitoring

python .claude/skills/performance-monitor/performance-monitor.py test

Custom Metrics File

python .claude/skills/performance-monitor/performance-monitor.py report custom_metrics.json

Report Output Example

================================================================================
PERFORMANCE MONITORING REPORT
================================================================================

Total recorded executions: 147
Tracked skills: 12

Skill                          Executions   Avg Time     Avg Memory   Success Rate
--------------------------------------------------------------------------------
database-optimizer             45           2.341s       124.5MB      100.0%
python-profiler                32           1.892s       89.3MB       96.9%
sast-analyzer                  28           5.123s       256.7MB      100.0%
aws-cost-analyzer              18           3.445s       178.2MB      94.4%
memory-analyzer                12           4.567s       312.1MB      91.7%
code-reviewer                  8            1.234s       67.8MB       100.0%

================================================================================
PERFORMANCE INSIGHTS
================================================================================

🐌 Slowest Skills (Average):
  • sast-analyzer: 5.123s
  • memory-analyzer: 4.567s
  • aws-cost-analyzer: 3.445s

💾 Most Memory Intensive:
  • memory-analyzer: 312.1MB
  • sast-analyzer: 256.7MB
  • aws-cost-analyzer: 178.2MB

⭐ Most Used Skills:
  • database-optimizer: 45 executions
  • python-profiler: 32 executions
  • sast-analyzer: 28 executions

⚠️  Skills with Failures:
  • memory-analyzer: 1 failures (8.3%)
  • aws-cost-analyzer: 1 failures (5.6%)
  • python-profiler: 1 failures (3.1%)

Instrumenting Your Code

Python Decorator

from .claude.skills.performance-monitor import performance_monitor

@monitor_performance('my-custom-skill')
def my_skill_function():
    # Your code here
    pass

Manual Recording

from .claude.skills.performance-monitor import PerformanceMonitor
import time

monitor = PerformanceMonitor()
start = time.time()

try:
    # Your code
    success = True
    error = None
except Exception as e:
    success = False
    error = str(e)

execution_time = time.time() - start
memory_used = 50  # MB

monitor.record_execution(
    skill_name='my-skill',
    execution_time=execution_time,
    memory_used=memory_used,
    success=success,
    error=error
)

Data Storage

Metrics are stored in JSON format at performance_metrics.json:

[
  {
    "timestamp": "2025-01-15T10:30:45.123456",
    "skill": "python-profiler",
    "execution_time": 1.892,
    "memory_used_mb": 89.3,
    "success": true,
    "error": null
  }
]

Performance Optimization Guidelines

Execution Time

  • Target: < 5s for most skills
  • Acceptable: 5-10s for complex analysis
  • Investigate: > 10s execution time

Memory Usage

  • Light: < 100MB
  • Moderate: 100-300MB
  • Heavy: > 300MB (review for optimization)

Success Rate

  • Excellent: > 98%
  • Good: 95-98%
  • Needs attention: < 95%

Troubleshooting

High Execution Time

  • Profile the skill with cProfile or pyinstrument
  • Check for inefficient algorithms (O(n²))
  • Look for unnecessary I/O operations
  • Review external API calls

High Memory Usage

  • Check for memory leaks
  • Review large data structure usage
  • Use generators instead of lists
  • Implement streaming for large files

Low Success Rate

  • Review error messages in metrics file
  • Add error handling
  • Validate input data
  • Add retry logic for transient failures

CI/CD Integration

GitHub Actions

name: Performance Monitoring

on: [push]

jobs:
  monitor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run with monitoring
        run: |
          python .claude/skills/performance-monitor/performance-monitor.py test
      - name: Generate report
        run: |
          python .claude/skills/performance-monitor/performance-monitor.py report

Requirements

pip install psutil  # For memory monitoring

Metrics Retention

  • Keep last 1000 executions per skill
  • Archive monthly reports
  • Clear old metrics: rm performance_metrics.json

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.