Skip to content

Commit 62f0141

Browse files
committed
Initial commit: CLI tools skill with 74+ tool catalog
Features: - Reactive mode: auto-install missing tools on 'command not found' - Proactive mode: audit project environments for missing/outdated tools - Maintenance mode: batch update all managed tools Supports: Python, Node.js, Rust, Go, PHP, Ruby, Docker, Terraform, and more
0 parents  commit 62f0141

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+6715
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# OS files
2+
.DS_Store
3+
Thumbs.db
4+
5+
# Editor files
6+
*.swp
7+
*.swo
8+
*~
9+
.idea/
10+
.vscode/
11+
12+
# Temporary files
13+
*.tmp
14+
*.log
15+
*.bak
16+
17+
# Package archives
18+
*.tar.gz
19+
*.zip

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Netresearch GmbH & Co. KG
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# CLI Tools Skill
2+
3+
A Claude Code skill for automatic CLI tool management. Detects missing tools, installs them via optimal package managers, and audits project environments.
4+
5+
## Features
6+
7+
- **Reactive Mode**: Auto-detect "command not found" errors and install missing tools
8+
- **Proactive Mode**: Audit project environments and report missing/outdated tools
9+
- **Maintenance Mode**: Batch update all managed tools across package managers
10+
11+
## Supported Tools
12+
13+
74+ tools across categories:
14+
15+
| Category | Tools |
16+
|----------|-------|
17+
| **Core CLI** | ripgrep, fd, fzf, jq, yq, bat, delta, just |
18+
| **Languages** | python, node, rust, go, ruby, php |
19+
| **Package Managers** | uv, npm, pnpm, cargo, pip, gem, composer |
20+
| **DevOps** | docker, compose, kubectl, terraform, ansible |
21+
| **Linters** | eslint, prettier, ruff, black, shellcheck, phpstan |
22+
| **Security** | trivy, gitleaks, bandit, semgrep |
23+
| **Git Tools** | gh, glab, git-lfs, delta |
24+
25+
## Project Type Detection
26+
27+
Automatically detects project types and their requirements:
28+
29+
| Project Type | Detection Files | Required Tools |
30+
|--------------|-----------------|----------------|
31+
| Python | `pyproject.toml`, `requirements.txt` | python, uv |
32+
| Node.js | `package.json` | node, npm |
33+
| Rust | `Cargo.toml` | rust |
34+
| Go | `go.mod` | go |
35+
| PHP | `composer.json`, `*.php` | php, composer |
36+
| Ruby | `Gemfile` | ruby |
37+
| Docker | `Dockerfile`, `docker-compose.yml` | docker, compose |
38+
| Terraform | `*.tf` | terraform |
39+
40+
## Installation
41+
42+
### As a Claude Code Skill
43+
44+
```bash
45+
# Copy to your skills directory
46+
cp -r cli-tools ~/.claude/skills/
47+
```
48+
49+
### Manual Usage
50+
51+
```bash
52+
# Install a specific tool
53+
./scripts/install_tool.sh ripgrep install
54+
55+
# Detect project type
56+
./scripts/detect_project_type.sh json .
57+
58+
# Audit environment
59+
./scripts/check_environment.sh audit .
60+
61+
# Update all tools
62+
./scripts/auto_update.sh update
63+
```
64+
65+
## Triggers
66+
67+
The skill activates automatically on:
68+
69+
### Error Patterns
70+
```
71+
bash: <tool>: command not found
72+
zsh: command not found: <tool>
73+
'<tool>' is not recognized as an internal or external command
74+
```
75+
76+
### User Requests
77+
- "check environment", "audit tools"
78+
- "what's missing", "what's outdated"
79+
- "install development tools"
80+
- "update all tools"
81+
82+
## Installation Methods
83+
84+
The skill selects the optimal installation method based on catalog priority:
85+
86+
1. **GitHub Release Binary** - Direct download (fastest, no deps)
87+
2. **Cargo** - Rust tools via cargo install
88+
3. **UV/Pip** - Python tools
89+
4. **NPM** - Node tools
90+
5. **Apt/Brew** - System packages (fallback)
91+
92+
Priority: user-level (`~/.local/bin`, `~/.cargo/bin`) over system-level.
93+
94+
## Directory Structure
95+
96+
```
97+
cli-tools/
98+
├── SKILL.md # Skill definition and workflows
99+
├── catalog/ # Tool definitions (74+ JSON files)
100+
│ ├── ripgrep.json
101+
│ ├── php.json
102+
│ └── ...
103+
├── scripts/
104+
│ ├── install_tool.sh # Main installer
105+
│ ├── auto_update.sh # Batch updater
106+
│ ├── check_environment.sh
107+
│ ├── detect_project_type.sh
108+
│ ├── lib/ # Shared libraries
109+
│ └── installers/ # Method-specific installers
110+
└── references/
111+
├── binary_to_tool_map.md
112+
└── project_type_requirements.md
113+
```
114+
115+
## Requirements
116+
117+
- **jq**: Required for JSON parsing (auto-installed if missing)
118+
- **Bash 4+**: Required for associative arrays
119+
- **Internet**: Required for tool downloads
120+
121+
## License
122+
123+
MIT License - See [LICENSE](LICENSE) for details.
124+
125+
## Contributing
126+
127+
1. Add tool definition to `catalog/<tool>.json`
128+
2. Update `references/binary_to_tool_map.md` if binary differs from tool name
129+
3. Test with `scripts/install_tool.sh <tool> install`
130+
4. Submit PR
131+
132+
## Credits
133+
134+
Created for use with [Claude Code](https://claude.ai/code) by Anthropic.

SKILL.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
---
2+
name: cli-tools
3+
description: |
4+
CLI tool management for coding agents. This skill should be used when:
5+
- A command fails with "command not found" or similar errors
6+
- The user asks to install, update, or check CLI tools
7+
- A project needs environment setup or dependency checking
8+
- Tools are missing, outdated, or need reconciliation
9+
Provides auto-installation of 74+ tools via optimal package managers,
10+
project environment auditing, and batch update capabilities.
11+
---
12+
13+
# CLI Tools Skill
14+
15+
Manage CLI tool installation, environment auditing, and updates for coding agents.
16+
17+
## Capabilities
18+
19+
1. **Reactive: Missing Tool Resolution** - Auto-detect and install tools when commands fail
20+
2. **Proactive: Environment Checking** - Audit project dependencies and tool versions
21+
3. **Maintenance: Batch Updates** - Update all managed tools across package managers
22+
23+
## Triggers
24+
25+
### Reactive Mode (Auto-Install Missing Tools)
26+
27+
Activate when observing these error patterns:
28+
29+
```
30+
bash: <tool>: command not found
31+
zsh: command not found: <tool>
32+
'<tool>' is not recognized as an internal or external command
33+
sh: <tool>: not found
34+
/bin/sh: <tool>: not found
35+
Error: Cannot find module '<tool>'
36+
```
37+
38+
### Proactive Mode (Environment Check)
39+
40+
Activate on user requests:
41+
- "check environment", "check my tools", "audit tools"
42+
- "what's missing", "what's outdated", "update tools"
43+
- "fix my environment", "setup environment"
44+
- "install development tools", "install project dependencies"
45+
- Project initialization or `/sc:load` context
46+
47+
### Maintenance Mode (Batch Updates)
48+
49+
Activate on:
50+
- "update all tools", "upgrade everything"
51+
- "update package managers", "refresh tools"
52+
53+
## Workflows
54+
55+
### Workflow 1: Missing Tool Resolution
56+
57+
When a command fails with "command not found":
58+
59+
1. **Extract tool name** from error message
60+
2. **Resolve catalog entry** using `references/binary_to_tool_map.md`:
61+
- `rg``ripgrep`
62+
- `fd``fd`
63+
- `python3``python`
64+
3. **Check if catalog exists**: `catalog/<tool>.json`
65+
4. **Execute installation**:
66+
```bash
67+
scripts/install_tool.sh <tool> install
68+
```
69+
5. **Verify installation**: Check command now works
70+
6. **Retry original command**
71+
72+
**Example:**
73+
```
74+
User runs: rg "pattern" src/
75+
Error: bash: rg: command not found
76+
77+
Action sequence:
78+
1. Lookup: rg → ripgrep (from binary_to_tool_map.md)
79+
2. Execute: scripts/install_tool.sh ripgrep install
80+
3. Verify: rg --version
81+
4. Retry: rg "pattern" src/
82+
```
83+
84+
### Workflow 2: Environment Audit
85+
86+
When checking project environment:
87+
88+
1. **Detect project type**:
89+
```bash
90+
scripts/detect_project_type.sh text .
91+
```
92+
2. **Run full audit**:
93+
```bash
94+
scripts/check_environment.sh audit .
95+
```
96+
3. **Report findings**:
97+
- Missing required tools
98+
- Outdated tools
99+
- PATH issues
100+
- Duplicate installations
101+
4. **Offer to fix** issues found
102+
103+
**Example:**
104+
```
105+
User: "check my environment"
106+
107+
Action sequence:
108+
1. Detect: Python project (pyproject.toml found)
109+
2. Required: python, uv
110+
3. Recommended: ruff, black, mypy
111+
4. Check each tool...
112+
5. Report: "Missing: ruff. All others OK."
113+
6. Offer: "Install ruff? [Y/n]"
114+
```
115+
116+
### Workflow 3: Batch Updates
117+
118+
When updating all tools:
119+
120+
1. **Dry run first** to preview changes:
121+
```bash
122+
DRY_RUN=1 scripts/auto_update.sh update
123+
```
124+
2. **Confirm with user** before proceeding
125+
3. **Execute updates** by scope:
126+
```bash
127+
SCOPE=user scripts/auto_update.sh update
128+
```
129+
4. **Report results**: Updated count, failures
130+
131+
## Available Scripts
132+
133+
| Script | Purpose | Usage |
134+
|--------|---------|-------|
135+
| `install_tool.sh` | Install/update/uninstall tools | `install_tool.sh <tool> [install\|update\|uninstall]` |
136+
| `auto_update.sh` | Batch update all package managers | `auto_update.sh [detect\|update]` |
137+
| `check_environment.sh` | Audit environment | `check_environment.sh [audit\|path\|project]` |
138+
| `detect_project_type.sh` | Detect project type | `detect_project_type.sh [text\|json] [dir]` |
139+
140+
## Catalog Coverage
141+
142+
74 tools across categories:
143+
144+
- **Core CLI**: ripgrep, fd, fzf, jq, yq, bat, delta, just
145+
- **Languages**: python, node, rust, go, ruby
146+
- **Package Managers**: uv, npm, pnpm, cargo, pip, gem
147+
- **DevOps**: docker, compose, kubectl, terraform, ansible
148+
- **Linters**: eslint, prettier, ruff, black, shellcheck
149+
- **Security**: trivy, gitleaks, bandit, semgrep
150+
- **Git Tools**: gh, glab, git-lfs, delta
151+
152+
## Installation Methods
153+
154+
The skill selects the optimal installation method based on catalog priority:
155+
156+
1. **GitHub Release Binary** - Direct download (fastest, no deps)
157+
2. **Cargo** - Rust tools via cargo install
158+
3. **UV/Pip** - Python tools
159+
4. **NPM** - Node tools
160+
5. **Apt/Brew** - System packages (fallback)
161+
162+
Priority: user-level (`~/.local/bin`, `~/.cargo/bin`) over system-level.
163+
164+
## References
165+
166+
Load these as needed:
167+
168+
- `references/binary_to_tool_map.md` - Binary name to catalog entry mapping
169+
- `references/project_type_requirements.md` - Project type to required tools
170+
171+
## Error Handling
172+
173+
If installation fails:
174+
175+
1. Check error message for root cause
176+
2. Try alternative installation method (catalog has multiple)
177+
3. Check network connectivity
178+
4. Verify package manager is working
179+
5. Report failure with actionable guidance
180+
181+
## Notes
182+
183+
- **jq dependency**: Most scripts require `jq`. Install it first if missing.
184+
- **PATH updates**: After installation, may need to reload shell or update PATH.
185+
- **Permissions**: User-level installs do not need sudo. System installs may.
186+
- **Offline mode**: Cannot install without network, but can audit local tools.

catalog/ansible-core.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "ansible-core",
3+
"install_method": "pipx",
4+
"description": "Ansible core automation engine",
5+
"homepage": "https://ansible.com",
6+
"github_repo": "ansible/ansible",
7+
"binary_name": "ansible",
8+
"package_name": "ansible-core",
9+
"guide": {
10+
"display_name": "Ansible Core",
11+
"install_action": "upgrade",
12+
"order": 350
13+
},
14+
"notes": "ansible-core is the base Ansible engine. The 'ansible' package includes additional collections."
15+
}

catalog/ast-grep.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "ast-grep",
3+
"install_method": "github_release_binary",
4+
"description": "A CLI tool for code structural search, lint and rewriting",
5+
"homepage": "https://github.com/ast-grep/ast-grep",
6+
"github_repo": "ast-grep/ast-grep",
7+
"binary_name": "ast-grep",
8+
"download_url_template": "https://github.com/ast-grep/ast-grep/releases/download/{version}/app-{arch}-unknown-linux-gnu.zip",
9+
"arch_map": {
10+
"x86_64": "x86_64",
11+
"aarch64": "aarch64",
12+
"armv7l": "armv7"
13+
}
14+
}

0 commit comments

Comments
 (0)