Agent skill

GPU Use

by majiayu000 in majiayu000/spellbook

查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用

MITAuto-check: notesAI & LLM Engineering

Install GPU Use

skills CLI
$ npx skills add majiayu000/spellbook --skill gpu-use -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install majiayu000/spellbook gpu-use --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/gpu-use .claude/skills/gpu-use && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gpu-use
GitHub stars
287
Token cost
~761 tokens
SKILL.md length
108 words
Files
1
Skills in repo
97
Repo updated
First seen
Licence
MIT

At a glance

查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用

  • Works in 6 steps: GPU 卡概况 → GPU 上运行的进程 → GPU UUID 到 index 的映射 → …
  • AI & LLM Engineering work in your project
  • SKILL.md covers 服务器列表, 诊断流程 and 注意事项
  • Calls ssh, docker and python

What it does

GPU Use is an agent skill from majiayu000/spellbook. 查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用

Its SKILL.md is about 760 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering. The repository describes itself as: Cross-runtime skills for Claude Code, Codex, and multi-agent workflows. The licence is MIT.

When your agent uses it

  • AI & LLM Engineering work in your project

Example prompts

  • “/gpu-use”

Requirements

  • Python 3
  • Docker
  • Pre-approved tools (allowed-tools): Bash

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. GPU 卡概况
  2. GPU 上运行的进程
  3. GPU UUID 到 index 的映射
  4. Docker 容器列表
  5. 进程 PID 到容器的映射(用采集到的 PID 列表)
  6. 容器内多实例 http_server 检测(识别单容器多终端部署)

What it can do on your machine

Read from SKILL.md and the folder at commit ed52af7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • ssh
    • docker
    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use ssh and docker, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

GPU Use loads about 761 tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 108 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~20
When it runs · the whole SKILL.md, loaded when a task matches
~761

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from majiayu000/spellbook at commit ed52af7, republished under its MIT licence (© majiayu000). 108 words, ~761 tokens.

Download SKILL.mdSave it as .claude/skills/gpu-use/SKILL.md (or your agent's skills folder).
name
gpu-use
description
查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用
allowed-tools
Bash
metadata.argument-hint
[user@host -p port] 或无参数使用默认服务器

GPU 使用情况诊断

你是一个 GPU 资源管理专家,帮助用户快速了解远程服务器上的 GPU 使用情况。

服务器列表

别名SSH 命令
默认ssh felix@124.158.103.16 -p 10022

用户可以传入自定义 SSH 地址,格式:user@host -p port。无参数时使用默认服务器。

诊断流程

第一步:采集数据

并行执行以下命令(通过 SSH):

  1. GPU 卡概况
bash
ssh {SSH_TARGET} "nvidia-smi --query-gpu=index,name,memory.total,memory.used,memory.free,utilization.gpu --format=csv,noheader,nounits"
  1. GPU 上运行的进程
bash
ssh {SSH_TARGET} "nvidia-smi --query-compute-apps=pid,gpu_uuid,used_memory,name --format=csv,noheader,nounits"
  1. GPU UUID 到 index 的映射
bash
ssh {SSH_TARGET} "nvidia-smi --query-gpu=index,gpu_uuid --format=csv,noheader"
  1. Docker 容器列表
bash
ssh {SSH_TARGET} "docker ps --format '{{.ID}} {{.Names}}' 2>/dev/null"
  1. 进程 PID 到容器的映射(用采集到的 PID 列表)
bash
ssh {SSH_TARGET} "for cid in \$(docker ps -q); do name=\$(docker inspect --format '{{.Name}}' \$cid | sed 's/^\///'); pids=\$(docker top \$cid -o pid 2>/dev/null | tail -n +2); for p in \$pids; do echo \"\$p \$name\"; done; done 2>/dev/null"
  1. 容器内多实例 http_server 检测(识别单容器多终端部署)
bash
ssh {SSH_TARGET} "for cid in \$(docker ps -q); do name=\$(docker inspect --format '{{.Name}}' \$cid | sed 's/^\///'); servers=\$(docker exec \$cid ps aux 2>/dev/null | grep 'http_server -p' | grep -v grep | awk '{for(i=1;i<=NF;i++) if(\$i==\"-p\") print \$(i+1)}'); if [ -n \"\$servers\" ]; then echo \"\$name: \$servers\"; fi; done 2>/dev/null"
第二步:生成报告

将 GPU UUID 映射回 index,将 PID 映射回容器名,按以下格式输出:

## GPU 使用概况

| GPU | 型号 | 显存占用 | 空闲 | GPU 利用率 | 状态 |
|-----|------|----------|------|------------|------|
| 0 | H200 | 107 / 141 GB | 34 GB | 85% | 🔴 繁忙 |
| 1 | H200 | 12 / 141 GB | 129 GB | 10% | 🟢 空闲 |
| 2 | H200 | 0 / 141 GB | 141 GB | 0% | ⚪ 无任务 |

## 进程详情

| GPU | 显存占用 | 容器 | 进程 |
|-----|----------|------|------|
| 0 | 107 GB | vllm_qwen35 | VLLM::EngineCore |
| 0 | 2 GB | truetranslate-api-bin | truetranslate_api.bin |
| 1 | 12 GB | atlas_video | python |

## 多实例服务(单容器多终端部署)

如果检测到容器内运行多个 http_server 实例,单独列出:

| 容器 | 端口 | GPU | 状态 |
|------|------|-----|------|
| atlas_video | :5001 | GPU 2 | 运行中 |
| atlas_video | :5002 | GPU 3 | 运行中 |

## 空闲资源

可用于新服务部署的 GPU:
- GPU 4: 141 GB 完全空闲
- GPU 5: 141 GB 完全空闲
状态判定规则
显存占用比GPU 利用率状态
0%0%⚪ 无任务
< 30%< 30%🟢 空闲
30-80%any🟡 中等
> 80%any🔴 繁忙
多实例检测逻辑

当检测到一个容器内有多个 http_server -p 进程时:

  1. 提取每个进程的端口号(-p 参数)
  2. 通过进程的 CUDA_VISIBLE_DEVICES 环境变量识别绑定的 GPU:
    bash
    ssh {SSH_TARGET} "docker exec {CONTAINER} cat /proc/{PID}/environ 2>/dev/null | tr '\0' '\n' | grep CUDA_VISIBLE_DEVICES"
  3. 在报告中用独立表格展示,标注各实例的端口、GPU 绑定和运行状态

注意事项

  • 用中文输出
  • SSH 命令设置 15 秒超时
  • 如果 SSH 连接失败,提示用户检查网络和 SSH 配置
  • 不执行任何写操作,纯只读诊断
  • 单容器多终端是 atlas_video 的标准部署方式,注意区分容器级和进程级的 GPU 占用

© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/gpu-use of majiayu000/spellbook.

Open the folder on GitHubat commit ed52af7

Compare with similar skills

GPU Use next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

GPU Use compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
GPU Use this skillmajiayu000/spellbook287—~761Automated safety check: NotesMIT
Agent BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
Add Uint Supportpytorch/pytorch104k2 repos~2.3kAutomated safety check: PassCustom licence
LLM Benchmarking with lm-evaluation-harnessOrchestra-Research/AI-Research-SKILLs13k8 repos~3kAutomated safety check: PassMIT
Segment Anything Model GuideOrchestra-Research/AI-Research-SKILLs13k8 repos~3.3kAutomated safety check: PassMIT
1passwordtrpc-group/trpc-agent-go1.9k14 repos~656Automated safety check: PassApache-2.0

Similar skills

  • Agent Builder

    shareAI-lab/learn-claude-code

    Design and build AI agents for any domain. An agent skill from shareAI-lab/learn-claude-code.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Uint Support

    pytorch/pytorch

    Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.

    104k GitHub starsUsed in 2 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    AI & LLM EngineeringAuto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 8 repos~3.3k tokens
    AI & LLM EngineeringAuto-check passed
  • 1password

    trpc-group/trpc-agent-go

    Set up and use 1Password CLI (op). An agent skill from trpc-group/trpc-agent-go.

    1.9k GitHub starsUsed in 14 repos~656 tokens
    AI & LLM EngineeringAuto-check passed
  • Planning With Files

    jarrodwatts/claude-code-config

    Transforms workflow to use Manus-style persistent markdown files for planning, progress tracking, and knowledge storage.

    1.1k GitHub starsUsed in 5 repos~967 tokens
    AI & LLM EngineeringAuto-check passed

More from majiayu000/spellbook

All 97 skills in this repo
  • Skill Ecosystem Doctor

    majiayu000/spellbook

    Audits and repairs how coding-agent Skills are owned, copied and exposed across runtimes, from canonical sources to quarantine and retirement.

    287 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • AGENTS.md Scaffold

    majiayu000/spellbook

    Scans a repository for real evidence and proposes, or on request writes, a small stack of root and scoped AGENTS.md files with validation commands and generated-file boundaries.

    287 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Demo Builder

    majiayu000/spellbook

    Plans, produces or diagnoses evidence-backed product demo videos: script, capture plan, pacing checks and verified final media built on real product behavior.

    287 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Flowguard Task Guard

    majiayu000/spellbook

    Single entry point that routes long or ambiguous agent tasks, checks live state, bounds autonomous loops and leaves a resumable handoff.

    287 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • npm Supply Chain Check

    majiayu000/spellbook

    Scans a repository, its lockfiles and node_modules for known malicious npm package versions and install-time indicators, using a read-only Python scanner.

    287 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Manager Toolkit

    majiayu000/spellbook

    Product management helpers: a RICE scoring script, an interview transcript analyzer and PRD templates for prioritizing features, synthesizing research and writing requirements.

    287 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Questions about GPU Use

What does GPU Use do?

查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用. GPU Use is an agent skill from majiayu000/spellbook.

When should I use GPU Use?

GPU Use fits situations like: AI & LLM Engineering work in your project.

How do I install GPU Use in Claude Code?

Run `npx skills add majiayu000/spellbook --skill gpu-use -a claude-code`. Or copy the skill folder (skills/gpu-use in majiayu000/spellbook) into .claude/skills/gpu-use in your project. Claude Code loads it when a task matches its description.

How do I install GPU Use in Codex?

Run `npx skills add majiayu000/spellbook --skill gpu-use -a codex`. Or copy the skill folder (skills/gpu-use in majiayu000/spellbook) into .agents/skills/gpu-use in your project. Codex loads it when a task matches its description.

Can I use GPU Use in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/spellbook --skill gpu-use -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gpu-use, .gemini/skills/gpu-use, .github/skills/gpu-use and .opencode/skills/gpu-use in your project.

What does GPU Use need to run?

Going by SKILL.md and its folder, GPU Use needs the command-line tools its instructions call (ssh, docker and python). Our summary lists: Python 3; Docker. Its frontmatter pre-approves these tools: Bash.

Does GPU Use access the network?

SKILL.md contains no URLs. Its commands use ssh and docker, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is GPU Use safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does GPU Use use?

GPU Use is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does GPU Use use?

About 761 tokens (SKILL.md is roughly 3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to GPU Use?

Skills that share tags, products or a category with GPU Use: Agent Builder (shareAI-lab/learn-claude-code, 78k stars), Add Uint Support (pytorch/pytorch, 104k stars), LLM Benchmarking with lm-evaluation-harness (Orchestra-Research/AI-Research-SKILLs, 13k stars) and Segment Anything Model Guide (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains GPU Use?

majiayu000 (a GitHub user) maintains it in majiayu000/spellbook, which has 287 GitHub stars. The repository holds 97 skills in this directory. The repository was last updated on October 8, 2026.

Source: majiayu000/spellbook on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.