Official agent skill

Space Doctor

by huggingface in huggingface/hf-mcp-server

Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files.

OfficialMITAuto-check passedAI & LLM Engineering

Install Space Doctor

skills CLI
$ npx skills add huggingface/hf-mcp-server --skill space-doctor -a claude-code

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

GitHub CLI
$ gh skill install huggingface/hf-mcp-server space-doctor --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/huggingface/hf-mcp-server.git skills-src && mkdir -p .claude/skills && cp -r skills-src/monitor/distribution/skills/space-doctor .claude/skills/space-doctor && 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
space-doctor
GitHub stars
302
Token cost
~1.8k tokens
SKILL.md length
823 words
Files
2 (incl. assets)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files.

  • Works in 6 steps: Inspect remote state → Acquire source at the failing revision → Run deterministic checks → …
  • Scheduled Space monitoring
  • SKILL.md covers Scheduled contract and Workflow
  • Calls hf and python3

What it does

Space Doctor is an agent skill from huggingface/hf-mcp-server, published by the product's own GitHub organization. Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files. Use for scheduled Space monitoring, BUILDERROR or RUNTIMEERROR triage, Gradio and ZeroGPU failures, source analysis, and patch preparation. Read-only against the Hub - it never uploads, publishes, or restarts anything.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including assets (for example `assets/doctor-result.schema.json`). Compatibility notes: Requires Python 3.10+ and fast-agent shell access. Remote reads require either a connected Hugging Face MCP server or the hf CLI.

It sits in AI & LLM Engineering, covering Model hubs and datasets. It works with Hugging Face and Gradio. The repository describes itself as: Hugging Face MCP Server. The licence is MIT.

When your agent uses it

  • Scheduled Space monitoring
  • RUNTIMEERROR triage
  • Gradio and ZeroGPU failures
  • Source analysis

Example prompts

  • “/space-doctor”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Requires Python 3.10+ and fast-agent shell access. Remote reads require either a connected Hugging Face MCP server or the hf CLI.

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Inspect remote state
  2. Acquire source at the failing revision
  3. Run deterministic checks
  4. Decide whether a fix is safe
  5. Prepare the candidate
  6. Verify before reporting

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • hf
    • python3

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

  • Network

    No URLs in SKILL.md.

    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.

  • Compatibility

    Requires Python 3.10+ and fast-agent shell access. Remote reads require either a connected Hugging Face MCP server or the hf CLI.

    From compatibility in the SKILL.md frontmatter.

Context cost

Space Doctor loads about 1.8k tokens when it runs. Until then it costs about 95 tokens; SKILL.md has 823 words of instructions outside code blocks.

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

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 passed

The automated check found no risky patterns in SKILL.md.

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 huggingface/hf-mcp-server at commit dce2d5f, republished under its MIT licence (© huggingface). 823 words, ~1,800 tokens.

Download SKILL.mdSave it as .claude/skills/space-doctor/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
space-doctor
description
Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files. Use for scheduled Space monitoring, BUILD_ERROR or RUNTIME_ERROR triage, Gradio and ZeroGPU failures, source analysis, and patch preparation. Read-only against the Hub - it never uploads, publishes, or restarts anything.
compatibility
Requires Python 3.10+ and fast-agent shell access. Remote reads require either a connected Hugging Face MCP server or the hf CLI.
metadata.author
space-doctor
metadata.version
2.0.0

Space Doctor

Diagnose a broken Hugging Face Space and, when a narrow reversible source fix is appropriate, write the complete fixed files into the candidate directory you were given. You have no Hub write access: never attempt an upload, PR, restart, or any other mutation. The parent process opens a PR from your candidate files and performs any restart itself.

Use fast-agent for reasoning and Hub reads. Diagnose from the observed failure, actual Hub logs, and the pinned source; static patterns and generic automated rewrites are not a repair decision.

Scheduled contract

A scheduled request provides the Space ID, exact failing revision, run ID, observed status/stage/detail, previous restart outcome for that revision (when one exists), and a workspace containing a candidate/ directory. Treat the restart outcome as evidence, not proof that the current failure has the same cause. Emit exactly one final structured result matching the configured JSON schema, only after all work is complete:

  • status: "fix-proposed" with changed_files, fix_summary, and pr_title when you have written complete fixed files (paths relative to the Space repository root) into candidate/.
  • status: "needs-human" with needs_human_reason otherwise.

Diagnose exactly the requested revision. If the Space has moved to a different revision, report needs-human with reason revision-changed. Never place credentials, tokens, or local filesystem paths in any output field.

Workflow

1. Inspect remote state

Prefer connected Hugging Face MCP tools. With the hf CLI:

bash
hf spaces info <namespace/name> --expand runtime --format json
hf spaces logs <namespace/name> --tail 300
hf spaces logs <namespace/name> --build --tail 300   # for BUILD_ERROR

Record runtime stage, hardware, revision, runtime.raw.errorMessage, and the first actionable error. Read both build and runtime logs when relevant and compare them with the observed status/stage/detail supplied in the request. Always use the full 40-character repository SHA. Do not treat RUNNING alone as healthy.

2. Acquire source at the failing revision
bash
mkdir -p <workspace>/source
hf download <namespace/name> --repo-type space \
  --revision <full-sha> --local-dir <workspace>/source \
  --exclude '*.safetensors' --exclude '*.safetensors.index.json' \
  --exclude '*.bin' --exclude '*.pt' --exclude '*.pth' --exclude '*.ckpt' \
  --exclude '*.onnx' --exclude '*.gguf' --exclude '*.h5' --exclude '*.tflite'

Never download a moving default branch when diagnosing a specific failure. Acquire source, configuration, and dependency manifests needed to reproduce the failure, but do not download model weights or launch a large model locally. If a required source file is absent, fetch that named file at the same full SHA.

3. Run deterministic checks

Read the source and log context yourself. Compile Python without writing __pycache__ into the tree:

bash
python3 -I -c '
import pathlib, sys
root = pathlib.Path(sys.argv[1])
for path in sorted(root.rglob("*.py")):
    compile(path.read_text(encoding="utf-8"), str(path), "exec")
' <workspace>/source

Classify findings by full SHA, stage, and timestamp. If a new build stops earlier than a historical runtime failure, report the old failure as superseded rather than the active root cause.

4. Decide whether a fix is safe

Report needs-human when:

  • actual Space runtime evidence establishes an authentication, permissions, secrets, or grants failure and no independent code fix is available;
  • billing, storage, or hardware must change;
  • the failure appears transient or platform-wide;
  • a fix would change product behavior or model choice;
  • dependency resolution needs a broad or major-version upgrade;
  • no clear root cause is supported by logs and source.

Never repair access by adding or rotating a secret. Safe candidates are narrow, reversible fixes directly supported by a deterministic failure.

Show full SKILL.md (354 more words)Show less
5. Prepare the candidate

Make a source-aware edit only when the logs and source establish a narrow, reversible root cause. First copy the complete acquired source tree to <workspace>/verify/ and edit that complete tree. Do not edit a partial candidate directory. Once verified, create <workspace>/candidate/ containing only each changed file's complete contents at its repository-relative path; list exactly those paths in changed_files.

ZeroGPU rules:

  • eager module-scope model loading and .to("cuda") placement are normally correct after import spaces; actual CUDA computation belongs inside @spaces.GPU;
  • do not move model construction into a request handler merely to make it lazy;
  • do not add platform-managed gradio, spaces, or huggingface_hub to requirements.txt solely because they are imported.
6. Verify before reporting

Before reporting fix-proposed:

  • compile all modified Python and relevant entrypoint source in the complete <workspace>/verify/ tree with in-memory compile(...), never py_compile;
  • inspect the complete verified tree, not the partial candidate, and confirm the root-cause failure is gone or directly mitigated without a new error;
  • compare source/ and verify/, then ensure candidate/ contains only the changed complete files, with no secret, cache, run artifact, or unrelated file.

For dependency repairs, reconstruct the exact platform install inputs from the failing build (dependency file, injected Gradio/Spaces/torch requirements, Python version) and verify the resolution; a reduced synthetic resolver is exploratory evidence only. For gated models, verify authenticated read access without downloading weights when authorized credentials are available. An unauthenticated model probe returning 401/403 does not establish an access failure in the actual Space runtime: the Space may have its own authorized credentials. Do not infer a human hold from that probe alone (including Krea). A verified independent code repair may be fix-proposed for a PR even when model access remains unverified. Include a warning finding describing the probe context and verification limitation; do not claim full runtime success. For access issues, report needs-human only when actual Space runtime evidence establishes access failure and no independent fix is available. Never add, rotate, or expose secrets to repair access. Do not launch a large model locally.

Finally, re-read the remote revision. If it no longer matches the requested revision, report needs-human with reason revision-changed.

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

Files

SKILL.md and 1 other file (assets) in monitor/distribution/skills/space-doctor of huggingface/hf-mcp-server.

  • SKILL.md
  • assets/doctor-result.schema.json

Open the folder on GitHubat commit dce2d5f

Compare with similar skills

Space Doctor 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.

Space Doctor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Space Doctor this skillhuggingface/hf-mcp-server302—~1.8kAutomated safety check: PassMIT
Generate Openenv Envadithya-s-k/FineEnvs461—~2.4kAutomated safety check: PassApache-2.0
Hugging Face ZeroGPUhuggingface/skills11k2 repos~4.6kAutomated safety check: PassApache-2.0
LoRA Space Builderhuggingface/skills11k2 repos~8.4kAutomated safety check: PassApache-2.0
Huggingface Spaceshuggingface/skills11k1 repos~4.4kAutomated safety check: PassApache-2.0
Hf MCPhuggingface/skills11k2 repos~1.2kAutomated safety check: PassApache-2.0

Similar skills

  • Generate Openenv Env

    adithya-s-k/FineEnvs

    Builds an OpenEnv (Hugging Face) variant of an RL environment.

    461 GitHub stars~2.4k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Hugging Face ZeroGPU

    huggingface/skills

    Official

    Covers the rules for writing Gradio Spaces on ZeroGPU hardware: the @spaces.GPU decorator, duration and quota tuning, process isolation and CUDA build limits.

    11k GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • LoRA Space Builder

    huggingface/skills

    Official

    Builds and publishes a Gradio demo on Hugging Face Spaces for a LoRA, with the pipeline, UI and settings chosen to match that LoRA's task and model card.

    11k GitHub starsUsed in 2 repos~8.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Huggingface Spaces

    huggingface/skills

    Official

    Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging, buckets, inference providers, community…

    11k GitHub starsUsed in 1 repo~4.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Hf MCP

    huggingface/skills

    Official

    Use Hugging Face Hub via MCP server tools. An agent skill from huggingface/skills.

    11k GitHub starsUsed in 2 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Huggingface Spaces

    waybarrios/opencode-power-pack

    Build, deploy, debug, or maintain a Hugging Face Space using Gradio, Docker, or Static SDKs.

    534 GitHub stars~4.2k tokensUpdated 4 days ago
    AI & LLM EngineeringAuto-check passed

Questions about Space Doctor

What does Space Doctor do?

Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files. Space Doctor is an agent skill from huggingface/hf-mcp-server, published by the product's own GitHub organization. Diagnose broken Hugging Face Gradio Spaces from their actual logs and pinned source, then prepare a minimal verified source fix as candidate files.

When should I use Space Doctor?

Space Doctor fits situations like: scheduled Space monitoring; RUNTIMEERROR triage; gradio and ZeroGPU failures; source analysis.

How do I install Space Doctor in Claude Code?

Run `npx skills add huggingface/hf-mcp-server --skill space-doctor -a claude-code`. Or copy the skill folder (monitor/distribution/skills/space-doctor in huggingface/hf-mcp-server) into .claude/skills/space-doctor in your project. Claude Code loads it when a task matches its description.

How do I install Space Doctor in Codex?

Run `npx skills add huggingface/hf-mcp-server --skill space-doctor -a codex`. Or copy the skill folder (monitor/distribution/skills/space-doctor in huggingface/hf-mcp-server) into .agents/skills/space-doctor in your project. Codex loads it when a task matches its description.

Can I use Space Doctor 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 huggingface/hf-mcp-server --skill space-doctor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/space-doctor, .gemini/skills/space-doctor, .github/skills/space-doctor and .opencode/skills/space-doctor in your project.

What does Space Doctor need to run?

Going by SKILL.md and its folder, Space Doctor needs the command-line tools its instructions call (hf and python3). Our summary lists: Python 3. Compatibility (from SKILL.md): Requires Python 3.10+ and fast-agent shell access. Remote reads require either a connected Hugging Face MCP server or the hf CLI..

Does Space Doctor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Space Doctor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Space Doctor use?

Space Doctor 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 Space Doctor use?

About 1.8k tokens (SKILL.md is roughly 7.2k 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 Space Doctor?

Skills that share tags, products or a category with Space Doctor: Generate Openenv Env (adithya-s-k/FineEnvs, 461 stars), Hugging Face ZeroGPU (huggingface/skills, 11k stars), LoRA Space Builder (huggingface/skills, 11k stars) and Huggingface Spaces (huggingface/skills, 11k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Space Doctor?

huggingface (a GitHub organization, an official publisher) maintains it in huggingface/hf-mcp-server, which has 302 GitHub stars. The repository was last updated on October 7, 2026.

Source: huggingface/hf-mcp-server on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.