AgentSkillsCN

cc-web-workarounds

Claude Code Web 环境的限制与应对方案。当您在 CC Web 中运行代码、遭遇 gh/git 相关问题,或在远程环境中遇到命令意外失败时,可参考此方法。

SKILL.md
--- frontmatter
name: cc-web-workarounds
description: Claude Code Web environment limitations and workarounds. Use when running in CC Web, encountering gh/git issues, or when commands fail unexpectedly in remote environments.

CC Web Workarounds

Limitations and workarounds for Claude Code Web environments.

Environment Detection

bash
is_web_env=false
[ "$CLAUDE_CODE_REMOTE" = "true" ] && is_web_env=true
[ "${CLAUDE_ENVIRONMENT:-}" = "ccweb" ] && is_web_env=true
[ -n "${CODESPACES:-}" ] && is_web_env=true

Known Limitations

IssueWorkaround
gh pr checks failsUse gh api repos/OWNER/REPO/actions/runs
gh issue list failsUse gh api repos/OWNER/REPO/issues
Shallow git history (<50 commits)Use gh api for full history
claude -p subprocess brokenDefer tasks needing Claude subprocess
apt-get blockedNone; use local devcontainer
No git worktreesSingle-branch workflow only
New branch from main onlyCannot use existing branches or branch from non-main
No TexLive/LaTeXMLUse local for thesis builds

GitHub CLI Workarounds

Instead of gh pr checks:

bash
gh api repos/{owner}/{repo}/commits/{sha}/check-runs --jq '.check_runs[] | {name, status, conclusion}'

Instead of gh issue list:

bash
gh api repos/{owner}/{repo}/issues --jq '.[] | {number, title, state}'

Instead of local git log:

bash
gh api repos/{owner}/{repo}/commits --jq '.[].commit.message'

Shallow Clone Warning

Session startup detects shallow clones:

bash
local_commits=$(git rev-list --count HEAD 2>/dev/null || echo "0")
if [ "$local_commits" -lt 50 ]; then
    echo "WARNING: Shallow clone detected"
fi

Hook Crash Prevention

When writing hooks for CC Web:

  • Use bash -c not bash -lc (no login shell)
  • Fallback: ${CLAUDE_PROJECT_DIR:-.}
  • Add || true with set -e
  • Add --timeout=30 to wget

Emergency Minimal Settings

If hooks crash, use this .claude/settings.json:

json
{
  "env": { "GIT_PAGER": "cat" },
  "permissions": { "defaultMode": "bypassPermissions" }
}

See Also

  • .devcontainer/CLAUDE.md — Environment overview
  • .claude/hooks/session-start.sh — Environment detection