Skip to content

claude-code template: sandbox-fetch-docs says gh is unauthenticated and everything is firewalled; both are wrong #323

Backlog

Description

@gatezh

Summary

claude-code/.claude/skills/sandbox-fetch-docs/SKILL.md describes a container that no longer exists. It says gh is "installed but not authenticated" and that every non-GitHub site is firewalled, and it tells Claude not to try either. In fact both variants route git authentication through gh auth git-credential, so gh is always logged in. The default variant has no firewall at all. As a result, Claude skips the best tool available (gh api, with 5,000 requests an hour and code search), falls back to anonymous GitHub API calls (60 an hour), and avoids WebFetch even where WebFetch works.

The skill's Bun path is also wrong for hoisted installs. It only looks under node_modules/.bun/<pkg>@<ver>/, which exists only with the isolated linker.

Reproduction

  1. Open a downstream project in the default variant (.devcontainer/).
  2. Ask Claude to "check the docs" for a dependency.
  3. Claude loads sandbox-fetch-docs, skips gh, and makes anonymous curl api.github.com calls. In a hoisted project its find node_modules/.bun … also returns nothing.

Verification

From the default variant of a downstream project:

$ gh auth status
github.com
  ✓ Logged in to github.com account gatezh (/home/node/.config/gh/hosts.yml)
$ gh api rate_limit --jq '.resources.core.limit, .resources.code_search.limit'
5000
10
$ curl -sS -m 5 -o /dev/null -w '%{http_code}\n' https://example.com
200

WebFetch to non-GitHub documentation sites also succeeds in the default variant.

claude-code/.devcontainer/claude-sandbox/devcontainer.json sets credential.https://github.com.helper to !gh auth git-credential and persists ~/.config/gh on a volume, so the "not authenticated" row is wrong for the sandbox variant too.

Suggested fix

Replace the skill with the version below (v2.0.0), which is already in use downstream. Compared with the current version, it:

  • puts gh api first after the installed package, with recipes for reading a file at a tag, listing the tree, release notes and code search
  • looks for packages in both the hoisted (node_modules/<pkg>) and isolated (node_modules/.bun/<pkg>@*) Bun layouts
  • splits the network rules by variant (default: open; sandbox: the allowlist plus allowed-domains.txt) and adds a one-line probe
  • drops the anonymous Contents API section and the "What NEVER works" table
  • notes that separate docs repos such as gohugoio/hugoDocs don't tag every release
Proposed SKILL.md
---
name: sandbox-fetch-docs
description: Use when needing to verify implementation against official library docs, check API contracts, or look up how a dependency works — especially after bugs caused by wrong assumptions about a library's API. Triggers on "check the docs", "verify against docs", "official documentation", "how does X API work", "canonical implementation".
metadata:
  author: Serge Gatezh
  url: https://github.com/gatezh
  version: "2.0.0"
---

# Fetch documentation in this devcontainer

Prefer sources pinned to the installed version. Vendor sites describe the latest release, which may not be what the project runs.

## 1. The installed package

For npm dependencies, the type definitions are the API contract and the source shows actual behaviour. Where Bun puts a package depends on the linker. The hoisted layout (`configVersion: 0` in `bun.lock`) uses `node_modules/<pkg>/`. The isolated layout uses `node_modules/.bun/<pkg>@<version>/node_modules/<pkg>/`. One command covers both:

```sh
ls -d node_modules/<pkg> node_modules/.bun/<pkg>@* 2>/dev/null
```

Tools pinned by mise (`.mise.toml`), such as `hugo`, aren't in `node_modules`. Run `<tool> version` to get the version, then read their source on GitHub at that tag.

## 2. GitHub through `gh`

`gh` is logged in in both container variants, which route git authentication through `gh auth git-credential`. The REST API allows 5,000 requests an hour.

```sh
# A file at a tag or branch
gh api 'repos/OWNER/REPO/contents/PATH?ref=TAG' -H 'Accept: application/vnd.github.raw'
# The whole tree, to find paths
gh api 'repos/OWNER/REPO/git/trees/REF?recursive=1' --jq '.tree[].path'
# Release notes between versions
gh release view TAG --repo OWNER/REPO
# Code search: default branch only, 10 requests a minute
gh search code 'QUERY' --repo OWNER/REPO
```

To find a package's repo, run `curl -s https://registry.npmjs.org/<pkg>/latest | jq -r .repository.url`.

Some projects keep their docs in a separate repo that tags only some releases. Hugo, for example, uses `gohugoio/hugoDocs`. If the exact tag 404s, list the tags and use the nearest one at or below the installed version.

## 3. Vendor doc sites

Which sites you can reach depends on the container variant:

- **Default (`.devcontainer/`)** has no firewall, so WebFetch reaches any public site. Many sites publish an index at `/llms.txt`.
- **Sandbox (`.devcontainer/claude-sandbox/`)** has a firewall that allows GitHub, the npm registry, the Anthropic API, the VS Code marketplace and the MDN MCP server, plus whatever is listed in `.devcontainer/claude-sandbox/allowed-domains.txt`. Other hosts time out, so read the docs' source on GitHub instead.

If you're unsure which variant you're in, run `curl -sS -m 5 -o /dev/null -w '%{http_code}' https://example.com`. A response of `200` means there's no firewall.

For web platform APIs (HTML, CSS, DOM, JavaScript), use the MDN MCP tools in either variant.

Related, starter only: claude-code/.claude/settings.json allows Bash(npx:*) in a bun-only template. Bash(bunx *) is the matching rule; bun * doesn't match bunx. ls, cat and find are already in Claude Code's built-in read-only set, so their allow rules can go. Dropping find also stops pre-approving find -exec and find -delete. Downstream also switched to the Bash(cmd *) form the permission dialog writes, and added "$schema": "https://json.schemastore.org/claude-code-settings.json".

Affected files in this repo

  • claude-code/.claude/skills/sandbox-fetch-docs/SKILL.md
  • .claude/skills/sandbox-fetch-docs/SKILL.md (the template repo's own copy)
  • claude-code/.claude/settings.json (starter permissions)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions