
Token Burner
- 396 installs
- Updated June 24, 2026
- wu529778790/shenzjd-skills
Helps with ai & agent building tasks.
About
token-burner is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- token-burner
- AI & Agent Building
- AI-coding skill
Token Burner by the numbers
- 396 all-time installs (skills.sh)
- +60 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #1,984 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wu529778790/shenzjd-skills --skill token-burnerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 396 |
|---|---|
| Last updated | June 24, 2026 |
| Repository | wu529778790/shenzjd-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
Token Burner
在 token 过期前自动执行有价值的项目改进任务,不浪费任何额度。
Overview
自动扫描项目,发现代码审查、测试生成、文档完善、依赖审计、重构等任务,按优先级排序后自主执行。使用 worktree 隔离每个任务,执行后自动验证,确保每次修改都是安全的。
When to Use
- User wants to use tokens productively before they expire
- User wants to run an autonomous code improvement session
- User says "burn tokens" / "token burner" / "用掉 token"
- User wants to auto-discover and fix issues across a project
- User inputs
/token-burner - User wants automated code review across the project
- User wants to find and fix code smells automatically
- User wants to improve test coverage without manual effort
- User wants to do a full project health check and cleanup
When NOT to Use:
- User wants to work on a specific, well-defined task (use normal workflow)
- User wants to chat or brainstorm (no token waste concern)
- User's project has no code to improve
- User wants to run automated tests only (use test runner directly)
- User wants to generate documentation only (use doc generation tools)
- User wants to refactor specific files (do it manually for better control)
Core Pattern
Step 1: 项目扫描
检测项目类型和结构,发现可执行任务:
# 检测项目类型
test -f package.json && echo "Node.js"
test -f go.mod && echo "Go"
test -f requirements.txt && echo "Python"
test -f Cargo.toml && echo "Rust"
# 检测 git 状态
git log --oneline -5 # 最近变更
git diff --stat HEAD~3 # 变更范围
git status --porcelain # 未提交变更任务发现引擎:(详见 templates/task-discovery.md)
| 任务类型 | 发现方式 | 优先级 |
|---|---|---|
| 🔒 依赖安全 | 如果 dependency-audit skill 可用则委派,否则直接运行审计工具 | P0 - 立即执行 |
| 🐛 代码缺陷 | 分析 git diff 中的逻辑问题 | P0 - 立即执行 |
| 🧪 测试覆盖 | 找无测试的源文件,检查覆盖率 | P1 - 高优先级 |
| 📝 文档缺失 | 检查 README、函数注释、API 文档 | P2 - 中优先级 |
| ♻️ 代码重构 | 重复代码、复杂函数、code smell | P2 - 中优先级 |
| 🧹 Git 清理 | 过时分支、conflict markers、大文件 | P3 - 低优先级 |
生成任务列表,每个任务包含:type、file、description、impact(high/medium/low)、risk(high/medium/low)。
Step 2: 优先级排序
按 score = impact_score × (1 - risk_score) 排序:
| 因子 | high | medium | low |
|---|---|---|---|
| impact | 3 | 2 | 1 |
| risk | 0.8 | 0.4 | 0.1 |
安全策略:
- P0 任务(安全漏洞、缺陷)→ 立即执行
- P1 任务(测试)→ 可以执行,但每个任务在 worktree 中隔离
- P2 任务(文档、重构)→ 可以执行
- P3 任务(清理)→ 只在有剩余 token 时执行
前置依赖检查:
执行前先检查所需工具是否可用,缺失时跳过对应任务类型而非静默失败:
# 检查工具可用性
command -v jq >/dev/null 2>&1 || echo "⚠️ jq 未安装,安全审计任务将跳过"
command -v npm >/dev/null 2>&1 || echo "⚠️ npm 未安装,Node.js 审计将跳过"
command -v go >/dev/null 2>&1 || echo "⚠️ go 未安装,Go 审计将跳过"
command -v pip-audit >/dev/null 2>&1 || echo "⚠️ pip-audit 未安装,Python 审计将跳过"过滤规则:
- 跳过
node_modules/、vendor/、.git/等目录 - 跳过已由其他 skill 覆盖的任务(如 git-hooks-setup 已配置的)
- 跳过超过 500 行变更的大任务(拆分为子任务)
Step 3: 自主执行
使用 Agent tool 逐个执行任务,每个任务在独立 worktree 中:
对每个 task in 队列:
retries = 0
max_retries = 3
while retries < max_retries:
1. Agent(task.prompt, {
subagent_type: "general-purpose",
isolation: "worktree",
description: "token-burner:" + task.type
})
2. 在 worktree 中跑测试验证
3. 如果测试通过 → 合并到主分支,break
4. 如果测试失败 → retries++
- 如果 retries < max_retries → 回滚 worktree,重试
- 如果 retries >= max_retries → 记录失败原因,跳过此任务
5. 更新任务状态每种任务的执行策略:
| 任务类型 | 执行方式 | 验证方式 |
|---|---|---|
| 🔒 依赖安全 | 运行审计工具,生成修复命令 | 重新审计确认 |
| 🐛 代码缺陷 | 分析 diff,定位问题,修复 | 跑相关测试 |
| 🧪 测试覆盖 | 为源文件生成单元测试 | 跑新测试确认通过 |
| 📝 文档缺失 | 生成 README/注释/API docs | 检查文档格式 |
| ♻️ 代码重构 | 提取函数、消除重复、简化逻辑 | 跑全量测试 |
| 🧹 Git 清理 | 清理无用文件、格式化 | git status 确认 |
执行限制:
- 每个任务最多 3 次重试
- 单个任务超时 5 分钟则跳过
- 总任务数默认最多 20 个(可通过
--max-tasks调整)
Step 4: 记录和报告
每个任务完成后记录到 memory(任务类型、文件、状态、说明),执行结构见 templates/execution-report.md。
Step 5: 收尾
生成最终报告 templates/execution-report.md,包含:
- 执行统计(成功率、耗时、token 消耗估算)
- 每个任务的详细结果
- 未执行任务的原因
- 下次运行建议
Quick Reference
Note: Parameters below are natural language hints parsed by the AI. Without parameters, the AI will ask interactively.
/token-burner # Scan and execute all tasks
/token-burner 只跑测试和文档 # Only test and doc tasks
/token-burner 最多跑 10 个任务 # Limit to 10 tasks
/token-burner 只扫描不执行 # Scan only, don't execute
/token-burner 扫描 /path/to/repo # Target specific project| Hint | Description | Default |
|---|---|---|
只跑 type | Task type filter (security/bug/test/docs/refactor/clean) | All |
最多跑 N 个任务 | Maximum tasks to execute | 20 |
| 只扫描不执行 | Scan only, don't execute | false |
扫描 path | Target project path | Current directory |
Common Mistakes
| 错误 | 正确做法 | 原因 |
|---|---|---|
| 不跑测试就合并 | 每个任务执行后必须验证 | 避免引入新 bug |
| 一次执行太多任务 | 控制在 20 个以内 | 避免 token 耗尽时半途而废 |
| 跳过 worktree 隔离 | 始终用 isolation: "worktree" | 避免任务间互相干扰 |
| 不记录执行结果 | 写入 memory 文件 | 下次运行需要知道哪些做过 |
| 对生产代码不做验证 | 改完必须跑测试 | 确保不破坏现有功能 |
| 不检查工具可用性 | 执行前验证工具是否存在 | 缺失工具的任务应跳过而非报错 |
| 在大项目上不限制任务数 | 设置 --max-tasks 限制 | 避免 token 耗尽后任务中断 |
| 跳过风险评估 | 按 impact × (1 - risk) 排序 | 高风险任务应谨慎处理 |
| 不区分 node_modules 等目录 | 跳过 vendor/node_modules/.git | 扫描第三方代码浪费 token |
| 重构时不做 diff 检查 | 限制单任务变更 < 500 行 | 过大变更难以验证安全性 |
🔥 Token Burner
Autonomously discover and execute valuable code improvements before tokens expire. Never waste a token again.
Installation
# npx skills (recommended)
npx skills add wu529778790/shenzjd-skills -s token-burner -y
# Manual (Claude Code)
git clone https://github.com/wu529778790/shenzjd-skills.git
cp -r shenzjd-skills/token-burner ~/.claude/skills/
# Manual (Cursor)
# Copy SKILL.md content to .cursorrules or .cursor/rules/Usage
Note: Parameters are natural language hints parsed by the AI. Without parameters, the AI will ask interactively.
/token-burner # Scan and execute all tasks
/token-burner 只跑测试和文档 # Only test and doc tasks
/token-burner 最多跑 10 个任务 # Limit to 10 tasks
/token-burner 只扫描不执行 # Scan only, don't execute
/token-burner 扫描 /path/to/repo # Target specific project| Hint | Description | Default |
|---|---|---|
只跑 type | Filter task types (security/bug/test/docs/refactor/clean) | All |
最多跑 N 个任务 | Maximum tasks to execute | 20 |
| 只扫描不执行 | Scan only, don't execute | false |
扫描 path | Target project path | Current directory |
How It Works
Project Scan → Task Discovery → Priority Queue → Autonomous Execution → Report
│ │ │ │ │
│ │ │ │ │
Detect Find issues Sort by impact Agent executes Generate
project & opportunities × (1 - risk) in worktrees summary
type with testsTask Types
| Type | Discovery Method | Priority |
|---|---|---|
| 🔒 Security audit | npm audit / govulncheck / pip-audit | P0 |
| 🐛 Bug detection | Analyze git diff for logic issues | P0 |
| 🧪 Test generation | Find untested source files | P1 |
| 📝 Documentation | Check README, comments, API docs | P2 |
| ♻️ Refactoring | Duplicate code, complexity, code smells | P2 |
| 🧹 Git cleanup | Stale branches, conflict markers | P3 |
Safety
- Each task runs in an isolated git worktree
- Tests run after every change
- Failed tasks auto-rollback
- Checkpoint commits every 5 tasks
- Progress persisted across sessions
Prerequisites
- Git repository with history
- Project-specific tools (npm, go, pip, cargo) installed
jqinstalled (for JSON processing)
Token Burner 执行报告
运行概览
| 指标 | 值 |
|---|---|
| 项目 | {{project_name}} |
| 运行时间 | {{start_time}} ~ {{end_time}} |
| 总耗时 | {{duration}} |
| 扫描任务数 | {{total_tasks}} |
| 执行任务数 | {{executed_tasks}} |
| 成功 | {{success_count}} |
| 失败 | {{failed_count}} |
| 跳过 | {{skipped_count}} |
| 成功率 | {{success_rate}}% |
任务详情
| # | 类型 | 优先级 | 文件 | 状态 | 说明 | 耗时 |
|---|
{{#each tasks}} | {{@index}} | {{type_icon}} {{type}} | {{priority}} | {{file}} | {{status_icon}} {{status}} | {{description}} | {{duration}} | {{/each}}
失败任务分析
{{#if failed_tasks}} {{#each failed_tasks}}
{{type}}: {{file}}
- 错误信息: {{error}}
- 重试次数: {{retries}}
- 失败原因: {{reason}}
- 建议: {{suggestion}}
{{/each}} {{else}} 无失败任务。 {{/if}}
未执行任务
{{#if skipped_tasks}}
| # | 类型 | 文件 | 跳过原因 |
|---|
{{#each skipped_tasks}} | {{@index}} | {{type}} | {{file}} | {{reason}} | {{/each}} {{else}} 所有任务均已执行。 {{/if}}
改动统计
| 类型 | 文件数 | 新增行 | 删除行 |
|---|---|---|---|
| 测试 | {{test_files}} | +{{test_add}} | -{{test_del}} |
| 文档 | {{doc_files}} | +{{doc_add}} | -{{doc_del}} |
| 重构 | {{refactor_files}} | +{{refactor_add}} | -{{refactor_del}} |
| 修复 | {{fix_files}} | +{{fix_add}} | -{{fix_del}} |
| 合计 | {{total_files}} | +{{total_add}} | -{{total_del}} |
下次运行建议
{{#each suggestions}}
- {{this}}
{{/each}}
任务发现指南
本文档定义了 token-burner 如何在任意项目中自动发现可执行任务。
项目类型检测
# Node.js / TypeScript
test -f package.json && echo "node"
# Go
test -f go.mod && echo "go"
# Python
test -f requirements.txt -o -f pyproject.toml -o -f setup.py && echo "python"
# Rust
test -f Cargo.toml && echo "rust"
# Java
test -f pom.xml -o -f build.gradle && echo "java"任务发现规则
P0 - 安全和缺陷(立即执行)
依赖安全扫描:
# Node.js(需要 jq 和 package-lock.json)
if command -v jq >/dev/null 2>&1 && test -f package-lock.json; then
# npm audit 发现漏洞时退出码非 0,故不依赖退出码,直接解析 JSON
vuln_count=$(npm audit --json 2>/dev/null | jq '.metadata.vulnerabilities.total // (.vulnerabilities | length) // 0' 2>/dev/null)
if [ -n "$vuln_count" ] && [ "$vuln_count" != "null" ]; then
echo "npm vulnerabilities: $vuln_count"
else
echo "audit parse failed"
fi
elif ! test -f package-lock.json; then
echo "⚠️ 缺少 package-lock.json,跳过 npm audit"
fi
# Go(需要 govulncheck)
if command -v go >/dev/null 2>&1; then
$(go env GOPATH)/bin/govulncheck ./... 2>/dev/null || echo "⚠️ govulncheck 未安装或执行失败"
fi
# Python(需要 pip-audit)
if command -v pip-audit >/dev/null 2>&1; then
pip-audit 2>/dev/null || echo "⚠️ pip-audit 执行失败"
else
echo "⚠️ pip-audit 未安装,运行: pip install pip-audit"
fi代码缺陷检测:
- 检查
git diff中的常见错误模式 - 搜索
TODO: fix、FIXME、HACK标记 - 检查是否有未处理的错误(空 catch、忽略返回值)
P1 - 测试覆盖(高优先级)
无测试文件检测:
# Node.js - 找没有对应测试的源文件(需要 shopt -s globstar 递归匹配)
shopt -s globstar
for f in src/**/*.ts; do
test_file="${f%.ts}.test.ts"
test -f "$test_file" || echo "Missing test: $f"
done
# Go - 检查测试覆盖率
go test -coverprofile=coverage.out ./... 2>/dev/null
go tool cover -func=coverage.out | grep "total:"低覆盖率检测:
- 覆盖率 < 50% 的文件 → 生成测试任务
- 覆盖率 50-80% 的文件 → 补充边界测试
P2 - 文档和重构(中优先级)
文档缺失检测:
# 检查 README 是否存在
test -f README.md || echo "Missing README.md"
# 检查函数注释(Go)
grep -r "^func " --include="*.go" | head -20
# 检查 API 文档
test -d docs/api || echo "Missing API docs"代码重复检测:
# 简单的重复行检测
sort file.ts | uniq -d | head -10
# 复杂度检测(需要工具)
# npx complexity-report src/ --maxcomplexity 10P3 - Git 清理(低优先级)
过时分支检测:
git branch --merged main | grep -v "main\|master"大文件检测:
git ls-files | xargs ls -lS 2>/dev/null | sort -rn | head -10Conflict markers 检测:
grep -r "<<<<<<" --include="*.ts" --include="*.js" --include="*.go" .任务评分公式
score = impact_score × (1 - risk_score)
impact_score:
security_vulnerability = 3
bug_fix = 3
test_coverage = 2
documentation = 2
refactoring = 2
cleanup = 1
risk_score:
change_business_logic = 0.8
add_tests = 0.4
add_docs = 0.4
read_only_analysis = 0.1任务输出格式
每个发现的任务输出为:
{
"id": "task-001",
"type": "security|bug|test|docs|refactor|clean",
"priority": "P0|P1|P2|P3",
"file": "path/to/file",
"description": "简短描述",
"impact": "high|medium|low",
"risk": "high|medium|low",
"score": 2.4,
"prompt": "执行此任务的具体指令"
}