Token导航 LogoToken导航

Agent Skill · 研究检索

optimize-prompt-token-efficiency(优化提示令牌效率)

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

optimize-prompt-token-efficiency 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 67,168。

总安装 250周安装 10GitHub Stars 11下载 81核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:optimize-prompt-token-efficiency(优化提示令牌效率)
来源仓库:https://github.com/doodledood/claude-code-plugins
仓库路径:skills/optimize-prompt-token-efficiency
安装命令:
npx skills add https://github.com/doodledood/claude-code-plugins --skill optimize-prompt-token-efficiency
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/doodledood/claude-code-plugins --skill optimize-prompt-token-efficiency

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助提示词、系统指令和工作流模板的整理,提升可复用性与行为规范性。适用于规范任务边界、统一输出格式或拆分操作步骤的场景。通过 npx skills add 命令从指定 GitHub 仓库安装并使用。使用时应保留真实业务约束,避免将示例当作硬规则。

optimize-prompt-token-efficiency 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/optimize-prompt-token-efficiency

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/doodledood/claude-code-plugins --skill optimiz…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

optimize-prompt-token-efficiency 怎么安装?

在终端执行 npx skills add https://github.com/doodledood/claude-code-plugins --skill optimize-prompt-t…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

optimize-prompt-token-efficiency 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

optimize-prompt-token-efficiency 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

optimize-prompt-token-efficiency 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

optimize-prompt-token-efficiency 用的人多吗?

公开数据是累计安装 250 次,近一周安装 10 次,下载 81 次,GitHub 11 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

optimize-prompt-token-efficiency 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
optimize-prompt-token-efficiency

优化提示令牌效率 · 本页

25011调用外部服务未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Optimize Prompt Token Efficiency

Iteratively optimize prompt token efficiency by maximizing information density through verification loops. Primary goal: reduce token consumption while preserving all semantic content for AI-consumed prompts (CLAUDE.md, skills, agent prompts, specs).

Overview

This skill transforms verbose prompts into token-efficient versions through:

  1. Verification First - prompt-token-efficiency-verifier checks for inefficiencies before any changes
  2. Optimization - Apply targeted compression based on verifier feedback
  3. Re-verification - Verify compression is lossless, iterate if issues remain (max 5 iterations)
  4. Output - Atomic replacement only after verification passes

Loop: Read → Verify → (Exit if efficient) → Optimize based on feedback → Re-verify → (Iterate if issues) → Output

Key principle: Don't try to optimize in one pass. The verifier drives all changes - if it finds no inefficiencies, the prompt is already token-efficient.

Workflow

Phase 0: Create Task List (use task management immediately)

Create todos tracking workflow phases. List reflects areas of work, not fixed steps.

Starter todos:

- [ ] Input validation
- [ ] Initial verification
- [ ] (Expand: optimization iterations on INEFFICIENCIES_FOUND)
- [ ] Output optimized prompt

Phase 1: Input Validation

Mark "Input validation" todo in_progress.

Step 1.1: Parse arguments

Extract file path from $ARGUMENTS. If no path provided, error with usage instructions.

Step 1.2: Validate file

  • Check file exists using Read tool
  • Verify supported type: .md, .txt, .yaml, .json
  • If unsupported, error: "Unsupported file type. Supported:.md,.txt,.yaml,.json"

Step 1.3: Read and measure original

  • Read file content
  • Estimate token count: Math.ceil(content.length / 4) (approximate)
  • Store original content and token count for comparison

Step 1.4: Store metadata

  • original_path: Source file path
  • original_content: Full prompt text
  • original_tokens: Estimated token count
  • working_path: /tmp/optimized-efficiency-{timestamp}.{ext} for iterations

Mark "Input validation" todo completed.

Phase 2: Initial Verification

Mark "Initial verification" todo in_progress.

Step 2.1: Copy to working path

Copy original content to working_path using Write tool (verification needs a file path).

Step 2.2: Run verifier first

Launch prompt-token-efficiency-verifier agent via Task tool BEFORE any optimization:

  • subagent_type: "prompt-engineering:prompt-token-efficiency-verifier"
  • prompt: "Verify prompt token efficiency. File: {working_path}. Check for redundancy, verbose phrasing, filler words, structural inefficiencies, and compression opportunities. Report VERIFIED if already efficient, or INEFFICIENCIES_FOUND with specific details."

Step 2.3: Handle verifier response

  • If "VERIFIED": Mark todo completed, proceed directly to Phase 4 (Output) with message: "Prompt is already token-efficient. No changes needed."
  • If "INEFFICIENCIES_FOUND": Mark todo completed, save the issues list, add "Optimization iteration 1" todo and proceed to Phase 3
  • If verifier fails or returns unexpected format: Retry once with identical parameters. If retry fails, report error: "Verification failed - cannot proceed without verifier."

Step 2.4: Display verifier findings

If inefficiencies found, show user summary and proceed:

Verifier found {count} token efficiency issues. Proceeding with optimization...

Mark "Initial verification" todo completed.

Phase 3: Optimization Loop (Verifier-Driven)

Mark "Optimization iteration 1" todo in_progress.

Key principle: All fixes are driven by verifier feedback. Do NOT analyze the prompt independently - only fix the specific inefficiencies the verifier reported.

For each iteration from 1 to 5:

  1. Apply compressions from verifier feedback: For each inefficiency in the verifier's report, apply the suggested compression. Write optimized version to working_path.

- Only fix inefficiencies the verifier identified - do not add your own improvements

  1. Re-verify: Launch prompt-token-efficiency-verifier agent via Task tool:

- subagent_type: "prompt-engineering:prompt-token-efficiency-verifier" - prompt: "Verify compression is lossless. Original file: {original_path}. Compressed file: {working_path}. Compare semantic content - check for missing facts, altered meaning, lost emphasis, removed nuance. Report VERIFIED if lossless, or ISSUES_FOUND with specific gaps."

  1. Handle response:

- If "VERIFIED": mark todo completed, exit loop, proceed to Phase 4 - If "ISSUES_FOUND" and iteration < 5: mark todo completed, save new issues list, add "Optimization iteration {next}" todo, continue to next iteration - If "ISSUES_FOUND" and iteration = 5: mark todo completed with note about unresolved issues, proceed to Phase 4 with warning - If verifier fails or returns unexpected format: display error to user, retry once with identical parameters. If retry fails, proceed to Phase 4 with warning: "Verification incomplete - manual review recommended."

Compression Techniques

Apply these techniques to fix inefficiencies flagged by the verifier:

TechniqueDescriptionBefore → After
Redundancy removalEliminate repeated concepts"It is important to note that you should always remember to..." → "Always..."
Terse phrasingReplace verbose constructions"In order to accomplish this task, you will need to..." → "To do this:"
Filler eliminationRemove hedging, qualifiers, throat-clearing"Make sure that you do not forget to include..." → "Include:"
Structural optimizationMerge/reorganize sections"First X. After that Y. Then Z." → "Steps: X → Y → Z"
Context-aware abbreviationAbbreviate terms after first mention"Model Context Protocol server" (×10) → "MCP server" (after first)
Dense formattingUse lists, tables, compact notationProse paragraphs → Tables, bullet lists

Transformation Rules:

  1. Preserve ALL semantic information - Every fact, instruction, constraint, and example must be present
  2. Preserve nuance and emphasis - Bold, caps, repetition, ordering that signals priority; intentional hedging (uncertainty was meaningful)
  3. Restructuring allowed - Reorder, merge sections if it increases density WITHOUT losing priority signals
  4. Format preservation - Output must be same format as input (markdown stays markdown)
  5. No reduction target - 10% reduction with nuance preserved > 40% reduction with nuance lost

Avoid creating ambiguity:

  • Don't merge conditions with different triggers ("when A, do X; when B, do Y" ≠ "when A/B, do X/Y")
  • Keep explicit referents (don't reduce "Use Read tool" to "Use the tool" if context is unclear)
  • Don't flatten relationships ("A requires B, C requires D" ≠ "A, C require B, D")
  • Ensure scope is clear (qualifier applies to which items?)

Phase 4: Output

Mark "Output optimized prompt" todo in_progress.

Step 4.1: Calculate metrics

  • Original token count (from Phase 1)
  • Compressed token count: Math.ceil(compressed_content.length / 4)
  • Reduction percentage: ((original - compressed) / original * 100).toFixed(0)

Step 4.2: Apply changes (atomic replacement)

If verification passed:

# Replace original atomically
mv {working_path} {original_path}

Step 4.3: Display results

If verification passed:

Optimized: {path}
Iterations: {count}
Original:  {original_tokens} tokens
Optimized: {compressed_tokens} tokens
Reduction: {percentage}%

Changes applied:
- {summary of compressions}

Status: Token-efficient and lossless

If verification failed after 5 iterations:

Optimized with warnings: {path}
Iterations: 5
Original:  {original_tokens} tokens
Optimized: {compressed_tokens} tokens
Reduction: {percentage}%

Unresolved issues:
- {list from last verification}

Review the changes manually.

Mark "Output optimized prompt" todo completed. Mark all todos complete.

Key Principles

PrincipleRule
Verify firstAlways run verifier before any optimization; maybe prompt is already efficient
Verifier-drivenOnly fix inefficiencies the verifier identifies - no independent analysis or improvements
Track progressUse task management to track phases; expand tasks on iteration
LosslessnessNever sacrifice semantic information for density; every fact must be preserved
Nuance preservationKeep emphasis, intentional hedging, priority signals; 10% with nuance > 40% without
No ambiguityCompressed must be as unambiguous as original
Verification requiredNever output without verifier checking
Atomic outputOriginal untouched until verification passes

Edge Cases

ScenarioHandling
No input providedError: "Usage: /optimize-prompt-token-efficiency "
File not foundError: "File not found: {path}"
Unsupported typeError: "Unsupported file type. Supported:.md,.txt,.yaml,.json"
Already efficientVerifier returns VERIFIED on first check → Report: "Prompt is already token-efficient. No changes needed."
Initial verifier failsRetry once; if still fails, Error: "Verification failed - cannot proceed without verifier."
Re-verification failsDisplay error, retry once; if retry fails, output with warning
YAML/JSON structurePreserve structure validity, compress string values only
Very large file (>50KB)Process as single unit
0-10% reductionSuccess: "Content was already near-optimal density"
Verification fails 5xOutput best attempt with warning

Example Usage

# Optimize a verbose CLAUDE.md
/optimize-prompt-token-efficiency CLAUDE.md

# Optimize a skill file
/optimize-prompt-token-efficiency claude-plugins/my-plugin/skills/my-skill/SKILL.md

# Optimize an agent prompt
/optimize-prompt-token-efficiency agents/code-reviewer.md

Example Output

Optimized: docs/README.md
Iterations: 2
Original:  4,250 tokens
Optimized: 3,612 tokens
Reduction: 15%

Changes applied:
- Removed redundant intro section
- Consolidated overlapping examples
- Tersified verbose instructions
- Preserved emphasis markers and conditional logic

Status: Token-efficient and lossless
Prompt is already token-efficient. No changes needed.
Original: 1,995 tokens

平台分布

Codex

37.66%
按下载量换算31

Claude

30.05%
按下载量换算24

Cursor

19.96%
按下载量换算16

Gemini CLI

9.98%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

未通过

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills