ln-653-runtime-performance-auditor by levnikolaevich/claude-code-skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-653-runtime-performance-auditor路径说明: 文件路径(
shared/、references/、../ln-*)是相对于技能仓库根目录的。如果在当前工作目录中未找到,请定位此 SKILL.md 文件所在的目录,然后向上返回一级以找到仓库根目录。如果缺少shared/目录,请通过 WebFetch 从https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}获取文件。
专门用于审计异步和通用代码中运行时性能反模式的 Worker。
必读: 加载 shared/references/audit_worker_core_contract.md。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
接收包含以下内容的 contextStore:tech_stack、best_practices、codebase_root、output_dir。
领域感知: 支持 domain_mode + current_domain。
必读: 加载 shared/references/two_layer_detection.md 以了解检测方法。
scan_path 范围内进行 Grep 模式匹配async def 代码块,然后检查其中的违规shared/templates/audit_worker_report_template.md 在内存中构建完整的 Markdown 报告,通过单次 Write 调用写入 {output_dir}/653-runtime-performance.md内容: 在异步函数内部执行同步文件/网络操作,阻塞事件循环
检测(Python):
async def 函数open(、.read_bytes()、.read_text()、.write_bytes()、.write_text()、Path(...).(read|write)requests.get、requests.post、urllib.requestsubprocess.run(、subprocess.call(await asyncio.to_thread(...) 或 await loop.run_in_executor(...) 中的调用检测(Node.js):
async function 或箭头异步函数内部,grep 查找 fs.readFileSync、fs.writeFileSync、child_process.execSync严重性:
__init__/设置/引导程序(非请求路径)中的阻塞 IO → 低。在非热点路径中读取小文件 (<1KB) → 跳过建议: 对于文件操作,使用 aiofiles、asyncio.to_thread() 或 loop.run_in_executor();使用 httpx.AsyncClient 替代 requests
修复工作量: 小(包装在 to_thread 中或切换到异步库)
内容: 使用列表推导式,而生成器表达式已足够
检测:
len([x for x in ...]) - 分配列表仅用于计数;使用 sum(1 for ...)any([x for x in ...]) - 为短路检查分配列表;使用 any(x for ...)all([x for x in ...]) - 相同模式;使用 all(x for ...)set([x for x in ...]) - 使用集合推导式 {x for x in ...}"".join([x for x in ...]) - 直接使用生成器 "".join(x for x in ...)严重性:
建议: 将 [...] 替换为生成器 (...) 或集合推导式 {...}
修复工作量: 小(仅语法更改)
内容: 在异步函数内部的 time.sleep() 会阻塞事件循环
检测:
async def 代码块中 grep 查找 time\.sleepawait some_async_call() ... time.sleep(N) ... await another_call()严重性:
time.sleep()(冻结所有并发请求)time.sleep()time.sleep → 跳过建议: 替换为 await asyncio.sleep(N)
修复工作量: 小(单行更改)
内容: 在循环内通过 += 构建字符串(对于大字符串是 O(n^2) 复杂度)
检测:
result、output、html、text 在 for/while 循环内使用 +=+=,位于循环体内严重性:
建议: 使用 list.append() + "".join(),或 io.StringIO,或结合 "".join(generator) 的 f-string
修复工作量: 小(重构为列表 + join)
to_thread内容: 在异步处理程序中的 CPU 密集型同步代码,未卸载到线程
检测:
async def 内部,查找 CPU 密集型操作:
json.loads(large_data)、json.load(file)PIL.Image.open、cv2.imreadhashlib、bcrypt.hashpwlxml.etree.parse、BeautifulSoup(asyncio.to_thread() 或 executor 中的操作严重性:
建议: 包装在 await asyncio.to_thread(func, *args) (Python 3.9+) 或 loop.run_in_executor(None, func, *args) 中
修复工作量: 小(包装在 to_thread 中)
内容: 当数据仅被读取而未被修改时,不必要的 .copy()、list()、dict()
检测:
data = list(items),其中 data 仅被迭代(从未修改)config = config_dict.copy(),其中 config 仅被读取result = dict(original),其中 result 未经修改即返回严重性:
建议: 移除不必要的副本;如果未发生修改,则传递原始数据
修复工作量: 小(移除复制调用)
必读: 加载 shared/references/audit_worker_core_contract.md 和 shared/references/audit_scoring.md。
必读: 加载 shared/references/audit_worker_core_contract.md 和 shared/templates/audit_worker_report_template.md。
将报告写入 {output_dir}/653-runtime-performance.md,其中包含 category: "Runtime Performance" 和检查项:blocking_io_in_async、unnecessary_list_allocation、sync_sleep_in_async、string_concat_in_loop、missing_to_thread、redundant_data_copies。
向协调器返回摘要:
Report written: docs/project/.audit/ln-650/{YYYY-MM-DD}/653-runtime-performance.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)
必读: 加载 shared/references/audit_worker_core_contract.md。
to_thread/run_in_executor 中的调用必读: 加载 shared/references/audit_worker_core_contract.md。
{output_dir}/653-runtime-performance.md(原子性的单次 Write 调用)shared/references/audit_output_schema.md版本: 1.0.0 最后更新: 2026-02-04
每周安装次数
137
仓库
GitHub 星标数
245
首次出现
2026年2月7日
安全审计
安装于
cursor127
opencode127
claude-code127
codex126
gemini-cli126
github-copilot125
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. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Specialized worker auditing runtime performance anti-patterns in async and general code.
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
Receives contextStore with: tech_stack, best_practices, codebase_root, output_dir.
Domain-aware: Supports domain_mode + current_domain.
MANDATORY READ: Load shared/references/two_layer_detection.md for detection methodology.
Parse context from contextStore
Scan codebase for violations
scan_pathasync def blocks first, then check for violations inside themCollect findings with severity, location, effort, recommendation
Calculate score using penalty algorithm
Write Report: Build full markdown report in memory per shared/templates/audit_worker_report_template.md, write to {output_dir}/653-runtime-performance.md in single Write call
Return Summary: Return minimal summary to coordinator (see Output Format)
What: Synchronous file/network operations inside async functions, blocking event loop
Detection (Python):
async def functionsopen(, .read_bytes(), .read_text(), .write_bytes(), .write_text(), Path(...).(read|write)requests.get, requests.post, urllib.requestDetection (Node.js):
async function or arrow async, grep for fs.readFileSync, fs.writeFileSync, child_process.execSyncSeverity:
__init__/setup/bootstrap (not request path) → LOW. Small file (<1KB) read in non-hot path → skipRecommendation: Use aiofiles, asyncio.to_thread(), or loop.run_in_executor() for file operations; use httpx.AsyncClient instead of requests
Effort: S (wrap in to_thread or switch to async library)
What: List comprehension where generator expression suffices
Detection:
len([x for x in ...]) - allocates list just to count; use sum(1 for ...)any([x for x in ...]) - allocates list for short-circuit check; use any(x for ...)all([x for x in ...]) - same pattern; use all(x for ...)set([x for x in ...]) - use set comprehension {x for x in ...}"".join([x for x in ...]) - use generator directly "".join(x for x in ...)Severity:
Recommendation: Replace [...] with generator (...) or set comprehension {...}
Effort: S (syntax change only)
What: time.sleep() inside async function blocks event loop
Detection:
time\.sleep inside async def blocksawait some_async_call() ... time.sleep(N) ... await another_call()Severity:
time.sleep() in async API handler (freezes all concurrent requests)time.sleep() in async background tasktime.sleep in CLI/script (not async server) → skipRecommendation: Replace with await asyncio.sleep(N)
Effort: S (one-line change)
What: Building string via += inside loop (O(n^2) for large strings)
Detection:
result, output, html, text with += inside for/while loop+= containing string operand inside loop bodySeverity:
Recommendation: Use list.append() + "".join(), or io.StringIO, or f-string with "".join(generator)
Effort: S (refactor to list + join)
to_thread for CPU-BoundWhat: CPU-intensive synchronous code in async handler without offloading to thread
Detection:
async def, find CPU-intensive operations:
json.loads(large_data), json.load(file)PIL.Image.open, cv2.imreadhashlib, bcrypt.hashpwlxml.etree.parse, BeautifulSoup(asyncio.to_thread() or executorSeverity:
Recommendation: Wrap in await asyncio.to_thread(func, *args) (Python 3.9+) or loop.run_in_executor(None, func, *args)
Effort: S (wrap in to_thread)
What: Unnecessary .copy(), list(), dict() when data is only read, not mutated
Detection:
data = list(items) where data is only iterated (never modified)config = config_dict.copy() where config is only readresult = dict(original) where result is returned without modificationSeverity:
Recommendation: Remove unnecessary copy; pass original if not mutated
Effort: S (remove copy call)
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/references/audit_scoring.md.
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/templates/audit_worker_report_template.md.
Write report to {output_dir}/653-runtime-performance.md with category: "Runtime Performance" and checks: blocking_io_in_async, unnecessary_list_allocation, sync_sleep_in_async, string_concat_in_loop, missing_to_thread, redundant_data_copies.
Return summary to coordinator:
Report written: docs/project/.audit/ln-650/{YYYY-MM-DD}/653-runtime-performance.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
to_thread/run_in_executorMANDATORY READ: Load shared/references/audit_worker_core_contract.md.
{output_dir}/653-runtime-performance.md (atomic single Write call)shared/references/audit_output_schema.mdVersion: 1.0.0 Last Updated: 2026-02-04
Weekly Installs
137
Repository
GitHub Stars
245
First Seen
Feb 7, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
cursor127
opencode127
claude-code127
codex126
gemini-cli126
github-copilot125
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
36,300 周安装
Git Hooks 设置指南:Husky 配置、代码质量检查与自动化提交验证
136 周安装
压力测试指南:使用k6和JMeter进行系统极限与崩溃点测试
136 周安装
agent-browser 浏览器自动化测试工具 - 基于引用的 AI 友好型端到端测试 CLI
136 周安装
App Store Connect 参考指南:崩溃分析、TestFlight反馈与性能指标导出
136 周安装
iOS Apple Intelligence 路由器使用指南 - Foundation Models 与 AI 方法分流
136 周安装
Arboreto:基因调控网络推断Python库,支持GRNBoost2/GENIE3算法与分布式计算
136 周安装
subprocess.run(subprocess.call(await asyncio.to_thread(...) or await loop.run_in_executor(...)