/setperms
Initialize Claude Code with modern dev-shell-tools for a comfortable development experience.
What This Does
Installs complete dev environment setup:
- Permissions (
.claude/settings.local.json) - Pre-approved CLI tools
- Rules (
.claude/rules/cli-tools.md) - Instructions to prefer modern tools
Tools from dev-shell-tools:
Core Tools:
- Git: Full git access, lazygit, gh (GitHub CLI), delta, difft
- File ops: ls, mkdir, cat, wc, tree, eza, bat, chmod
- Search: rg (ripgrep), fd, fzf, ast-grep/sg
- Navigation: zoxide/z, broot/br
- Data processing: jq, yq, sd, xargs
- Analysis: tokei, procs, hyperfine, dust
Dev Tools:
- Package managers: npm, node, python, uv, pip, brew
- Task runners: just, bash
- Network: curl, http (httpie), firecrawl
- Documentation: tldr
- Windows: powershell
AI CLI Tools:
- gemini: Google Gemini CLI (2M context)
- claude: Anthropic Claude CLI
- codex: OpenAI Codex CLI
- perplexity: Perplexity CLI (web search)
Execution Flow
/setperms
|
+-- Check for existing .claude/ files
| +-- If exists: Ask to overwrite or skip
| +-- If not: Proceed
|
+-- Create .claude directory
+-- Create .claude/rules directory
|
+-- Write settings.local.json (permissions)
+-- Write rules/cli-tools.md (tool preferences)
Instructions
Step 1: Check for existing settings
ls -la .claude/settings.local.json 2>/dev/null
ls -la .claude/rules/cli-tools.md 2>/dev/null
If files exist, ask user:
- Overwrite: Replace entirely
- Skip: Keep existing, do nothing
Step 2: Create directories
mkdir -p .claude/rules
Step 3: Write permissions file
Write to .claude/settings.local.json:
{
"permissions": {
"allow": [
"Bash(git:*)",
"Bash(ls:*)",
"Bash(mkdir:*)",
"Bash(cat:*)",
"Bash(wc:*)",
"Bash(tree:*)",
"Bash(curl:*)",
"Bash(rg:*)",
"Bash(fd:*)",
"Bash(fzf:*)",
"Bash(z:*)",
"Bash(zoxide:*)",
"Bash(br:*)",
"Bash(broot:*)",
"Bash(ast-grep:*)",
"Bash(sg:*)",
"Bash(bat:*)",
"Bash(eza:*)",
"Bash(delta:*)",
"Bash(difft:*)",
"Bash(jq:*)",
"Bash(yq:*)",
"Bash(sd:*)",
"Bash(lazygit:*)",
"Bash(gh:*)",
"Bash(tokei:*)",
"Bash(uv:*)",
"Bash(just:*)",
"Bash(http:*)",
"Bash(procs:*)",
"Bash(hyperfine:*)",
"Bash(npm:*)",
"Bash(node:*)",
"Bash(python:*)",
"Bash(pip:*)",
"Bash(powershell -Command:*)",
"Bash(powershell.exe:*)",
"Bash(bash:*)",
"Bash(chmod:*)",
"Bash(xargs:*)",
"Bash(command -v:*)",
"Bash(brew:*)",
"Bash(tldr:*)",
"Bash(dust:*)",
"Bash(btm:*)",
"Bash(bottom:*)",
"Bash(firecrawl:*)",
"Bash(gemini:*)",
"Bash(claude:*)",
"Bash(codex:*)",
"Bash(perplexity:*)"
],
"deny": [],
"ask": [
"Bash(git reset --hard:*)",
"Bash(git checkout -- :*)",
"Bash(git clean -f:*)",
"Bash(git stash drop:*)",
"Bash(git stash clear:*)",
"Bash(git restore --worktree:*)",
"Bash(git push --force:*)",
"Bash(git push -f:*)",
"Bash(git push origin --force:*)",
"Bash(git push origin -f:*)",
"Bash(git branch -D:*)"
]
},
"hooks": {}
}
Step 4: Write rules file
Write to .claude/rules/cli-tools.md:
# CLI Tool Preferences (dev-shell-tools)
ALWAYS prefer modern CLI tools over traditional alternatives.
## File Search & Navigation
| Instead of | Use | Why |
|------------|-----|-----|
| `find` | `fd` | 5x faster, respects .gitignore |
| `grep` | `rg` (ripgrep) | 10x faster, respects .gitignore |
| `ls` | `eza` | Git status, tree view |
| `cat` | `bat` | Syntax highlighting |
| `cd` + manual | `z`/`zoxide` | Frecent directories |
| `tree` | `eza --tree` | Interactive |
## Data Processing
| Instead of | Use |
|------------|-----|
| `sed` | `sd` |
| Manual JSON | `jq` |
| Manual YAML | `yq` |
## Git Operations
| Instead of | Use |
|------------|-----|
| `git diff` | `delta` or `difft` |
| Manual git | `lazygit` |
| GitHub web | `gh` |
## Code Analysis
- Line counts: `tokei`
- AST search: `ast-grep` / `sg`
- Benchmarks: `hyperfine`
- Disk usage: `dust`
## System Monitoring
| Instead of | Use |
|------------|-----|
| `du -h` | `dust` |
| `top`/`htop` | `btm` (bottom) |
## Documentation
| Instead of | Use |
|------------|-----|
| `man <cmd>` | `tldr <cmd>` |
## Python
| Instead of | Use |
|------------|-----|
| `pip` | `uv` |
| `python -m venv` | `uv venv` |
## Task Running
Prefer `just` over Makefiles.
## Web Fetching
| Priority | Tool | When to Use |
|----------|------|-------------|
| 1 | `WebFetch` | First attempt - fast, built-in |
| 2 | `r.jina.ai/URL` | JS-rendered pages, cleaner extraction |
| 3 | `firecrawl <url>` | Anti-bot bypass, blocked sites |
## AI CLI Tools
For multi-model analysis:
| Tool | Model | Best For |
|------|-------|----------|
| `gemini` | Gemini 2.5 | 2M context, large codebases |
| `claude` | Claude | Coding, analysis |
| `codex` | OpenAI | Deep reasoning |
| `perplexity` | Perplexity | Web search, current info |
## Git Safety
Destructive commands require confirmation (in "ask" list):
| Command | Risk | Safe Alternative |
|---------|------|------------------|
| `git reset --hard` | Loses uncommitted changes | `git stash` first |
| `git checkout -- <file>` | Discards file changes | `git stash` or `git diff` first |
| `git clean -fd` | Deletes untracked files | `git clean -n` (dry run) first |
| `git stash drop` | Permanently deletes stash | Check `git stash list` first |
| `git push --force` | Overwrites remote history | `git push --force-with-lease` |
| `git branch -D` | Deletes unmerged branch | `git branch -d` (safe delete) |
**Before destructive operations:**
1. Check status: `git status`
2. Check for uncommitted changes: `git diff`
3. Consider stashing: `git stash`
4. Use dry-run flags when available
Reference: https://github.com/0xDarkMatter/dev-shell-tools
Step 5: Confirm
Report to user:
Initialized Claude Code with dev-shell-tools:
Created:
.claude/settings.local.json (51 tool permissions, 11 guardrails)
.claude/rules/cli-tools.md (modern tool preferences)
Claude will now:
- Auto-approve dev-shell-tools commands
- Prefer fd over find, rg over grep, bat over cat, etc.
- Use AI CLIs for multi-model analysis
- Ask before destructive git commands (reset --hard, push --force, etc.)
To customize: edit files in .claude/
To add to git: git add .claude/
Options
| Flag |
Effect |
--force |
Overwrite existing without asking |
--perms-only |
Only install permissions, skip rules |
--rules-only |
Only install rules, skip permissions |
--minimal |
Minimal permissions (git, ls, cat, mkdir only) |
--full |
Add cloud/container tools (docker, kubectl, terraform, etc.) |
--no-guardrails |
Skip git safety guardrails (empty "ask" list) |
Full Template (--full)
Adds to permissions:
"Bash(docker:*)",
"Bash(docker-compose:*)",
"Bash(podman:*)",
"Bash(kubectl:*)",
"Bash(helm:*)",
"Bash(terraform:*)",
"Bash(pulumi:*)",
"Bash(aws:*)",
"Bash(gcloud:*)",
"Bash(az:*)",
"Bash(wrangler:*)",
"Bash(flyctl:*)",
"Bash(railway:*)"
Notes
- Permissions are project-local (don't affect other projects)
- Rules instruct Claude to prefer modern tools
- Global settings in
~/.claude/ still apply
- Changes take effect on next tool use (no restart needed)
- Tools from: https://github.com/0xDarkMatter/dev-shell-tools
1---2name: setperms3description: Set tool permissions for Claude Code. Configures allowed commands, rules, and preferences in .claude/ directory. Triggers on: setperms, init tools, configure permissions, setup project, set permissions, init claude.4---5
6# /setperms
7
8Initialize Claude Code with modern dev-shell-tools for a comfortable development experience.
9
10## What This Does
11
12**Installs complete dev environment setup:**
13
141. **Permissions** (`.claude/settings.local.json`) - Pre-approved CLI tools
152. **Rules** (`.claude/rules/cli-tools.md`) - Instructions to prefer modern tools
16
17Tools from [dev-shell-tools](https://github.com/0xDarkMatter/dev-shell-tools):
18
19**Core Tools:**
20- **Git**: Full git access, lazygit, gh (GitHub CLI), delta, difft
21- **File ops**: ls, mkdir, cat, wc, tree, eza, bat, chmod
22- **Search**: rg (ripgrep), fd, fzf, ast-grep/sg
23- **Navigation**: zoxide/z, broot/br
24- **Data processing**: jq, yq, sd, xargs
25- **Analysis**: tokei, procs, hyperfine, dust
26
27**Dev Tools:**
28- **Package managers**: npm, node, python, uv, pip, brew
29- **Task runners**: just, bash
30- **Network**: curl, http (httpie), firecrawl
31- **Documentation**: tldr
32- **Windows**: powershell
33
34**AI CLI Tools:**
35- **gemini**: Google Gemini CLI (2M context)
36- **claude**: Anthropic Claude CLI
37- **codex**: OpenAI Codex CLI
38- **perplexity**: Perplexity CLI (web search)
39
40## Execution Flow
41
42```
43/setperms
44 |
45 +-- Check for existing .claude/ files
46 | +-- If exists: Ask to overwrite or skip
47 | +-- If not: Proceed
48 |
49 +-- Create .claude directory
50 +-- Create .claude/rules directory
51 |
52 +-- Write settings.local.json (permissions)
53 +-- Write rules/cli-tools.md (tool preferences)
54```
55
56## Instructions
57
58### Step 1: Check for existing settings
59
60```bash
61ls -la .claude/settings.local.json 2>/dev/null
62ls -la .claude/rules/cli-tools.md 2>/dev/null
63```
64
65If files exist, ask user:
66- **Overwrite**: Replace entirely
67- **Skip**: Keep existing, do nothing
68
69### Step 2: Create directories
70
71```bash
72mkdir -p .claude/rules
73```
74
75### Step 3: Write permissions file
76
77Write to `.claude/settings.local.json`:
78
79```json
80{
81 "permissions": {
82 "allow": [
83 "Bash(git:*)",
84 "Bash(ls:*)",
85 "Bash(mkdir:*)",
86 "Bash(cat:*)",
87 "Bash(wc:*)",
88 "Bash(tree:*)",
89 "Bash(curl:*)",
90 "Bash(rg:*)",
91 "Bash(fd:*)",
92 "Bash(fzf:*)",
93 "Bash(z:*)",
94 "Bash(zoxide:*)",
95 "Bash(br:*)",
96 "Bash(broot:*)",
97 "Bash(ast-grep:*)",
98 "Bash(sg:*)",
99 "Bash(bat:*)",
100 "Bash(eza:*)",
101 "Bash(delta:*)",
102 "Bash(difft:*)",
103 "Bash(jq:*)",
104 "Bash(yq:*)",
105 "Bash(sd:*)",
106 "Bash(lazygit:*)",
107 "Bash(gh:*)",
108 "Bash(tokei:*)",
109 "Bash(uv:*)",
110 "Bash(just:*)",
111 "Bash(http:*)",
112 "Bash(procs:*)",
113 "Bash(hyperfine:*)",
114 "Bash(npm:*)",
115 "Bash(node:*)",
116 "Bash(python:*)",
117 "Bash(pip:*)",
118 "Bash(powershell -Command:*)",
119 "Bash(powershell.exe:*)",
120 "Bash(bash:*)",
121 "Bash(chmod:*)",
122 "Bash(xargs:*)",
123 "Bash(command -v:*)",
124 "Bash(brew:*)",
125 "Bash(tldr:*)",
126 "Bash(dust:*)",
127 "Bash(btm:*)",
128 "Bash(bottom:*)",
129 "Bash(firecrawl:*)",
130 "Bash(gemini:*)",
131 "Bash(claude:*)",
132 "Bash(codex:*)",
133 "Bash(perplexity:*)"
134 ],
135 "deny": [],
136 "ask": [
137 "Bash(git reset --hard:*)",
138 "Bash(git checkout -- :*)",
139 "Bash(git clean -f:*)",
140 "Bash(git stash drop:*)",
141 "Bash(git stash clear:*)",
142 "Bash(git restore --worktree:*)",
143 "Bash(git push --force:*)",
144 "Bash(git push -f:*)",
145 "Bash(git push origin --force:*)",
146 "Bash(git push origin -f:*)",
147 "Bash(git branch -D:*)"
148 ]
149 },
150 "hooks": {}
151}
152```
153
154### Step 4: Write rules file
155
156Write to `.claude/rules/cli-tools.md`:
157
158```markdown
159# CLI Tool Preferences (dev-shell-tools)
160
161ALWAYS prefer modern CLI tools over traditional alternatives.
162
163## File Search & Navigation
164
165| Instead of | Use | Why |
166|------------|-----|-----|
167| `find` | `fd` | 5x faster, respects .gitignore |
168| `grep` | `rg` (ripgrep) | 10x faster, respects .gitignore |
169| `ls` | `eza` | Git status, tree view |
170| `cat` | `bat` | Syntax highlighting |
171| `cd` + manual | `z`/`zoxide` | Frecent directories |
172| `tree` | `eza --tree` | Interactive |
173
174## Data Processing
175
176| Instead of | Use |
177|------------|-----|
178| `sed` | `sd` |
179| Manual JSON | `jq` |
180| Manual YAML | `yq` |
181
182## Git Operations
183
184| Instead of | Use |
185|------------|-----|
186| `git diff` | `delta` or `difft` |
187| Manual git | `lazygit` |
188| GitHub web | `gh` |
189
190## Code Analysis
191
192- Line counts: `tokei`
193- AST search: `ast-grep` / `sg`
194- Benchmarks: `hyperfine`
195- Disk usage: `dust`
196
197## System Monitoring
198
199| Instead of | Use |
200|------------|-----|
201| `du -h` | `dust` |
202| `top`/`htop` | `btm` (bottom) |
203
204## Documentation
205
206| Instead of | Use |
207|------------|-----|
208| `man <cmd>` | `tldr <cmd>` |
209
210## Python
211
212| Instead of | Use |
213|------------|-----|
214| `pip` | `uv` |
215| `python -m venv` | `uv venv` |
216
217## Task Running
218
219Prefer `just` over Makefiles.
220
221## Web Fetching
222
223| Priority | Tool | When to Use |
224|----------|------|-------------|
225| 1 | `WebFetch` | First attempt - fast, built-in |
226| 2 | `r.jina.ai/URL` | JS-rendered pages, cleaner extraction |
227| 3 | `firecrawl <url>` | Anti-bot bypass, blocked sites |
228
229## AI CLI Tools
230
231For multi-model analysis:
232
233| Tool | Model | Best For |
234|------|-------|----------|
235| `gemini` | Gemini 2.5 | 2M context, large codebases |
236| `claude` | Claude | Coding, analysis |
237| `codex` | OpenAI | Deep reasoning |
238| `perplexity` | Perplexity | Web search, current info |
239
240## Git Safety
241
242Destructive commands require confirmation (in "ask" list):
243
244| Command | Risk | Safe Alternative |
245|---------|------|------------------|
246| `git reset --hard` | Loses uncommitted changes | `git stash` first |
247| `git checkout -- <file>` | Discards file changes | `git stash` or `git diff` first |
248| `git clean -fd` | Deletes untracked files | `git clean -n` (dry run) first |
249| `git stash drop` | Permanently deletes stash | Check `git stash list` first |
250| `git push --force` | Overwrites remote history | `git push --force-with-lease` |
251| `git branch -D` | Deletes unmerged branch | `git branch -d` (safe delete) |
252
253**Before destructive operations:**
2541. Check status: `git status`
2552. Check for uncommitted changes: `git diff`
2563. Consider stashing: `git stash`
2574. Use dry-run flags when available
258
259Reference: https://github.com/0xDarkMatter/dev-shell-tools
260```
261
262### Step 5: Confirm
263
264Report to user:
265```
266Initialized Claude Code with dev-shell-tools:
267
268Created:
269 .claude/settings.local.json (51 tool permissions, 11 guardrails)
270 .claude/rules/cli-tools.md (modern tool preferences)
271
272Claude will now:
273 - Auto-approve dev-shell-tools commands
274 - Prefer fd over find, rg over grep, bat over cat, etc.
275 - Use AI CLIs for multi-model analysis
276 - Ask before destructive git commands (reset --hard, push --force, etc.)
277
278To customize: edit files in .claude/
279To add to git: git add .claude/
280```
281
282## Options
283
284| Flag | Effect |
285|------|--------|
286| `--force` | Overwrite existing without asking |
287| `--perms-only` | Only install permissions, skip rules |
288| `--rules-only` | Only install rules, skip permissions |
289| `--minimal` | Minimal permissions (git, ls, cat, mkdir only) |
290| `--full` | Add cloud/container tools (docker, kubectl, terraform, etc.) |
291| `--no-guardrails` | Skip git safety guardrails (empty "ask" list) |
292
293### Full Template (--full)
294
295Adds to permissions:
296```json
297"Bash(docker:*)",
298"Bash(docker-compose:*)",
299"Bash(podman:*)",
300"Bash(kubectl:*)",
301"Bash(helm:*)",
302"Bash(terraform:*)",
303"Bash(pulumi:*)",
304"Bash(aws:*)",
305"Bash(gcloud:*)",
306"Bash(az:*)",
307"Bash(wrangler:*)",
308"Bash(flyctl:*)",
309"Bash(railway:*)"
310```
311
312## Notes
313
314- Permissions are project-local (don't affect other projects)
315- Rules instruct Claude to prefer modern tools
316- Global settings in `~/.claude/` still apply
317- Changes take effect on next tool use (no restart needed)
318- Tools from: https://github.com/0xDarkMatter/dev-shell-tools