用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/caarlos0/dotfiles --skill typescript-performance命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | typescript-performance |
| description | Diagnose and optimize TypeScript checker, build, V8, Node, and browser performance. |
First identify the slow layer: type checking, emit and bundling, emitted JavaScript, Node.js, or the browser. Measure one representative workload and change one demonstrated bottleneck.
Start with phase timing:
tsc -p tsconfig.json --extendedDiagnostics
tsc -p tsconfig.json --generateTrace trace --incremental false
npx @typescript/analyze-trace trace
Use --generateTrace only when check time dominates. Its output identifies
expensive files, comparisons, and type instantiations.
Concrete checker fixes, only for traced hot spots:
--listFiles or --explainFiles.
exclude does not remove an imported file.types to ambient packages the program uses; do not load every
installed @types package by accident.incremental for repeated builds and invalidate .tsbuildinfo when the
compiler or relevant configuration changes.skipLibCheck saves time by not validating dependency declarations. It can
hide incompatible .d.ts files, so treat it as a correctness trade-off rather
than a default optimization. isolatedDeclarations enables compatible tools to
emit declarations per file; it does not make ordinary tsc checking faster.
Run fast transpilation beside, never instead of, type checking:
tsc --noEmit ─────────────► type errors
source ─► esbuild / SWC ─► JavaScript and source maps
Enable isolatedModules to detect constructs unsafe for file-isolated
transpilers. Inspect:
package.json sideEffects. Use false only when module evaluation is
actually pure; list CSS, polyfills, and registration modules explicitly.target against the deployed runtime. Lower targets inject syntax-lowering
code; TypeScript does not polyfill missing runtime APIs.Interfaces, type aliases, generics, and type modifiers erase. Regular enums, namespaces, decorators, and parameter properties emit JavaScript. Inspect the bundle before making runtime claims.
In measured hot paths:
Reject stale bans on try/catch, async/await, classes, or modern syntax.
V8 behavior changes; require a current profile on the deployed Node or browser.
fs, dns, crypto, and zlib can contend for the
shared libuv worker pool. Moving work off the event loop does not create
unlimited capacity.write() returns false, wait for
drain, and prefer stream.pipeline for connected stages and error cleanup.AsyncLocalStorage for request context instead of raw async_hooks.node --cpu-prof app.js
node --heap-prof app.js
Measure bundle delivery, script parse/evaluate/GC, rendering, and field responsiveness separately. Use the Performance panel to attribute long tasks before splitting or yielding. Include structured-clone and messaging cost when moving work to Web Workers; transfer buffers when ownership transfer is valid. Batch DOM reads and writes to avoid repeated style and layout work.
Lighthouse is lab evidence. Use Core Web Vitals field data for real-user impact; one local run is not a regression gate.
Bundle bytes and compiler diagnostic counts can be hard gates when the lockfile, toolchain, input, and variance are controlled. Keep shared-runner wall time and browser lab scores advisory until repeated baselines show a stable threshold.
code-review checks a completed diff. When invoked from code-review, do not
invoke it again.code-simplifier runs after the gain is proven.change-impact-auditor traces config, cache, module, and consumer changes.runtime-process-debugging owns event-loop, process, pipe, and shutdown
failures.Correctness overrides performance.