Build tools that work on everyone's device, not just yours.
The problem: Your code works perfectly on your machine but breaks on others because of hardcoded paths, account names, or missing validation.
This skill: A proven methodology for building tools that auto-discover setup variations and work universally.
- bash
- Basic understanding of shell scripts
Your tools work on any device without manual configuration.
This skill provides:
- Three discovery questions to ask before coding
- Four core patterns for universal tools
- An automated pre-publish checklist
- Real-world examples from debugging sessions
Learned from fixing tools that failed on other devices despite working perfectly locally.
clawdhub install portable-toolsResult: You build tools once and they work everywhere.
Before writing any code, answer three questions:
-
What varies between devices?
- Account names, file paths, data formats, OS versions?
-
How do I prove this works?
- Can I show BEFORE/AFTER with real values from different setups?
-
What happens when it breaks?
- Have I tested with wrong config, missing data, edge cases?
Then implement using four core patterns:
Don't assume. Pass parameters explicitly.
# ❌ Ambiguous
find_entry "service"
# ✅ Explicit
find_entry "service" "account"Check structure before use.
DATA=$(read_config)
validate "$DATA" || error "Invalid structure"Try alternatives when configured value fails.
for candidate in "$configured" "default" "fallback"; do
if has_data "$candidate"; then break; fi
doneShow what you tried and how to verify.
error "Not found
Tried: $attempts
Verify with: command_to_check"Before publishing, run the automated checklist:
bash ~/clawd/skills/portable-tools/pre-publish-checklist.sh /path/to/your/codeOutput:
✅ No hardcoded paths
✅ Has validation patterns
⚠️ Errors could be more helpful
Success metric: Someone with a different setup can use your tool without asking you questions.
Everything below is optional. The four patterns above handle most cases.
This section contains:
- Full methodology guide
- Real-world case studies
- Integration examples
You don't need to read this to start building portable tools.
Full Methodology Guide
See SKILL.md for complete patterns and anti-patterns.
Key topics covered:
- Discovery phase (list what varies)
- Implementation patterns in detail
- Testing phase (wrong config, missing data, edge cases)
- Pre-flight checklist breakdown
- Common anti-patterns to avoid
Real-World Example: OAuth Refresher
The problem:
Script assumed single keychain entry. Read the wrong one.
Root cause:
Didn't ask "what varies between devices" upfront.
Symptoms:
- Worked on one device
- Failed on others with "no refresh token found"
- Actually had TWO keychain entries (metadata vs full data)
Fix applied:
- Made account name explicit (not ambiguous)
- Validated data structure before use
- Built automatic fallback to common names
- Added helpful errors with verification commands
Result: Works across all device setups without configuration.
See full postmortem in SKILL.md.
Integration With Other Workflows
Add to testing section:
## Cross-Device Testing
- [ ] Test with different account names
- [ ] Test with wrong config
- [ ] Test with missing dataBefore publishing:
## Portability Check
- [ ] No hardcoded paths
- [ ] Validation on all inputs
- [ ] Helpful errorsAnswer the three questions upfront when designing new skills.
MIT