ginskill-init 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/agents/developer.md +56 -0
- package/agents/frontend-design.md +69 -0
- package/agents/mobile-reviewer.md +36 -0
- package/agents/review-code.md +49 -0
- package/agents/security-scanner.md +50 -0
- package/agents/tester.md +72 -0
- package/bin/cli.js +226 -0
- package/package.json +20 -0
- package/skills/ai-asset-generator/SKILL.md +255 -0
- package/skills/ai-asset-generator/docs/gen-image.md +274 -0
- package/skills/ai-asset-generator/docs/genvideo.md +341 -0
- package/skills/ai-asset-generator/docs/remove-background.md +19 -0
- package/skills/ai-asset-generator/generate-credit-assets.mjs +180 -0
- package/skills/ai-asset-generator/generate-ginbrowser-assets.mjs +242 -0
- package/skills/ai-asset-generator/generate-sty-icon.mjs +149 -0
- package/skills/ai-asset-generator/lib/bg-remove.mjs +34 -0
- package/skills/ai-asset-generator/lib/env.mjs +38 -0
- package/skills/ai-asset-generator/lib/kie-client.mjs +88 -0
- package/skills/ai-asset-generator/scripts/scaffold-generator.mjs +203 -0
- package/skills/ai-build-ai/SKILL.md +124 -0
- package/skills/ai-build-ai/docs/agent-teams.md +293 -0
- package/skills/ai-build-ai/docs/checkpointing.md +161 -0
- package/skills/ai-build-ai/docs/create-agent.md +399 -0
- package/skills/ai-build-ai/docs/create-mcp.md +395 -0
- package/skills/ai-build-ai/docs/create-skill.md +299 -0
- package/skills/ai-build-ai/docs/headless-mode.md +614 -0
- package/skills/ai-build-ai/docs/hooks.md +578 -0
- package/skills/ai-build-ai/docs/memory-claude-md.md +375 -0
- package/skills/ai-build-ai/docs/output-styles.md +208 -0
- package/skills/ai-build-ai/docs/overview.md +162 -0
- package/skills/ai-build-ai/docs/permissions.md +391 -0
- package/skills/ai-build-ai/docs/plugins.md +396 -0
- package/skills/ai-build-ai/docs/sandbox.md +262 -0
- package/skills/ai-build-ai/scripts/load-tutorial.sh +54 -0
- package/skills/icon-generator/SKILL.md +270 -0
- package/skills/mobile-app-review/SKILL.md +321 -0
- package/skills/mobile-app-review/references/apple-review.md +132 -0
- package/skills/mobile-app-review/references/google-play-review.md +203 -0
- package/skills/mongodb/SKILL.md +667 -0
- package/skills/mongodb/references/mongoose-patterns.md +368 -0
- package/skills/nestjs-architecture/SKILL.md +1086 -0
- package/skills/nestjs-architecture/references/advanced-patterns.md +590 -0
- package/skills/performance/SKILL.md +509 -0
- package/skills/react-fsd-architecture/SKILL.md +693 -0
- package/skills/react-fsd-architecture/references/fsd-patterns.md +747 -0
- package/skills/react-query/SKILL.md +685 -0
- package/skills/react-query/references/query-patterns.md +365 -0
- package/skills/review-code/SKILL.md +321 -0
- package/skills/review-code/references/clean-code-principles.md +395 -0
- package/skills/review-code/references/frontend-patterns.md +136 -0
- package/skills/review-code/references/nestjs-patterns.md +184 -0
- package/skills/review-code/scripts/check-module.sh +201 -0
- package/skills/review-code/scripts/deep-scan.sh +604 -0
- package/skills/review-code/scripts/dep-check.sh +522 -0
- package/skills/review-code/scripts/detect-duplicates.sh +466 -0
- package/skills/review-code/scripts/format-check.sh +577 -0
- package/skills/review-code/scripts/run-review.sh +167 -0
- package/skills/review-code/scripts/scan-codebase.sh +152 -0
- package/skills/security-scanner/SKILL.md +327 -0
- package/skills/security-scanner/references/nestjs-security.md +260 -0
- package/skills/security-scanner/references/nextjs-security.md +201 -0
- package/skills/security-scanner/references/react-native-security.md +199 -0
- package/skills/security-scanner/scripts/security-scan.sh +478 -0
- package/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# AI Build AI — Overview
|
|
2
|
+
|
|
3
|
+
You are helping the user understand and use Claude Code's extensibility system. Claude Code can be extended in nine ways:
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## The Nine Extension Types
|
|
8
|
+
|
|
9
|
+
### 1. Skills (`/ai-build-ai skill`)
|
|
10
|
+
**What:** Reusable prompt playbooks stored as `SKILL.md` files. Auto-invoked by Claude or triggered with `/skill-name`.
|
|
11
|
+
**When:** Repeatable workflows, domain knowledge, step-by-step procedures Claude should follow consistently.
|
|
12
|
+
**Location:** `.claude/skills/<name>/SKILL.md` (project) | `~/.claude/skills/<name>/SKILL.md` (personal)
|
|
13
|
+
|
|
14
|
+
### 2. Custom Subagents (`/ai-build-ai agent`)
|
|
15
|
+
**What:** Specialized AI assistants with their own context window, system prompt, tools, and permissions.
|
|
16
|
+
**When:** Context isolation for verbose tasks, restricted tool access, parallel workloads, domain specialists.
|
|
17
|
+
**Location:** `.claude/agents/<name>.md` (project) | `~/.claude/agents/<name>.md` (personal)
|
|
18
|
+
|
|
19
|
+
### 3. MCP Servers (`/ai-build-ai mcp`)
|
|
20
|
+
**What:** External tools and data sources connected via Model Context Protocol. Gives Claude access to GitHub, databases, Slack, APIs.
|
|
21
|
+
**When:** Claude needs to interact with external systems.
|
|
22
|
+
**Command:** `claude mcp add --transport http|sse|stdio <name> <url-or-command>`
|
|
23
|
+
|
|
24
|
+
### 4. Headless / Agent SDK (`/ai-build-ai headless`)
|
|
25
|
+
**What:** Running Claude programmatically from scripts, CI/CD, or the Python/TypeScript SDK.
|
|
26
|
+
**When:** Automation, batch processing, CI/CD integration, building apps with Claude as the AI.
|
|
27
|
+
**Key flag:** `claude -p "your prompt" --allowedTools "Read,Edit,Bash"`
|
|
28
|
+
|
|
29
|
+
### 5. Hooks (`/ai-build-ai hooks`)
|
|
30
|
+
**What:** Shell commands / HTTP endpoints / LLM prompts that fire automatically at lifecycle points (PreToolUse, PostToolUse, SessionStart, Stop, etc.).
|
|
31
|
+
**When:** Auto-format files on save, block dangerous commands, inject context, send notifications, enforce rules deterministically.
|
|
32
|
+
**Location:** `.claude/settings.json` under `"hooks"` key
|
|
33
|
+
|
|
34
|
+
### 6. Plugins (`/ai-build-ai plugins`)
|
|
35
|
+
**What:** Packaged bundles of skills + agents + hooks + MCP servers with a manifest (`plugin.json`), versioning, and marketplace distribution.
|
|
36
|
+
**When:** Sharing across teams/community, versioned releases, one-command installs.
|
|
37
|
+
**Structure:** `my-plugin/.claude-plugin/plugin.json` + `skills/`, `agents/`, `hooks/`, `.mcp.json`
|
|
38
|
+
|
|
39
|
+
### 7. Agent Teams (`/ai-build-ai teams`)
|
|
40
|
+
**What:** Multiple Claude Code instances coordinated as a team — a lead assigns tasks, teammates work independently and communicate directly.
|
|
41
|
+
**When:** Complex parallel work needing inter-agent discussion, competing hypothesis testing, cross-layer features.
|
|
42
|
+
**Enable:** `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` (experimental)
|
|
43
|
+
|
|
44
|
+
### 8. CLAUDE.md & Memory (`/ai-build-ai memory`)
|
|
45
|
+
**What:** Persistent instructions (CLAUDE.md) and auto-learning (auto memory) that survive across sessions.
|
|
46
|
+
**When:** Project conventions, coding standards, architecture decisions, personal workflow preferences.
|
|
47
|
+
**Location:** `./CLAUDE.md`, `~/.claude/CLAUDE.md`, `.claude/rules/*.md`
|
|
48
|
+
|
|
49
|
+
### 9. Permissions (`/ai-build-ai permissions`)
|
|
50
|
+
**What:** Fine-grained control over which tools, files, and domains Claude can access — allow/deny/ask rules.
|
|
51
|
+
**When:** Restricting Claude to safe operations, CI/CD automation, enterprise policy enforcement.
|
|
52
|
+
**Location:** `.claude/settings.json` under `"permissions"` key
|
|
53
|
+
|
|
54
|
+
### 10. Sandbox (`/ai-build-ai sandbox`)
|
|
55
|
+
**What:** OS-level enforcement that restricts what bash commands (and their child processes) can read, write, or access on the network — independent of Claude's permission rules.
|
|
56
|
+
**When:** Extra security for untrusted scripts, preventing accidental writes to sensitive files, restricting outbound network access.
|
|
57
|
+
**Platform:** macOS (Seatbelt), Linux/WSL2 (bubblewrap+socat)
|
|
58
|
+
|
|
59
|
+
### 11. Checkpointing (`/ai-build-ai checkpoint`)
|
|
60
|
+
**What:** Automatic snapshots before every file edit. Rewind code, conversation, or both to any previous state. Fork sessions to experiment without losing work.
|
|
61
|
+
**When:** Recovering from mistakes, experimenting with risky changes, managing context.
|
|
62
|
+
**How:** `Esc+Esc` or `/rewind` to open rewind menu; `claude --continue` / `--resume` to manage sessions.
|
|
63
|
+
|
|
64
|
+
### 12. Output Styles (`/ai-build-ai output-styles`)
|
|
65
|
+
**What:** Modify Claude's communication style — tone, verbosity, teaching mode. Replaces sections of Claude's default system prompt.
|
|
66
|
+
**When:** Learning mode, pair programming style, domain expert persona, ultra-concise mode.
|
|
67
|
+
**Location:** `~/.claude/output-styles/` (personal) or `.claude/output-styles/` (project)
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Decision Table: What Should I Build?
|
|
72
|
+
|
|
73
|
+
| Goal | Build This |
|
|
74
|
+
|------|-----------|
|
|
75
|
+
| Teach Claude a repeatable workflow (code review, PR creation, deploy) | **Skill** |
|
|
76
|
+
| Add domain knowledge Claude should always apply | **Skill** (`user-invocable: false`) |
|
|
77
|
+
| Isolate verbose output from main conversation context | **Subagent** |
|
|
78
|
+
| Restrict tools for a specific task type | **Subagent** |
|
|
79
|
+
| Connect to GitHub / Slack / database / internal API | **MCP Server** |
|
|
80
|
+
| Build your own custom MCP server | **MCP Server** (build it with the MCP SDK) |
|
|
81
|
+
| Run Claude in CI/CD, scripts, or automation | **Headless / Agent SDK** |
|
|
82
|
+
| Build an app that uses Claude as the AI backend | **Agent SDK** (Python/TypeScript) |
|
|
83
|
+
| Auto-format files after every edit | **Hook** (PostToolUse) |
|
|
84
|
+
| Block dangerous commands deterministically | **Hook** (PreToolUse) |
|
|
85
|
+
| Send notifications when Claude needs input | **Hook** (Notification) |
|
|
86
|
+
| Enforce rules that must ALWAYS apply (not just Claude deciding) | **Hook** |
|
|
87
|
+
| Share extensions with your team or community | **Plugin** |
|
|
88
|
+
| Distribute versioned, installable extensions | **Plugin** |
|
|
89
|
+
| Parallel work needing teammates to discuss with each other | **Agent Teams** |
|
|
90
|
+
| Persist coding standards for the whole team | **CLAUDE.md** (committed) |
|
|
91
|
+
| Restrict what files/commands Claude can touch | **Permissions** |
|
|
92
|
+
| Enterprise-wide policy enforcement | **Managed Permissions** |
|
|
93
|
+
| Add OS-level protection for bash commands | **Sandbox** |
|
|
94
|
+
| Block bash from accessing secrets or network | **Sandbox** |
|
|
95
|
+
| Undo a mistake without losing other work | **Checkpointing** (`Esc+Esc`) |
|
|
96
|
+
| Change Claude's tone or teaching style | **Output Style** |
|
|
97
|
+
| Create a "learning mode" or "mentor mode" | **Output Style** |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Quick Start
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# 1. Create a skill
|
|
105
|
+
mkdir -p .claude/skills/my-skill
|
|
106
|
+
cat > .claude/skills/my-skill/SKILL.md << 'EOF'
|
|
107
|
+
---
|
|
108
|
+
name: my-skill
|
|
109
|
+
description: What this skill does and when to use it
|
|
110
|
+
---
|
|
111
|
+
# Instructions for Claude...
|
|
112
|
+
EOF
|
|
113
|
+
|
|
114
|
+
# 2. Create a subagent
|
|
115
|
+
mkdir -p .claude/agents
|
|
116
|
+
cat > .claude/agents/my-agent.md << 'EOF'
|
|
117
|
+
---
|
|
118
|
+
name: my-agent
|
|
119
|
+
description: When Claude should delegate to this agent
|
|
120
|
+
tools: Read, Grep, Glob
|
|
121
|
+
model: haiku
|
|
122
|
+
---
|
|
123
|
+
You are a specialized agent...
|
|
124
|
+
EOF
|
|
125
|
+
|
|
126
|
+
# 3. Add a hook (in .claude/settings.json)
|
|
127
|
+
# { "hooks": { "PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "..." }] }] } }
|
|
128
|
+
|
|
129
|
+
# 4. Add an MCP server
|
|
130
|
+
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
|
|
131
|
+
|
|
132
|
+
# 5. Run Claude programmatically
|
|
133
|
+
claude -p "Summarize this project" --output-format json
|
|
134
|
+
|
|
135
|
+
# 6. Create CLAUDE.md
|
|
136
|
+
/init # Auto-generates from codebase
|
|
137
|
+
|
|
138
|
+
# 7. Create a plugin
|
|
139
|
+
mkdir -p my-plugin/.claude-plugin
|
|
140
|
+
echo '{"name":"my-plugin","description":"...","version":"1.0.0"}' > my-plugin/.claude-plugin/plugin.json
|
|
141
|
+
claude --plugin-dir ./my-plugin # Test it
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Topic Commands
|
|
147
|
+
|
|
148
|
+
| Command | Loads |
|
|
149
|
+
|---------|-------|
|
|
150
|
+
| `/ai-build-ai skill` | SKILL.md format, frontmatter, arguments, dynamic context, examples |
|
|
151
|
+
| `/ai-build-ai agent` | Subagent config, tools, models, memory, hooks, examples |
|
|
152
|
+
| `/ai-build-ai mcp` | MCP server setup + building your own MCP server |
|
|
153
|
+
| `/ai-build-ai headless` | `claude -p`, output formats, CI/CD, Python/TS SDK |
|
|
154
|
+
| `/ai-build-ai hooks` | All hook events, types, exit codes, matchers, recipes |
|
|
155
|
+
| `/ai-build-ai plugins` | Plugin manifest, structure, skills/agents/hooks/MCP in plugins, distribution |
|
|
156
|
+
| `/ai-build-ai teams` | Agent teams: enable, start, control, display modes, use cases |
|
|
157
|
+
| `/ai-build-ai memory` | CLAUDE.md, .claude/rules/, auto memory, imports, monorepo setup |
|
|
158
|
+
| `/ai-build-ai permissions` | Allow/deny rules, modes, Bash/Read/Edit/WebFetch/MCP/Agent rules |
|
|
159
|
+
| `/ai-build-ai sandbox` | OS-level enforcement, filesystem rules, network filtering, path prefixes |
|
|
160
|
+
| `/ai-build-ai checkpoint` | Rewind, fork, session management, summarize from here |
|
|
161
|
+
| `/ai-build-ai output-styles` | Built-in styles, custom styles, keep-coding-instructions |
|
|
162
|
+
| `/ai-build-ai` | This overview + decision table |
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Tutorial: Permissions
|
|
2
|
+
|
|
3
|
+
Claude Code has a permission system to control what tools, files, and domains Claude can access. Configure it in `settings.json` or manage interactively with `/permissions`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: The Permission Tiers
|
|
8
|
+
|
|
9
|
+
| Tool type | Default behavior |
|
|
10
|
+
|-----------|----------------|
|
|
11
|
+
| Read-only (Read, Grep, Glob) | No approval needed |
|
|
12
|
+
| Bash commands | Prompts first time per project per command |
|
|
13
|
+
| File modification (Edit, Write) | Prompts, "yes don't ask again" lasts until session end |
|
|
14
|
+
|
|
15
|
+
Rules are evaluated: **deny → ask → allow**. The first matching rule wins.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 2: Permission Modes
|
|
20
|
+
|
|
21
|
+
Set `defaultMode` in `.claude/settings.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"defaultMode": "acceptEdits"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Mode | Behavior |
|
|
30
|
+
|------|----------|
|
|
31
|
+
| `default` | Standard: prompts on first use of each tool |
|
|
32
|
+
| `acceptEdits` | Auto-accepts file edits for the session |
|
|
33
|
+
| `plan` | Read-only: Claude can analyze but not modify files or execute commands |
|
|
34
|
+
| `dontAsk` | Auto-denies tools unless pre-approved via rules |
|
|
35
|
+
| `bypassPermissions` | Skips ALL permission prompts (only in safe/isolated environments) |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 3: Permission Rules
|
|
40
|
+
|
|
41
|
+
Define allow/deny rules in `.claude/settings.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"permissions": {
|
|
46
|
+
"allow": [
|
|
47
|
+
"Bash(npm run *)",
|
|
48
|
+
"Bash(git commit *)",
|
|
49
|
+
"Read",
|
|
50
|
+
"Edit(/src/**)"
|
|
51
|
+
],
|
|
52
|
+
"deny": [
|
|
53
|
+
"Bash(git push *)",
|
|
54
|
+
"Bash(rm -rf *)",
|
|
55
|
+
"Edit(.env)"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You can also set `ask` rules to force a prompt even if normally auto-allowed:
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"permissions": {
|
|
65
|
+
"ask": ["Bash(git push *)"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 4: Rule Syntax
|
|
73
|
+
|
|
74
|
+
### Match all uses of a tool
|
|
75
|
+
```
|
|
76
|
+
Bash ← any bash command
|
|
77
|
+
Read ← any file read
|
|
78
|
+
Edit ← any file edit
|
|
79
|
+
WebFetch ← any web fetch
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Exact match
|
|
83
|
+
```
|
|
84
|
+
Bash(npm run build) ← only this exact command
|
|
85
|
+
Read(./.env) ← only this file
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Wildcard prefix matching (`*`)
|
|
89
|
+
```
|
|
90
|
+
Bash(npm run *) ← any command starting with "npm run "
|
|
91
|
+
Bash(git *) ← any git command
|
|
92
|
+
Bash(* --version) ← any command ending with " --version"
|
|
93
|
+
Bash(git * main) ← git checkout main, git merge main, etc.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Space before `*` matters:**
|
|
97
|
+
- `Bash(ls *)` — matches `ls -la` but NOT `lsof` (word boundary enforced)
|
|
98
|
+
- `Bash(ls*)` — matches both `ls -la` AND `lsof` (no boundary)
|
|
99
|
+
|
|
100
|
+
**Shell operators are NOT trusted:**
|
|
101
|
+
- `Bash(safe-cmd *)` will NOT give permission to `safe-cmd && dangerous-cmd`
|
|
102
|
+
- Claude Code is operator-aware — each chained command is checked separately
|
|
103
|
+
|
|
104
|
+
### File path patterns
|
|
105
|
+
|
|
106
|
+
For `Read` and `Edit` rules, use gitignore-style patterns:
|
|
107
|
+
|
|
108
|
+
| Pattern prefix | Meaning | Example |
|
|
109
|
+
|---------------|---------|---------|
|
|
110
|
+
| `//path` | Absolute from filesystem root | `Read(//Users/alice/secrets/**)` |
|
|
111
|
+
| `~/path` | From home directory | `Read(~/.ssh/*)` |
|
|
112
|
+
| `/path` | Relative to project root | `Edit(/src/**/*.ts)` |
|
|
113
|
+
| `path` | Relative to cwd | `Read(*.env)` |
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"permissions": {
|
|
118
|
+
"allow": [
|
|
119
|
+
"Edit(/src/**/*.ts)",
|
|
120
|
+
"Edit(/src/**/*.tsx)",
|
|
121
|
+
"Read"
|
|
122
|
+
],
|
|
123
|
+
"deny": [
|
|
124
|
+
"Edit(.env)",
|
|
125
|
+
"Edit(package-lock.json)",
|
|
126
|
+
"Read(//etc/passwd)"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Note: `*` matches files in one directory, `**` matches recursively.
|
|
133
|
+
|
|
134
|
+
### WebFetch rules
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
WebFetch(domain:github.com) ← only github.com
|
|
138
|
+
WebFetch(domain:api.example.com) ← only this API
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### MCP tool rules
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
mcp__puppeteer ← all tools from puppeteer MCP server
|
|
145
|
+
mcp__puppeteer__* ← same (wildcard form)
|
|
146
|
+
mcp__github__search_repositories ← specific tool from github server
|
|
147
|
+
mcp__.*__write.* ← any "write" tool across all MCP servers (regex)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Agent/Subagent rules
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Agent(Explore) ← the Explore built-in agent
|
|
154
|
+
Agent(Plan) ← the Plan built-in agent
|
|
155
|
+
Agent(my-custom-agent) ← your custom agent
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
To block Claude from using specific agents:
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"permissions": {
|
|
162
|
+
"deny": ["Agent(Explore)", "Agent(dangerous-agent)"]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Step 5: Practical Configuration Examples
|
|
170
|
+
|
|
171
|
+
### Safe exploration mode (read-only + specific bash)
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"permissions": {
|
|
176
|
+
"allow": [
|
|
177
|
+
"Read",
|
|
178
|
+
"Bash(git log *)",
|
|
179
|
+
"Bash(git diff *)",
|
|
180
|
+
"Bash(git status)",
|
|
181
|
+
"Bash(npm test *)",
|
|
182
|
+
"Bash(* --help *)",
|
|
183
|
+
"Bash(* --version)"
|
|
184
|
+
],
|
|
185
|
+
"deny": [
|
|
186
|
+
"Edit",
|
|
187
|
+
"Write",
|
|
188
|
+
"Bash(git push *)",
|
|
189
|
+
"Bash(rm *)",
|
|
190
|
+
"Bash(sudo *)"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Development workflow (allow most, deny dangerous)
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"permissions": {
|
|
201
|
+
"allow": [
|
|
202
|
+
"Read",
|
|
203
|
+
"Edit(/src/**)",
|
|
204
|
+
"Edit(/tests/**)",
|
|
205
|
+
"Write(/src/**)",
|
|
206
|
+
"Bash(npm run *)",
|
|
207
|
+
"Bash(bun *)",
|
|
208
|
+
"Bash(git commit *)",
|
|
209
|
+
"Bash(git add *)",
|
|
210
|
+
"Bash(git diff *)",
|
|
211
|
+
"Bash(git log *)",
|
|
212
|
+
"Bash(git status)"
|
|
213
|
+
],
|
|
214
|
+
"deny": [
|
|
215
|
+
"Edit(.env)",
|
|
216
|
+
"Edit(.env.local)",
|
|
217
|
+
"Edit(package-lock.json)",
|
|
218
|
+
"Bash(git push *)",
|
|
219
|
+
"Bash(rm -rf *)",
|
|
220
|
+
"Bash(sudo *)",
|
|
221
|
+
"Bash(curl *)",
|
|
222
|
+
"Bash(wget *)"
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### CI/CD (fully open for automation)
|
|
229
|
+
|
|
230
|
+
For automated pipelines in isolated environments:
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"defaultMode": "bypassPermissions"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Or via CLI flag: `claude -p "..." --dangerously-skip-permissions`
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Step 6: Settings Files and Precedence
|
|
242
|
+
|
|
243
|
+
Permissions can be set at multiple levels. Higher priority wins for conflicting rules:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
1. Managed policy settings ← Highest (org admin, can't be overridden)
|
|
247
|
+
2. CLI flags (--disallowedTools)
|
|
248
|
+
3. .claude/settings.local.json (project-local, not committed)
|
|
249
|
+
4. .claude/settings.json (project-level, committed to git)
|
|
250
|
+
5. ~/.claude/settings.json ← Lowest (personal defaults)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Example: deny list via CLI:**
|
|
254
|
+
```bash
|
|
255
|
+
claude --disallowedTools "Agent(Explore),Bash(rm *)"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Example: settings.json with all permission options:**
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"defaultMode": "default",
|
|
262
|
+
"permissions": {
|
|
263
|
+
"allow": [
|
|
264
|
+
"Bash(npm run *)",
|
|
265
|
+
"Read",
|
|
266
|
+
"Edit(/src/**)"
|
|
267
|
+
],
|
|
268
|
+
"ask": [
|
|
269
|
+
"Bash(git push *)"
|
|
270
|
+
],
|
|
271
|
+
"deny": [
|
|
272
|
+
"Bash(sudo *)",
|
|
273
|
+
"Edit(.env)"
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Step 7: Extend Permissions with Hooks
|
|
282
|
+
|
|
283
|
+
For dynamic, context-aware permission decisions, use `PreToolUse` hooks:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"hooks": {
|
|
288
|
+
"PreToolUse": [{
|
|
289
|
+
"matcher": "Bash",
|
|
290
|
+
"hooks": [{
|
|
291
|
+
"type": "command",
|
|
292
|
+
"command": ".claude/hooks/validate-commands.sh"
|
|
293
|
+
}]
|
|
294
|
+
}]
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
#!/bin/bash
|
|
301
|
+
# .claude/hooks/validate-commands.sh
|
|
302
|
+
INPUT=$(cat)
|
|
303
|
+
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
304
|
+
|
|
305
|
+
# Block production deployments without approval
|
|
306
|
+
if echo "$CMD" | grep -q "deploy.*production"; then
|
|
307
|
+
echo "Blocked: production deployments require manual approval from lead" >&2
|
|
308
|
+
exit 2
|
|
309
|
+
fi
|
|
310
|
+
|
|
311
|
+
# Block database migrations in non-migration sessions
|
|
312
|
+
if echo "$CMD" | grep -q "migrate.*run"; then
|
|
313
|
+
echo "Blocked: run migrations via the /migrate skill instead" >&2
|
|
314
|
+
exit 2
|
|
315
|
+
fi
|
|
316
|
+
|
|
317
|
+
exit 0
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Hooks run before the permission system, giving you fine-grained runtime control that static rules can't provide.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Step 8: Working Directories
|
|
325
|
+
|
|
326
|
+
By default, Claude accesses files in its launch directory. Extend access:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# At startup
|
|
330
|
+
claude --add-dir /path/to/shared-lib --add-dir /path/to/config
|
|
331
|
+
|
|
332
|
+
# During session
|
|
333
|
+
/add-dir /path/to/new-directory
|
|
334
|
+
|
|
335
|
+
# Permanently in settings
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**In settings.json:**
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"additionalDirectories": [
|
|
342
|
+
"/path/to/shared-lib",
|
|
343
|
+
"../sibling-project"
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Files in additional directories follow the same permission rules as the main working directory.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Step 9: Managed / Enterprise Settings
|
|
353
|
+
|
|
354
|
+
For org-wide policies, admins deploy settings to:
|
|
355
|
+
- macOS: `/Library/Application Support/ClaudeCode/`
|
|
356
|
+
- Linux/WSL: `/etc/claude-code/`
|
|
357
|
+
- Windows: `C:\Program Files\ClaudeCode\`
|
|
358
|
+
|
|
359
|
+
**Managed-only settings** (can only be set by admin):
|
|
360
|
+
|
|
361
|
+
| Setting | Effect |
|
|
362
|
+
|---------|--------|
|
|
363
|
+
| `disableBypassPermissionsMode: "disable"` | Prevents `bypassPermissions` mode entirely |
|
|
364
|
+
| `allowManagedPermissionRulesOnly: true` | Only managed rules apply; users can't add their own |
|
|
365
|
+
| `allowManagedHooksOnly: true` | Only managed hooks run; user/project hooks blocked |
|
|
366
|
+
| `allowManagedMcpServersOnly: true` | Only managed MCP server allowlist applies |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Quick Reference
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
# View and manage permissions interactively
|
|
374
|
+
/permissions
|
|
375
|
+
|
|
376
|
+
# Allow specific tools via CLI
|
|
377
|
+
claude --allowedTools "Read,Edit,Bash(npm run *)"
|
|
378
|
+
|
|
379
|
+
# Deny specific tools via CLI
|
|
380
|
+
claude --disallowedTools "Agent(Explore),Bash(rm *)"
|
|
381
|
+
|
|
382
|
+
# Skip all permissions (CI only!)
|
|
383
|
+
claude -p "..." --dangerously-skip-permissions
|
|
384
|
+
|
|
385
|
+
# Run in plan mode (read-only, no edits)
|
|
386
|
+
claude --default-permission-mode plan
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Rule priority:** `deny > ask > allow` — deny always wins.
|
|
390
|
+
|
|
391
|
+
**Rule tip:** Use hooks for dynamic decisions, rules for static patterns.
|