Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/davidyichengwei/agentic-engineering-framework/bp-performance-optimizationnpx skills add davidYichengWei/agentic-engineering-framework --skill bp-performance-optimizationgit clone --depth 1 https://github.com/davidYichengWei/agentic-engineering-frameworkWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00050 | $0.01454 |
| Opus 5 | $0.00025 | $0.00727 |
| Sonnet 5 | $0.00010 | $0.00291 |
| Haiku 4.5 | $0.00005 | $0.00145 |
Grade A, and why
bp-performance-optimization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.
性能优化技术
前置检查
本 skill 是参考资料,不是工作流入口。
在应用本 skill 的优化规则前,必须确认:
-
优化目标是否明确?
- 具体要优化什么?延迟?吞吐?内存?
- 当前数据是多少?目标是多少?
- 如何测量和验证?
-
是否已经定位瓶颈?
- 有 profiling 数据吗?
- 热点在哪里?
如果以上问题不清楚:
- 涉及代码修改 → 先走
workflow-code-generationSkill(它会引导需求澄清) - 仅做分析 → 先与用户确认优化目标和当前数据
核心理念
优化的本质是简化。 复杂的代码通常更大、更慢、更耗能。
方法论
| 阶段 | 要点 |
|---|---|
| 1. 定义目标 | 明确成功标准:延迟?吞吐?内存?功耗? |
| 2. 设计评估 | 糟糕的设计无法靠优化弥补 |
| 3. Profile | 关注消耗指标(指令数、cache miss),不只是时间 |
| 4. 算法优先 | 先优化数据结构和算法 |
| 5. 应用规则 | 对热点应用具体优化规则 |
设计原则
| 原则 | 说明 |
|---|---|
| 简单直接 | 避免过度抽象;能删代码比加代码好 |
| 连续优于分散 | vector/数组优于链表(cache 友好) |
| 直接优于间接 | 减少指针追逐,每次间接访问都是潜在 cache miss |
| 独占优于共享 | unique_ptr 无开销;shared_ptr 有原子操作开销 |
| 扁平优于深层 | 避免复杂继承层次和虚函数派发 |
| Early Binding | 把工作提前做一次,避免重复做多次 |
| 模块化 | 清晰契约,允许局部替换而不改架构 |
优化规则速查
Space-for-Time(空间换时间)
| 规则 | 说明 |
|---|---|
| Data Structure Augmentation | 添加冗余信息加速操作 |
| Precomputation | 预计算并存储结果 |
| Caching | 缓存频繁访问的数据 |
| Lazy Evaluation | 延迟计算直到真正需要 |
详见 reference/space-for-time.md
Time-for-Space(时间换空间)
| 规则 | 说明 |
|---|---|
| Packing | 紧凑存储减少内存占用 |
| Overlaying | 复用内存空间 |
| Interpreters | 用解释器压缩程序表示 |
详见 reference/time-for-space.md
Loop Rules(循环优化)
| 规则 | 说明 |
|---|---|
| Code Motion | 将循环不变量移出循环 |
| Combining Tests | 合并测试条件,使用哨兵 |
| Loop Unrolling | 展开循环减少迭代开销 |
| Loop Fusion | 合并相同范围的循环 |
Logic Rules(逻辑优化)
| 规则 | 说明 |
|---|---|
| Algebraic Identities | 用等价的更廉价表达式替换 |
| Short-Circuiting | 提前终止求值 |
| Reordering Tests | 廉价/常成功的测试放前面 |
| Precompute Logical Functions | 查表替代逻辑计算 |
Procedure Rules(过程优化)
| 规则 | 说明 |
|---|---|
| Inlining | 内联展开减少调用开销 |
| Exploit Common Cases | 快速路径处理常见情况 |
| Tail Recursion Removal | 尾递归转循环 |
| Parallelism | 利用硬件并行能力 |
What ships with it
8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 160 lines · 50 tokens per session scan A 3cec2fa92f70
bp-performance-optimization is a skill published in the GitHub repository davidYichengWei/agentic-engineering-framework (159 stars, last pushed 5mo ago), licensed MIT. It adds 50 tokens to every session and 1,454 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
auto-perf-optimize
Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.
chat-perf
Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…