Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

accelint-ts-performance加速 ts 性能

Agent Skill

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

总安装

3,843

周安装

157

GitHub Stars

10

下载量

1,231
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-ts-performance

简介

accelint-ts-performance 提供系统化的 TypeScript 性能优化方案,针对运行时效率问题提供专家级反模式识别与修复建议。

  • 适用于高频率调用的工具函数、渲染循环、实时系统等对性能敏感的场景,帮助发现隐藏的瓶颈。
  • 必须审计所有代码,不因函数看似简单而跳过检查;仅关注性能特定问题,通用最佳实践请用 accelint-ts-best-practices。
  • 安装命令为 npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-ts-performance,需确认是否触发命令执行或网络请求。
  • 强调:切勿假设代码为冷路径,即使格式化或验证类函数也可能在高频调用中影响性能。

SKILL.md

TypeScript Performance Optimization

Systematic performance optimization for JavaScript/TypeScript codebases. Combines audit workflow with expert-level optimization patterns for runtime performance.

NEVER Do When Optimizing Performance

Note: For general best practices (type safety with any/enum, avoiding null, not mutating parameters), use the accelint-ts-best-practices skill instead. This section focuses exclusively on performance-specific anti-patterns.

  • NEVER assume code is cold path - Utility functions, formatters, parsers, and validators appear simple but are frequently called in loops, rendering pipelines, or real-time systems. Always audit ALL code for performance anti-patterns. Do not make assumptions about usage frequency or skip auditing based on perceived simplicity.
  • NEVER apply all optimizations blindly - Performance patterns have trade-offs. Balance optimization gains against code complexity. When conducting audits, identify ALL anti-patterns through systematic analysis and report them with expected gains. Let users decide which optimizations to apply based on their specific context.
  • NEVER ignore algorithmic complexity - Optimizing O(n²) code with micro-optimizations is futile. For n=1000, algorithmic fix (O(n² → O(n)) yields 1000x speedup; micro-optimizations yield 1.1-2x at best. Fix algorithm first: use Maps/Sets for O(1) lookups, eliminate nested iterations, choose appropriate data structures.
  • NEVER sacrifice correctness for speed - Performance bugs are still bugs. Optimizations frequently break edge cases: off-by-one errors in manual loops, wrong behavior for empty arrays, null handling issues. Verify behavior matches before and after. Add comprehensive tests covering edge cases before optimizing—catching bugs in production costs far more than any performance gain.
  • NEVER optimize code you don't own - Shared utilities, library internals, or code actively developed by others creates merge conflicts, duplicates effort, and confuses ownership. Performance changes affect all callers; coordinate with owners or defer optimization until code stabilizes.
  • NEVER ignore memory vs CPU trade-offs - Caching trades memory for speed. Unbounded memoization causes memory leaks in long-running applications. A 2x CPU speedup that increases memory 10x can trigger OOM crashes or frequent GC pauses (worse than original slowness). Profile memory usage alongside CPU; set cache size limits; use WeakMap for lifecycle-bound caches.
  • NEVER assume performance across environments - V8 optimizations differ between Node.js versions (v18 vs v20), browsers (Chrome vs Safari), and architectures (x64 vs ARM). An optimization yielding 3x speedup in Chrome may regress 1.5x in Safari. Profile in ALL target environments before shipping; maintain fallback implementations for environment-specific optimizations.
  • NEVER chain array methods (.filter().map().reduce()) - Each method creates intermediate arrays and iterates separately. For arrays with 10k items, .filter().map() allocates 10k + 5k items (if 50% pass filter) and iterates twice. Use single reduce pass to iterate once with zero intermediate allocations, yielding 2-5x speedup in hot paths.
  • NEVER use Array.includes() for repeated lookups - Array.includes() is O(n) linear search. Checking 1000 items against array of 100 is O(n×m) = 100k operations. Use Set.has() instead: O(1) lookup via hash table, reducing 100k operations to 1000 for ~100x speedup. Build Set once upfront; amortized cost is negligible.
  • NEVER await before checking if you need the result - await suspends execution immediately, even if the value isn't needed. Move await into conditional branches that actually use the result. Example: const data = await fetch(url); if (condition) {use(data);} wastes I/O time when condition is false. Better: if (condition) {const data = await fetch(url); use(data);} skips fetch entirely when unneeded.
  • NEVER recompute constants inside loops - Recomputing invariants wastes CPU in every iteration. For 10k iterations, array.length lookup (even if cached by engine) or Math.max(a, b) runs 10k times unnecessarily. Hoist invariants outside loops: const len = array.length; for (let i = 0; i < len; i++) or curry functions to precompute constant parameters once.
  • NEVER create unbounded loops or queues - Prevents runaway resource consumption from bugs or malicious input. Set explicit limits (for (let i = 0; i < Math.min(items.length, 10000); i++)) or timeouts. Unbounded loops can freeze UI threads; unbounded queues cause OOM crashes. Fail fast with clear limits rather than degrading gracefully into unusability.
  • NEVER place try/catch in hot paths - V8 cannot inline functions containing try-catch blocks and marks entire function as non-optimizable. Single try-catch in hot loop causes 3-5x slowdown by preventing inlining, escape analysis, and other optimizations. Validate inputs before hot paths using type guards; move try-catch outside loops to wrap entire operation; use Result types for expected errors.

Before Optimizing Performance, Ask

Apply these tests to focus optimization efforts effectively:

Impact Assessment

  • Is this code actually slow? When profiling data is available, use it to inform prioritization. When unavailable, audit all code for anti-patterns.
  • What percentage of runtime does this represent? When profiling data is available, flame graphs help identify the highest-impact issues. When unavailable, report all anti-patterns found.
  • Raw performance matters - Audit ALL code for performance anti-patterns regardless of current usage context. Utility functions, formatters, parsers, and data transformations are frequently called in loops, rendering pipelines, or real-time systems even when they appear simple.

Correctness Verification

  • Do I have tests covering this code? Performance bugs are subtle. Comprehensive tests catch regressions from optimizations. Add tests before optimizing.
  • What are the edge cases? Off-by-one errors, empty arrays, null/undefined values become more likely with manual loop optimizations. Test exhaustively.

Complexity vs Benefit

  • Is the algorithmic complexity optimal? O(n) → O(1) is 1000x speedup. Micro-optimizations are 1.1-2x at best. Fix algorithm first.
  • Will this optimization persist? If the code changes frequently, optimization may be discarded soon. Optimize stable code first.
  • What's the readability cost? Manual loops are faster but harder to maintain than .map(). Balance performance with team velocity.

How to Use

This skill uses progressive disclosure to minimize context usage:

1. Start with the Workflow (SKILL.md)

Follow the 4-phase audit workflow below for systematic performance analysis.

2. Reference Performance Rules Overview (AGENTS.md)

Load AGENTS.md to scan compressed rule summaries organized by category.

3. Load Specific Performance Patterns as Needed

When you identify specific performance issues, load corresponding reference files for detailed ❌/✅ examples.

4. Use the Report Template (For Explicit Audit Requests)

When users explicitly request a performance audit, load the template for consistent reporting:

Performance Optimization Workflow

Two modes of operation:

  1. Audit Mode - Skill invoked directly (/accelint-ts-performance <path>) or user explicitly requests performance audit

- Generate a structured audit report using the template (Phases 1-2 only) - Report findings for user review before implementation - User decides which optimizations to apply

  1. Implementation Mode - Skill triggers automatically during feature work

- Identify and apply optimizations directly (all 4 phases) - No formal report needed - Focus on fixing issues inline

Copy this checklist to track progress:

- [ ] Phase 1: Profile - Identify actual bottlenecks using profiling tools
- [ ] Phase 2: Analyze - Categorize issues by impact and optimization category
- [ ] Phase 3: Optimize - Apply performance patterns from references/
- [ ] Phase 4: Verify - Measure improvements and validate correctness

Phase 1: Profile to Identify Bottlenecks

CRITICAL: Audit ALL code for performance anti-patterns. Do not skip code based on assumptions about usage frequency. Utility functions, formatters, parsers, validators, and data transformations are frequently called in loops, rendering pipelines, or real-time systems even if their implementation appears simple.

When profiling tools are available, use them to establish baseline measurements:

  • Browser: Chrome DevTools Performance tab
  • Node.js: node --prof script.js && node --prof-process isolate-*.log

Whether profiling data is available or not: Perform systematic static code analysis to identify ALL performance anti-patterns:

  • O(n²) complexity (nested loops, repeated searches)
  • Excessive allocations (template literals, object spreads, array methods)
  • Template literal allocation when String() would suffice
  • Array method chaining (.filter().map())
  • Blocking async operations
  • Try/catch in loops

Output: Complete list of ALL identified anti-patterns with their locations and expected performance impact. Do not filter based on "severity" or "priority" - report everything found.

When generating audit reports (when skill is invoked directly via /accelint-ts-performance <path> or user explicitly requests performance audit), use the structured template:

  1. Load assets/output-report-template.md for the report structure
  2. Follow the template's guidance for consistent formatting and issue grouping

Phase 2: Analyze and Categorize Issues

For EVERY issue identified in Phase 1, categorize by optimization type:

Categorize ALL issues by optimization type:

Issue TypeCategoryExpected Gain
Nested loops, O(n²) complexityAlgorithmic optimization10-1000x
Repeated expensive computationsCaching & memoization2-100x
Allocation-heavy codeAllocation reduction1.5-5x
Sequential access violationsMemory locality1.5-3x
Excessive I/O operationsI/O optimization5-50x
Blocking async operationsI/O optimization2-10x
Property access in loopsCaching & memoization1.2-2x

Quick reference for mapping issues:

Load references/quick-reference.md for detailed issue-to-category mapping and anti-pattern detection.

Output: Categorized list of ALL issues with their optimization categories. Do not filter or prioritize - list everything found in Phase 1.

Phase 3: Optimize Using Performance Patterns

Step 1: Identify your bottleneck category from Phase 2 analysis.

Step 2: Load MANDATORY references for your category. Read each file completely with no range limits.

CategoryMANDATORY FilesOptionalDo NOT Load
Algorithmic (O(n²), nested loops, repeated lookups)reduce-looping.mdreduce-branching.mdmemoization, caching, I/O, allocation
Caching (property access in loops, repeated calculations)memoization.mdcache-property-access.mdcache-storage-api.md (for Storage APIs)I/O, allocation
I/O (blocking async, excessive I/O operations)batching.mddefer-await.mdalgorithmic, memory
Memory (allocation-heavy, GC pressure)object-operations.mdavoid-allocations.mdI/O, caching
Locality (sequential access violations, cache misses)predictable-execution.mdall others
Safety (unbounded loops, runaway queues)bounded-iteration.mdall others
Micro-opt (hot path fine-tuning, 1.1-2x improvements)currying.mdperformance-misc.mdall others (apply only after algorithmic fixes)

Notes:

  • If bottleneck spans multiple categories, load references for all relevant categories
  • Only apply micro-optimizations if: bottleneck is in hot path, algorithmic optimization already applied, need additional 1.1-2x performance

Step 3: Scan for quick reference during optimization

Load AGENTS.md to see compressed rule summaries organized by category. Use as a quick lookup while implementing patterns from the detailed reference files above.

Apply patterns systematically:

  1. Load the reference file for the identified issue category
  2. Scan the ❌/✅ examples to find matching patterns
  3. Apply the optimization with minimal changes to preserve correctness
  4. Add comments explaining the optimization and referencing the pattern

Example optimization:

// ❌ Before: O(n²) - nested iteration
for (const user of users) {
  const items = allItems.filter(item => item.userId === user.id);
  process(items);
}

// ✅ After: O(n) - single pass with Map lookup
// Performance: reduce-looping.md - build lookup once pattern
const itemsByUser = new Map<string, Item[]>();
for (const item of allItems) {
  if (!itemsByUser.has(item.userId)) {
    itemsByUser.set(item.userId, []);
  }
  itemsByUser.get(item.userId)!.push(item);
}

for (const user of users) {
  const items = itemsByUser.get(user.id) ?? [];
  process(items);
}

Phase 4: Verify Improvements

Measure performance gain:

  1. Re-run profiler with same inputs
  2. Compare before/after runtime percentages
  3. Document speedup factor (e.g., "2.3x faster")

Verify correctness:

  1. Run existing test suite - all tests must pass
  2. Add new tests for edge cases affected by optimization
  3. Manual testing for user-facing functionality

Document optimization:

// Performance optimization applied: 2026-01-28
// Issue: Nested iteration causing O(n²) complexity with 10k items
// Pattern: reduce-looping.md - Map-based lookup
// Speedup: 145x faster (5200ms → 36ms)
// Verified: All tests pass, manual QA complete

Deciding whether to keep the optimization:

  • >10x speedup: Always keep if tests pass
  • 2-10x speedup: Keep if tests pass and code remains maintainable
  • 1.2-2x speedup: Keep for hot paths (>1000 executions/sec) or real-time systems
  • 1.05-1.2x speedup: Keep only if trivial change or critical rendering/animation loop
  • <1.05x speedup: Revert unless it also improves readability

Real-time systems (60fps rendering, live data visualization): Even 1.05x improvements matter in critical hot paths. Use frame timing profiler to verify impact on frame budget (16.67ms for 60fps).

If tests fail: Fix the optimization or revert. Performance bugs are still bugs.

Freedom Calibration

Calibrate guidance specificity to optimization impact:

Optimization TypeFreedom LevelGuidance FormatExample
Algorithmic (10x+ gain)Medium freedomMultiple valid approaches, pick based on constraints"Use Map for O(1) lookup or Set for deduplication"
Caching (2-10x gain)Medium freedomPattern with examples, cache invalidation strategy"Memoize with WeakMap if lifecycle matches source objects"
Micro-optimization (1.1-2x)Low freedomExact pattern from reference, measure first"Cache array.length in loop: for (let i = 0, len = arr.length;...)"

The test: "What's the speedup and maintenance cost?"

  • 10x+ speedup → Worth complexity, medium freedom with patterns
  • 2-10x speedup → Justify with measurements, medium freedom
  • 1.2-2x speedup → Valuable for hot paths and real-time systems, low freedom with exact patterns
  • 1.05-1.2x speedup → Only if trivial change or critical hot path (60fps rendering, etc.)

Important Notes

  • Audit everything philosophy - Audit ALL code for performance anti-patterns. Utility functions, formatters, parsers, and validators are frequently called in loops or real-time systems even when they appear simple. Do not make assumptions about usage frequency.
  • Report all findings - Whether profiling data is available or not, perform systematic static analysis to identify and report ALL anti-patterns with their expected gains. Do not filter based on "severity" or "priority."
  • Reference files are authoritative - The patterns in references/ have been validated. Follow them exactly unless measurements prove otherwise.
  • Hot path definition - Code executed >1000 times per user interaction or >100 times per second in server contexts. For real-time systems (60fps rendering, live visualization), hot paths are functions in the critical rendering loop consuming >1ms per frame.
  • Real-time systems have stricter requirements - 60fps = 16.67ms frame budget. 120fps = 8.33ms. Even 1.05x improvements in hot paths are valuable. Profile with frame timing, not just total execution time.
  • Regression testing - Performance optimizations frequently introduce subtle bugs in edge cases. Add tests before optimizing.
  • Memory profiling matters - Some optimizations (memoization, caching) trade memory for speed. Monitor memory usage in production, especially for long-running real-time applications.

Quick Decision Tree

Use this table to rapidly identify which optimization category applies.

Audit everything: Identify ALL performance anti-patterns in the code regardless of current usage context. Report all findings with expected gains.

If You See...Root CauseOptimization CategoryExpected Gain
Nested for loops over same dataO(n²) complexityAlgorithmic (reduce-looping)10-1000x
.filter() followed by .find() or .map()Multiple passes over dataAlgorithmic (reduce-looping)2-10x
Repeated array.find() or .includes()O(n) linear searchAlgorithmic (reduce-looping, use Set/Map)10-100x
Many if/else chains on same variableBranch-heavy codeAlgorithmic (reduce-branching)1.5-3x
Same function called with same inputs repeatedlyRedundant computationCaching (memoization)2-100x
obj.prop.nested.deep accessed multiple times in loopProperty access overheadCaching (cache-property-access)1.2-2x
localStorage.getItem() or sessionStorage in loopExpensive I/O in loopCaching (cache-storage-api)5-20x
Multiple await fetch() in sequenceSequential I/O blockingI/O (batching, defer-await)2-10x
await before conditional that might not need resultPremature async suspensionI/O (defer-await)1.5-3x
Many object spreads {...obj} or [...arr]Allocation overheadMemory (avoid-allocations)1.5-5x
Creating objects/arrays inside hot loopsGC pressure from allocationsMemory (avoid-allocations)2-5x
Object.assign() or spread when mutation is safeUnnecessary immutability costMemory (object-operations)1.5-3x
Accessing array elements non-sequentiallyCache locality issuesMemory Locality (predictable-execution)1.5-3x
while(true) or unbounded queue growthRunaway resource usageSafety (bounded-iteration)Prevents crashes
Function called with mostly same first N paramsRepeated parameter passingMicro-opt (currying)1.1-1.5x
try/catch inside hot loopV8 deoptimizationMicro-opt (performance-misc)3-5x
String concatenation in loop with +Quadratic string copyingMicro-opt (performance-misc)2-10x

How to use this table:

  1. Identify the pattern from profiler bottleneck
  2. Find matching row in "If You See..." column
  3. Jump to corresponding Optimization Category in Phase 3
  4. Load MANDATORY reference files for that category

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.64%
按下载量换算451

Claude

32.49%
按下载量换算400

Cursor

18.3%
按下载量换算225

Gemini CLI

10.25%
按下载量换算126

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

来源信息

继续浏览同类 Skills