ai-efficiency

ai-efficiency is a skill for Claude Code, Codex from movebrickschi/harness-engineering-mcp. It costs 34 tokens per session (1,745 once invoked), scanned A, original, MIT.

A practical checklist for helping an AI coding agent complete multi-step work with less repeated text and fewer unnecessary tool calls. It covers searching, reading files, parallel work, editing, testing, caching, and switching to systematic debugging.

In plain words
What is it for?
Use it for tasks involving several files, large codebases, many conversation rounds, or explicit concern about AI usage costs.
Why use it?
It reduces token use and keeps the agent focused on the files and tests affected by a change. It also discourages reading large directories or logs in full and prevents repeated patch attempts after a bug persists.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/movebrickschi/harness-engineering-mcp/ai-efficiency
Any agent
npx skills add movebrickschi/harness-engineering-mcp --skill ai-efficiency
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-efficiency

README.md
[![agentmods](https://agentmods.dev/badge/skills/movebrickschi/harness-engineering-mcp/ai-efficiency.svg)](https://agentmods.dev/skills/movebrickschi/harness-engineering-mcp/ai-efficiency)
Your own site
<a href="https://agentmods.dev/skills/movebrickschi/harness-engineering-mcp/ai-efficiency"><img src="https://agentmods.dev/badge/skills/movebrickschi/harness-engineering-mcp/ai-efficiency.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,745 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.01745
Opus 5 $0.00017 $0.00873
Sonnet 5 $0.00007 $0.00349
Haiku 4.5 $0.00003 $0.00175

Measured 4d ago against content hash 21194db82268, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-efficiency 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 4d 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.

assets/skills/ai-efficiency/SKILL.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Efficiency · 高效执行 & 省 Token 清单

使用本 skill 的场景:

  • 任务规模 ≥ 3 个文件 / ≥ 50 行改动
  • 多轮对话已经在 6 轮以上还没完成
  • 用户/团队明确关心 token 成本

assets/spec/AI_EFFICIENCY.md 是「契约 / 执行」对应关系——契约写规则,本 skill 是把规则翻译成当下就能照做的清单


Phase 0 · 入场 30 秒自检

  1. 是不是 3 步以内的小事?是 → 直接做,不要拉 skill 链。
  2. 是不是已经有 plan?没有 → 先 writing-plans 出最小计划,动手。
  3. 是不是跨 ≥ 3 文件 / 跨模块?是 → 委派 subagent。
  4. 是不是已经发生过 ≥ 6 轮往返且没收敛?是 → 中止,回到 §6 模式切换。

Phase 1 · 检索(找到正确的几个位置)

1.1 工具优先级

Grep "确切字符串" > Glob "src/path/**/*.ts" > SemanticSearch "意图问句" > Read 全文

1.2 一次问对,少问多次

反模式 正确做法
Grep "user" (命中数百) Grep "class UserService " --type ts
在 monorepo 找东西 Grep ... --path packages/api/src
不知道命中多少 先用 output_mode: "count" 看一次

1.3 并行批发

独立的 3 个 Grep / Read,一次性发出去:

batch:
  Grep "patternA"
  Grep "patternB"
  Glob "src/**/types.ts"

Phase 2 · 阅读(用最少 token 拿到上下文)

2.1 切片不全读

小文件 < 200 行:直接 Read
中文件 200-800 行:Read offset/limit,分 2-3 段
大文件 > 800 行:先 Grep 定位,再 Read offset/limit

2.2 不重复粘贴

如果 L0(spec / rule)/ L1(项目配置)已经被加载过,不要在回复里复制其中段落。指向资源 URI 即可。

2.3 摘要替代原文

读完后用 1-2 句给主会话摘要,不要把原文塞回。


Phase 3 · 修改(让改动安全 & 可被 cache)

3.1 StrReplace 优先于重写

  • 改 ≤ 3 处 → 用 StrReplace
  • 改 ≥ 整个函数 / 重大重构 → 用 Write 重写单个文件
  • 跨文件大改 → 拆成 N 次 StrReplace,每次原子

3.2 一次改一个语义单元

反模式:一个 StrReplace 把 Class A 拆成 A + B + C 三个文件
正确  :先 StrReplace 抽出 A 的接口;再 Write 新增 B;再 StrReplace 让 C 引用

每步都让代码处于可编译态,便于回退。

3.3 改完立刻验证

StrReplace → ReadLints → npm test --run (仅本文件相关测试) → 下一步

不要堆 10 个改动一起 commit,回滚成本巨大。


Phase 4 · 验证(最少跑测试拿到 PASS 证据)

4.1 跑被影响的子集

反模式 正确做法
每次都 npm test 全量 npm test -- --runRelatedTests src/foo.ts
Java 跑全模块 mvn -pl module-x test
Python pytest pytest tests/test_foo.py -q

4.2 只在最后做 harness check --strict --run-tests

任务收尾时一次全局门禁,不要每改一行跑一次。

4.3 失败 → root cause first

测试红了优先用 systematic-debugging skill 找根因,而不是「让我再调一下看看」式打补丁。

Read the full file on GitHub · 196 lines

Changes

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.

  1. 4d ago First seen · 196 lines · 34 tokens per session scan A 21194db82268

Subscribe to this mod's changes

ai-efficiency is a skill published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 34 tokens to every session and 1,745 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

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.

obra/superpowers · 37 tokens

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.

microsoft/vscode · 62 tokens

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.

microsoft/vscode · 51 tokens

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.

microsoft/vscode · 53 tokens

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…

microsoft/vscode · 71 tokens