Agent Skillsvictorgarciaesgi/regle › ts-memory-baseline

ts-memory-baseline

GitHub

定义 TypeScript 内存使用基准测试流程,用于测量编译器诊断和类型检查的内存消耗。通过对比新旧基线中位数,评估泛型变更或性能回归,确保构建和测试稳定性。

.cursor/skills/ts-memory-baseline/SKILL.md victorgarciaesgi/regle

Trigger Scenarios

检查 TS 服务器压力 检测类型级性能回归 重型泛型类型变更前后的对比

Install

npx skills add victorgarciaesgi/regle --skill ts-memory-baseline -g -y
More Options

Use without installing

npx skills use victorgarciaesgi/regle@ts-memory-baseline

指定 Agent (Claude Code)

npx skills add victorgarciaesgi/regle --skill ts-memory-baseline -a claude-code -g -y

安装 repo 全部 skill

npx skills add victorgarciaesgi/regle --all -g -y

预览 repo 内 skill

npx skills add victorgarciaesgi/regle --list

SKILL.md

Frontmatter
{
    "name": "ts-memory-baseline",
    "metadata": {
        "author": "regle",
        "version": "2026.03.19"
    },
    "description": "Measure and compare TypeScript memory usage for @regle\/core and test typechecks. Use when checking TS server pressure, type-level perf regressions, or before\/after heavy generic typing changes."
}

TypeScript memory baseline procedure

This skill defines a reproducible process to measure TypeScript memory usage in this repository.

Hard requirements

  1. Use Node 24 for all measurements.
  2. Run pnpm build before any test-related measurement.
  3. pnpm run test:typecheck should never fail. If it fails, treat the run as invalid for regression tracking.

Environment setup

PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH"
node -v
pnpm -v

Expected:

  • Node v24.x
  • pnpm 11.20.0 (or project-compatible version)

Measurement runbook (must follow)

  1. Ensure no extra monorepo tasks are running.
  2. Use the exact Node 24 PATH prefix in every command.
  3. Run one warm-up pass that is discarded.
  4. Run 3 measured passes and compare medians.
  5. Save only the final medians in tests/TS_MEMORY_BASELINE_RESULTS.md.

Measurement commands

A. @regle/core compiler diagnostics

PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
./node_modules/.bin/tsc -p "packages/core/tsconfig.json" --noEmit --extendedDiagnostics

Capture:

  • Memory used
  • Instantiations
  • Check time

B. Full type tests memory

Run build first:

PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" pnpm build

Then:

PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
/usr/bin/time -l pnpm run test:typecheck

Capture:

  • exit code (must be 0)
  • maximum resident set size
  • peak memory footprint
  • real/user/sys

Recommended sequence:

# warm-up (discard)
PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
/usr/bin/time -l corepack pnpm run test:typecheck

# measured runs (collect all 3)
PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
/usr/bin/time -l corepack pnpm run test:typecheck
PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
/usr/bin/time -l corepack pnpm run test:typecheck
PATH="/Users/victorgarcia/.nvm/versions/node/v24.15.0/bin:$PATH" \
/usr/bin/time -l corepack pnpm run test:typecheck

Comparison protocol

Use median deltas because absolute values can vary with machine/CPU load.

  1. Compute medians for old baseline and new run.
  2. Compute delta % = (new - old) / old * 100.
  3. Evaluate with these thresholds:
    • Likely noise: within ±5% for memory metrics.
    • Watch zone: >5% and <=10% increase.
    • Regression candidate: >10% increase.
  4. For Check time and real time, treat as noisy:
    • investigate only if increase is >15% and reproducible across runs.
  5. If pnpm run test:typecheck exit code is non-zero, invalidate the run (do not update baseline).

Results storage

Store only numeric outcomes in:

  • tests/TS_MEMORY_BASELINE_RESULTS.md

Do not put procedural instructions in the results file.

Version History

  • 0df09b5 Current 2026-08-19 21:51

    pnpm 版本要求从 11.6.0 升级至 11.20.0

  • aeafba7 2026-07-24 21:59

Same Skill Collection

.cursor/skills/antfu/SKILL.md
.cursor/skills/caveman/SKILL.md
.cursor/skills/diagnose/SKILL.md
.cursor/skills/edit-article/SKILL.md
.cursor/skills/grill-me/SKILL.md
.cursor/skills/grill-with-docs/SKILL.md
.cursor/skills/improve-codebase-architecture/SKILL.md
.cursor/skills/prototype/SKILL.md
.cursor/skills/tsdown/SKILL.md
.cursor/skills/turborepo/SKILL.md
.cursor/skills/vite-plus/SKILL.md
.cursor/skills/vite/SKILL.md
.cursor/skills/vitepress/SKILL.md
.cursor/skills/vitest/SKILL.md
.cursor/skills/vue/SKILL.md
.cursor/skills/write-a-skill/SKILL.md
.github/skills/code-review/SKILL.md
skills/regle-advanced/SKILL.md
skills/regle-migrate-vuelidate/SKILL.md
skills/regle-rules/SKILL.md
skills/regle-schemas/SKILL.md
skills/regle-typescript/SKILL.md
skills/regle/SKILL.md
.cursor/skills/zoom-out/SKILL.md

Metadata

Files
0
Version
0df09b5
Hash
78e251ee
Indexed
2026-07-24 21:59

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 13:47
浙ICP备14020137号-1 $방문자$