Token optimization best practices for cost-effective Claude Code usage. Automatically applies efficient file reading, command execution, and output handling strategies. Includes model selection guidance (Opus for learning, Sonnet for development/debugging). Prefers bash commands over reading files.
Detected risks:
Cost-effective use of Claude Code hinges on not spending tokens you do not need to, and this skill codifies a default set of optimization habits that apply across projects unless a user explicitly asks for verbose output or full file contents. Its baseline assumption is that users prefer efficient, cost-effective assistance, and it pairs concrete tactics with judgment about when to relax them.
Model selection comes first. Opus is recommended for learning and deep understanding - grasping a new codebase, broad exploration, deep analysis, and very complex or architectural debugging - while Sonnet is the default for regular development such as writing, editing, fixing, testing, documentation, and general questions. A typical session starts with a short Opus investment to understand the code, switches to Sonnet for implementation, and returns to Opus only when deep architectural understanding is needed, saving roughly 50 percent versus all-Opus usage. It also debunks the myth that many installed skills waste tokens, explaining that progressive disclosure loads only skill descriptions until a skill is activated.
The core is a set of optimization rules: use quiet or minimal output flags, never read entire log files, check lightweight sources like git status or package.json first, prefer Grep over reading whole files, read with offset and limit, and substitute bash commands such as cp, sed, cat, wc, and jq for Read plus Edit on pure transformations and inspection. It then refines that with a scope-based framing: the choice between bash and Read plus Edit is about whether the user benefits from seeing a reviewable diff. Code edits, validation-sensitive files, and interactive review favor Read plus Edit, while read-only inspection and large-file transformations favor bash or python. A decision tree and override rules round it out, telling the agent when to prioritize understanding over efficiency, such as reading a few key files fully while learning architecture.
Use Opus for learning, broad exploration, deep analysis, and architectural debugging; use Sonnet as the default for writing, editing, debugging, testing, and general development tasks.
Following the start-with-Opus-then-switch-to-Sonnet pattern is cited as saving roughly 50 percent in token cost versus using Opus for everything.
No. Skills use progressive disclosure, so Claude only sees short skill descriptions at session start and loads full content when a skill is activated.
For read-only inspection of structured data and transformations of large files. Prefer Read plus Edit for code changes, validation-sensitive files, and when the user wants to review a diff.
When the user explicitly asks for full output, when filtered output lacks needed context, when a file is known to be small, or when learning code structure and architecture.
Quick Setup:
.claude/skills/Repository
delphine-l/claude_global