본문으로 건너뛰기
cccskills
무료GitHub에 공개

slim

Token-slim mode — cut this session's token usage by routing every file read, code search, directory listing, and JSON dump through the token-slim MCP server (or its binary directly). Works in any repository or folder; the server itself is LLM-agnostic (any MCP client). Use when the user types /slim, or asks to save/reduce tokens, "トークン節約", "トークン削減", "コンテキスト節約", "token slim".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md6.3 KB
  • ts.sh1.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

/slim — Token-Slim Mode (session-wide)

Purpose: for the REST OF THIS SESSION, minimize tokens spent on tool results and on your own output. Measured savings on real files: -32% reading Rust source with comments stripped (mode=slim), -95% with the default mode=auto outline on a large file, -41% on commented Python. These rules stay active after context compaction — re-read this skill if you lose them.

Step 1 — Engage (pick the FIRST path that works)

  1. MCP tools available (mcp__token-slim__* visible, possibly deferred): load ALL of them in ONE ToolSearch call, then use them for everything below.

    ToolSearch query: select:mcp__token-slim__read_slim,mcp__token-slim__grep_slim,mcp__token-slim__refs_slim,mcp__token-slim__dir_map,mcp__token-slim__json_slim,mcp__token-slim__text_slim,mcp__token-slim__token_count

  2. MCP not connected — call the binary directly via Bash using the helper shipped with this skill (identical behavior, works from any cwd):

    sh ~/.claude/skills/slim/ts.sh read_slim '{"path":"src/main.rs"}'
    sh ~/.claude/skills/slim/ts.sh dir_map
    

    The helper finds the binary via $TOKEN_SLIM_BIN → ~/dev/claude-code-token-slim-mcp/target/release/token-slim-mcp → which token-slim-mcp → ~/.cargo/bin/ (no user-specific paths; print the resolved path with sh ~/.claude/skills/slim/ts.sh --which). Tell the user ONCE that the permanent, every-folder installation is:

    claude mcp add token-slim --scope user -- "$(sh ~/.claude/skills/slim/ts.sh --which)"
    

    (--scope user = available in every repo/folder. The server is plain stdio JSON-RPC with zero Claude-specific behavior, so the same binary also works in Codex / Cursor / Gemini CLI etc. via their mcpServers config — keep it that way; never suggest editing the server for one client.)

  3. Binary missing too — install it (works on any machine): git clone https://github.com/tacyan/claude-code-token-slim-mcp && cd claude-code-token-slim-mcp && cargo install --path . (lands in ~/.cargo/bin, auto-discovered by ts.sh). As a LAST resort run under the "no-tool discipline" (Step 2 rules B only, using narrow built-in reads and head-capped Bash output).

After engaging, confirm to the user in ONE short line (their language): slim mode ON + which path (MCP / direct binary / discipline-only).

Step 2 — Session rules (MANDATORY until the session ends)

A. Tool substitution — never use the fat version when a slim one exists

Instead of…Use
Read (first look at any file)read_slim {path} — auto: outline (-95%) for big files, slim body for small ones
Read (specific range)read_slim {path, offset, limit} — the drill-down after an outline
Read (whole body on purpose)read_slim {path, mode:"slim"} — only when you truly need it
Grep / rggrep_slim {pattern, path, ext, max_results, exclude}
Grep with test noisegrep_slim {..., exclude_tests: true} — usually the biggest single win
ls / Glob / treedir_map {path, depth}
cat of JSON / big API responsejson_slim {path} or json_slim {json}
quoting long text backtext_slim {text, level:"aggressive"}
"how big is this?"token_count {path} before any large read

Every result starts with a [token-slim] … ~X→~Y tok (-Z%) header — trust it for budgeting. Caps are tunable per call (max_tokens, max_results, depth) or via env (TOKEN_SLIM_MAX_TOKENS, TOKEN_SLIM_GREP_MAX_RESULTS, TOKEN_SLIM_DIR_MAX_ENTRIES).

read_slim {path} defaults to mode=auto: it returns the outline (signatures + line numbers, nothing silently dropped) whenever the file is big enough for the body to be worth skipping, and the slimmed body otherwise. The header always says which one you got — mode=outline(auto) means bodies are NOT in context; fetch them with offset/limit. Never re-read the whole file just because you got an outline.

Claude Code Edit exception: Edit requires exact text previously seen via the built-in Read. Workflow: locate the target with grep_slim / read_slim (outline) first, then Read ONLY the narrow offset/limit range you will edit. Never full-file Read when a range suffices.

B. Output discipline (applies even with zero tools)

  • Bash: cap output (| head -50, 2>/dev/null, -q flags); never cat a file into the transcript when a slim read exists.
  • Drill down, don't hoover up: outline → grep → narrow range. Read a whole file only when you will edit most of it.
  • Don't re-read files already in context; don't paste back content the user already saw; quote only the lines you're discussing.
  • Your replies: lead with the answer, cut boilerplate, no restating tool results that the user can already see.
  • Delegate broad exploration to a subagent (Explore/fork) so raw dumps stay out of this context; keep only its conclusion.

Tool cheat sheet (exact schemas)

  • read_slim {path, offset?, limit?, mode?: auto|slim|outline|raw, strip_comments?, max_tokens?}
  • grep_slim {pattern, path?, ext?: "rs,toml", literal?, ignore_case?, max_results?, exclude?: ["**/test/**"], exclude_tests?, include?}
  • dir_map {path?, depth? (default 3), max_entries?}
  • json_slim {json | path, max_array?, max_depth?, max_string?} — JSONC (comments / trailing commas: bun.lock, tsconfig.json, .vscode/*.json) parses too
  • text_slim {text, level?: normal|aggressive, max_tokens?}
  • token_count {path | text}

Direct-binary equivalent for any of the above: sh ~/.claude/skills/slim/ts.sh <tool> '<json-arguments>'

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

bulk

무료

Bulk mode — maximum development speed by spending tokens aggressively on massive parallel sub-agents and multi-agent workflows, while the orchestrator context stays lean (pairs with /slim). Invoking /bulk is the user's explicit opt-in to Workflow/ultracode-style orchestration for this session. Use when the user types /bulk, asks for "爆速", "並列で大量に", "ultracode", "多エージェント", or hands over a big task where wall-clock speed matters more than token cost.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

tacyan/claude-code-token-slim-mcp42026년 8월 26일 업데이트

tacyan의 스킬 모두 보기

이 스킬의 문제 신고