Skip to main content
hooksSource-backedReview first Safety Privacy

Performance Impact Monitor - Hooks

Monitors and alerts on performance-impacting changes in real-time.

by JSONbored·added 2025-09-19·
HarnessClaude Code
Trigger:Notification
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/hooks, https://github.com/JSONbored/awesome-claude/blob/main/content/hooks/performance-impact-monitor.mdx
Safety notes
Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.
Privacy notes
Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-09-19

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

CLI install

Copy-ready — paste the snippet to get started.

Install command

Provided

Config snippet

Provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

0/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens, permissions & scopes.

2 areas
  • SafetyPermissions & scopesRuns automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.
  • PrivacyCredentials & tokensReceives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.

Safety notes

  • Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.

Privacy notes

  • Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.

Schema details

Install type
cli
Reading time
3 min
Difficulty score
0
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/hooks
Runtime and command metadata
Trigger
Notification
Script language
bash
Script body
#!/usr/bin/env bash

# Performance Impact Monitor Hook
# Monitors for performance-impacting changes in real-time

echo "⚡ Performance Impact Monitor" >&2

# Initialize performance monitoring
PERF_WARNINGS=0
PERF_ERRORS=0
PERF_INFO=0
FILE_SIZE=0
LINE_COUNT=0

# Performance thresholds (configurable)
LARGE_FILE_THRESHOLD=100000    # 100KB
MASSIVE_FILE_THRESHOLD=500000  # 500KB
LARGE_FUNCTION_LINES=50
COMPLEX_CYCLOMATIC=10
LONG_TIMER_MS=5000

# Function to report performance impacts
report_performance() {
  local level="$1"
  local message="$2"
  local suggestion="$3"
  
  case "$level" in
    "ERROR")
      echo "🚨 CRITICAL PERFORMANCE IMPACT: $message" >&2
      [ -n "$suggestion" ] && echo "   💡 Suggestion: $suggestion" >&2
      PERF_ERRORS=$((PERF_ERRORS + 1))
      ;;
    "WARNING")
      echo "⚠️ PERFORMANCE WARNING: $message" >&2
      [ -n "$suggestion" ] && echo "   💡 Suggestion: $suggestion" >&2
      PERF_WARNINGS=$((PERF_WARNINGS + 1))
      ;;
    "INFO")
      echo "ℹ️ PERFORMANCE INFO: $message" >&2
      [ -n "$suggestion" ] && echo "   💡 Tip: $suggestion" >&2
      PERF_INFO=$((PERF_INFO + 1))
      ;;
  esac
}

# Get environment variables (simulated Claude tool context)
TOOL_NAME="${CLAUDE_TOOL_NAME:-unknown}"
FILE_PATH="${CLAUDE_TOOL_FILE_PATH:-}"

# If no file path provided, try to get from stdin input
if [ -z "$FILE_PATH" ]; then
  # Try to read tool input from stdin (for newer hook format)
  INPUT=$(cat)
  TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"' 2>/dev/null || echo "unknown")
  FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""' 2>/dev/null || echo "")
fi

# Skip if no file path available
if [ -z "$FILE_PATH" ]; then
  exit 0
fi

# Skip if file doesn't exist or is not readable
if [ ! -f "$FILE_PATH" ] || [ ! -r "$FILE_PATH" ]; then
  exit 0
fi

# Only monitor for Edit/Write operations
if [[ "$TOOL_NAME" != "Edit" ]] && [[ "$TOOL_NAME" != "Write" ]] && [[ "$TOOL_NAME" != "MultiEdit" ]]; then
  exit 0
fi

FILE_NAME=$(basename "$FILE_PATH")
FILE_EXT="${FILE_NAME##*.}"

echo "   📊 Analyzing performance impact of: $FILE_NAME" >&2

# 1. File Size Impact Analysis
FILE_SIZE=$(stat -f%z "$FILE_PATH" 2>/dev/null || stat -c%s "$FILE_PATH" 2>/dev/null || echo "0")
LINE_COUNT=$(wc -l < "$FILE_PATH" 2>/dev/null || echo "0")

echo "   📏 File size: $(( FILE_SIZE / 1024 ))KB, Lines: $LINE_COUNT" >&2

# File size warnings
if [ "$FILE_SIZE" -gt "$MASSIVE_FILE_THRESHOLD" ]; then
  report_performance "ERROR" "Massive file detected ($(( FILE_SIZE / 1024 ))KB)" "Consider code splitting or modularization"
elif [ "$FILE_SIZE" -gt "$LARGE_FILE_THRESHOLD" ]; then
  report_performance "WARNING" "Large file detected ($(( FILE_SIZE / 1024 ))KB)" "Monitor bundle size impact and consider optimization"
fi

# 2. Language-Specific Performance Analysis
case "$FILE_EXT" in
  "js"|"jsx"|"ts"|"tsx")
    echo "   📦 JavaScript/TypeScript performance analysis..." >&2
    
    # Large function detection
    LARGE_FUNCTIONS=$(grep -n 'function\\|=>' "$FILE_PATH" | while read line; do
      line_num=$(echo "$line" | cut -d: -f1)
      # Simple heuristic: look for next function or end of file
      next_func=$(tail -n +$((line_num + 1)) "$FILE_PATH" | grep -n 'function\\|=>' | head -1 | cut -d: -f1)
      if [ -n "$next_func" ]; then
        func_lines=$((next_func - 1))
      else
        func_lines=$(tail -n +$line_num "$FILE_PATH" | wc -l)
      fi
      
      if [ "$func_lines" -gt "$LARGE_FUNCTION_LINES" ]; then
        echo "$line_num:$func_lines"
      fi
    done)
    
    if [ -n "$LARGE_FUNCTIONS" ]; then
      func_count=$(echo "$LARGE_FUNCTIONS" | wc -l)
      report_performance "WARNING" "$func_count large function(s) detected (>$LARGE_FUNCTION_LINES lines)" "Consider breaking down into smaller functions"
    fi
    
    # Performance anti-patterns
    if grep -q '\\$(' "$FILE_PATH" 2>/dev/null; then
      jquery_count=$(grep -c '\\$(' "$FILE_PATH" 2>/dev/null || echo "0")
      if [ "$jquery_count" -gt 5 ]; then
        report_performance "INFO" "Heavy jQuery usage detected ($jquery_count instances)" "Consider modern alternatives like vanilla JS or React"
      fi
    fi
    
    # Long timers
    if grep -E '(setTimeout|setInterval).*[0-9]{4,}' "$FILE_PATH" 2>/dev/null; then
      report_performance "WARNING" "Long timer intervals detected (>=${LONG_TIMER_MS}ms)" "Verify if long delays are intentional"
    fi
    
    # Nested loops
    NESTED_LOOPS=$(grep -E 'for.*{[^}]*for.*{[^}]*for' "$FILE_PATH" 2>/dev/null || echo "")
    if [ -n "$NESTED_LOOPS" ]; then
      report_performance "ERROR" "Triple nested loops detected - O(n³) complexity" "Consider algorithm optimization or data structure changes"
    elif grep -E 'for.*{[^}]*for' "$FILE_PATH" 2>/dev/null; then
      nested_count=$(grep -c 'for.*{[^}]*for' "$FILE_PATH" 2>/dev/null || echo "0")
      if [ "$nested_count" -gt 3 ]; then
        report_performance "WARNING" "Multiple nested loops detected" "Review algorithmic complexity"
      fi
    fi
    
    # Memory leak patterns
    if grep -q 'addEventListener.*function' "$FILE_PATH" 2>/dev/null; then
      if ! grep -q 'removeEventListener' "$FILE_PATH" 2>/dev/null; then
        report_performance "WARNING" "Event listeners without cleanup detected" "Add removeEventListener calls to prevent memory leaks"
      fi
    fi
    
    # Global variable pollution
    GLOBAL_VARS=$(grep -c '^var\\|^let\\|^const' "$FILE_PATH" 2>/dev/null || echo "0")
    if [ "$GLOBAL_VARS" -gt 20 ]; then
      report_performance "INFO" "Many global variables detected ($GLOBAL_VARS)" "Consider using modules or namespacing"
    fi
    
    # Bundle size impact for dependencies
    if grep -q 'import.*from' "$FILE_PATH" 2>/dev/null; then
      LARGE_IMPORTS=$(grep -E 'import.*(lodash|moment|rxjs)' "$FILE_PATH" 2>/dev/null || echo "")
      if [ -n "$LARGE_IMPORTS" ]; then
        report_performance "INFO" "Large library imports detected" "Consider tree shaking or lighter alternatives"
      fi
    fi
    ;;
    
  "py")
    echo "   🐍 Python performance analysis..." >&2
    
    # List comprehensions vs loops
    if grep -q 'for.*in.*:' "$FILE_PATH" 2>/dev/null; then
      list_comp_count=$(grep -c '\\[.*for.*in.*\\]' "$FILE_PATH" 2>/dev/null || echo "0")
      loop_count=$(grep -c 'for.*in.*:' "$FILE_PATH" 2>/dev/null || echo "0")
      
      if [ "$loop_count" -gt 0 ] && [ "$list_comp_count" -eq 0 ]; then
        report_performance "INFO" "Consider using list comprehensions for better performance" "List comprehensions are often faster than explicit loops"
      fi
    fi
    
    # Global imports inside functions
    if grep -A 5 'def ' "$FILE_PATH" | grep -q 'import' 2>/dev/null; then
      report_performance "WARNING" "Imports inside functions detected" "Move imports to module level for better performance"
    fi
    
    # String concatenation
    if grep -q '+.*+.*+' "$FILE_PATH" 2>/dev/null; then
      report_performance "INFO" "String concatenation chains detected" "Consider using f-strings or join() for better performance"
    fi
    ;;
    
  "sql")
    echo "   🗄️ SQL performance analysis..." >&2
    
    # Missing indexes (basic heuristics)
    if grep -qi 'where.*=' "$FILE_PATH" 2>/dev/null; then
      if ! grep -qi 'index' "$FILE_PATH" 2>/dev/null; then
        report_performance "WARNING" "WHERE clauses without visible indexes" "Ensure proper indexing for query performance"
      fi
    fi
    
    # SELECT * usage
    if grep -qi 'select \\*' "$FILE_PATH" 2>/dev/null; then
      select_star_count=$(grep -ci 'select \\*' "$FILE_PATH" 2>/dev/null || echo "0")
      report_performance "WARNING" "SELECT * queries detected ($select_star_count)" "Specify only needed columns for better performance"
    fi
    
    # Cartesian products
    if grep -qi 'from.*,.*where' "$FILE_PATH" 2>/dev/null; then
      if ! grep -qi 'join' "$FILE_PATH" 2>/dev/null; then
        report_performance "ERROR" "Potential cartesian product detected" "Use explicit JOINs instead of comma-separated tables"
      fi
    fi
    ;;
    
  "css"|"scss"|"sass")
    echo "   🎨 CSS performance analysis..." >&2
    
    # Complex selectors
    COMPLEX_SELECTORS=$(grep -c '[[:space:]].*[[:space:]].*[[:space:]].*[[:space:]]' "$FILE_PATH" 2>/dev/null || echo "0")
    if [ "$COMPLEX_SELECTORS" -gt 5 ]; then
      report_performance "WARNING" "Complex CSS selectors detected ($COMPLEX_SELECTORS)" "Simplify selectors for better rendering performance"
    fi
    
    # Expensive properties
    if grep -q 'box-shadow.*,.*,' "$FILE_PATH" 2>/dev/null; then
      report_performance "INFO" "Complex box-shadow detected" "Consider simpler shadow effects for better performance"
    fi
    
    if grep -q '@import' "$FILE_PATH" 2>/dev/null; then
      import_count=$(grep -c '@import' "$FILE_PATH" 2>/dev/null || echo "0")
      if [ "$import_count" -gt 3 ]; then
        report_performance "WARNING" "Multiple CSS @imports detected ($import_count)" "Consider bundling CSS files to reduce HTTP requests"
      fi
    fi
    ;;
    
  "html")
    echo "   🌐 HTML performance analysis..." >&2
    
    # Inline styles
    INLINE_STYLES=$(grep -c 'style=' "$FILE_PATH" 2>/dev/null || echo "0")
    if [ "$INLINE_STYLES" -gt 10 ]; then
      report_performance "WARNING" "Many inline styles detected ($INLINE_STYLES)" "Move styles to CSS files for better caching"
    fi
    
    # Large images without attributes
    if grep -q '<img' "$FILE_PATH" 2>/dev/null; then
      if ! grep -q 'width=\\|height=' "$FILE_PATH" 2>/dev/null; then
        img_count=$(grep -c '<img' "$FILE_PATH" 2>/dev/null || echo "0")
        report_performance "INFO" "Images without dimensions detected ($img_count)" "Add width/height attributes to prevent layout shifts"
      fi
    fi
    ;;
esac

# 3. Asset Performance Analysis
echo "   🖼️ Asset performance analysis..." >&2

# Check for asset imports/references
if [[ "$FILE_EXT" =~ ^(js|jsx|ts|tsx|css|scss|html)$ ]]; then
  # Image references
  IMAGE_REFS=$(grep -oE '\\.(jpg|jpeg|png|gif|svg|webp)' "$FILE_PATH" 2>/dev/null | wc -l || echo "0")
  if [ "$IMAGE_REFS" -gt 10 ]; then
    report_performance "INFO" "Many image references detected ($IMAGE_REFS)" "Consider image optimization and lazy loading"
  fi
  
  # Large base64 data
  if grep -q 'data:image' "$FILE_PATH" 2>/dev/null; then
    BASE64_COUNT=$(grep -c 'data:image' "$FILE_PATH" 2>/dev/null || echo "0")
    report_performance "WARNING" "Base64 encoded images detected ($BASE64_COUNT)" "Consider using separate image files for better caching"
  fi
fi

# 4. Database Query Analysis
if grep -qi 'select\\|insert\\|update\\|delete' "$FILE_PATH" 2>/dev/null; then
  echo "   🗄️ Database query analysis..." >&2
  
  # N+1 query patterns
  if grep -q 'for.*in' "$FILE_PATH" 2>/dev/null && grep -q 'select\\|query' "$FILE_PATH" 2>/dev/null; then
    report_performance "WARNING" "Potential N+1 query pattern detected" "Consider using joins or batch queries"
  fi
  
  # Missing LIMIT clauses
  if grep -qi 'select.*from' "$FILE_PATH" 2>/dev/null; then
    if ! grep -qi 'limit\\|top\\|rownum' "$FILE_PATH" 2>/dev/null; then
      unlimited_queries=$(grep -ci 'select.*from' "$FILE_PATH" 2>/dev/null || echo "0")
      if [ "$unlimited_queries" -gt 2 ]; then
        report_performance "WARNING" "Queries without LIMIT detected ($unlimited_queries)" "Add LIMIT clauses to prevent large result sets"
      fi
    fi
  fi
