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-0.0.3.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: skillcost-0.0.3.tar.gz
  • Upload date:
  • Size: 54.0 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-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3d892c790e7d9e7e909849000461b276a55f1176316677e4de310be10e6cd12d
MD5 5e80a5a36aa3078ca9f230bb1ce950e3
BLAKE2b-256 c7a9748591c12db55cc06d981e0889ad605322e172b55f21e043cf06efe3fd37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: skillcost-0.0.3-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-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 af9aad3da403ef59a42281fe5c8d8ac3541da919a20710e8c829bec7a7d066a4
MD5 20e563103bc5630b38a85863bf5edef6
BLAKE2b-256 c48565d4a33c1ceb38da304efc913171a583e20eba2ad4a20174a7ef62bc7ade

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