AgentSkillsCN

web-environment-setup

为构建 Umbraco.AI 解决方案,搭建 Claude Code Web 环境。安装 .NET SDK,配置 NuGet 代理,并为 GitVersioning 做好准备。适用于在启动新的 Claude Code Web 会话以构建项目时使用。

SKILL.md
--- frontmatter
name: web-environment-setup
description: Sets up Claude Code web environment for building the Umbraco.AI solution. Installs .NET SDK, configures proxy for NuGet, and prepares git for GitVersioning. Use this when starting a new Claude Code web session to build the project.
allowed-tools: Bash, Read

Web Environment Setup

You are helping set up the Umbraco.AI repository for building in Claude Code web environment.

Task

Run the web environment setup script to prepare the environment for .NET development.

Quick Start

bash
# One-command setup
source .claude/scripts/setup-web-environment.sh

# Build
dotnet build Umbraco.AI.sln

Workflow

  1. Run the setup script:

    bash
    source .claude/scripts/setup-web-environment.sh
    
  2. Verify the setup by checking:

    • dotnet --version returns 10.x
    • Proxy environment variables are set
    • Git is not a shallow clone
  3. Test the build:

    bash
    dotnet build Umbraco.AI.sln
    

Problem

Claude Code web runs in a sandboxed environment with restrictions:

  1. Proxy Authentication - Network requests go through a JWT-authenticated proxy
  2. Package Feed Restrictions - Only certain hosts are allowed (e.g., api.nuget.org but not www.myget.org)
  3. Shallow Git Clones - May break Nerdbank.GitVersioning
  4. .NET SDK - May not be pre-installed

Scripts

ScriptPurposeUsage
setup-web-environment.shFull environment setupsource .claude/scripts/setup-web-environment.sh
setup-dotnet-proxy.shProxy + NuGet config onlysource .claude/scripts/setup-dotnet-proxy.sh
dotnet-with-proxy.shRun dotnet with proxy.claude/scripts/dotnet-with-proxy.sh restore

What setup-web-environment.sh Does

  1. Installs .NET SDK 10.0 via apt (if not present)
  2. Starts px-proxy to handle JWT-authenticated proxy for NuGet
  3. Creates user-level NuGet.Config that uses only api.nuget.org (bypasses restricted MyGet feeds)
  4. Unshallows git clone so Nerdbank.GitVersioning can calculate version height

Environment Detection

All scripts automatically detect if they're running in Claude Code web by checking for JWT proxy patterns:

bash
if [[ "$HTTP_PROXY" =~ "jwt_" ]] && [[ "$HTTP_PROXY" =~ "@" ]]; then
    # Claude Code web environment - run setup
else
    # Local environment - do nothing
fi
EnvironmentHTTP_PROXY valueDetection
Claude Code webhttp://...jwt_eyJ...@host:port✅ Detected
Local (no proxy)(unset)❌ Not detected
Local (corporate proxy)http://proxy.corp:8080❌ Not detected

On local machines, the scripts do nothing - they're safe to run anywhere.

Troubleshooting

IssueSolution
Proxy errorsCheck /tmp/px-proxy.log
NuGet restore failsVerify proxy: pgrep -f px
GitVersioning errorsRun git fetch --unshallow origin
MyGet warningsSafe to ignore - nuget.org is used instead

How It Works

code
┌─────────────────────────────────────────────────────────────────┐
│                    Claude Code Web Environment                   │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  HTTP_PROXY = http://...jwt_<token>@<host>:<port>              │
│       │                                                         │
│       ▼                                                         │
│  ┌─────────────┐     ┌─────────────┐     ┌─────────────┐       │
│  │  px-proxy   │────▶│  Sandbox    │────▶│  Allowed    │       │
│  │  :3128      │     │  Proxy      │     │  Hosts      │       │
│  └─────────────┘     └─────────────┘     └─────────────┘       │
│       ▲                                         │               │
│       │                                         ▼               │
│  ┌─────────────┐                        ┌─────────────┐        │
│  │   dotnet    │                        │ api.nuget.org│        │
│  │   restore   │                        │ (allowed)   │        │
│  └─────────────┘                        └─────────────┘        │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

The px-proxy handles the JWT authentication transparently, allowing standard .NET tooling to work through the sandbox proxy.