token stats: switch to anthropic count_tokens

Amolith created

Change summary

README.md      | 210 ++++++++++++++++++++++++++--------------------------
skill-stats.go |  12 +-
2 files changed, 111 insertions(+), 111 deletions(-)

Detailed changes

README.md 🔗

@@ -102,9 +102,9 @@ changes.
 
 - Install with: `make addressing-code-review-comments`
 - Source: [skills/addressing-code-review-comments/](skills/addressing-code-review-comments/)
-- Name/desc: 28 tok
-- SKILL.md: 133 tok
-- Full skill: 161 tok (all `.md` files in the folder)
+- Name/desc: 81 tok
+- SKILL.md: 444 tok
+- Full skill: 525 tok (all `.md` files in the folder)
 
 ### amoliths-opinions
 
@@ -114,9 +114,9 @@ testing, and Go-specific ecosystem defaults.
 
 - Install with: `make amoliths-opinions`
 - Source: [skills/amoliths-opinions/](skills/amoliths-opinions/)
-- Name/desc: 50 tok
-- SKILL.md: 271 tok
-- Full skill: 5210 tok (all `.md` files in the folder)
+- Name/desc: 167 tok
+- SKILL.md: 958 tok
+- Full skill: 19392 tok (all `.md` files in the folder)
 
 ### ast-grep
 
@@ -126,9 +126,9 @@ Writes [ast-grep] rules for structural code search and modification.
 
 - Install with: `make ast-grep`
 - Source: [skills/ast-grep/](skills/ast-grep/)
-- Name/desc: 43 tok
-- SKILL.md: 1272 tok
-- Full skill: 2457 tok (all `.md` files in the folder)
+- Name/desc: 137 tok
+- SKILL.md: 4731 tok
+- Full skill: 9172 tok (all `.md` files in the folder)
 
 ### auditing-repositories
 
@@ -136,9 +136,9 @@ Audits open source repositories for security, privacy, and unexpected behavior.
 
 - Install with: `make auditing-repositories`
 - Source: [skills/auditing-repositories/](skills/auditing-repositories/)
-- Name/desc: 32 tok
-- SKILL.md: 480 tok
-- Full skill: 707 tok (all `.md` files in the folder)
+- Name/desc: 113 tok
+- SKILL.md: 1983 tok
+- Full skill: 2902 tok (all `.md` files in the folder)
 
 ### authoring-skills
 
@@ -147,9 +147,9 @@ structure, frontmatter, and progressive disclosure patterns.
 
 - Install with: `make authoring-skills`
 - Source: [skills/authoring-skills/](skills/authoring-skills/)
-- Name/desc: 24 tok
-- SKILL.md: 401 tok
-- Full skill: 1787 tok (all `.md` files in the folder)
+- Name/desc: 71 tok
+- SKILL.md: 1499 tok
+- Full skill: 6733 tok (all `.md` files in the folder)
 
 ### backing-up-with-keld
 
@@ -159,9 +159,9 @@ environment variables, and systemd timer setup.
 
 - Install with: `make backing-up-with-keld`
 - Source: [skills/backing-up-with-keld/](skills/backing-up-with-keld/)
-- Name/desc: 27 tok
-- SKILL.md: 796 tok
-- Full skill: 1478 tok (all `.md` files in the folder)
+- Name/desc: 72 tok
+- SKILL.md: 3077 tok
+- Full skill: 5662 tok (all `.md` files in the folder)
 
 ### collaborating-through-pr-pico-sh
 
@@ -173,9 +173,9 @@ both contributing and reviewing patch requests using `git format-patch` and
 
 - Install with: `make collaborating-through-pr-pico-sh`
 - Source: [skills/collaborating-through-pr-pico-sh/](skills/collaborating-through-pr-pico-sh/)
-- Name/desc: 32 tok
-- SKILL.md: 239 tok
-- Full skill: 775 tok (all `.md` files in the folder)
+- Name/desc: 103 tok
+- SKILL.md: 849 tok
+- Full skill: 2785 tok (all `.md` files in the folder)
 
 ### computing-golden-ratio-typography
 
@@ -184,9 +184,9 @@ readable measures from a font file or explicit font metrics.
 
 - Install with: `make computing-golden-ratio-typography`
 - Source: [skills/computing-golden-ratio-typography/](skills/computing-golden-ratio-typography/)
-- Name/desc: 38 tok
-- SKILL.md: 560 tok
-- Full skill: 598 tok (all `.md` files in the folder)
+- Name/desc: 120 tok
+- SKILL.md: 1901 tok
+- Full skill: 2021 tok (all `.md` files in the folder)
 
 ### cooking
 
@@ -196,9 +196,9 @@ through cuisine-specific flavor logic without flattening regional traditions.
 
 - Install with: `make cooking`
 - Source: [skills/cooking/](skills/cooking/)
-- Name/desc: 86 tok
-- SKILL.md: 1292 tok
-- Full skill: 12751 tok (all `.md` files in the folder)
+- Name/desc: 283 tok
+- SKILL.md: 5428 tok
+- Full skill: 47930 tok (all `.md` files in the folder)
 
 ### creating-tasks-through-lunatask
 
@@ -211,9 +211,9 @@ windows.
 
 - Install with: `make creating-tasks-through-lunatask`
 - Source: [skills/creating-tasks-through-lunatask/](skills/creating-tasks-through-lunatask/)
-- Name/desc: 29 tok
-- SKILL.md: 343 tok
-- Full skill: 980 tok (all `.md` files in the folder)
+- Name/desc: 84 tok
+- SKILL.md: 1190 tok
+- Full skill: 3428 tok (all `.md` files in the folder)
 
 ### fallback-code-review
 
@@ -222,9 +222,9 @@ CodeRabbit, or Kodus.
 
 - Install with: `make fallback-code-review`
 - Source: [skills/fallback-code-review/](skills/fallback-code-review/)
-- Name/desc: 44 tok
-- SKILL.md: 228 tok
-- Full skill: 272 tok (all `.md` files in the folder)
+- Name/desc: 136 tok
+- SKILL.md: 773 tok
+- Full skill: 909 tok (all `.md` files in the folder)
 
 ### formatting-commits
 
@@ -233,9 +233,9 @@ accordingly. Supports Conventional Commits and kernel-style imperative commits.
 
 - Install with: `make formatting-commits`
 - Source: [skills/formatting-commits/](skills/formatting-commits/)
-- Name/desc: 34 tok
-- SKILL.md: 142 tok
-- Full skill: 596 tok (all `.md` files in the folder)
+- Name/desc: 116 tok
+- SKILL.md: 514 tok
+- Full skill: 2127 tok (all `.md` files in the folder)
 
 ### frontend-accessibility
 
@@ -245,9 +245,9 @@ reader compatibility.
 
 - Install with: `make frontend-accessibility`
 - Source: [skills/frontend-accessibility/](skills/frontend-accessibility/)
-- Name/desc: 32 tok
-- SKILL.md: 498 tok
-- Full skill: 2173 tok (all `.md` files in the folder)
+- Name/desc: 112 tok
+- SKILL.md: 1900 tok
+- Full skill: 8058 tok (all `.md` files in the folder)
 
 ### handling-customer-data
 
@@ -256,9 +256,9 @@ without ever seeing it directly.
 
 - Install with: `make handling-customer-data`
 - Source: [skills/handling-customer-data/](skills/handling-customer-data/)
-- Name/desc: 29 tok
-- SKILL.md: 331 tok
-- Full skill: 360 tok (all `.md` files in the folder)
+- Name/desc: 93 tok
+- SKILL.md: 1221 tok
+- Full skill: 1314 tok (all `.md` files in the folder)
 
 ### humanize
 
@@ -270,9 +270,9 @@ Originally from [blader/humanizer].
 
 - Install with: `make humanize`
 - Source: [skills/humanize/](skills/humanize/)
-- Name/desc: 55 tok
-- SKILL.md: 860 tok
-- Full skill: 2289 tok (all `.md` files in the folder)
+- Name/desc: 191 tok
+- SKILL.md: 3110 tok
+- Full skill: 8132 tok (all `.md` files in the folder)
 
 ### ideating-with-bdd
 
@@ -282,9 +282,9 @@ scenarios. Works for any language or framework.
 
 - Install with: `make ideating-with-bdd`
 - Source: [skills/ideating-with-bdd/](skills/ideating-with-bdd/)
-- Name/desc: 69 tok
-- SKILL.md: 730 tok
-- Full skill: 1253 tok (all `.md` files in the folder)
+- Name/desc: 223 tok
+- SKILL.md: 2533 tok
+- Full skill: 4393 tok (all `.md` files in the folder)
 
 ### in-session-review
 
@@ -293,9 +293,9 @@ files, and spaghetti-condition growth.
 
 - Install with: `make in-session-review`
 - Source: [skills/in-session-review/](skills/in-session-review/)
-- Name/desc: 32 tok
-- SKILL.md: 1015 tok
-- Full skill: 1047 tok (all `.md` files in the folder)
+- Name/desc: 109 tok
+- SKILL.md: 3958 tok
+- Full skill: 4067 tok (all `.md` files in the folder)
 
 ### initialising-and-updating-agents-md
 
@@ -305,9 +305,9 @@ the project's source and config files.
 
 - Install with: `make initialising-and-updating-agents-md`
 - Source: [skills/initialising-and-updating-agents-md/](skills/initialising-and-updating-agents-md/)
-- Name/desc: 38 tok
-- SKILL.md: 395 tok
-- Full skill: 433 tok (all `.md` files in the folder)
+- Name/desc: 111 tok
+- SKILL.md: 1426 tok
+- Full skill: 1537 tok (all `.md` files in the folder)
 
 ### invoking-subagents
 
@@ -317,9 +317,9 @@ history or processing large diffs without filling the main context window.
 
 - Install with: `make invoking-subagents`
 - Source: [skills/invoking-subagents/](skills/invoking-subagents/)
-- Name/desc: 27 tok
-- SKILL.md: 210 tok
-- Full skill: 237 tok (all `.md` files in the folder)
+- Name/desc: 85 tok
+- SKILL.md: 766 tok
+- Full skill: 851 tok (all `.md` files in the folder)
 
 ### licensing-with-reuse
 
@@ -329,9 +329,9 @@ Manages REUSE-compliant licensing with the `reuse` CLI. Covers `reuse annotate`,
 
 - Install with: `make licensing-with-reuse`
 - Source: [skills/licensing-with-reuse/](skills/licensing-with-reuse/)
-- Name/desc: 33 tok
-- SKILL.md: 560 tok
-- Full skill: 593 tok (all `.md` files in the folder)
+- Name/desc: 117 tok
+- SKILL.md: 2059 tok
+- Full skill: 2176 tok (all `.md` files in the folder)
 
 ### maintaining-aur-packages
 
@@ -341,9 +341,9 @@ PKGBUILDs for source, `-bin`, and `-git` package types, checksums with
 
 - Install with: `make maintaining-aur-packages`
 - Source: [skills/maintaining-aur-packages/](skills/maintaining-aur-packages/)
-- Name/desc: 35 tok
-- SKILL.md: 689 tok
-- Full skill: 1274 tok (all `.md` files in the folder)
+- Name/desc: 119 tok
+- SKILL.md: 2496 tok
+- Full skill: 4821 tok (all `.md` files in the folder)
 
 ### managing-personal-knowledge
 
@@ -354,9 +354,9 @@ Logseq, Roam, and SilverBullet.
 
 - Install with: `make managing-personal-knowledge`
 - Source: [skills/managing-personal-knowledge/](skills/managing-personal-knowledge/)
-- Name/desc: 68 tok
-- SKILL.md: 859 tok
-- Full skill: 2172 tok (all `.md` files in the folder)
+- Name/desc: 247 tok
+- SKILL.md: 2935 tok
+- Full skill: 7441 tok (all `.md` files in the folder)
 
 ### monitoring-with-munin
 
@@ -365,9 +365,9 @@ hosts, writes plugins, configures masters, and handles alerts.
 
 - Install with: `make monitoring-with-munin`
 - Source: [skills/monitoring-with-munin/](skills/monitoring-with-munin/)
-- Name/desc: 38 tok
-- SKILL.md: 907 tok
-- Full skill: 1470 tok (all `.md` files in the folder)
+- Name/desc: 117 tok
+- SKILL.md: 3432 tok
+- Full skill: 5522 tok (all `.md` files in the folder)
 
 ### notifying-through-ntfy
 