fi

# 5. Framework-Specific Analysis
if [[ "$FILE_EXT" =~ ^(jsx|tsx)$ ]]; then
  echo "   ⚛️ React performance analysis..." >&2
  
  # Component re-render patterns
  if grep -q 'useState\\|useEffect' "$FILE_PATH" 2>/dev/null; then
    if ! grep -q 'useMemo\\|useCallback\\|React.memo' "$FILE_PATH" 2>/dev/null; then
      hooks_count=$(grep -c 'useState\\|useEffect' "$FILE_PATH" 2>/dev/null || echo "0")
      if [ "$hooks_count" -gt 5 ]; then
        report_performance "INFO" "Many React hooks without memoization" "Consider useMemo/useCallback for expensive operations"
      fi
    fi
  fi
  
  # Inline object/function creation in props
  if grep -q '={{' "$FILE_PATH" 2>/dev/null; then
    inline_objects=$(grep -c '={{' "$FILE_PATH" 2>/dev/null || echo "0")
    if [ "$inline_objects" -gt 5 ]; then
      report_performance "WARNING" "Many inline objects in JSX props ($inline_objects)" "Extract to variables to prevent unnecessary re-renders"
    fi
  fi
fi

# 6. Generate Performance Impact Summary
echo "" >&2
echo "⚡ Performance Impact Summary" >&2
echo "============================" >&2
echo "   📄 File: $FILE_NAME ($(( FILE_SIZE / 1024 ))KB)" >&2
echo "   🚨 Critical Issues: $PERF_ERRORS" >&2
echo "   ⚠️ Warnings: $PERF_WARNINGS" >&2
echo "   ℹ️ Optimization Tips: $PERF_INFO" >&2

