name: your-skill-name description: Use this skill when [specific CLI-related situations]. This includes [use cases involving command-line tools]. Keywords: [trigger words, tool names].
[Skill Title]
[Overview of what this CLI-focused skill accomplishes]
CLI Tools
Essential command-line tools for this skill:
| Tool | Purpose | Installation |
|---|---|---|
tool-name |
[What it does] | npm install -g tool-name |
another-tool |
[What it does] | Built-in / brew install |
Approach
1. [First Phase]
# Description of what this does
command --with flags
# Another command
another-command argument
2. [Second Phase]
# Chained commands
command1 | command2 | command3
# With variables
RESULT=$(command)
echo "$RESULT"
3. [Third Phase]
# Final operations
final-command --output result.txt
Command Reference
[Category 1]
# [Description]
tool command --flag value
# [Description]
tool other-command
[Category 2]
# [Description]
another-tool --option
# [Description]
another-tool subcommand
Examples
Example 1: [Use Case]
User Query: "[example query]"
Commands:
# Step 1: [Description]
first-command
# Step 2: [Description]
second-command
# Step 3: [Description]
third-command
Output:
[Expected output]
Example 2: [Another Use Case]
User Query: "[another query]"
Commands:
command1 && command2 && command3
Node.js Integration
When CLI tools aren't sufficient, use Node.js:
#!/usr/bin/env node
import { exec } from 'child_process';
import { promisify } from 'util';
const execAsync = promisify(exec);
async function runCommands() {
const { stdout: result1 } = await execAsync('command1');
const { stdout: result2 } = await execAsync(`command2 ${result1.trim()}`);
console.log(result2);
}
runCommands();
Best Practices
- Always quote shell variables:
"$VAR"not$VAR - Use absolute paths when possible
- Chain commands with
&&for sequential execution - Use
|for piping output between commands - Check command exit codes for error handling
Validation
- All required CLI tools are available
- Commands complete without errors
- Output matches expected format
- No sensitive data exposed in logs
Troubleshooting
Issue: Command Not Found
Symptoms: command: not found
Solution:
# Check if installed
which command-name
# Install if missing
npm install -g command-name
# or
brew install command-name
Issue: Permission Denied
Symptoms: Permission denied
Solution:
# Check permissions
ls -la file-path
# Fix if needed
chmod +x script.sh