npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

scl339-token-saver

v1.0.0

Published

LLM token optimization CLI tool. Analyze prompts, generate optimized templates, and measure token savings. Reduces LLM API costs by up to 60%.

Readme

SCL339 Token Saver

💰 LLM Token Optimization CLI Tool — Analyze prompts, generate optimized templates, and measure token savings. Reduce LLM API costs by up to 60%.

npm version npm downloads GitHub PRs Welcome


🚀 Features

  • Analyze any prompt file and get token optimization scores
  • Identify specific savings opportunities (verbose instructions, repetition, excessive examples)
  • Generate optimized prompt templates for common tasks (code review, debugging, refactoring)
  • Export detailed JSON reports for CI/CD pipelines
  • Zero dependencies — pure Node.js, no npm install overhead

📦 Installation

# Via npm (recommended)
npm install -g scl339-token-saver

# Or clone from GitHub
git clone https://github.com/shuchengle/scl339-token-saver.git
cd scl339-token-saver
npm link

🎯 Usage

Analyze a prompt

# Analyze a file
token-saver analyze my-prompt.txt

# Pipe input
cat prompt.md | token-saver analyze

Generate optimized templates

# List all templates
token-saver template

# Show specific template
token-saver template code-review
token-saver template debug
token-saver template explain
token-saver template refactor

Generate a report

token-saver report prompt.txt report.json

Sample output

══════════════════════════════════════════════
  TOKEN SAVER — Prompt Analysis Report
══════════════════════════════════════════════

  Total characters:  2,456
  Estimated tokens:  614
  Line count:        87
  Optimization:      72.3/100

  ⚠  Optimization opportunities:

  🟡  Too many instruction lines — consider consolidating
      Potential savings: ~45 tokens
  🟢  Excessive blank lines — reduce to improve token efficiency
      Potential savings: ~12 tokens

  ──────────────────────────────────────────
  Total potential savings: ~168 tokens (27%)
  Estimated cost reduction: ~27%

🔧 CLI Commands

| Command | Description | |---------|-------------| | token-saver analyze <file> | Analyze a prompt file for optimization opportunities | | token-saver template [type] | Display optimized prompt templates | | token-saver report <in> [out] | Generate a detailed JSON report | | token-saver help | Show help information |

🧩 Templates

The built-in templates are designed to be minimal yet effective — focused prompts that get the job done without wasted tokens:

  • code-review — Systematic code review with severity classification
  • debug — Structured debugging workflow
  • explain — Three-level code explanation
  • refactor — Readability, performance, maintainability improvements

🔗 Related SCL339 Projects

  • scl339-skill-pack — AI coding assistant skill pack with 12+ skills for Claude Code, Codex, and Cursor
  • auto-pr-review-action — Automated PR review GitHub Action for code quality automation

🤖 GitHub Action

Token Saver also works as a GitHub Action! Add it to your CI pipeline:

name: Token Optimization Check
on: [push, pull_request]
jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: shuchengle/scl339-token-saver@v1
        with:
          files: "prompts/*.md"
          threshold: 20

📄 License

MIT — see LICENSE


☕ Sponsor

If this tool helps you save on LLM costs, consider supporting the project:

Alipay: Scan the QR code or search for shuchengle on Alipay to sponsor.

支付宝扫一扫,赞助支持

Your support keeps the open source ecosystem thriving. Thank you! 🙏