# Performance impact assessment
TOTAL_ISSUES=$((PERF_ERRORS + PERF_WARNINGS))

if [ "$PERF_ERRORS" -gt 0 ]; then
  echo "   🚨 Impact Level: HIGH - Critical performance issues detected" >&2
elif [ "$PERF_WARNINGS" -gt 3 ]; then
  echo "   ⚠️ Impact Level: MODERATE - Multiple performance concerns" >&2
elif [ "$PERF_WARNINGS" -gt 0 ]; then
  echo "   ⚠️ Impact Level: LOW - Minor performance considerations" >&2
elif [ "$PERF_INFO" -gt 0 ]; then
  echo "   ✅ Impact Level: MINIMAL - Good practices recommended" >&2
else
  echo "   🎉 Impact Level: OPTIMAL - No performance issues detected" >&2
fi

if [ "$TOTAL_ISSUES" -gt 0 ]; then
  echo "" >&2
  echo "💡 Performance Optimization Resources:" >&2
  echo "   • Web: Core Web Vitals and Lighthouse audits" >&2
  echo "   • JavaScript: Profiler tools and performance monitoring" >&2
  echo "   • Database: Query optimization and indexing strategies" >&2
  echo "   • Bundle: Code splitting and tree shaking" >&2
fi

echo "⚡ Performance impact monitoring complete" >&2
exit 0
Full copyable content
{
  "hooks": {
    "notification": {
      "script": "./.claude/hooks/performance-impact-monitor.sh"
    }
  }
}

About this resource

Features

  • Real-time performance anti-pattern detection and alerting including performance anti-pattern detection (nested loops with O(n²) and O(n³) complexity detection, memory leak patterns with event listener and closure leak detection, inefficient algorithms with algorithmic complexity analysis, global variable pollution detection), real-time alerting (immediate notifications on performance issues with ERROR/WARNING/INFO severity levels, actionable suggestions for performance improvements, context-aware recommendations), language-specific anti-patterns (JavaScript/TypeScript anti-patterns: jQuery usage, long timers, nested loops, memory leaks, Python anti-patterns: list comprehensions vs loops, imports inside functions, string concatenation, SQL anti-patterns: missing indexes, SELECT *, cartesian products, CSS anti-patterns: complex selectors, expensive properties, multiple @imports, HTML anti-patterns: inline styles, images without dimensions), and framework-specific analysis (React performance patterns: component re-render detection, inline object/function creation in props, memoization recommendations, Vue/Angular performance patterns)
  • Bundle size impact analysis with threshold monitoring including bundle size calculation (file size analysis with KB/MB reporting, dependency impact assessment with import analysis, import size tracking with large library detection), threshold-based monitoring (configurable file size thresholds: LARGE_FILE_THRESHOLD 100KB, MASSIVE_FILE_THRESHOLD 500KB, bundle size regression detection with historical comparison, size impact scoring with severity classification), bundle optimization recommendations (code splitting suggestions for reducing bundle size, tree shaking recommendations for unused code removal, lazy loading suggestions for on-demand loading, dynamic import recommendations), and bundle size tracking (historical bundle size comparison across sessions, size trend analysis with regression detection, bundle size reporting with detailed breakdown)
  • Complex algorithm and nested loop detection including nested loop detection (double nested loops O(n²) complexity detection with pattern matching, triple nested loops O(n³) complexity detection with critical alerts, nested loop counting and reporting with location identification), algorithmic complexity analysis (time complexity estimation with Big O notation, space complexity assessment with memory usage analysis, complexity warnings with severity classification), algorithm optimization suggestions (data structure recommendations for better performance, algorithm alternatives with efficiency improvements, optimization strategies with code examples), and performance-critical code identification (hot path detection with performance profiling, bottleneck identification with impact scoring, optimization priority scoring with actionable recommendations)
  • Memory leak pattern identification and warnings including memory leak detection (event listener leaks with addEventListener/removeEventListener detection, closure leaks with scope analysis, global variable leaks with pollution detection, circular reference detection), memory leak pattern identification (addEventListener without removeEventListener pattern matching, unclosed resources with resource tracking, memory accumulation patterns with growth detection), memory leak warnings (severity-based warnings with ERROR/WARNING levels, memory leak location identification with line numbers, cleanup suggestions with code examples), and memory management recommendations (proper cleanup patterns with best practices, resource management with lifecycle hooks, memory optimization strategies with performance tips)
  • Database query performance impact assessment including query performance analysis (N+1 query detection with loop and query pattern matching, missing index detection with WHERE clause analysis, SELECT * usage detection with column specification recommendations), query optimization suggestions (index recommendations for WHERE clauses, query rewriting suggestions for better performance, batch query recommendations for N+1 prevention), database performance warnings (slow query patterns with complexity detection, inefficient joins with cartesian product detection, query performance impact scoring), and query performance scoring (query complexity assessment with execution time estimation, performance impact scoring with severity classification, optimization priority with actionable recommendations)
  • Asset optimization recommendations and size tracking including asset size analysis (image size analysis with KB/MB reporting, base64 data detection with encoding size calculation, asset reference counting with import analysis), asset optimization recommendations (image optimization suggestions with format recommendations, lazy loading recommendations for on-demand loading, asset bundling suggestions for HTTP request reduction), asset size tracking (historical asset size comparison across sessions, asset size regression detection with threshold-based alerts, asset performance scoring), and asset performance scoring (asset impact assessment with bundle size impact, optimization priority with severity classification, performance recommendations with actionable suggestions)
  • Render blocking resource detection for web applications including render blocking detection (CSS blocking resources with @import and detection, JavaScript blocking resources with

Source citations

Add this badge to your README

Show that Performance Impact Monitor - Hooks is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/hooks/performance-impact-monitor.svg)](https://heyclau.de/entry/hooks/performance-impact-monitor)

How it compares

Performance Impact Monitor - Hooks side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

Field

Monitors and alerts on performance-impacting changes in real-time.

Open dossier

Alerts when files exceed size thresholds that could impact performance. This PostToolUse hook provides comprehensive file size monitoring when files are created or modified, automatically detecting files that exceed recommended size thresholds for different file types and providing optimization suggestions.

Open dossier

Monitors memory usage and alerts when thresholds are exceeded.

Open dossier

A Claude Code hook that flags files exceeding complexity thresholds after you edit them — estimating cyclomatic complexity, line and function counts, and nesting depth (via ESLint's complexity rule and Radon).

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
Submitter
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Brand
Categoryhookshookshookshooks
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredJSONbored
Added2025-09-192025-09-192025-09-192025-09-19
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesRuns automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling.Runs after edits to JS/TS/Python files and prints advisory warnings only; the line/function/brace counts are heuristics, not a substitute for ESLint or Radon run on the full project.
Privacy notesReceives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output.Reads the contents of files you edit to compute complexity locally; it prints warnings to hook output and does not transmit code, but those messages can reveal file structure.
Prerequisites— none listed— none listed— none listed— none listed
Install
mkdir -p .claude/hooks && touch .claude/hooks/performance-impact-monitor.sh && chmod +x .claude/hooks/performance-impact-monitor.sh
mkdir -p .claude/hooks && touch .claude/hooks/file-size-warning-monitor.sh && chmod +x .claude/hooks/file-size-warning-monitor.sh
mkdir -p .claude/hooks && touch .claude/hooks/memory-usage-monitor.sh && chmod +x .claude/hooks/memory-usage-monitor.sh
mkdir -p .claude/hooks && touch .claude/hooks/code-complexity-alert-monitor.sh && chmod +x .claude/hooks/code-complexity-alert-monitor.sh
Config
{
  "hooks": {
    "notification": {
      "script": "./.claude/hooks/performance-impact-monitor.sh"
    }
  }
}
{
  "hooks": {
    "postToolUse": {
      "script": "./.claude/hooks/file-size-warning-monitor.sh",
      "matchers": [
        "write",
        "edit"
      ]
    }
  }
}
{
  "hooks": {
    "notification": {
      "script": "./.claude/hooks/memory-usage-monitor.sh",
      "timeout": 5000
    }
  }
}
{
  "hooks": {
    "notification": {
      "script": "./.claude/hooks/code-complexity-alert-monitor.sh"
    }
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.