@@ -378,9 +378,9 @@ turn.
 
 - Install with: `make notifying-through-ntfy`
 - Source: [skills/notifying-through-ntfy/](skills/notifying-through-ntfy/)
-- Name/desc: 26 tok
-- SKILL.md: 478 tok
-- Full skill: 1541 tok (all `.md` files in the folder)
+- Name/desc: 70 tok
+- SKILL.md: 1832 tok
+- Full skill: 6058 tok (all `.md` files in the folder)
 
 ### rebasing-with-git
 
@@ -390,9 +390,9 @@ enabled. Supports worktrees including `wt`-managed repos.
 
 - Install with: `make rebasing-with-git`
 - Source: [skills/rebasing-with-git/](skills/rebasing-with-git/)
-- Name/desc: 41 tok
-- SKILL.md: 1057 tok
-- Full skill: 1098 tok (all `.md` files in the folder)
+- Name/desc: 137 tok
+- SKILL.md: 3937 tok
+- Full skill: 4074 tok (all `.md` files in the folder)
 
 ### researching-with-rumilo
 
@@ -404,9 +404,9 @@ codebases without filling the main context window.
 
 - Install with: `make researching-with-rumilo`
 - Source: [skills/researching-with-rumilo/](skills/researching-with-rumilo/)
-- Name/desc: 37 tok
-- SKILL.md: 557 tok
-- Full skill: 594 tok (all `.md` files in the folder)
+- Name/desc: 101 tok
+- SKILL.md: 1970 tok
+- Full skill: 2071 tok (all `.md` files in the folder)
 
 ### scripting-with-go
 
@@ -416,9 +416,9 @@ project, copy the header comment and adjust as needed.
 
 - Install with: `make scripting-with-go`
 - Source: [skills/scripting-with-go/](skills/scripting-with-go/)
-- Name/desc: 29 tok
-- SKILL.md: 333 tok
-- Full skill: 362 tok (all `.md` files in the folder)
+- Name/desc: 93 tok
+- SKILL.md: 1250 tok
+- Full skill: 1343 tok (all `.md` files in the folder)
 
 ### testing-with-gocuke-and-gherkin
 
@@ -429,9 +429,9 @@ Drives BDD, red/green TDD, and property-based testing in Go projects using
 
 - Install with: `make testing-with-gocuke-and-gherkin`
 - Source: [skills/testing-with-gocuke-and-gherkin/](skills/testing-with-gocuke-and-gherkin/)
-- Name/desc: 47 tok
-- SKILL.md: 299 tok
-- Full skill: 1123 tok (all `.md` files in the folder)
+- Name/desc: 150 tok
+- SKILL.md: 1093 tok
+- Full skill: 4107 tok (all `.md` files in the folder)
 
 ### toki-pona-dictionary
 
@@ -443,9 +443,9 @@ definitions and community usage tags.
 
 - Install with: `make toki-pona-dictionary`
 - Source: [skills/toki-pona-dictionary/](skills/toki-pona-dictionary/)
-- Name/desc: 48 tok
-- SKILL.md: 114 tok
-- Full skill: 162 tok (all `.md` files in the folder)
+- Name/desc: 128 tok
+- SKILL.md: 407 tok
+- Full skill: 535 tok (all `.md` files in the folder)
 
 ### updating-llm-client-model-lists
 
@@ -454,9 +454,9 @@ Synchronizes model configurations across Zed, Crush, and Pi from Plexus'
 
 - Install with: `make updating-llm-client-model-lists`
 - Source: [skills/updating-llm-client-model-lists/](skills/updating-llm-client-model-lists/)
-- Name/desc: 32 tok
-- SKILL.md: 1009 tok
-- Full skill: 1041 tok (all `.md` files in the folder)
+- Name/desc: 99 tok
+- SKILL.md: 3835 tok
+- Full skill: 3934 tok (all `.md` files in the folder)
 
 ### using-exe-dev
 
@@ -467,9 +467,9 @@ disks, instant HTTPS, and built-in auth via SSH.
 
 - Install with: `make using-exe-dev`
 - Source: [skills/using-exe-dev/](skills/using-exe-dev/)
-- Name/desc: 24 tok
-- SKILL.md: 176 tok
-- Full skill: 200 tok (all `.md` files in the folder)
+- Name/desc: 79 tok
+- SKILL.md: 705 tok
+- Full skill: 784 tok (all `.md` files in the folder)
 
 ### using-jujutsu
 
@@ -480,9 +480,9 @@ diff reading, and common pitfalls that trip up agents.
 
 - Install with: `make using-jujutsu`
 - Source: [skills/using-jujutsu/](skills/using-jujutsu/)
-- Name/desc: 35 tok
-- SKILL.md: 337 tok
-- Full skill: 372 tok (all `.md` files in the folder)
+- Name/desc: 101 tok
+- SKILL.md: 1170 tok
+- Full skill: 1271 tok (all `.md` files in the folder)
 
 ### working-with-zmx
 
@@ -492,9 +492,9 @@ writes files into sessions over SSH.
 
 - Install with: `make working-with-zmx`
 - Source: [skills/working-with-zmx/](skills/working-with-zmx/)
-- Name/desc: 35 tok
-- SKILL.md: 241 tok
-- Full skill: 276 tok (all `.md` files in the folder)
+- Name/desc: 108 tok
+- SKILL.md: 838 tok
+- Full skill: 946 tok (all `.md` files in the folder)
 
 ### writing-git-tags
 
@@ -505,9 +505,9 @@ and Conventional Commits via [git-format].
 
 - Install with: `make writing-git-tags`
 - Source: [skills/writing-git-tags/](skills/writing-git-tags/)
-- Name/desc: 26 tok
-- SKILL.md: 386 tok
-- Full skill: 425 tok (all `.md` files in the folder)
+- Name/desc: 80 tok
+- SKILL.md: 1440 tok
+- Full skill: 1557 tok (all `.md` files in the folder)
 
 ### writing-rust
 
@@ -517,9 +517,9 @@ warns against common anti-patterns.
 
 - Install with: `make writing-rust`
 - Source: [skills/writing-rust/](skills/writing-rust/)
-- Name/desc: 29 tok
-- SKILL.md: 607 tok
-- Full skill: 1425 tok (all `.md` files in the folder)
+- Name/desc: 91 tok
+- SKILL.md: 2348 tok
+- Full skill: 5426 tok (all `.md` files in the folder)
 
 ## Contributions
 

skill-stats.go 🔗

@@ -18,8 +18,8 @@ import (
 )
 
 const (
-	syntheticAPI  = "https://api.synthetic.new/anthropic/v1/messages/count_tokens"
-	model         = "syn:large:text"
+	anthropicAPI  = "https://api.anthropic.com/v1/messages/count_tokens"
+	model         = "claude-opus-4-8"
 	workerCount   = 5 // Number of parallel API workers
 	readmePath    = "README.md"
 	skillsHeading = "## Available skills"
@@ -69,9 +69,9 @@ func main() {
 	workers := flag.Int("workers", workerCount, "Number of parallel API workers")
 	flag.Parse()
 
-	apiKey := os.Getenv("SYNTHETIC_API_KEY")
+	apiKey := os.Getenv("ANTHROPIC_API_KEY")
 	if apiKey == "" {
-		fmt.Fprintln(os.Stderr, "Error: SYNTHETIC_API_KEY environment variable not set")
+		fmt.Fprintln(os.Stderr, "Error: ANTHROPIC_API_KEY environment variable not set")
 		os.Exit(1)
 	}
 
@@ -403,11 +403,11 @@ func countTokensAPI(apiKey, text string) (int, error) {
 		return 0, fmt.Errorf("marshal request: %w", err)
 	}
 
-	req, err := http.NewRequest("POST", syntheticAPI, bytes.NewBuffer(jsonData))
+	req, err := http.NewRequest("POST", anthropicAPI, bytes.NewBuffer(jsonData))
 	if err != nil {
 		return 0, fmt.Errorf("create request: %w", err)
 	}
-	req.Header.Set("Authorization", "Bearer "+apiKey)
+	req.Header.Set("x-api-key", apiKey)
 	req.Header.Set("Content-Type", "application/json")
 	req.Header.Set("anthropic-version", "2023-06-01")