WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto

feat: add working-with-devenv skill for Nix/devenv environments (#17)

Add comprehensive skill for working with Nix and devenv to prevent
common anti-patterns and teach proper development workflows.

**Skill Features:**
- Quick reference table for common operations
- Patterns for interactive dev, scripts, and automation
- direnv setup for automatic environment activation
- Anti-patterns prevented: manual PATH modification, global installs,
nested shells, assuming commands available
- Troubleshooting guide

**Development Process:**
- Created using TDD for documentation (RED-GREEN-REFACTOR)
- Tested with multiple pressure scenarios
- Verified agents follow proper patterns after skill deployment
- Condensed from 928 to 597 words for token efficiency

The skill is installable via: cp -r skills/working-with-devenv ~/.claude/skills/

authored by

Malpercio and committed by
GitHub
832b1f86 6d32d665

+189 -1
-1
CLAUDE.md
··· 105 105 106 106 These are pre-existing issues that need to be resolved. Until fixed, use `--no-verify` when committing or temporarily disable the typecheck command in `.lefthook.yml`. 107 107 108 - 109 108 ## Testing Standards 110 109 111 110 **CRITICAL: Always run tests before committing code or requesting code review.**
+42
skills/README.md
··· 1 + # Claude Code Skills 2 + 3 + This directory contains Claude Code skills developed for this project. These skills help AI agents work effectively with our development environment and tooling. 4 + 5 + ## Available Skills 6 + 7 + ### working-with-devenv 8 + 9 + A comprehensive guide for working with Nix and devenv environments. Prevents common anti-patterns like manual PATH modification and teaches proper patterns for: 10 + 11 + - Environment detection and verification 12 + - Interactive development workflows 13 + - Script automation with devenv 14 + - Automatic activation using direnv 15 + - Common mistakes to avoid 16 + 17 + **Use this skill when:** Working with projects that use Nix/devenv, encountering command not found errors, or writing automation scripts. 18 + 19 + ## Installing Skills 20 + 21 + To use these skills in your local Claude Code environment: 22 + 23 + ```sh 24 + # Copy skill to your personal skills directory 25 + cp -r skills/working-with-devenv ~/.claude/skills/ 26 + ``` 27 + 28 + Skills in `~/.claude/skills/` are automatically discovered by Claude Code agents. 29 + 30 + ## Skill Development 31 + 32 + These skills follow Test-Driven Development principles for documentation: 33 + 34 + 1. **RED Phase** - Test agents without skill, document anti-patterns 35 + 2. **GREEN Phase** - Write skill addressing specific violations 36 + 3. **REFACTOR Phase** - Close loopholes, optimize for clarity 37 + 38 + See individual skill directories for testing scenarios and baseline findings. 39 + 40 + ## Contributing 41 + 42 + Skills that are broadly useful beyond this project can be contributed back to the Superpowers Marketplace. Project-specific conventions should go in `CLAUDE.md` instead.
+147
skills/working-with-devenv/SKILL.md
··· 1 + --- 2 + name: working-with-devenv 3 + description: Use when working with projects that use Nix and devenv for dependency management, before running package manager commands (pnpm, npm, turbo), or when encountering command not found errors in devenv projects 4 + --- 5 + 6 + # Working with Devenv 7 + 8 + ## Overview 9 + 10 + **devenv** manages project dependencies through Nix. Commands like `pnpm`, `node`, `turbo` live in `.devenv/profile/bin/` and are only available inside a devenv shell. 11 + 12 + **Core principle:** Verify you're in devenv before running managed commands. Never manually modify PATH. 13 + 14 + ## Quick Reference 15 + 16 + | Task | Command | When | 17 + |------|---------|------| 18 + | Check if in devenv | `echo $DEVENV_STATE` | Shows path if active, empty if not | 19 + | Enter interactive shell | `devenv shell` | For multiple commands, development work | 20 + | Run single command | `devenv shell -c "command"` | One-off execution, CI scripts | 21 + | Auto-activate (best) | `direnv allow` (once) | Automatic activation on `cd` | 22 + | Exit devenv shell | `exit` | Leave interactive shell | 23 + 24 + ## Patterns 25 + 26 + ### Interactive Development 27 + 28 + ```bash 29 + devenv shell # Enter shell once 30 + pnpm install # Run multiple commands 31 + pnpm build 32 + pnpm test 33 + exit # Leave when done 34 + ``` 35 + 36 + ### One-Off Commands 37 + 38 + ```bash 39 + devenv shell -c "pnpm build" # Single command 40 + devenv shell -c "pnpm install && pnpm build" # Chain commands 41 + ``` 42 + 43 + ### Scripts and Automation 44 + 45 + ```bash 46 + #!/usr/bin/env bash 47 + set -e 48 + 49 + # Auto-activate devenv if not already in it 50 + if [ -z "$DEVENV_STATE" ]; then 51 + exec devenv shell -c "$0 $@" 52 + fi 53 + 54 + # Rest of script runs with devenv active 55 + pnpm install && pnpm build && pnpm test 56 + ``` 57 + 58 + **Why `exec`:** Replaces current process instead of nesting shells. 59 + 60 + ### Automatic Activation with direnv (Best Practice) 61 + 62 + **Setup once:** 63 + ```bash 64 + brew install direnv # Install direnv 65 + echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc # Hook into shell (or bash) 66 + source ~/.zshrc # Reload config 67 + cd /path/to/project # Navigate to project 68 + direnv allow # Allow activation 69 + ``` 70 + 71 + **Then just use commands:** 72 + ```bash 73 + cd /path/to/project # Automatically activates devenv 74 + pnpm build # Commands work immediately 75 + ``` 76 + 77 + **Advantages:** No manual `devenv shell`, auto-activates/deactivates on `cd`, team consistency. 78 + 79 + **Note:** If project has `.envrc` file, it's already configured for direnv. 80 + 81 + ## Common Mistakes 82 + 83 + ### ❌ Manual PATH Modification 84 + 85 + ```bash 86 + # DON'T 87 + export PATH=.devenv/profile/bin:$PATH 88 + PATH=.devenv/profile/bin:$PATH pnpm build 89 + ``` 90 + 91 + **Why wrong:** `.devenv/profile/bin/` paths change on updates, bypasses environment setup, breaks if devenv not built. 92 + 93 + **Do instead:** `devenv shell -c "pnpm build"` or use direnv. 94 + 95 + ### ❌ Global Package Installation 96 + 97 + ```bash 98 + # DON'T 99 + npm install -g turbo 100 + pnpm add -g some-package 101 + ``` 102 + 103 + **Why wrong:** devenv manages dependencies via Nix. Global installs create version conflicts, not reproducible. 104 + 105 + **Do instead:** Check if in devenv first, or add to `devenv.nix`. 106 + 107 + ### ❌ Nested Shells 108 + 109 + ```bash 110 + # DON'T enter devenv when already in devenv 111 + devenv shell # Creates nested shell 112 + ``` 113 + 114 + **Why wrong:** Wastes resources, confusing exit behavior. 115 + 116 + **Do instead:** Check `$DEVENV_STATE` first: `[ -n "$DEVENV_STATE" ] && echo "Already in devenv"` 117 + 118 + ### ❌ Assuming Commands Are Available 119 + 120 + ```bash 121 + # DON'T run without checking environment 122 + pnpm build # Might work, might not 123 + ``` 124 + 125 + **Why wrong:** Inconsistent behavior, fails for others/CI. 126 + 127 + **Do instead:** Use `devenv shell -c` or verify `$DEVENV_STATE` first. 128 + 129 + ## Troubleshooting 130 + 131 + **Command not found after entering devenv:** 132 + - Run `devenv update` to rebuild environment 133 + - Verify `.devenv/` directory exists 134 + 135 + **Nested shell confusion:** 136 + - Check depth: `echo $SHLVL` 137 + - Exit to fresh shell: `exec bash` 138 + 139 + **PATH seems wrong:** 140 + - Never modify PATH manually - let devenv manage it 141 + - Rebuild: `devenv update` 142 + 143 + ## When NOT to Use 144 + 145 + - Already in devenv (check `$DEVENV_STATE` first) 146 + - System commands (`ls`, `grep`, `git` don't need devenv) 147 + - Other project's commands (only use for current project)