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.3.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.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: skillcost-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 e33bc306879f55744b30de13637db8fd779b6be3604c1d9f80ae1f250ce11504
MD5 2ff38456ee6f6168b332922656102393
BLAKE2b-256 23ceaa2fafe45295ccde6e42429c107936bb1ea78ab6d9cd6d758b058ae6ba1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: skillcost-1.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-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48269d44d539e76b193112c55fcb530d10847051e209ab67fb431b0140172c96
MD5 b051439e15d698a7a3afcd6be95f44ee
BLAKE2b-256 5aa130c6698f717f0141c1f40c490fe64b1aa33285df6f2eac504062450509b9

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