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,396 @@
|
|
|
1
|
+
# Tutorial: Create a Plugin
|
|
2
|
+
|
|
3
|
+
Plugins package skills, agents, hooks, and MCP servers into a distributable unit. Use plugins when you want to share functionality across teams, publish to a marketplace, or maintain versioned releases that can be installed with one command.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: Plugins vs Standalone Config
|
|
8
|
+
|
|
9
|
+
| Aspect | Standalone (`.claude/`) | Plugin |
|
|
10
|
+
|--------|------------------------|--------|
|
|
11
|
+
| Skill names | `/hello` | `/my-plugin:hello` (namespaced) |
|
|
12
|
+
| Sharing | Manual copy | Install via marketplace |
|
|
13
|
+
| Versioning | Git-based | Semantic versioning in manifest |
|
|
14
|
+
| Best for | Personal, project-specific, experiments | Team distribution, open source, reuse |
|
|
15
|
+
|
|
16
|
+
**Start with standalone** config in `.claude/` for quick iteration. Convert to a plugin when you're ready to share.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 2: Plugin Directory Structure
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
my-plugin/
|
|
24
|
+
├── .claude-plugin/
|
|
25
|
+
│ └── plugin.json ← REQUIRED: plugin manifest
|
|
26
|
+
├── skills/
|
|
27
|
+
│ └── my-skill/
|
|
28
|
+
│ └── SKILL.md ← Skills (namespaced as /my-plugin:my-skill)
|
|
29
|
+
├── commands/
|
|
30
|
+
│ └── quick-cmd.md ← Legacy commands format (also supported)
|
|
31
|
+
├── agents/
|
|
32
|
+
│ └── my-agent.md ← Custom agents
|
|
33
|
+
├── hooks/
|
|
34
|
+
│ └── hooks.json ← Hook configurations
|
|
35
|
+
├── .mcp.json ← MCP server configurations
|
|
36
|
+
├── .lsp.json ← LSP server configurations (optional)
|
|
37
|
+
├── settings.json ← Default settings when plugin is enabled
|
|
38
|
+
└── README.md ← Documentation
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**CRITICAL:** `.claude-plugin/` only contains `plugin.json`. Everything else goes at the plugin root.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Step 3: Create the Manifest
|
|
46
|
+
|
|
47
|
+
**`.claude-plugin/plugin.json`:**
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"name": "my-plugin",
|
|
52
|
+
"description": "What this plugin does",
|
|
53
|
+
"version": "1.0.0",
|
|
54
|
+
"author": {
|
|
55
|
+
"name": "Your Name",
|
|
56
|
+
"email": "you@example.com"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/you/my-plugin",
|
|
59
|
+
"repository": "https://github.com/you/my-plugin",
|
|
60
|
+
"license": "MIT"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
| Field | Required | Purpose |
|
|
65
|
+
|-------|----------|---------|
|
|
66
|
+
| `name` | Yes | Unique ID and skill namespace prefix. Lowercase, hyphens. |
|
|
67
|
+
| `description` | Yes | Shown in plugin manager when browsing/installing. |
|
|
68
|
+
| `version` | Yes | Semantic versioning (`1.0.0`). Increment for updates. |
|
|
69
|
+
| `author` | No | Attribution info. |
|
|
70
|
+
| `homepage` | No | Link to docs or landing page. |
|
|
71
|
+
| `repository` | No | Source code URL. |
|
|
72
|
+
| `license` | No | SPDX license identifier. |
|
|
73
|
+
|
|
74
|
+
The `name` field becomes the namespace prefix for all skills: a skill named `review` in a plugin named `code-tools` becomes `/code-tools:review`.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Step 4: Add Skills
|
|
79
|
+
|
|
80
|
+
Skills in a plugin live in `skills/<skill-name>/SKILL.md`:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
my-plugin/
|
|
84
|
+
└── skills/
|
|
85
|
+
└── code-review/
|
|
86
|
+
└── SKILL.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**`skills/code-review/SKILL.md`:**
|
|
90
|
+
```yaml
|
|
91
|
+
---
|
|
92
|
+
name: code-review
|
|
93
|
+
description: Reviews code for best practices. Use when reviewing code, checking PRs, or auditing quality.
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
# Code Review
|
|
97
|
+
|
|
98
|
+
When reviewing code, check for:
|
|
99
|
+
1. Security vulnerabilities
|
|
100
|
+
2. Error handling completeness
|
|
101
|
+
3. TypeScript type safety
|
|
102
|
+
4. Test coverage
|
|
103
|
+
|
|
104
|
+
...
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
After installing, use it as `/my-plugin:code-review`.
|
|
108
|
+
|
|
109
|
+
Skills in plugins support all the same features as standalone skills: arguments (`$ARGUMENTS`), dynamic context (`!`cmd``), `context: fork`, `allowed-tools`, etc.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 5: Add Agents
|
|
114
|
+
|
|
115
|
+
Agents in plugins live in `agents/<name>.md` — exactly the same format as standalone agents:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
my-plugin/
|
|
119
|
+
└── agents/
|
|
120
|
+
└── security-reviewer.md
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**`agents/security-reviewer.md`:**
|
|
124
|
+
```yaml
|
|
125
|
+
---
|
|
126
|
+
name: security-reviewer
|
|
127
|
+
description: Security expert. Use proactively when reviewing code changes for vulnerabilities.
|
|
128
|
+
tools: Read, Grep, Glob, Bash
|
|
129
|
+
model: sonnet
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
You are a security engineer specializing in web application security...
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Agents are **not** namespaced like skills — they keep their plain `name`.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Step 6: Add Hooks
|
|
140
|
+
|
|
141
|
+
Hooks in plugins live in `hooks/hooks.json`:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
my-plugin/
|
|
145
|
+
└── hooks/
|
|
146
|
+
└── hooks.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**`hooks/hooks.json`:**
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"hooks": {
|
|
153
|
+
"PostToolUse": [
|
|
154
|
+
{
|
|
155
|
+
"matcher": "Edit|Write",
|
|
156
|
+
"hooks": [
|
|
157
|
+
{
|
|
158
|
+
"type": "command",
|
|
159
|
+
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write 2>/dev/null || true"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Same format as `settings.json` hooks — just the `"hooks"` key and below.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Step 7: Add MCP Servers
|
|
173
|
+
|
|
174
|
+
MCP servers in plugins live in `.mcp.json` at the plugin root:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
my-plugin/
|
|
178
|
+
└── .mcp.json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**`.mcp.json`:**
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"my-internal-api": {
|
|
186
|
+
"type": "stdio",
|
|
187
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/servers/api-server",
|
|
188
|
+
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
|
|
189
|
+
"env": {
|
|
190
|
+
"API_URL": "${MY_API_URL}"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- `${CLAUDE_PLUGIN_ROOT}` — resolved to the plugin's directory at runtime
|
|
198
|
+
- MCP servers start automatically when the plugin is enabled (requires Claude Code restart to apply changes)
|
|
199
|
+
- Supports `stdio`, `http`, and `sse` transport types
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Step 8: Add LSP Servers (Optional)
|
|
204
|
+
|
|
205
|
+
LSP servers give Claude real-time code intelligence for languages not natively supported:
|
|
206
|
+
|
|
207
|
+
**`.lsp.json`:**
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"go": {
|
|
211
|
+
"command": "gopls",
|
|
212
|
+
"args": ["serve"],
|
|
213
|
+
"extensionToLanguage": {
|
|
214
|
+
".go": "go"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Users need the LSP binary installed. For common languages (TypeScript, Python, Rust), use pre-built plugins from the marketplace instead.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Step 9: Default Settings
|
|
225
|
+
|
|
226
|
+
Ship default settings with your plugin via `settings.json` at the plugin root:
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"agent": "security-reviewer"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Setting `agent` activates one of the plugin's custom agents as the default main thread. This changes how Claude Code behaves when the plugin is enabled. Currently only the `agent` key is supported here.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Step 10: Test Locally
|
|
239
|
+
|
|
240
|
+
Use `--plugin-dir` to load your plugin without installing:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Load single plugin
|
|
244
|
+
claude --plugin-dir ./my-plugin
|
|
245
|
+
|
|
246
|
+
# Load multiple plugins
|
|
247
|
+
claude --plugin-dir ./plugin-one --plugin-dir ./plugin-two
|
|
248
|
+
|
|
249
|
+
# Inside Claude Code:
|
|
250
|
+
/my-plugin:skill-name # Test a skill
|
|
251
|
+
/agents # Check agents appear
|
|
252
|
+
/hooks # Verify hooks are registered
|
|
253
|
+
/mcp # Check MCP servers
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Changes to plugin files require restarting Claude Code to take effect.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Step 11: Convert Existing Config to Plugin
|
|
261
|
+
|
|
262
|
+
If you have skills/hooks in `.claude/`, convert them:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Create plugin structure
|
|
266
|
+
mkdir -p my-plugin/.claude-plugin
|
|
267
|
+
|
|
268
|
+
# Create manifest
|
|
269
|
+
cat > my-plugin/.claude-plugin/plugin.json << 'EOF'
|
|
270
|
+
{
|
|
271
|
+
"name": "my-plugin",
|
|
272
|
+
"description": "Migrated from standalone configuration",
|
|
273
|
+
"version": "1.0.0"
|
|
274
|
+
}
|
|
275
|
+
EOF
|
|
276
|
+
|
|
277
|
+
# Copy existing files
|
|
278
|
+
cp -r .claude/skills my-plugin/ # If you have skills
|
|
279
|
+
cp -r .claude/agents my-plugin/ # If you have agents
|
|
280
|
+
cp -r .claude/commands my-plugin/ # If you have commands
|
|
281
|
+
|
|
282
|
+
# Migrate hooks from settings.json → hooks/hooks.json
|
|
283
|
+
mkdir my-plugin/hooks
|
|
284
|
+
# Copy the "hooks" object from .claude/settings.json to hooks/hooks.json
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**What changes after migration:**
|
|
288
|
+
|
|
289
|
+
| Standalone | Plugin |
|
|
290
|
+
|-----------|--------|
|
|
291
|
+
| `/hello` | `/my-plugin:hello` |
|
|
292
|
+
| `.claude/commands/` | `plugin/commands/` |
|
|
293
|
+
| `.claude/settings.json` hooks | `plugin/hooks/hooks.json` |
|
|
294
|
+
| Manual sharing | `claude plugin install` |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Step 12: Distribute
|
|
299
|
+
|
|
300
|
+
### Via URL/Git
|
|
301
|
+
|
|
302
|
+
Users install with:
|
|
303
|
+
```bash
|
|
304
|
+
claude plugin install https://github.com/you/my-plugin
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Or via marketplace if you submit to one:
|
|
308
|
+
```bash
|
|
309
|
+
/plugin install my-plugin # From configured marketplace
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Submit to official marketplace
|
|
313
|
+
|
|
314
|
+
1. Go to `claude.ai/settings/plugins/submit` or `platform.claude.com/plugins/submit`
|
|
315
|
+
2. Fill out the submission form
|
|
316
|
+
3. Once approved, users can install via `/plugin install plugin-name`
|
|
317
|
+
|
|
318
|
+
### Via team marketplace
|
|
319
|
+
|
|
320
|
+
Create a `marketplace.json` registry file and host it. Teams can point Claude Code to it:
|
|
321
|
+
```bash
|
|
322
|
+
claude plugin source add https://your-company.com/plugins/marketplace.json
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Complete Plugin Example: Code Quality Toolkit
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
code-quality/
|
|
331
|
+
├── .claude-plugin/
|
|
332
|
+
│ └── plugin.json
|
|
333
|
+
├── skills/
|
|
334
|
+
│ ├── review/
|
|
335
|
+
│ │ └── SKILL.md # /code-quality:review
|
|
336
|
+
│ └── refactor/
|
|
337
|
+
│ └── SKILL.md # /code-quality:refactor
|
|
338
|
+
├── agents/
|
|
339
|
+
│ └── code-reviewer.md # Auto-review agent
|
|
340
|
+
├── hooks/
|
|
341
|
+
│ └── hooks.json # Auto-format on save
|
|
342
|
+
└── README.md
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**`.claude-plugin/plugin.json`:**
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"name": "code-quality",
|
|
349
|
+
"description": "Code review, refactoring, and auto-formatting toolkit",
|
|
350
|
+
"version": "2.1.0",
|
|
351
|
+
"author": { "name": "GinStudio Team" },
|
|
352
|
+
"repository": "https://github.com/ginstudio/code-quality-plugin"
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
**`hooks/hooks.json`:**
|
|
357
|
+
```json
|
|
358
|
+
{
|
|
359
|
+
"hooks": {
|
|
360
|
+
"PostToolUse": [{
|
|
361
|
+
"matcher": "Edit|Write",
|
|
362
|
+
"hooks": [{
|
|
363
|
+
"type": "command",
|
|
364
|
+
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write 2>/dev/null || true"
|
|
365
|
+
}]
|
|
366
|
+
}]
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**`agents/code-reviewer.md`:**
|
|
372
|
+
```yaml
|
|
373
|
+
---
|
|
374
|
+
name: code-reviewer
|
|
375
|
+
description: Expert code reviewer. Use proactively after any code changes.
|
|
376
|
+
tools: Read, Grep, Glob, Bash
|
|
377
|
+
model: sonnet
|
|
378
|
+
memory: project
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
You are a senior code reviewer. After code changes, run git diff HEAD~1 and provide structured feedback by severity (CRITICAL/WARNING/SUGGESTION).
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Checklist Before Publishing
|
|
387
|
+
|
|
388
|
+
- [ ] `version` follows semver (`1.0.0`)
|
|
389
|
+
- [ ] `description` clearly explains what the plugin does
|
|
390
|
+
- [ ] Skills tested with `/plugin-name:skill-name`
|
|
391
|
+
- [ ] Agents appear in `/agents`
|
|
392
|
+
- [ ] Hooks fire correctly (test via `/hooks`)
|
|
393
|
+
- [ ] MCP servers start up (check via `/mcp`)
|
|
394
|
+
- [ ] `README.md` explains installation + usage
|
|
395
|
+
- [ ] No secrets or credentials in plugin files
|
|
396
|
+
- [ ] Plugin loads cleanly with `claude --plugin-dir ./my-plugin`
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Tutorial: Sandboxing
|
|
2
|
+
|
|
3
|
+
Claude Code's sandbox restricts what bash commands and their child processes can do at the **OS level** — independent of Claude's permission rules.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: Understand How Sandboxing Works
|
|
8
|
+
|
|
9
|
+
The sandbox adds OS-level enforcement ON TOP of Claude's permission system:
|
|
10
|
+
|
|
11
|
+
| Layer | What it controls | How to configure |
|
|
12
|
+
|-------|-----------------|-----------------|
|
|
13
|
+
| **Permissions** | Which tools Claude can call | `.claude/settings.json` permissions |
|
|
14
|
+
| **Sandbox** | What bash commands can access at OS level | `/sandbox` or `settings.json` sandbox config |
|
|
15
|
+
|
|
16
|
+
Both layers run independently. A command can pass Claude's permission check but still be blocked by the sandbox if it tries to access a restricted path or network domain.
|
|
17
|
+
|
|
18
|
+
### Platform Support
|
|
19
|
+
|
|
20
|
+
| Platform | Implementation | Prerequisites |
|
|
21
|
+
|----------|---------------|--------------|
|
|
22
|
+
| macOS | Seatbelt (built-in) | None |
|
|
23
|
+
| Linux / WSL2 | bubblewrap + socat | `sudo apt-get install bubblewrap socat` |
|
|
24
|
+
| WSL1 | ❌ Not supported | Requires WSL2 kernel features |
|
|
25
|
+
| Windows native | Planned | Not yet available |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Step 2: Enable Sandboxing
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Toggle in the current session
|
|
33
|
+
/sandbox
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This opens a mode selection menu. Choose:
|
|
37
|
+
|
|
38
|
+
1. **Auto-allow mode** — Sandboxed bash commands run automatically without prompts. Commands that can't be sandboxed fall through to normal permissions.
|
|
39
|
+
2. **Regular permissions mode** — All commands still go through standard permission prompts, but are also sandboxed at OS level.
|
|
40
|
+
|
|
41
|
+
Or enable permanently in `.claude/settings.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"sandbox": {
|
|
46
|
+
"enabled": true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Step 3: Default Filesystem Behavior
|
|
54
|
+
|
|
55
|
+
By default, sandboxed commands can:
|
|
56
|
+
- **Read**: all of your filesystem EXCEPT explicitly denied directories
|
|
57
|
+
- **Write**: ONLY the current working directory and subdirectories
|
|
58
|
+
|
|
59
|
+
All restrictions apply to child processes too (kubectl, terraform, npm scripts, etc.).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Step 4: Configure Filesystem Rules
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"sandbox": {
|
|
68
|
+
"filesystem": {
|
|
69
|
+
"allowWrite": ["//tmp/build", "~/.kube/cache"],
|
|
70
|
+
"denyWrite": ["/src/secrets/**"],
|
|
71
|
+
"denyRead": ["~/.ssh/", "~/.aws/credentials"]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Path Prefix Convention
|
|
78
|
+
|
|
79
|
+
| Prefix | Meaning | Example |
|
|
80
|
+
|--------|---------|---------|
|
|
81
|
+
| `//` | Absolute filesystem path | `//tmp/build` → `/tmp/build` |
|
|
82
|
+
| `~/` | Home directory | `~/.kube` → `$HOME/.kube` |
|
|
83
|
+
| `/` | Relative to settings file directory | `/build` → `$SETTINGS_DIR/build` |
|
|
84
|
+
| `./` or none | Relative, runtime-resolved | `./output` |
|
|
85
|
+
|
|
86
|
+
**Arrays merge across config scopes.** If managed settings allow `//opt/company-tools` and you add `~/.kube`, both are active simultaneously.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Step 5: Configure Network Rules
|
|
91
|
+
|
|
92
|
+
By default, no network filtering. To restrict outbound access from bash commands:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"sandbox": {
|
|
97
|
+
"network": {
|
|
98
|
+
"allowedDomains": [
|
|
99
|
+
"registry.npmjs.org",
|
|
100
|
+
"api.github.com",
|
|
101
|
+
"*.internal.company.com"
|
|
102
|
+
],
|
|
103
|
+
"blockedDomains": ["*.social-media.com"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Network filtering works via a proxy running **outside** the sandbox — all subprocess traffic routes through it. When an unapproved domain is accessed:
|
|
110
|
+
- Blocked at OS level
|
|
111
|
+
- User gets immediate notification with options: deny, allow once, or permanently allow
|
|
112
|
+
|
|
113
|
+
**Important distinction:**
|
|
114
|
+
- `sandbox.network.allowedDomains` — controls what **bash commands** can reach
|
|
115
|
+
- `WebFetch(domain:x)` permission rules — controls what Claude's **WebFetch tool** can access
|
|
116
|
+
- These are completely separate controls
|
|
117
|
+
|
|
118
|
+
### Custom Proxy
|
|
119
|
+
|
|
120
|
+
For advanced logging, HTTPS inspection, or custom filtering:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"sandbox": {
|
|
125
|
+
"network": {
|
|
126
|
+
"httpProxyPort": 8080,
|
|
127
|
+
"socksProxyPort": 8081
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Step 6: Exclude Specific Commands from Sandbox
|
|
136
|
+
|
|
137
|
+
Some tools are incompatible with the sandbox. Run them outside it entirely:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"sandbox": {
|
|
142
|
+
"excludedCommands": ["docker", "git"]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Known incompatibilities:**
|
|
148
|
+
- `watchman` — incompatible with sandbox; use `jest --no-watchman` instead
|
|
149
|
+
- `docker` — incompatible; add to `excludedCommands`
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Step 7: The Escape Hatch
|
|
154
|
+
|
|
155
|
+
When a command fails due to sandbox restrictions, Claude can retry it with `dangerouslyDisableSandbox` — those retried commands bypass the sandbox and fall through to normal permission prompts.
|
|
156
|
+
|
|
157
|
+
To disable this escape hatch entirely:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"sandbox": {
|
|
162
|
+
"allowUnsandboxedCommands": false
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
When set to `false`, `dangerouslyDisableSandbox` is completely ignored — useful for stricter enterprise environments.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Step 8: Full Configuration Example
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"sandbox": {
|
|
176
|
+
"filesystem": {
|
|
177
|
+
"allowWrite": [
|
|
178
|
+
"//tmp/**",
|
|
179
|
+
"~/.npm/**",
|
|
180
|
+
"~/Library/Caches/**"
|
|
181
|
+
],
|
|
182
|
+
"denyWrite": [
|
|
183
|
+
"~/.ssh/**",
|
|
184
|
+
"~/.aws/**",
|
|
185
|
+
"/etc/**"
|
|
186
|
+
],
|
|
187
|
+
"denyRead": [
|
|
188
|
+
"~/.ssh/id_rsa",
|
|
189
|
+
"~/.aws/credentials"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"network": {
|
|
193
|
+
"allowedDomains": [
|
|
194
|
+
"registry.npmjs.org",
|
|
195
|
+
"api.github.com",
|
|
196
|
+
"pypi.org",
|
|
197
|
+
"*.amazonaws.com"
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
"excludedCommands": ["docker"],
|
|
201
|
+
"allowUnsandboxedCommands": false
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Step 9: Sandbox + Permissions — How They Interact
|
|
209
|
+
|
|
210
|
+
| Tool | Permissions control | Sandbox applies? |
|
|
211
|
+
|------|--------------------|--------------------|
|
|
212
|
+
| `Read` tool | Yes — permission rules | No |
|
|
213
|
+
| `Edit` / `Write` tool | Yes — permission rules | No |
|
|
214
|
+
| `WebFetch` tool | Yes — `WebFetch(domain:x)` rules | No |
|
|
215
|
+
| `Bash` command | Yes — permission rules | **Yes** — OS-level enforcement |
|
|
216
|
+
| Bash child processes | Inherited from Bash | **Yes** — all child processes sandboxed |
|
|
217
|
+
|
|
218
|
+
**Key insight:** `Edit`/`Read` deny rules and `sandbox.filesystem.denyRead`/`denyWrite` are **merged** — both apply simultaneously. So `Edit(.env)` deny in permissions blocks the Edit tool, while `denyWrite: [".env"]` in sandbox blocks any bash command that tries to write `.env`.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Step 10: Security Limitations to Know
|
|
223
|
+
|
|
224
|
+
1. **Network filtering does not inspect traffic content** — domain-level only; domain fronting may bypass it
|
|
225
|
+
2. **Broad domains** — allowing `github.com` could theoretically enable data exfiltration via repository uploads
|
|
226
|
+
3. **Unix sockets** — `allowUnixSockets` can grant sandbox bypass; allowing `/var/run/docker.sock` effectively grants host system access
|
|
227
|
+
4. **Filesystem write permissions** — allowing writes to `$PATH` dirs or shell configs (`.bashrc`, `.zshrc`) enables privilege escalation
|
|
228
|
+
5. **Weak nested sandbox** — `enableWeakerNestedSandbox: true` (for Docker environments without privileged namespaces) considerably weakens security
|
|
229
|
+
|
|
230
|
+
### Linux / WSL2 inside Docker
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"sandbox": {
|
|
235
|
+
"enableWeakerNestedSandbox": true
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Only use when additional isolation is enforced externally (e.g., the Docker container itself is isolated).
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Quick Reference
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Enable/disable sandbox interactively
|
|
248
|
+
/sandbox
|
|
249
|
+
|
|
250
|
+
# Open source sandbox runtime (sandbox arbitrary programs, including MCP servers)
|
|
251
|
+
npx @anthropic-ai/sandbox-runtime <command>
|
|
252
|
+
|
|
253
|
+
# Install prerequisites on Linux/WSL2
|
|
254
|
+
sudo apt-get install bubblewrap socat # Ubuntu/Debian
|
|
255
|
+
sudo dnf install bubblewrap socat # Fedora
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Sandbox applies to:** Bash commands and all their child processes.
|
|
259
|
+
|
|
260
|
+
**Sandbox does NOT apply to:** Read, Edit, Write, Glob, Grep, WebFetch, MCP tools.
|
|
261
|
+
|
|
262
|
+
**Rule priority:** `denyRead` / `denyWrite` always win over `allowWrite`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# load-tutorial.sh — Loads the right tutorial doc based on the topic argument.
|
|
3
|
+
# Used by ai-build-ai SKILL.md via the !`command` dynamic context injection.
|
|
4
|
+
#
|
|
5
|
+
# Usage: load-tutorial.sh [topic]
|
|
6
|
+
# Topics: skill | agent | mcp | headless | hooks | plugin | teams | memory | permissions | overview (default)
|
|
7
|
+
|
|
8
|
+
SKILL_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
9
|
+
TOPIC="${1:-overview}"
|
|
10
|
+
|
|
11
|
+
# Normalize input: lowercase, strip leading /, trim spaces
|
|
12
|
+
TOPIC=$(echo "$TOPIC" | tr '[:upper:]' '[:lower:]' | sed 's|^/||' | xargs)
|
|
13
|
+
|
|
14
|
+
case "$TOPIC" in
|
|
15
|
+
skill|skills|create-skill|new-skill|add-skill|write-skill)
|
|
16
|
+
cat "$SKILL_DIR/docs/create-skill.md"
|
|
17
|
+
;;
|
|
18
|
+
agent|agents|subagent|subagents|create-agent|new-agent|add-agent|custom-agent)
|
|
19
|
+
cat "$SKILL_DIR/docs/create-agent.md"
|
|
20
|
+
;;
|
|
21
|
+
mcp|mcp-server|create-mcp|new-mcp|add-mcp|model-context-protocol|server)
|
|
22
|
+
cat "$SKILL_DIR/docs/create-mcp.md"
|
|
23
|
+
;;
|
|
24
|
+
headless|headless-mode|programmatic|cli|sdk|agent-sdk|automation|script|ci|cicd|pipeline|github-actions|gitlab)
|
|
25
|
+
cat "$SKILL_DIR/docs/headless-mode.md"
|
|
26
|
+
;;
|
|
27
|
+
hook|hooks|lifecycle|event|events|automation|pretooluse|posttooluse|sessionstart|stop)
|
|
28
|
+
cat "$SKILL_DIR/docs/hooks.md"
|
|
29
|
+
;;
|
|
30
|
+
plugin|plugins|distribute|distribution|marketplace|package|publish)
|
|
31
|
+
cat "$SKILL_DIR/docs/plugins.md"
|
|
32
|
+
;;
|
|
33
|
+
team|teams|agent-team|agent-teams|multi-agent|parallel|teammate|teammates)
|
|
34
|
+
cat "$SKILL_DIR/docs/agent-teams.md"
|
|
35
|
+
;;
|
|
36
|
+
memory|claude-md|claudemd|rules|persistent|instructions|context|remember)
|
|
37
|
+
cat "$SKILL_DIR/docs/memory-claude-md.md"
|
|
38
|
+
;;
|
|
39
|
+
permission|permissions|allow|deny|rule|rules|access|bypasspermissions)
|
|
40
|
+
cat "$SKILL_DIR/docs/permissions.md"
|
|
41
|
+
;;
|
|
42
|
+
sandbox|sandboxing|isolat*|seatbelt|bubblewrap|filesystem|network-filter)
|
|
43
|
+
cat "$SKILL_DIR/docs/sandbox.md"
|
|
44
|
+
;;
|
|
45
|
+
checkpoint|checkpointing|rewind|restore|fork|session|resume|undo)
|
|
46
|
+
cat "$SKILL_DIR/docs/checkpointing.md"
|
|
47
|
+
;;
|
|
48
|
+
output-style|output-styles|style|styles|tone|explanatory|learning)
|
|
49
|
+
cat "$SKILL_DIR/docs/output-styles.md"
|
|
50
|
+
;;
|
|
51
|
+
*)
|
|
52
|
+
cat "$SKILL_DIR/docs/overview.md"
|
|
53
|
+
;;
|
|
54
|
+
esac
|