OTP Manager Skill
Reusable skill for managing Erlang/OTP 28.3.1 in Claude Code Web environments.
Purpose
Provides automated procedures for:
- OTP Installation: Download and build OTP 28.3.1 from Erlang Solutions
- OTP Verification: Check installed version and compilation readiness
- OTP Cleanup: Remove build artifacts and cached files
Commands
/otp-manager fetch-build
Download and build OTP 28.3.1 from official Erlang Solutions packages.
Behavior:
- Check if OTP 28.3.1 is already installed (idempotent)
- Download erlang-solutions repository package
- Install OTP 28.3.1 via apt-get
- Verify installation success
- Return status + version
Idempotency: Safe to run multiple times. Skips installation if OTP >= 28.3.1 already exists.
Error Handling:
- Network timeout: Retries 3 times with exponential backoff
- Package installation failure: Clears cache and retries
- Permission denied: Reports error (requires sudo)
- Version mismatch: Reports installed version vs required
Output:
✅ OTP 28.3.1 installed successfully
Version: 28.3.1
Location: /usr/lib/erlang
Time: 45s
Example:
/otp-manager fetch-build
# Downloads and installs OTP 28.3.1
# Returns: exit code 0 (success) | 1 (failure)
/otp-manager verify
Check OTP version and verify compilation readiness.
IMPORTANT: Always source the environment file first to ensure OTP 28 is used:
source .erlmcp/env.sh
Behavior:
- Source
.erlmcp/env.sh(ensures OTP 28.3.1 in PATH) - Detect installed OTP version (erl -noshell -eval)
- Compare against required version (28.3.1)
- Test basic compilation (rebar3 version)
- Return verification result
Checks Performed:
- OTP version >= 28.3.1
- erl command available (from .erlmcp/env.sh)
- rebar3 command available
- Basic compilation works
Output:
✅ OTP verification passed
Installed: 28.3.1
Required: 28.3.1
rebar3: 3.24.0
Status: READY
Exit Codes:
- 0: Verification passed (OTP >= 28.3.1)
- 1: OTP not found or version too low
- 2: OTP found but rebar3 missing
- 3: OTP found but compilation test failed
Example:
/otp-manager verify
# Sources .erlmcp/env.sh, checks OTP version and compilation readiness
# Returns: exit code 0-3 (see above)
/otp-manager clean
Remove OTP build artifacts and cached files.
Behavior:
- Remove build artifacts in
/tmp/erlmcp-build/ - Clear apt-get cache for erlang packages
- Remove lock files in
.erlmcp/cache/ - Preserve installed OTP binaries (safe cleanup)
Safety:
- Does NOT uninstall OTP (only removes build artifacts)
- Does NOT remove user code or dependencies
- Does NOT affect rebar3 project builds
Output:
✅ OTP cleanup complete
Removed: 123 MB build artifacts
Cleared: 45 MB apt cache
Preserved: OTP 28.3.1 installation
Example:
/otp-manager clean
# Removes build artifacts and cache
# Returns: exit code 0 (success)
Integration with Subagents
This skill can be preloaded into subagents for autonomous OTP management:
Verifier Subagent (.claude/agents/verifier.md):
preload_skills:
- otp-manager
Build Engineer Subagent (.claude/agents/build-engineer.md):
preload_skills:
- otp-manager
Once preloaded, subagents can invoke OTP manager commands autonomously:
# Verifier checks OTP before running tests
/otp-manager verify
if [ $? -eq 0 ]; then
rebar3 eunit
fi
# Build engineer fetches OTP if missing
/otp-manager verify || /otp-manager fetch-build
Error Recovery
The skill implements robust error recovery:
| Error Class | Recovery Strategy |
|---|---|
| Network timeout | Retry 3x with exponential backoff (1s, 2s, 4s) |
| Package conflict | Clear apt cache and retry |
| Permission denied | Report to user (requires sudo) |
| Version mismatch | Report installed vs required version |
| Disk space | Report error (requires user intervention) |
Example: Network Timeout Recovery
⚠️ Network timeout downloading erlang-solutions package
🔄 Retry 1/3 (delay: 1s)...
⚠️ Network timeout downloading erlang-solutions package
🔄 Retry 2/3 (delay: 2s)...
✅ Download successful
Implementation Details
Source Files
otp_fetch_build.sh (120 lines):
- Downloads OTP 28.3.1 from erlang-solutions.com
- Installs via apt-get with retry logic
- Verifies installation success
- Creates lock file for idempotency
otp_verify.sh (50 lines):
- Detects OTP version via erl command
- Compares against required version
- Tests rebar3 availability
- Returns structured exit codes
otp_clean.sh (30 lines):
- Removes build artifacts
- Clears apt cache
- Preserves installed OTP
Design Principles
- Idempotent: All commands safe to run multiple times
- Fail-Safe: Clear error messages, no silent failures
- Cloud-Native: Works in ephemeral VM environments
- Reusable: Can be invoked by multiple subagents
- Auditable: Logs all operations to
.erlmcp/otp-manager.log
Testing
Test suite location: test/otp_manager_skill_tests.erl
Test Coverage:
- ✅ Idempotency: fetch-build twice produces same result
- ✅ Version detection: verify detects OTP 28.3.1 correctly
- ✅ Error handling: Network timeout triggers retry
- ✅ Clean operation: Removes artifacts without breaking OTP
- ✅ Slash command: /otp-manager invocation works
- ✅ Subagent integration: Can be preloaded into verifier
Running Tests:
rebar3 eunit --module=otp_manager_skill_tests
Expected output:
Testing otp_manager_skill_tests
All 6 tests passed.
Related Files
.claude/hooks/SessionStart.sh- Uses fetch-build logic on session start.claude/agents/verifier.md- Preloads this skill for OTP verification.claude/agents/build-engineer.md- Preloads this skill for OTP management.claude/settings.json- References otp-manager in skill registry
Changelog
v1.0.0 (2026-02-01)
- Initial implementation
- Commands: fetch-build, verify, clean
- Integration with verifier and build-engineer subagents
- Test coverage: 6 test cases
- Spec: AUTONOMOUS_IMPLEMENTATION_WORK_ORDER.md:WO-006
Converted and distributed by TomeVault — claim your Tome and manage your conversions.