token-counter

Estimate token usage for files or directories using a word-count heuristic.

28|3|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/girijashankarj/cursor-handbook --skill token-counter-girijashankarj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-counter
Source: https://github.com/girijashankarj/cursor-handbook/tree/main/.cursor/skills/devops/token-counter
Command: npx skills add https://github.com/girijashankarj/cursor-handbook --skill token-counter-girijashankarj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This tool estimates LLM token usage for files or directories using a word-based heuristic, helping you manage context budgets and avoid overflows.

Core Features & Use Cases

  • Simple token estimation for single files, directories, or entire projects.
  • Helps plan prompt length, decide what to include, and optimize token costs.
  • Provides a quick, rough budget to guide content selection and chunking.

Quick Start

Run the token counter script on a target file or directory to obtain an approximate token count.

Frequently Asked Questions about token-counter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I estimate LLM token usage for a project directory?

You can estimate LLM token usage by running a script that applies a word count multiplied by 1.3 heuristic across files and directories to approximate total token consumption.

What is the best way to calculate context budget for prompt length?

Calculating context budget involves estimating total tokens for your selected files using a heuristic, which provides a rough figure to guide content selection and prevent context overflows.

How do I count tokens in files to avoid context overflow?

Counting tokens in files uses a simple heuristic based on word count to approximate consumption, helping you decide what to include and where to optimize to avoid context overflow.

Can I get exact token counts using a heuristic estimation tool?

Heuristic estimation provides approximate rather than exact token counts, so the tool recommends using precise methods if you require accurate token measurement for your context budget.

Does word count accurately predict LLM token usage?

Word count provides a rough prediction of LLM token usage by multiplying the count by 1.3, but it remains an approximation that helps plan prompt length and optimize token costs.

When should I not use a heuristic for token estimation?

You should avoid heuristic token estimation when exact token counts are necessary for strict context limits, as the word count method only offers a rough budget for initial planning.