Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计提醒

token-efficiency代币效率

Agent Skill

token-efficiency 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

24,240

周安装

990

GitHub Stars

12

下载量

7,920
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/delphine-l/claude_global --skill token-efficiency

简介

令牌优化策略,可在所有项目中经济高效地使用克劳德代码。

  • 使用 Opus 进行学习和深入理解代码库,使用 Sonnet(默认)进行开发、调试和实施任务;典型模式可节省约 50% 的代币
  • 优先使用 bash 命令而不是读取文件进行修改:使用 sed, CP, 猫
  • 代替读/编辑/写周期,节省 90-95% 的文件操作
  • 使用 grep 读取之前先进行过滤, 头, 尾巴,并首先检查文件元数据;切勿在没有过滤的情况下读取整个日志文件
  • 默认使用安静/最小输出模式;仅当用户明确请求详细输出或完整文件内容时才覆盖
  • 技能使用渐进式披露(约 155 个标记仅用于描述);仅在激活时加载完整内容,因此符号链接多个技能是安全的

SKILL.md

Token Efficiency Expert

This skill provides token optimization strategies for cost-effective Claude Code usage across all projects. These guidelines help minimize token consumption while maintaining high-quality assistance.

Core Principle

ALWAYS follow these optimization guidelines by default unless the user explicitly requests verbose output or full file contents.

Default assumption: Users prefer efficient, cost-effective assistance.


Model Selection Strategy

Use the right model for the task to optimize cost and performance:

Opus - For Learning and Deep Understanding

Use Opus when:

  • Learning new codebases - Understanding architecture, code structure, design patterns
  • Broad exploration - Identifying key files, understanding repository organization
  • Deep analysis - Analyzing complex algorithms, performance optimization
  • Reading and understanding - When you need to comprehend existing code before making changes
  • Very complex debugging - Only when Sonnet can't solve it or issue is architectural

Sonnet - For Regular Development Tasks (DEFAULT)

Use Sonnet (default) for:

  • Writing code, editing and fixing, debugging, testing, documentation, deployment, general questions

Typical session pattern:

  1. Start with Opus - Spend 10-15 minutes understanding the codebase (one-time investment)
  2. Switch to Sonnet - Use for ALL implementation, debugging, and routine work
  3. Return to Opus - Only when explicitly needed for deep architectural understanding

Savings: ~50% token cost vs all-Opus usage.


Skills and Token Efficiency

Myth: Having many skills in .claude/skills/ increases token usage.

Reality: Skills use progressive disclosure - Claude sees only skill descriptions at session start (~155 tokens for 4 skills). Full skill content loaded only when activated.

It's safe to symlink multiple skills to a project. Token waste comes from reading large files unnecessarily, not from having skills available.


Token Optimization Rules (Quick Reference)

1. Use Quiet/Minimal Output Modes

Use --quiet, -q, --silent flags by default. Only use verbose when user explicitly asks.

2. NEVER Read Entire Log Files

Always filter before reading: tail -100, grep -i "error", specific time ranges.

3. Check Lightweight Sources First

Check git status --short, package.json, requirements.txt before reading large files.

4. Use Grep Instead of Reading Files

Search for specific content with Grep tool instead of reading entire files.

5. Read Files with Limits

Use offset and limit parameters. Check file size with wc -l first.

6. Use Bash Commands Instead of Reading Files

CRITICAL OPTIMIZATION. Reading files costs tokens. Bash commands don't.

OperationWastefulEfficient
Copy fileRead + Writecp source dest
Replace textRead + Editsed -i '' 's/old/new/g' file
AppendRead + Writeecho "text" >> file
Delete linesRead + Writesed -i '' '/pattern/d' file
Merge filesRead + Read + Writecat file1 file2 > combined
Count linesRead filewc -l file
Check contentRead filegrep -q "term" file

When to break this rule: Complex logic, code-aware changes, validation needed, interactive review. For details, see strategies.md.

7. Filter Command Output

Limit scope: head -50, find. -maxdepth 2, tree -L 2.

8. Summarize, Don't Dump

Provide structured summaries of directory contents, code structure, command output.

9. Use Head/Tail for Large Output

head -100, tail -50, sample from middle with head -500 | tail -100.

10. Use JSON/Data Tools Efficiently

Extract specific fields: jq '.metadata', jq 'keys'. For CSV: head -20, wc -l.

11. Optimize Code Reading

Get overview first (find, grep for classes/functions), read structure only, search for specific code, read only relevant sections.

12. Use Task Tool for Exploratory Searches

Use Task/Explore subagent for broad codebase exploration. Saves 70-80% tokens vs direct multi-file exploration.

13. Efficient Scientific Literature Searches

Batch 3-5 related searches in parallel. Save results immediately. Document "not found" items.

For detailed strategies, bash patterns, and extensive examples, see strategies.md.


Decision Tree for File Operations

Ask yourself:

  1. Creating new file? -> Write tool
  2. Low-cost operation (< 100 lines output)? -> Use Claude context directly
  3. Modifying code file (.py,.js,.xml)? -> Read + Edit (always)
  4. Modifying small data file (< 100 lines)? -> Read + Edit is fine
  5. Modifying critical data (genome stats, enriched tables)? -> bash + log file
  6. Modifying large data file? -> sed/awk
  7. Copying/moving files? -> cp/mv

When to Override These Guidelines

Override efficiency rules when:

  1. User explicitly requests full output ("Show me the entire log file")
  2. Filtered output lacks necessary context (error references missing line numbers)
  3. File is known to be small (< 200 lines)
  4. Learning code structure and architecture - Prioritize understanding over efficiency

In learning mode:

  • Read 2-5 key files fully to establish understanding
  • Use grep to find other relevant examples
  • Summarize patterns found across many files
  • After learning phase, return to efficient mode for implementation
  • For detailed learning mode strategies, see learning-mode.md

In cases 1-3, explain token cost to user and offer filtered view first.


Quick Reference Card

Model Selection (First Priority):

  • Learning/Understanding -> Use Opus
  • Development/Debugging/Implementation -> Use Sonnet (default)

Before ANY file operation, ask yourself:

  1. Am I creating a NEW file? -> Write tool directly
  2. Is this a LOW-COST operation? (< 100 lines) -> Use Claude context directly
  3. Am I modifying a CODE file? -> Read + Edit (always)
  4. Am I modifying a SMALL data file? (< 100 lines) -> Read + Edit is fine
  5. Am I modifying CRITICAL DATA? -> bash + log file
  6. Am I modifying a LARGE data file? -> bash commands (99%+ savings)
  7. Am I copying/merging files? -> cp/cat, not Read/Write
  8. Can I check metadata first? (file size, line count)
  9. Can I filter before reading? (grep, head, tail)
  10. Can I read just the structure? (first 50 lines, function names)
  11. Can I summarize instead of showing raw data?
  12. Does the user really need the full content?

Cost Impact

ApproachTokens/WeekNotes
Wasteful (Read/Edit/Write everything)500KReading files unnecessarily
Moderate (filtered reads only)200KGrep/head/tail usage
Efficient (bash commands + filters)30-50KUsing cp/sed/awk instead of Read

Applying these rules reduces costs by 90-95% on average.


Implementation

This skill automatically applies these optimizations when:

  • Reading log files
  • Executing commands with large output
  • Navigating codebases
  • Debugging errors
  • Checking system status

You can always override by saying:

  • "Show me the full output"
  • "Read the entire file"
  • "I want verbose mode"
  • "Don't worry about tokens"

Supporting Files

FileContentWhen to load
strategies.mdDetailed bash command strategies, file operation patterns, sed/awk examples, Jupyter notebook manipulation, safe glob patterns, macOS/Linux compatibilityWhen implementing specific file operations or need detailed bash patterns
learning-mode.mdStrategic file selection, targeted pattern learning workflows, broad repository exploration strategies, repository type identificationWhen entering learning mode or exploring a new codebase
examples.mdExtensive token savings examples with before/after comparisons, targeted learning examples (Galaxy wrappers, API patterns), cost calculationsWhen demonstrating token savings or learning from examples
project-patterns.mdAnalysis file organization, task management with TodoWrite, background process management, repository organization, MANIFEST system, efficient file operationsWhen organizing projects, managing long-running tasks, or setting up navigation patterns

Summary

Core motto: Right model. Right tool. Filter first. Read selectively. Summarize intelligently.

Model selection (highest impact):

  • Use Opus for learning/understanding (one-time investment)
  • Use Sonnet for development/debugging/implementation (default)

Tool selection (primary optimization):

  • Creating NEW files -> Write tool directly
  • LOW-COST operations (< 100 lines) -> Claude context directly
  • Modifying CODE files -> Read + Edit (always)
  • Modifying SMALL data files (< 100 lines) -> Read + Edit is fine
  • Modifying LARGE data files -> bash commands (sed, awk, grep)
  • Modifying CRITICAL DATA -> bash commands + log file
  • Complex edits -> Read + Edit tools

Secondary rules:

  • Filter before reading (grep, head, tail)
  • Read with limits when needed
  • Summarize instead of showing raw output
  • Use quiet modes for commands
  • Strategic file selection for learning

By following these guidelines, users can get 5-10x more value from their Claude subscription while maintaining high-quality assistance.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.01%
按下载量换算2,456

Gemini CLI

24.77%
按下载量换算1,962

OpenCode

17.12%
按下载量换算1,356

Codex

13.45%
按下载量换算1,065

Antigravity

8.24%
按下载量换算653

github-copilot

3.83%
按下载量换算303

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills