Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

ln-811-performance-profilerln 811 性能分析器

Agent Skill

ln-811-performance-profiler 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,421

周安装

97

GitHub Stars

441

下载量

784
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ln-811-performance-profiler(ln 811 性能分析器)
来源仓库:https://github.com/levnikolaevich/claude-code-skills
仓库路径:skills/ln-811-performance-profiler
安装命令:
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-811-performance-profiler
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-811-performance-profiler

简介

用于查找、检索和筛选相关信息。ln-811-performance-profiler 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法。
  • 安装前建议确认权限范围和维护状态。
  • 注意是否会触发联网、命令执行或文件读写操作。

SKILL.md

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If shared/ is missing, fetch files via WebFetch from https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.

ln-811-performance-profiler

Type: L3 Worker Category: 8XX Optimization

Runtime profiler that executes the optimization target, measures multiple metrics (CPU, memory, I/O, time), instruments code for per-function breakdown, and produces a standardized performance map from real data.


Overview

AspectDetails
InputProblem statement: target (file/endpoint/pipeline) + observed metric
OutputPerformance map (multi-metric, per-function), suspicion stack, bottleneck classification
PatternDiscover test → Baseline run → Static analysis → Deep profile → Performance map → Report

Workflow

Phases: Test Discovery → Baseline Run → Static Analysis → Deep Profile → Performance Map → Report


Phase 0: Test Discovery/Creation

MANDATORY READ: Load shared/references/ci_tool_detection.md for test framework detection. MANDATORY READ: Load shared/references/benchmark_generation.md for auto-generating benchmarks when none exist.

Find or create commands that exercise the optimization target. Two outputs: test_command (profiling/measurement) and e2e_test_command (functional safety gate).

Step 1: Discover test_command

PriorityMethodAction
1User-providedUser specifies test command or API endpoint
2Discover existing E2E testGrep test files for target entry point (stop at first match)
3Create test scriptGenerate per shared/references/benchmark_generation.md to .hex-skills/optimization/{slug}/profile_test.sh

E2E discovery protocol (stop at first match):

PriorityMethodHow
1Route-based searchGrep e2e/integration test files for entry point route
2Function-based searchGrep for entry point function name
3Module-based searchGrep for import of entry point module

Test creation (if no existing test found):

Target TypeGenerated Script
API endpointcurl -w "%{time_total}" -o /dev/null -s {endpoint}
FunctionStack-specific benchmark per shared/references/benchmark_generation.md
PipelineFull pipeline invocation with test input

Step 2: Discover e2e_test_command

If test_command came from E2E discovery (Step 1 priority 2): e2e_test_command = test_command.

Otherwise, run E2E discovery protocol again (same 3-priority table) to find a separate functional safety test.

If not found: e2e_test_command = null, log: WARNING: No e2e test covers {entry_point}. Full test suite serves as functional gate.

Output

FieldDescription
test_commandCommand for profiling/measurement
e2e_test_commandCommand for functional safety gate (may equal test_command, or null)
e2e_test_sourceDiscovery method: user / route / function / module / none

Phase 1: Baseline Run (Multi-Metric)

Run test_command with system-level profiling. Capture simultaneously:

MetricHow to CaptureWhen
Wall timetime wrapper or test harnessAlways
CPU time (user+sys)/usr/bin/time -v or language profilerAlways
Memory peak (RSS)/usr/bin/time -v (Max RSS) or tracemalloc / process.memoryUsage()Always
I/O bytes/usr/bin/time -v or structured logsIf I/O suspected
HTTP round-tripsCount from structured logs or application metricsIf network I/O in call graph
GPU utilizationnvidia-smi --query-gpuOnly if CUDA/GPU detected in stack

Baseline Protocol

ParameterValue
Runs3
MetricMedian
Warm-up1 discarded run
Outputbaseline — multi-metric snapshot

Monitor for Profiler Runs (Claude Code 2.1.98+)

MANDATORY READ: Load shared/references/monitor_integration_pattern.md

During baseline and deep profile runs: Monitor(command="{test_command} 2>&1", timeout_ms=300000, description="profiler run N")

Detect crashes or infinite loops immediately. Fallback: Bash with timeout.


Phase 2: Static Analysis → Instrumentation Points

MANDATORY READ: Load bottleneck_classification.md

Trace call chain from code + build suspicion stack. Purpose: guide WHERE to instrument in Phase 3.

Step 1: Trace Call Chain

Starting from entry point, trace depth-first (max depth 5). At each step, READ the full function body.

Cross-service tracing: If service_topology is available from coordinator and a step makes an HTTP/gRPC call to another service whose code is accessible:

SituationAction
HTTP call to service with code in submodule/monorepoFollow into that service's handler: resolve route → trace handler code (depth resets to 0 for the new service)
HTTP call to service without accessible codeClassify as External, record latency estimate
gRPC/message queue to known serviceSame as HTTP — follow into handler if code accessible

Record service: "{service_name}" on each step to track which service owns it. The performance_map steps tree can span multiple services.

Depth-First Rule: If code of the called service is accessible — ALWAYS profile INSIDE. NEVER classify an accessible service as "External/slow" without profiling its internals. "Slow" is a symptom, not a diagnosis.

5 Whys for each bottleneck: Before reporting a bottleneck, chain "why?" until you reach config/architecture level:

  1. "What is slow?" → alignment service (5.9s) 2. "Why?" → 6 pairs × ~1s each 3. "Why ~1s per pair?" → O(n²) mwmf computation 4. "Why O(n²)?" → library default, not production config 5. "Why default?" → matching_methods not configured → root cause = config

Step 2: Classify & Suspicion Scan

For each step, classify by type (CPU, I/O-DB, I/O-Network, I/O-File, Architecture, External, Cache) and scan for performance concerns.

Suspicion checklist (minimum, not limitation):

CategoryWhat to Look For
Connection managementClient created per-request? Missing pooling? Missing reuse?
Data flowData read multiple times? Over-fetching? Unnecessary transforms?
Async patternsSync I/O in async context? Sequential awaits without data dependency?
Resource lifecycleUnclosed connections? Temp files? Memory accumulation in loop?
ConfigurationHardcoded timeouts? Default pool sizes? Missing batch size config?
Redundant workSame validation at multiple layers? Same data loaded twice?
ArchitectureN+1 in loop? Batch API unused? Cache infra unused? Sequential-when-parallel?
*(open)*Anything else spotted — checklist does not limit findings

Step 2b: Suspicion Deduplication

MANDATORY READ: Load shared/references/output_normalization.md

After generating suspicions across all call chain steps, normalize and deduplicate per §1-§2:

  • Normalize suspicion descriptions (replace specific values with placeholders)
  • Group identical suspicions across different steps → merge into single entry with affected_steps: [list]
  • Example: "Missing connection pooling" found in steps 1.1, 1.2, 1.3 → one suspicion with affected_steps: ["1.1", "1.2", "1.3"]

Step 3: Verify & Map to Instrumentation Points

FOR each suspicion:
  1. VERIFY: follow code to confirm or dismiss
  2. VERDICT: CONFIRMED → map to instrumentation point | DISMISSED → log reason
  3. For each CONFIRMED suspicion, identify:
     - function to wrap with timing
     - I/O call to count
     - memory allocation to track

Profiler Selection (per stack)

StackNon-invasive profilerInvasive (if non-invasive insufficient)
Pythonpy-spy, cProfiletime.perf_counter() decorators
Node.jsclinic, --profconsole.time() wrappers
Gopprof (built-in)Usually not needed
.NETdotnet-traceStopwatch wrappers
Rustcargo flamegraphstd::time::Instant

Stack detection: per shared/references/ci_tool_detection.md.


Phase 3: Deep Profile

Profiler Hierarchy (escalate as needed)

LevelTool ExamplesWhat It ShowsWhen to Use
1py-spy, cProfile, pprof, dotnet-traceFunction-level hotspotsAlways — first pass
2line_profiler, per-line timingLine-level timing in hotspot functionHotspot function found but cause unclear
3tracemalloc, memory_profilerPer-line memory allocationMemory metrics abnormal in baseline

Step 1: Non-Invasive Profiling (preferred)

Run test_command with Level 1 profiler to get per-function breakdown without code changes.

Step 2: Escalation Decision

After Level 1 profiler run, evaluate result against suspicion stack from Phase 2:

Profiler ResultAction
Hotspot function identified, time breakdown confirms suspicionsDONE — proceed to Phase 4
Hotspot identified but internal cause unclear (CPU vs I/O inside one function)Escalate to Level 2 (line-level timing)
Memory baseline abnormal (peak or delta)Escalate to Level 3 (memory profiler)
Multiple suspicions unresolved — profiler granularity insufficientGo to Step 3 (targeted instrumentation)
Profiler unavailable or overhead > 20% of wall timeGo to Step 3 (targeted instrumentation)

Stop Conditions (Profiler Escalation)

ConditionAction
Hotspot identified with clear causeSTOP — proceed to Performance Map
All 3 profiler levels exhaustedSTOP — build map from best available data
Instrumentation breaks testsSTOP — revert instrumentation, use non-invasive data only
Profiler overhead > 20% of wall timeSTOP — skip to targeted instrumentation

Step 3: Targeted Instrumentation (proactive)

Add timing/logging along the call stack at instrumentation points identified in Phase 2 Step 3:

1. FOR each CONFIRMED suspicion without measured data:
     Add timing wrapper around target function/I/O call
     Add counter for I/O round-trips if network/DB suspected
     (cross-service: instrument in the correct service's codebase)
2. Re-run test_command (3 runs, median)
3. Collect per-function measurements from logs
4. Record list of instrumented files (may span multiple services)
Instrumentation TypeWhenExample
Timing wrapperAlways for unresolved suspicionstime.perf_counter() around function call
I/O call counterNetwork or DB bottleneck suspectedCount HTTP requests, DB queries in loop
Memory snapshotMemory accumulation suspectedtracemalloc.get_traced_memory() before/after

KEEP instrumentation in place. The executor reuses it for post-optimization per-function comparison, then cleans up after strike. Report instrumented_files in output.


Phase 4: Build Performance Map

Standardized format — feeds into .hex-skills/optimization/{slug}/context.md for downstream consumption.

performance_map:
  test_command: "uv run pytest tests/automated/e2e/test_example.py -s"
  baseline:
    wall_time_ms: 7280
    cpu_time_ms: 850
    memory_peak_mb: 256
    memory_delta_mb: 45
    io_read_bytes: 1200000
    io_write_bytes: 500000
    http_round_trips: 13
  steps:                          # service field present only in multi-service topology
    - id: "1"
      function: "process_job"
      location: "app/services/job_processor.py:45"
      service: "api"             # optional — which service owns this step
      wall_time_ms: 7200
      time_share_pct: 99
      type: "function_call"
      children:
        - id: "1.1"
          function: "translate_binary"
          wall_time_ms: 7100
          type: "function_call"
          children:
            - id: "1.1.1"
              function: "tikal_extract"
              service: "tikal"   # cross-service: code traced into submodule
              wall_time_ms: 2800
              type: "http_call"
              http_round_trips: 1
            - id: "1.1.2"
              function: "mt_translate"
              service: "mt-engine"
              wall_time_ms: 3500
              type: "http_call"
              http_round_trips: 13
  bottleneck_classification: "I/O-Network"
  bottleneck_detail: "13 sequential HTTP calls to MT service (3500ms)"
  top_bottlenecks:
    - step: "1.1.2", type: "I/O-Network", share: 48%
    - step: "1.1.1", type: "I/O-Network", share: 38%

Phase 5: Report

Report Structure

profile_result:
  entry_point_info:
    type: <string>                     # "api_endpoint" | "function" | "pipeline"
    location: <string>                 # file:line
    route: <string|null>               # API route (if endpoint)
    function: <string>                 # Entry point function name
  performance_map: <object>            # Full map from Phase 4
  bottleneck_classification: <string>  # Primary bottleneck type
  bottleneck_detail: <string>          # Human-readable description
  top_bottlenecks:
    - step, type, share, description
  optimization_hints:                  # CONFIRMED suspicions only (Phase 2)
    - hint with evidence
  suspicion_stack:                     # Full audit trail (confirmed + dismissed)
    - category: <string>
      location: <string>
      description: <string>
      verdict: <string>               # "confirmed" | "dismissed"
      evidence: <string>
      verification_note: <string>
  e2e_test:
    command: <string|null>             # E2E safety test command (from Phase 0)
    source: <string>                   # user / route / function / module / none
  instrumented_files: [<string>]       # Files with active instrumentation (empty if non-invasive only)
  wrong_tool_indicators: []            # Empty = proceed, non-empty = exit

Wrong Tool Indicators

IndicatorCondition
external_service_no_alternative90%+ measured time in external service, no batch/cache/parallel path
within_industry_normMeasured time within expected range for operation type
infrastructure_boundBottleneck is hardware (measured via system metrics)
already_optimizedCode already uses best patterns (confirmed by suspicion scan)

Error Handling

ErrorRecovery
Cannot resolve entry pointBlock: "file/function not found at {path}"
Test command fails on unmodified codeBlock: "test fails before profiling — fix test first"
Profiler not available for stackFall back to invasive instrumentation (Phase 3 Step 2)
Instrumentation breaks testsRevert immediately: git checkout --.
Call chain too deep (> 5 levels)Stop at depth 5, note truncation
Cannot classify step typeDefault to "Unknown", use measured time
No I/O detected (pure CPU)Classify as CPU, focus on algorithm profiling

References

  • bottleneck_classification.md — classification taxonomy
  • latency_estimation.md — latency heuristics (fallback for static-only mode)
  • shared/references/ci_tool_detection.md — stack/tool detection
  • shared/references/benchmark_generation.md — benchmark templates per stack

Runtime Summary Artifact

MANDATORY READ: Load shared/references/coordinator_summary_contract.md

Emit an optimization-worker summary envelope.

Managed mode:

  • ln-810 passes deterministic runId and exact summaryArtifactPath
  • write the summary to the provided summaryArtifactPath

Standalone mode:

  • omit runId and summaryArtifactPath
  • write .hex-skills/runtime-artifacts/runs/{run_id}/optimization-worker/ln-811--{identifier}.json

Definition of Done

  • Test command discovered or created for optimization target
  • E2E safety test discovered (or documented as unavailable)
  • Baseline measured: wall time, CPU, memory (3 runs, median)
  • Call graph traced and function bodies read
  • Suspicion stack built: each suspicion verified and mapped to instrumentation point
  • Deep profile completed (non-invasive preferred, invasive if needed)
  • Instrumented files reported (cleanup deferred to executor)
  • Performance map built in standardized format (real measurements)
  • Top 3 bottlenecks identified from measured data
  • Wrong tool indicators evaluated from real metrics
  • optimization_hints contain only CONFIRMED suspicions with measurement evidence
  • Report prepared with measured findings
  • Optimization profile artifact written to the shared location

Version: 3.0.0 Last Updated: 2026-03-15

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.14%
按下载量换算275

Claude

34.3%
按下载量换算269

Cursor

19.21%
按下载量换算151

Gemini CLI

8.99%
按下载量换算70

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills