swanlab-api-skill

swanlab-api-skill is a skill for Claude Code, Codex from Nexisato/SwanLab-MCP. It costs 40 tokens per session (3,265 once invoked), scanned B, original, MIT.

A skill for retrieving SwanLab experiment, project, workspace, and run data through its API. SwanLab is a platform for tracking machine-learning experiments, including their metrics and settings.

In plain words
What is it for?
Use it to retrieve runs, metadata, configurations, requirements, and workspace or project details, or save run metrics as JSON files.
Why use it?
It lets you inspect experiment information and export metrics without manually navigating the SwanLab service.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is -o ./data/metrics.

Good fit Use it to retrieve runs, metadata, configurations, requirements, and workspace or project details, or save run metrics as JSON files.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Nexisato/SwanLab-MCP
agentmods
npx agentmods add skills/nexisato/swanlab-mcp/swanlab-api-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swanlab-api-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/nexisato/swanlab-mcp/swanlab-api-skill/github.svg)](https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill)
Your own site
<a href="https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill"><img src="https://agentmods.dev/badge/skills/nexisato/swanlab-mcp/swanlab-api-skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swanlab-api-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/nexisato/swanlab-mcp/swanlab-api-skill"><img src="https://agentmods.dev/badge/skills/nexisato/swanlab-mcp/swanlab-api-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,265 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00040 $0.03265
Opus 5 $0.00020 $0.01632
Sonnet 5 $0.00008 $0.00653
Haiku 4.5 $0.00004 $0.00327

Measured 10d ago against content hash ab645e82914e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade B, and why

swanlab-api-skill scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

The scan reads SKILL.md. This mod also ships 6 executable files (scripts/__init__.py, scripts/projects.py, scripts/runs.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 600 ~/.swanlab/netrc
skill/swanlab-api-skill/SKILL.md · 415 lines

How it starts

The opening of the file, as written. The whole thing — 415 lines — stays where its author put it; the contents beside it link to each section on GitHub.

triggers:

  • 当用户需要获取 SwanLab 实验数据时
  • 当用户需要导出 metrics 到 JSON 时
  • 当用户需要获取 workspace、project、run 信息时
  • 当用户需要获取实验的 metadata、config、requirements 时

环境要求

  • Python >= 3.8
  • swanlab >= 0.7.8
  • pandas (用于 metrics 数据处理)

环境变量

变量名 必需 说明
SWANLAB_API_KEY 条件必需* SwanLab API 密钥
SWANLAB_HOST SwanLab 主机地址,默认 https://swanlab.cn

获取 API 密钥:https://swanlab.cn/space/~/settings

API Key 获取优先级 【最先执行】

  1. 环境变量 SWANLAB_API_KEY(优先)
  2. Netrc 文件 ~/.swanlab/netrc 中的 password 字段

Netrc 文件配置示例:

# 创建 netrc 文件
mkdir -p ~/.swanlab
cat > ~/.swanlab/netrc << 'EOF'
machine https://api.swanlab.cn
        login https://swanlab.cn
        password your_api_key_here
EOF
chmod 600 ~/.swanlab/netrc

注:环境变量优先级高于 netrc 文件。如果设置了 SWANLAB_API_KEY,将忽略 netrc 中的配置。

核心规则

  1. Username 默认规则:

    • 未指定 username 时,自动调用 api.workspaces() 获取 PERSON 类型的 workspace 作为默认
    • Path 支持简写:project_name/exp_id 会自动补全为 username/project_name/exp_id
  2. 输出规则:

    • 只有 runs metrics 命令会保存 JSON 文件
    • 其他所有命令都只输出到控制台(stdout)
  3. Metrics 输出:

    • 使用 -o 指定文件名,默认保存到 ./.cache/ 目录(自动创建)
    • 超过 8192 条记录时自动分片保存,命名格式 [name]-[chunk_idx:04d].json
    • 不分片时文件名为 [name].json
  4. 实验分析前置规则(重要):

    • 在获取实验指标 Metrics 之前,必须先获取实验元信息(runs get、runs config)
    • 元信息包括:实验名称、状态、超参数配置等
    • 禁止直接获取 metrics 而不了解实验的基本信息和配置

意图识别

当用户需要进行实验分析、实验对比或实验总结时,按以下步骤获取实验元信息:

  1. 获取实验基础信息(必需):

    python -m scripts.swanlab_cli runs get RUN_PATH
    
    • 了解实验名称、状态、创建时间、运行时长
    • 获取实验标签和分组信息
  2. 获取实验配置 Config(必需):

    python -m scripts.swanlab_cli runs config RUN_PATH
    
    • 获取超参数配置(学习率、批次大小、模型架构等)
    • 理解实验的目的和设置
  3. 获取实验环境 Metadata(建议):

    python -m scripts.swanlab_cli runs metadata RUN_PATH
    
    • 获取 Python 版本、操作系统、硬件信息(GPU/CPU)
    • 获取 Git 提交信息(代码版本)
    • 用于复现实验环境和排查环境问题
  4. 获取 Python 依赖 Requirements(可选):

    python -m scripts.swanlab_cli runs requirements RUN_PATH
    
    • 了解实验使用的库版本
    • 用于环境复现

Read the full file on GitHub · 415 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 415 lines · 40 tokens per session scan B ab645e82914e

Subscribe to this mod's changes

swanlab-api-skill is a skill published in the GitHub repository Nexisato/SwanLab-MCP (10 stars, last pushed 21d ago), licensed MIT. It adds 40 tokens to every session and 3,265 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens