Claude 助手
- 作者仓库星标 62
- 作者更新于 实时读取
- 作者仓库 skills
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @TerminalSkills · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: claude-hud
description: >- Build heads-up display dashboards that monitor AI coding agents in real-time. Track context w…
category: 通用
runtime: 无特殊运行时
---
# claude-hud 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Overview / Instructions / Step 1: Understand the HUD Architecture”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Overview / Instructions / Step 1: Understand the HUD Architecture”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Overview / Instructions / Step 1: Understand the HUD Architecture”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: claude-hud
description: >- Build heads-up display dashboards that monitor AI coding agents in real-time. Track context w…
category: 通用
source: TerminalSkills/skills
---
# claude-hud
## 什么时候使用
- claude-hud 是一个通用扩展技能,按 SKILL 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Overview / Instructions / Step 1: Understand the HUD Architecture」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "claude-hud" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Overview / Instructions / Step 1: Understand the HUD Architecture
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Claude HUD — AI Agent Dashboard
Overview
Build heads-up display dashboards that monitor AI coding agents in real-time. Track context window consumption, active tool calls, sub-agent status, task progress, and cost — all rendered in a terminal UI or web interface. Inspired by claude-hud (13k+ stars).
Instructions
Step 1: Understand the HUD Architecture
| Component | What It Shows | Data Source |
|---|---|---|
| Context meter | Tokens used / remaining | Agent API response headers |
| Tool tracker | Active tool calls + history | Hook into tool execution |
| Sub-agent panel | Spawned agents + status | Agent orchestration layer |
| Task progress | Todo items + completion | Parse agent task lists |
| Cost tracker | $ spent this session | Token count x model pricing |
Step 2: Set Up the Project
mkdir ai-hud && cd ai-hud
npm init -y
npm install blessed blessed-contrib chalk ws
Step 3: Build the Context Usage Monitor
// context-monitor.js
class ContextMonitor {
constructor(maxTokens = 200000) {
this.maxTokens = maxTokens;
this.inputTokens = 0;
this.outputTokens = 0;
this.cacheHits = 0;
}
update(apiResponse) {
const usage = apiResponse.usage || {};
this.inputTokens = usage.input_tokens || 0;
this.outputTokens = usage.output_tokens || 0;
this.cacheHits = usage.cache_read_input_tokens || 0;
return this.getStatus();
}
getStatus() {
const total = this.inputTokens + this.outputTokens;
const pct = ((total / this.maxTokens) * 100).toFixed(1);
return {
used: total, remaining: this.maxTokens - total,
percentage: parseFloat(pct), cached: this.cacheHits,
warning: parseFloat(pct) > 80 ? 'HIGH' : 'OK'
};
}
}
Step 4: Build the Tool Call Tracker
// tool-tracker.js
class ToolTracker {
constructor() {
this.active = [];
this.history = [];
this.counts = {};
}
onToolStart(toolName, input) {
const call = {
id: Date.now(), tool: toolName,
input: JSON.stringify(input).slice(0, 100),
startedAt: new Date(), status: 'running'
};
this.active.push(call);
this.counts[toolName] = (this.counts[toolName] || 0) + 1;
return call;
}
onToolEnd(callId, output) {
const idx = this.active.findIndex(c => c.id === callId);
if (idx !== -1) {
const call = this.active.splice(idx, 1)[0];
call.status = 'done';
call.duration = Date.now() - call.startedAt;
call.output = String(output).slice(0, 80);
this.history.unshift(call);
if (this.history.length > 50) this.history.pop();
}
}
getTopTools(n = 5) {
return Object.entries(this.counts).sort((a, b) => b[1] - a[1]).slice(0, n);
}
}
Step 5: Build the Terminal Dashboard
// dashboard.js
const blessed = require('blessed');
const contrib = require('blessed-contrib');
const screen = blessed.screen({ smartCSR: true, title: 'AI Agent HUD' });
const grid = new contrib.grid({ rows: 12, cols: 12, screen });
const contextGauge = grid.set(0, 0, 3, 4, contrib.gauge, {
label: ' Context Usage ', stroke: 'green', fill: 'white'
});
const toolLog = grid.set(0, 4, 6, 8, contrib.log, {
label: ' Tool Calls ', fg: 'green', selectedFg: 'green'
});
const taskBar = grid.set(3, 0, 3, 4, contrib.bar, {
label: ' Tasks ', barWidth: 6, maxHeight: 10
});
const costLine = grid.set(6, 0, 6, 6, contrib.line, {
label: ' Cost ($) ', showLegend: true, minY: 0
});
const agentTable = grid.set(6, 6, 6, 6, contrib.table, {
label: ' Sub-Agents ', keys: true, columnWidth: [20, 10, 15]
});
function refresh(state) {
contextGauge.setPercent(state.context.percentage);
state.tools.active.forEach(t => toolLog.log(`> ${t.tool} - ${t.input}`));
screen.render();
}
screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
screen.render();
Step 6: Connect via WebSocket
// server.js
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8765 });
wss.on('connection', (ws) => {
console.log('HUD client connected');
ws.on('message', (data) => {
const event = JSON.parse(data);
switch (event.type) {
case 'context_update': contextMonitor.update(event.data); break;
case 'tool_start': toolTracker.onToolStart(event.tool, event.input); break;
case 'tool_end': toolTracker.onToolEnd(event.id, event.output); break;
case 'task_update': taskTracker.update(event.tasks); break;
}
broadcastState();
});
});
Step 7: Add Cost Tracking
const PRICING = {
'claude-sonnet-4-20250514': { input: 3.0, output: 15.0 },
'claude-opus-4-20250514': { input: 15.0, output: 75.0 },
'gpt-4o': { input: 2.5, output: 10.0 },
};
function calculateCost(model, inputTokens, outputTokens) {
const p = PRICING[model] || PRICING['claude-sonnet-4-20250514'];
return ((inputTokens * p.input + outputTokens * p.output) / 1_000_000).toFixed(4);
}
Examples
Example 1: Monitor a Claude Code Refactoring Session
A developer launches the HUD while Claude Code refactors a large codebase:
const monitor = new ContextMonitor(200000); // Claude Sonnet 200k context
const tracker = new ToolTracker();
// Simulated events from a real refactoring session
monitor.update({ usage: { input_tokens: 45200, output_tokens: 12800, cache_read_input_tokens: 31000 } });
console.log(monitor.getStatus());
// { used: 58000, remaining: 142000, percentage: 29.0, cached: 31000, warning: 'OK' }
tracker.onToolStart('Read', { file_path: '/src/components/Dashboard.tsx' });
tracker.onToolStart('Grep', { pattern: 'useState', path: '/src' });
tracker.onToolEnd(tracker.active[0].id, '245 lines read');
console.log(tracker.getTopTools());
// [['Read', 12], ['Grep', 8], ['Edit', 6], ['Bash', 3]]
// Dashboard shows: context at 29%, 2 active tools, $0.0234 session cost
Example 2: Multi-Agent Workflow Dashboard
A team runs 3 agents in parallel and monitors all of them on one HUD:
const agents = {
'agent-1-backend': new ContextMonitor(200000),
'agent-2-frontend': new ContextMonitor(200000),
'agent-3-tests': new ContextMonitor(200000),
};
// Agent 1: refactoring API routes — 67% context used
agents['agent-1-backend'].update({ usage: { input_tokens: 98000, output_tokens: 36000 } });
// Agent 2: building React components — 23% context used
agents['agent-2-frontend'].update({ usage: { input_tokens: 32000, output_tokens: 14000 } });
// Agent 3: writing test suites — 45% context used
agents['agent-3-tests'].update({ usage: { input_tokens: 61000, output_tokens: 29000 } });
// Dashboard renders 3 gauges side-by-side:
// [agent-1: 67% HIGH] [agent-2: 23% OK] [agent-3: 45% OK]
// Total session cost: $0.0234 + $0.0108 + $0.0179 = $0.0521
Guidelines
- Keep the HUD lightweight — avoid heavy polling; use WebSocket push for real-time updates
- Set context alerts at 80% — warn developers before hitting the context window limit
- Log all events to disk — enable session replay for debugging and optimization
- Support multiple agents — design the dashboard to handle parallel agent workflows
- Customize per workflow — different tasks benefit from different widget layouts
- Respect privacy — do not log sensitive code content in tool call history; truncate inputs
References
- jarrodwatts/claude-hud — original inspiration
- blessed-contrib — terminal dashboard widgets
- Anthropic API usage headers — token counting
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核