Environment Skill
When to use this skill:
- You need to understand the environment architecture (for troubleshooting, modifications, or curiosity)
- You're modifying or extending the environment setup
- You encounter environment-related errors and need deeper context than error messages provide
When NOT to use this skill:
- Normal thesis work (build, test, commit) - error messages explain limitations
- You encounter a "local devcontainer only" error - the error message is sufficient
Environment Architecture
This project supports two environments:
1. Local Devcontainer (Jörn's machine)
- Defined by:
.devcontainer/Dockerfile, .devcontainer/devcontainer.json, scripts/devcontainer-post-create.sh
- What it does: Pre-installs all dependencies (TexLive, Rust, Python, Node.js, etc.) in a Docker image
- Special features:
- Bind mounts for cache persistence (
/srv/devhome/* → /home/vscode/*)
- Worktrees support (
/workspaces/worktrees for git worktree isolation)
- Shared Rust build cache via
CARGO_TARGET_DIR=/workspaces/worktrees/shared/target
2. Claude Code Web Environment
- Defined by: Ubuntu 24.04 base with pre-installed language runtimes (see Claude Code docs)
- What it does: Provides a clean environment accessible from anywhere via web browser
- What's pre-installed: Rust, Python (with uv), Node.js, Git, build-essential
- What's NOT pre-installed: TexLive, latexml
- Key difference: No devcontainer files run, no bind mounts, no worktrees directory
Critical limitation (known bug as of Jan 2026):
- apt-get does NOT work in web environment (DNS blocked by proxy architecture)
- See: GitHub issue #14538
- Consequence: TexLive cannot be installed, LaTeX builds are local-only
- What works: cargo, uv/pip, npm (HTTP proxy compatible)
- What doesn't work: apt-get, dpkg, any system packages
Dependency Installation
Progressive Disclosure Strategy
Level 1: Error messages explain the situation
- Build/lint scripts check for dependencies and print clear errors
- Example:
pdflatex not found (TexLive is local devcontainer only)
Level 2: This skill (understanding)
- Explains environment architecture
- Documents conventions for modifications
Level 3: Detailed implementation
- Devcontainer config files (
.devcontainer/*)
- Reference docs in
references/ subdirectory (if any)
What's Available Where
| Dependency |
Local Devcontainer |
Web Environment |
| TexLive (pdflatex, chktex) |
Pre-installed in Dockerfile |
NOT available (apt-get blocked) |
| latexml |
Pre-installed in Dockerfile |
NOT available (apt-get blocked) |
| Rust (cargo, rustc) |
Pre-installed |
Pre-installed |
| Python + uv |
Pre-installed |
Pre-installed |
| Python packages |
uv sync --extra dev |
uv sync --extra dev |
Conventions for Modifying Environments
When you need to add dependencies or modify environment setup:
1. Document with Progressive Disclosure
- CLAUDE.md: Add one-line note to Environment Dependencies section
- This skill: Explain architecture changes if significant
- Config files: Keep comments factual, avoid speculation
2. Install Script Conventions
If you create install scripts:
- Make scripts idempotent (check before installing)
- Print helpful messages about time/disk usage
- Support
--help flag
- Point build/lint scripts to install script in error messages
3. Never Make False Claims
- Future agents will believe documentation literally
- Example: Don't call a 2GB install "slim"
- Example: Don't say "everywhere" when you mean "in local devcontainer"
- When uncertain, be explicit about what you don't know
4. Keep It Simple (KISS)
- Follow standard patterns (cargo, npm, pip/uv; apt-get in local only)
- Don't over-engineer for hypothetical future requirements
- Don't add noise to config files that agents don't need
5. Maintain Both Environments
- Local devcontainer: Bake dependencies into Dockerfile when reasonable
- Web environment: Only cargo/uv/npm work (no apt-get due to DNS bug)
- Test changes in both environments (or document what's untested)
6. DRY - Don't Repeat Yourself
- Information should live in ONE canonical place
- Link to that place rather than duplicating
- Exception: Error messages can repeat key info (like "local devcontainer only") for convenience
Common Tasks
Detecting Which Environment You're In
# Web environment has this variable
if [[ -n "${CLAUDE_CODE_REMOTE:-}" ]]; then
echo "Running in web environment"
else
echo "Running in local environment (or other)"
fi
Adding a New Dependency
For Python packages (works in both environments):
- Add to
packages/python_viterbo/pyproject.toml
- Run
uv sync --extra dev
For system dependencies (local devcontainer only):
- Add to
.devcontainer/Dockerfile
- Update build scripts to fail gracefully with clear error in web environment
- Update CLAUDE.md: Add one line to Environment Dependencies section
Fixing Environment-Specific Issues
Example: Rust builds depend on CARGO_TARGET_DIR=/workspaces/worktrees/shared/target in local, but that dir doesn't exist in web.
Approach:
- Identify the constraint (worktrees mount only exists in local)
- Make it environment-aware (unset CARGO_TARGET_DIR in web, or create dir)
- Document the difference in this skill if non-obvious
- Test both environments
Files to Read
.devcontainer/Dockerfile - What's baked into local devcontainer image
.devcontainer/devcontainer.json - Local devcontainer configuration
scripts/devcontainer-post-create.sh - Local environment initialization
.claude/CLAUDE.md - Top-level environment guidance for agents
1---2name: environment-53description: Understanding and maintaining the development environments for this thesis project. Use for environment architecture, troubleshooting, or modifying environment setup.4---56# Environment Skill78**When to use this skill**:9- You need to understand the environment architecture (for troubleshooting, modifications, or curiosity)10- You're modifying or extending the environment setup11- You encounter environment-related errors and need deeper context than error messages provide1213**When NOT to use this skill**:14- Normal thesis work (build, test, commit) - error messages explain limitations15- You encounter a "local devcontainer only" error - the error message is sufficient1617---1819## Environment Architecture2021This project supports two environments:2223### 1. Local Devcontainer (Jörn's machine)24- **Defined by**: `.devcontainer/Dockerfile`, `.devcontainer/devcontainer.json`, `scripts/devcontainer-post-create.sh`25- **What it does**: Pre-installs all dependencies (TexLive, Rust, Python, Node.js, etc.) in a Docker image26- **Special features**:27 - Bind mounts for cache persistence (`/srv/devhome/*` → `/home/vscode/*`)28 - Worktrees support (`/workspaces/worktrees` for git worktree isolation)29 - Shared Rust build cache via `CARGO_TARGET_DIR=/workspaces/worktrees/shared/target`3031### 2. Claude Code Web Environment32- **Defined by**: Ubuntu 24.04 base with pre-installed language runtimes (see Claude Code docs)33- **What it does**: Provides a clean environment accessible from anywhere via web browser34- **What's pre-installed**: Rust, Python (with uv), Node.js, Git, build-essential35- **What's NOT pre-installed**: TexLive, latexml36- **Key difference**: No devcontainer files run, no bind mounts, no worktrees directory3738**Critical limitation (known bug as of Jan 2026):**39- apt-get does NOT work in web environment (DNS blocked by proxy architecture)40- See: [GitHub issue #14538](https://github.com/anthropics/claude-code/issues/14538)41- **Consequence**: TexLive cannot be installed, LaTeX builds are local-only42- **What works**: cargo, uv/pip, npm (HTTP proxy compatible)43- **What doesn't work**: apt-get, dpkg, any system packages4445---4647## Dependency Installation4849### Progressive Disclosure Strategy5051**Level 1: Error messages explain the situation**52- Build/lint scripts check for dependencies and print clear errors53- Example: `pdflatex not found (TexLive is local devcontainer only)`5455**Level 2: This skill (understanding)**56- Explains environment architecture57- Documents conventions for modifications5859**Level 3: Detailed implementation**60- Devcontainer config files (`.devcontainer/*`)61- Reference docs in `references/` subdirectory (if any)6263### What's Available Where6465| Dependency | Local Devcontainer | Web Environment |66|------------|-------------------|-----------------|67| TexLive (pdflatex, chktex) | Pre-installed in Dockerfile | NOT available (apt-get blocked) |68| latexml | Pre-installed in Dockerfile | NOT available (apt-get blocked) |69| Rust (cargo, rustc) | Pre-installed | Pre-installed |70| Python + uv | Pre-installed | Pre-installed |71| Python packages | `uv sync --extra dev` | `uv sync --extra dev` |7273---7475## Conventions for Modifying Environments7677When you need to add dependencies or modify environment setup:7879### 1. Document with Progressive Disclosure80- **CLAUDE.md**: Add one-line note to Environment Dependencies section81- **This skill**: Explain architecture changes if significant82- **Config files**: Keep comments factual, avoid speculation8384### 2. Install Script Conventions85If you create install scripts:86- Make scripts idempotent (check before installing)87- Print helpful messages about time/disk usage88- Support `--help` flag89- Point build/lint scripts to install script in error messages9091### 3. Never Make False Claims92- Future agents will believe documentation literally93- Example: Don't call a 2GB install "slim"94- Example: Don't say "everywhere" when you mean "in local devcontainer"95- When uncertain, be explicit about what you don't know9697### 4. Keep It Simple (KISS)98- Follow standard patterns (cargo, npm, pip/uv; apt-get in local only)99- Don't over-engineer for hypothetical future requirements100- Don't add noise to config files that agents don't need101102### 5. Maintain Both Environments103- **Local devcontainer**: Bake dependencies into Dockerfile when reasonable104- **Web environment**: Only cargo/uv/npm work (no apt-get due to DNS bug)105- Test changes in both environments (or document what's untested)106107### 6. DRY - Don't Repeat Yourself108- Information should live in ONE canonical place109- Link to that place rather than duplicating110- Exception: Error messages can repeat key info (like "local devcontainer only") for convenience111112---113114## Common Tasks115116### Detecting Which Environment You're In117```bash118# Web environment has this variable119if [[ -n "${CLAUDE_CODE_REMOTE:-}" ]]; then120 echo "Running in web environment"121else122 echo "Running in local environment (or other)"123fi124```125126### Adding a New Dependency127128**For Python packages** (works in both environments):1291. Add to `packages/python_viterbo/pyproject.toml`1302. Run `uv sync --extra dev`131132**For system dependencies** (local devcontainer only):1331. Add to `.devcontainer/Dockerfile`1342. Update build scripts to fail gracefully with clear error in web environment1353. **Update CLAUDE.md**: Add one line to Environment Dependencies section136137### Fixing Environment-Specific Issues138139Example: Rust builds depend on `CARGO_TARGET_DIR=/workspaces/worktrees/shared/target` in local, but that dir doesn't exist in web.140141**Approach**:1421. Identify the constraint (worktrees mount only exists in local)1432. Make it environment-aware (unset CARGO_TARGET_DIR in web, or create dir)1443. Document the difference in this skill if non-obvious1454. Test both environments146147---148149## Files to Read150151- `.devcontainer/Dockerfile` - What's baked into local devcontainer image152- `.devcontainer/devcontainer.json` - Local devcontainer configuration153- `scripts/devcontainer-post-create.sh` - Local environment initialization154- `.claude/CLAUDE.md` - Top-level environment guidance for agents