用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Dev-Toolbelt/dev-team-agents --skill token-efficiency命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | token-efficiency |
| description | Token optimization — efficient reads, bash ops, model selection. |
This skill provides token optimization strategies for cost-effective agent runs across all projects and every supported CLI (Claude Code, opencode, Codex CLI). The strategies are CLI-independent — they are about how much text enters the context window, not about which tool reads it. Apply these guidelines by default unless the user explicitly requests verbose output or full file contents.
Default assumption: users prefer efficient, cost-effective assistance.
Pick by model class, not by product name — every supported provider offers all three. The concrete model id per class and provider is resolved from scripts/lib/tiers.json; the Claude Code column below is one example mapping.
| Task type | Model class | Claude Code example |
|---|---|---|
| Learning a new codebase, understanding architecture, deep analysis | High-reasoning | Opus |
| Writing code, debugging, testing, documentation, routine questions | Balanced (default) | Sonnet |
| Structured output, fast repetitive extraction | Fast | Haiku |
Typical session pattern:
Savings: ~50% token cost vs. running the whole session on the high-reasoning model.
Prefer --quiet, -q, --silent flags. Only use verbose when user explicitly asks.
Always filter before reading: tail -100, grep -i "error", specific time ranges.
Check git status --short, package.json, requirements.txt before opening large files.
Search for specific content with the Grep tool instead of reading entire files.
Use offset and limit parameters. Check file size with wc -l first.
Reading files costs tokens. Bash commands don't.
| Operation | Wasteful | Efficient |
|---|---|---|
| Copy file | Read + Write | cp source dest |
| Replace text | Read + Edit | sed -i '' 's/old/new/g' file |
| Append line | Read + Write | echo "text" >> file |
| Delete lines | Read + Write | sed -i '' '/pattern/d' file |
| Merge files | Read + Read + Write | cat file1 file2 > combined |
| Count lines | Read file | wc -l file |
| Check content | Read file | grep -q "term" file |
Exception: complex logic, code-aware changes, interactive review. See strategies.md.
Limit scope: head -50, find . -maxdepth 2, tree -L 2.
Provide structured summaries of directory contents, code structure, and command output.
head -100, tail -50, or head -500 | tail -100 for middle sections.
Extract specific fields: jq '.metadata', jq 'keys'. Don't read entire JSON files.
Get an overview first (find, grep for classes/functions), read structure only, then read only the relevant sections.
Spawn an Explore subagent for broad codebase searches. Saves 70–80% tokens vs. direct multi-file exploration.
The rules above assume grep, find, and manual JSON reading. Faster, lower-token alternatives exist for each — rg (ripgrep), fd, jq, ast-grep (structural code search/rewrite), tokei (instant repo stats), delta (readable diff review). None are required; run /devteam:install list to see what's missing, or /devteam:install <tool> to install one — see skills/devops/tool-installers/SKILL.md for the cross-OS knowledge base. skills/shared/setup-health-check/references/checks-list.md Category 13 only detects and points here.
Before any file operation, ask:
sed/awk bash commandscp/cat, not Read/Write| Approach | Tokens/Week | Notes |
|---|---|---|
| Wasteful — Read/Edit/Write everything | 500K | Reading files unnecessarily |
| Moderate — filtered reads only | 200K | Grep/head/tail usage |
| Efficient — bash commands + filters | 30–50K | cp/sed/awk instead of Read |
Applying these rules reduces costs by 90–95% on average.
Skills in .claude/skills/ use progressive disclosure — Claude sees only the description (~40 tokens per skill) at session start. Full content loads only when activated. Having many skills available does not increase token usage.
Model first:
File operations:
sed, awk, grep)cp/catAlways:
| File | Content | When to load |
|---|---|---|
| strategies.md | Detailed bash patterns, sed/awk examples, macOS/Linux compatibility, file operation recipes | When implementing specific file operations or needing detailed bash patterns |