Skip to main content

Estimates the token cost of agent skills and their linked resources

Project description

skillcost

Estimates the token cost of agent skills and their linked resources.

Given a target file (typically a SKILL.md), skillcost counts tokens and crawls all linked files and URLs to produce three cost figures:

Metric Description
Resident Tokens loaded on every prompt, just because the skill is installed.
Baseline Tokens loaded when the skill is invoked — the skill file plus any @-includes.
Maximum Tokens loaded if the agent follows every link in the skill file.

This also works on CLAUDE.md or any other plain-text UTF-8 file.

Installation

Requires Python 3.12+ and uv.

uv sync

Usage

uv run python -m main <path/to/file>

Output defaults to human-readable text. Pass --json or --yaml for machine-readable output.

uv run python -m main SKILL.md
uv run python -m main SKILL.md --json
uv run python -m main SKILL.md --yaml

Example output

Token Cost Report
=================
  Resident : 97
  Baseline : 1,940
  Maximum  : 18,390

Files (24)
  /path/to/reference/conventions.md                                       926
  /path/to/reference/utilities.md                                       1,751
  ...

Links
  @-directives : 0
  Local links  : 17
  HTTP links   : 0

How links are counted

skillcost recognizes two link syntaxes in Markdown files:

  • @{relative/path} — an include directive; the file is always fetched when the skill is invoked, so it counts toward the baseline cost.
  • [text](relative/path) — a standard Markdown link; followed recursively and counted toward the maximum cost only.

HTTP links (https://...) are fetched and counted toward the maximum cost only.

Contributing

See CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skillcost-1.0.1.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skillcost-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file skillcost-1.0.1.tar.gz.

File metadata

  • Download URL: skillcost-1.0.1.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for skillcost-1.0.1.tar.gz
Algorithm Hash digest
SHA256 339f9e83c90a836eb908686862a8caed54ef7a72fbcc4226795fd9cd809678bb
MD5 d25cdf17b39bd4bef5c723c6f478e3a0
BLAKE2b-256 032ae9100264105c9331b1639890aecd0ce6f0b5e56d3f64fc138162c5df3284

See more details on using hashes here.

File details

Details for the file skillcost-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: skillcost-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for skillcost-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcd712d504e6268f7486b9fc5b360424706af6bc64e48d41570fa0d66f7d6002
MD5 b7aa330c647aa12c755d9def47c1b72f
BLAKE2b-256 51122ec9f8e8d00206a22d77171a816ff928c4bd4e34dc9aa3e787ac2c051989

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page