AGENT SKILL

ln-813-runtime-optimizer

Fixes blocking IO, unnecessary allocations, sync-in-async with keep/discard verification

License 许可
MIT
最近更新
2026-05-02
Stars
★ 3
Forks
1

01 前言 Front Matter

name
ln-813-runtime-optimizer
license
MIT
description
Fixes blocking IO, unnecessary allocations, sync-in-async with keep/discard verification

02 资源文件 67

03 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.

ln-813-runtime-optimizer

Type: L3 Worker Category: 8XX Optimization Parent: ln-810-performance-optimization-coordinator

Fixes runtime performance issues found by ln-653-runtime-performance-auditor. Each fix verified via tests + lint with keep/discard pattern.


Overview

Aspect Details
Input Audit findings from docs/project/persistence_audit.md (ln-653 section) OR target file
Output Optimized code, verification report
Companion ln-653-runtime-performance-auditor (finds issues) → ln-813 (fixes them)

Workflow

Phases: Pre-flight → Load Findings → Prioritize → Fix Loop → Report


Phase 0: Pre-flight Checks

Check Required Action if Missing
Audit findings OR target file Yes Block optimization
Test infrastructure Yes Block (need tests for verification)
Linter available No Skip lint step in verification
Git clean state Yes Block (need clean baseline for revert)

MANDATORY READ: Load shared/references/ci_tool_detection.md — use Test Frameworks + Linters sections.

Worktree & Branch Isolation

MANDATORY READ: Load shared/references/git_worktree_fallback.md — use ln-813 row.


Phase 1: Load Findings

From Audit Report

Read docs/project/persistence_audit.md, extract ln-653 findings:

Finding Type Optimization
Blocking IO in async asyncio.to_thread(), aiofiles, async HTTP client
String concat in loop StringBuilder (.NET), "".join() (Python), template literals (JS)
Unnecessary allocations Pre-allocate collections, object pooling, Span<T>
Sync sleep in async asyncio.sleep(), Task.Delay(), setTimeout
Redundant serialization Cache serialized form, avoid round-trip JSON in memory

From Target File

If no audit report: scan target file for runtime patterns matching the table above.


Phase 2: Prioritize Fixes

Priority Criteria
1 (highest) Blocking IO in async context (blocks event loop)
2 Sync sleep in async (starves thread pool)
3 Allocations in hot loop (GC pressure)
4 String concatenation patterns
5 Other micro-optimizations

Phase 3: Fix Loop (Keep/Discard)

Per-Fix Cycle

FOR each finding (F1..FN):
  1. APPLY: Edit code (surgical change)
  2. VERIFY: Run tests
     IF tests FAIL → DISCARD (revert) → next finding
  3. VERIFY: Run lint (if available)
     IF lint FAIL → DISCARD (revert) → next finding
  4. BOTH PASS → KEEP
  5. LOG: Record fix for report

Keep/Discard Decision

Condition Decision
No tests cover affected file/function SKIP finding — log as "uncovered, skipped"
Tests + lint pass KEEP
Tests fail DISCARD + log reason
Lint fail (new warnings) DISCARD + log reason
Lint unavailable KEEP (tests sufficient)

Phase 4: Report Results

Report Schema

Field Description
source Audit report path or target file
findings_total Total findings from audit
fixes_applied Successfully kept fixes
fixes_discarded Failed fixes with reasons
fix_details[] Per-fix: finding type, file, before/after description

Configuration

Options:
  # Source
  audit_report: "docs/project/persistence_audit.md"
  target_file: ""

  # Verification
  run_tests: true
  run_lint: true

  # Scope
  fix_types:
    - blocking_io
    - sync_sleep
    - unnecessary_alloc
    - string_concat
    - redundant_serialization

Error Handling

Error Cause Solution
No audit findings ln-653 not run or no issues Report "no findings to optimize"
Async rewrite complex Deep call chain affected Log as manual step, skip
Framework-specific pattern Unknown async framework Query Context7/Ref for docs

References

  • ../ln-653-runtime-performance-auditor/SKILL.md (companion: finds issues)
  • shared/references/ci_tool_detection.md (test + lint detection)

Definition of Done

  • Findings loaded from audit report or target file scan
  • Fixes prioritized (blocking IO first, then sync sleep, allocations, string concat)
  • Each fix applied with keep/discard: tests + lint pass → keep, either fails → discard
  • Report returned with findings total, fixes applied, fixes discarded

Version: 1.0.0 Last Updated: 2026-03-08

04 同仓库更多 Skills

levalencia
levalencia/agent-god-mode

zarr-python

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

★ 3
levalencia
levalencia/agent-god-mode

zabbix

Zabbix monitoring system automation via API and Python. Use when: (1) Managing hosts, templates, items, triggers, or host groups, (2) Automating monitoring configuration, (3) Sending data via Zabbix trapper/sender, (4) Querying historical data or events, (5) Bulk operations on Zabbix objects, (6) Maintenance window management, (7) User/permission management

开发工程师后端与接口Skill与智能体开发
★ 3
levalencia
levalencia/agent-god-mode

x-twitter-growth

X/Twitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X/Twitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.

★ 3
levalencia
levalencia/agent-god-mode

what-if-oracle

Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like "what if...", "what would happen if...", "what are the possibilities", "explore scenarios", "scenario analysis", "possibility space", "what could go wrong", "best case / worst case", "risk analysis", "contingency planning", "strategic options", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.

★ 3
levalencia
levalencia/agent-god-mode

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

前端开发
★ 3
levalencia
levalencia/agent-god-mode

venue-templates

Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

内容创作者写作与文案资料检索与研究
★ 3