/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, npx, node, pnpm, yarn, bun, python, uv, pip, cargo, go, brew
- Build tools: just, make, bash, rustc
- Network: curl, http (httpie), firecrawl, markitdown
- Containers: docker, docker-compose
- Archives: tar, zip, unzip
- Testing: pytest
- Data: sort, uniq, cut, tr, xargs, tee, head, tail, diff
- 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)
+-- Ensure .gitignore excludes settings.local.json (secret-safety)
+-- 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(npx:*)",
"Bash(node:*)",
"Bash(pnpm:*)",
"Bash(yarn:*)",
"Bash(bun:*)",
"Bash(python:*)",
"Bash(pip:*)",
"Bash(cargo:*)",
"Bash(go:*)",
"Bash(rustc:*)",
"Bash(pytest:*)",
"Bash(make:*)",
"Bash(docker:*)",
"Bash(docker-compose:*)",
"Bash(powershell -Command:*)",
"Bash(powershell.exe:*)",
"Bash(bash:*)",
"Bash(chmod:*)",
"Bash(sort:*)",
"Bash(uniq:*)",
"Bash(cut:*)",
"Bash(tr:*)",
"Bash(xargs:*)",
"Bash(tee:*)",
"Bash(head:*)",
"Bash(tail:*)",
"Bash(diff:*)",
"Bash(tar:*)",
"Bash(zip:*)",
"Bash(unzip:*)",
"Bash(command -v:*)",
"Bash(brew:*)",
"Bash(tldr:*)",
"Bash(dust:*)",
"Bash(btm:*)",
"Bash(bottom:*)",
"Bash(markitdown:*)",
"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 3b: Protect settings.local.json from git (mandatory)
settings.local.json is user-specific and frequently accumulates secrets in
permission rules (an API key baked into a Bash(...) allow entry, a token in a
custom command). It must never reach a remote. Before finishing, ensure the repo
root .gitignore excludes it:
# Add the rule only if it's not already present
grep -qxF '.claude/settings.local.json' .gitignore 2>/dev/null \
|| printf '\n# Local settings (user-specific; may contain API keys)\n.claude/settings.local.json\n' >> .gitignore
# If it was already tracked from a prior commit, stop tracking it (keeps the file)
git ls-files --error-unmatch .claude/settings.local.json >/dev/null 2>&1 \
&& git rm --cached .claude/settings.local.json
Skip silently if the project has no git repo. This pairs with the git-ops
push-safety gate, which also refuses any push that adds .claude/settings.local.json
— defense in depth so a leaked key can't recur.
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 (74 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(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."4license: MIT5compatibility: "Creates project-local .claude/ configuration."6allowed-tools: "Read Write Bash"7metadata:8 author: claude-mods9---1011# /setperms1213Initialize Claude Code with modern dev-shell-tools for a comfortable development experience.1415## What This Does1617**Installs complete dev environment setup:**18191. **Permissions** (`.claude/settings.local.json`) - Pre-approved CLI tools202. **Rules** (`.claude/rules/cli-tools.md`) - Instructions to prefer modern tools2122Tools from [dev-shell-tools](https://github.com/0xDarkMatter/dev-shell-tools):2324**Core Tools:**25- **Git**: Full git access, lazygit, gh (GitHub CLI), delta, difft26- **File ops**: ls, mkdir, cat, wc, tree, eza, bat, chmod27- **Search**: rg (ripgrep), fd, fzf, ast-grep/sg28- **Navigation**: zoxide/z, broot/br29- **Data processing**: jq, yq, sd, xargs30- **Analysis**: tokei, procs, hyperfine, dust3132**Dev Tools:**33- **Package managers**: npm, npx, node, pnpm, yarn, bun, python, uv, pip, cargo, go, brew34- **Build tools**: just, make, bash, rustc35- **Network**: curl, http (httpie), firecrawl, markitdown36- **Containers**: docker, docker-compose37- **Archives**: tar, zip, unzip38- **Testing**: pytest39- **Data**: sort, uniq, cut, tr, xargs, tee, head, tail, diff40- **Documentation**: tldr41- **Windows**: powershell4243**AI CLI Tools:**44- **gemini**: Google Gemini CLI (2M context)45- **claude**: Anthropic Claude CLI46- **codex**: OpenAI Codex CLI47- **perplexity**: Perplexity CLI (web search)4849## Execution Flow5051```52/setperms53 |54 +-- Check for existing .claude/ files55 | +-- If exists: Ask to overwrite or skip56 | +-- If not: Proceed57 |58 +-- Create .claude directory59 +-- Create .claude/rules directory60 |61 +-- Write settings.local.json (permissions)62 +-- Ensure .gitignore excludes settings.local.json (secret-safety)63 +-- Write rules/cli-tools.md (tool preferences)64```6566## Instructions6768### Step 1: Check for existing settings6970```bash71ls -la .claude/settings.local.json 2>/dev/null72ls -la .claude/rules/cli-tools.md 2>/dev/null73```7475If files exist, ask user:76- **Overwrite**: Replace entirely77- **Skip**: Keep existing, do nothing7879### Step 2: Create directories8081```bash82mkdir -p .claude/rules83```8485### Step 3: Write permissions file8687Write to `.claude/settings.local.json`:8889```json90{91 "permissions": {92 "allow": [93 "Bash(git:*)",94 "Bash(ls:*)",95 "Bash(mkdir:*)",96 "Bash(cat:*)",97 "Bash(wc:*)",98 "Bash(tree:*)",99 "Bash(curl:*)",100 "Bash(rg:*)",101 "Bash(fd:*)",102 "Bash(fzf:*)",103 "Bash(z:*)",104 "Bash(zoxide:*)",105 "Bash(br:*)",106 "Bash(broot:*)",107 "Bash(ast-grep:*)",108 "Bash(sg:*)",109 "Bash(bat:*)",110 "Bash(eza:*)",111 "Bash(delta:*)",112 "Bash(difft:*)",113 "Bash(jq:*)",114 "Bash(yq:*)",115 "Bash(sd:*)",116 "Bash(lazygit:*)",117 "Bash(gh:*)",118 "Bash(tokei:*)",119 "Bash(uv:*)",120 "Bash(just:*)",121 "Bash(http:*)",122 "Bash(procs:*)",123 "Bash(hyperfine:*)",124 "Bash(npm:*)",125 "Bash(npx:*)",126 "Bash(node:*)",127 "Bash(pnpm:*)",128 "Bash(yarn:*)",129 "Bash(bun:*)",130 "Bash(python:*)",131 "Bash(pip:*)",132 "Bash(cargo:*)",133 "Bash(go:*)",134 "Bash(rustc:*)",135 "Bash(pytest:*)",136 "Bash(make:*)",137 "Bash(docker:*)",138 "Bash(docker-compose:*)",139 "Bash(powershell -Command:*)",140 "Bash(powershell.exe:*)",141 "Bash(bash:*)",142 "Bash(chmod:*)",143 "Bash(sort:*)",144 "Bash(uniq:*)",145 "Bash(cut:*)",146 "Bash(tr:*)",147 "Bash(xargs:*)",148 "Bash(tee:*)",149 "Bash(head:*)",150 "Bash(tail:*)",151 "Bash(diff:*)",152 "Bash(tar:*)",153 "Bash(zip:*)",154 "Bash(unzip:*)",155 "Bash(command -v:*)",156 "Bash(brew:*)",157 "Bash(tldr:*)",158 "Bash(dust:*)",159 "Bash(btm:*)",160 "Bash(bottom:*)",161 "Bash(markitdown:*)",162 "Bash(firecrawl:*)",163 "Bash(gemini:*)",164 "Bash(claude:*)",165 "Bash(codex:*)",166 "Bash(perplexity:*)"167 ],168 "deny": [],169 "ask": [170 "Bash(git reset --hard:*)",171 "Bash(git checkout -- :*)",172 "Bash(git clean -f:*)",173 "Bash(git stash drop:*)",174 "Bash(git stash clear:*)",175 "Bash(git restore --worktree:*)",176 "Bash(git push --force:*)",177 "Bash(git push -f:*)",178 "Bash(git push origin --force:*)",179 "Bash(git push origin -f:*)",180 "Bash(git branch -D:*)"181 ]182 },183 "hooks": {}184}185```186187### Step 3b: Protect settings.local.json from git (mandatory)188189`settings.local.json` is user-specific and frequently accumulates secrets in190permission rules (an API key baked into a `Bash(...)` allow entry, a token in a191custom command). It must never reach a remote. Before finishing, ensure the repo192root `.gitignore` excludes it:193194```bash195# Add the rule only if it's not already present196grep -qxF '.claude/settings.local.json' .gitignore 2>/dev/null \197 || printf '\n# Local settings (user-specific; may contain API keys)\n.claude/settings.local.json\n' >> .gitignore198199# If it was already tracked from a prior commit, stop tracking it (keeps the file)200git ls-files --error-unmatch .claude/settings.local.json >/dev/null 2>&1 \201 && git rm --cached .claude/settings.local.json202```203204Skip silently if the project has no git repo. This pairs with the git-ops205push-safety gate, which also refuses any push that adds `.claude/settings.local.json`206— defense in depth so a leaked key can't recur.207208### Step 4: Write rules file209210Write to `.claude/rules/cli-tools.md`:211212```markdown213# CLI Tool Preferences (dev-shell-tools)214215ALWAYS prefer modern CLI tools over traditional alternatives.216217## File Search & Navigation218219| Instead of | Use | Why |220|------------|-----|-----|221| `find` | `fd` | 5x faster, respects .gitignore |222| `grep` | `rg` (ripgrep) | 10x faster, respects .gitignore |223| `ls` | `eza` | Git status, tree view |224| `cat` | `bat` | Syntax highlighting |225| `cd` + manual | `z`/`zoxide` | Frecent directories |226| `tree` | `eza --tree` | Interactive |227228## Data Processing229230| Instead of | Use |231|------------|-----|232| `sed` | `sd` |233| Manual JSON | `jq` |234| Manual YAML | `yq` |235236## Git Operations237238| Instead of | Use |239|------------|-----|240| `git diff` | `delta` or `difft` |241| Manual git | `lazygit` |242| GitHub web | `gh` |243244## Code Analysis245246- Line counts: `tokei`247- AST search: `ast-grep` / `sg`248- Benchmarks: `hyperfine`249- Disk usage: `dust`250251## System Monitoring252253| Instead of | Use |254|------------|-----|255| `du -h` | `dust` |256| `top`/`htop` | `btm` (bottom) |257258## Documentation259260| Instead of | Use |261|------------|-----|262| `man <cmd>` | `tldr <cmd>` |263264## Python265266| Instead of | Use |267|------------|-----|268| `pip` | `uv` |269| `python -m venv` | `uv venv` |270271## Task Running272273Prefer `just` over Makefiles.274275## Web Fetching276277| Priority | Tool | When to Use |278|----------|------|-------------|279| 1 | `WebFetch` | First attempt - fast, built-in |280| 2 | `r.jina.ai/URL` | JS-rendered pages, cleaner extraction |281| 3 | `firecrawl <url>` | Anti-bot bypass, blocked sites |282283## AI CLI Tools284285For multi-model analysis:286287| Tool | Model | Best For |288|------|-------|----------|289| `gemini` | Gemini 2.5 | 2M context, large codebases |290| `claude` | Claude | Coding, analysis |291| `codex` | OpenAI | Deep reasoning |292| `perplexity` | Perplexity | Web search, current info |293294## Git Safety295296Destructive commands require confirmation (in "ask" list):297298| Command | Risk | Safe Alternative |299|---------|------|------------------|300| `git reset --hard` | Loses uncommitted changes | `git stash` first |301| `git checkout -- <file>` | Discards file changes | `git stash` or `git diff` first |302| `git clean -fd` | Deletes untracked files | `git clean -n` (dry run) first |303| `git stash drop` | Permanently deletes stash | Check `git stash list` first |304| `git push --force` | Overwrites remote history | `git push --force-with-lease` |305| `git branch -D` | Deletes unmerged branch | `git branch -d` (safe delete) |306307**Before destructive operations:**3081. Check status: `git status`3092. Check for uncommitted changes: `git diff`3103. Consider stashing: `git stash`3114. Use dry-run flags when available312313Reference: https://github.com/0xDarkMatter/dev-shell-tools314```315316### Step 5: Confirm317318Report to user:319```320Initialized Claude Code with dev-shell-tools:321322Created:323 .claude/settings.local.json (74 tool permissions, 11 guardrails)324 .claude/rules/cli-tools.md (modern tool preferences)325326Claude will now:327 - Auto-approve dev-shell-tools commands328 - Prefer fd over find, rg over grep, bat over cat, etc.329 - Use AI CLIs for multi-model analysis330 - Ask before destructive git commands (reset --hard, push --force, etc.)331332To customize: edit files in .claude/333To add to git: git add .claude/334```335336## Options337338| Flag | Effect |339|------|--------|340| `--force` | Overwrite existing without asking |341| `--perms-only` | Only install permissions, skip rules |342| `--rules-only` | Only install rules, skip permissions |343| `--minimal` | Minimal permissions (git, ls, cat, mkdir only) |344| `--full` | Add cloud/container tools (docker, kubectl, terraform, etc.) |345| `--no-guardrails` | Skip git safety guardrails (empty "ask" list) |346347### Full Template (--full)348349Adds to permissions:350```json351"Bash(podman:*)",352"Bash(kubectl:*)",353"Bash(helm:*)",354"Bash(terraform:*)",355"Bash(pulumi:*)",356"Bash(aws:*)",357"Bash(gcloud:*)",358"Bash(az:*)",359"Bash(wrangler:*)",360"Bash(flyctl:*)",361"Bash(railway:*)"362```363364## Notes365366- Permissions are project-local (don't affect other projects)367- Rules instruct Claude to prefer modern tools368- Global settings in `~/.claude/` still apply369- Changes take effect on next tool use (no restart needed)370- Tools from: https://github.com/0xDarkMatter/dev-shell-tools