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.
Files changed (92) hide show
  1. package/README.md +77 -0
  2. package/agents/developer.md +56 -0
  3. package/agents/frontend-design.md +69 -0
  4. package/agents/mobile-reviewer.md +36 -0
  5. package/agents/review-code.md +49 -0
  6. package/agents/security-scanner.md +50 -0
  7. package/agents/tester.md +72 -0
  8. package/bin/cli.js +226 -0
  9. package/package.json +20 -0
  10. package/skills/ai-asset-generator/SKILL.md +255 -0
  11. package/skills/ai-asset-generator/docs/gen-image.md +274 -0
  12. package/skills/ai-asset-generator/docs/genvideo.md +341 -0
  13. package/skills/ai-asset-generator/docs/remove-background.md +19 -0
  14. package/skills/ai-asset-generator/generate-credit-assets.mjs +180 -0
  15. package/skills/ai-asset-generator/generate-ginbrowser-assets.mjs +242 -0
  16. package/skills/ai-asset-generator/generate-sty-icon.mjs +149 -0
  17. package/skills/ai-asset-generator/lib/bg-remove.mjs +34 -0
  18. package/skills/ai-asset-generator/lib/env.mjs +38 -0
  19. package/skills/ai-asset-generator/lib/kie-client.mjs +88 -0
  20. package/skills/ai-asset-generator/scripts/scaffold-generator.mjs +203 -0
  21. package/skills/ai-build-ai/SKILL.md +124 -0
  22. package/skills/ai-build-ai/docs/agent-teams.md +293 -0
  23. package/skills/ai-build-ai/docs/checkpointing.md +161 -0
  24. package/skills/ai-build-ai/docs/create-agent.md +399 -0
  25. package/skills/ai-build-ai/docs/create-mcp.md +395 -0
  26. package/skills/ai-build-ai/docs/create-skill.md +299 -0
  27. package/skills/ai-build-ai/docs/headless-mode.md +614 -0
  28. package/skills/ai-build-ai/docs/hooks.md +578 -0
  29. package/skills/ai-build-ai/docs/memory-claude-md.md +375 -0
  30. package/skills/ai-build-ai/docs/output-styles.md +208 -0
  31. package/skills/ai-build-ai/docs/overview.md +162 -0
  32. package/skills/ai-build-ai/docs/permissions.md +391 -0
  33. package/skills/ai-build-ai/docs/plugins.md +396 -0
  34. package/skills/ai-build-ai/docs/sandbox.md +262 -0
  35. package/skills/ai-build-ai/scripts/load-tutorial.sh +54 -0
  36. package/skills/icon-generator/SKILL.md +270 -0
  37. package/skills/mobile-app-review/SKILL.md +321 -0
  38. package/skills/mobile-app-review/references/apple-review.md +132 -0
  39. package/skills/mobile-app-review/references/google-play-review.md +203 -0
  40. package/skills/mongodb/SKILL.md +667 -0
  41. package/skills/mongodb/references/mongoose-patterns.md +368 -0
  42. package/skills/nestjs-architecture/SKILL.md +1086 -0
  43. package/skills/nestjs-architecture/references/advanced-patterns.md +590 -0
  44. package/skills/performance/SKILL.md +509 -0
  45. package/skills/react-fsd-architecture/SKILL.md +693 -0
  46. package/skills/react-fsd-architecture/references/fsd-patterns.md +747 -0
  47. package/skills/react-query/SKILL.md +685 -0
  48. package/skills/react-query/references/query-patterns.md +365 -0
  49. package/skills/review-code/SKILL.md +321 -0
  50. package/skills/review-code/references/clean-code-principles.md +395 -0
  51. package/skills/review-code/references/frontend-patterns.md +136 -0
  52. package/skills/review-code/references/nestjs-patterns.md +184 -0
  53. package/skills/review-code/scripts/check-module.sh +201 -0
  54. package/skills/review-code/scripts/deep-scan.sh +604 -0
  55. package/skills/review-code/scripts/dep-check.sh +522 -0
  56. package/skills/review-code/scripts/detect-duplicates.sh +466 -0
  57. package/skills/review-code/scripts/format-check.sh +577 -0
  58. package/skills/review-code/scripts/run-review.sh +167 -0
  59. package/skills/review-code/scripts/scan-codebase.sh +152 -0
  60. package/skills/security-scanner/SKILL.md +327 -0
  61. package/skills/security-scanner/references/nestjs-security.md +260 -0
  62. package/skills/security-scanner/references/nextjs-security.md +201 -0
  63. package/skills/security-scanner/references/react-native-security.md +199 -0
  64. package/skills/security-scanner/scripts/security-scan.sh +478 -0
  65. package/skills/ui-ux-pro-max/SKILL.md +377 -0
  66. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  67. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  68. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  69. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  70. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  71. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  72. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  73. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  74. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  75. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  76. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  77. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  78. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  79. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  80. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  81. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  82. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  83. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  84. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  85. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  86. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  87. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  88. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  89. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  90. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  91. package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  92. package/skills/ui-ux-pro-max/scripts/search.py +114 -0
@@ -0,0 +1,161 @@
1
+ # Tutorial: Checkpointing & Rewind
2
+
3
+ Claude Code automatically saves checkpoints before each file edit. Rewind any mistake without losing work — across sessions.
4
+
5
+ ---
6
+
7
+ ## Step 1: How Checkpoints Work
8
+
9
+ - Created automatically before each file edit
10
+ - One checkpoint per **user prompt** (not per individual file change within a prompt)
11
+ - Persist across sessions (accessible when you resume)
12
+ - Auto-cleaned after 30 days
13
+
14
+ **What checkpoints track:**
15
+ - File changes made by Edit, Write, and NotebookEdit tools
16
+
17
+ **What checkpoints do NOT track:**
18
+ - Files modified by bash commands (`rm`, `mv`, `cp`, shell scripts)
19
+ - Changes made outside Claude Code (manual edits in your editor)
20
+ - Edits from other concurrent Claude sessions on the same files
21
+
22
+ ---
23
+
24
+ ## Step 2: Open the Rewind Menu
25
+
26
+ ```bash
27
+ Esc+Esc # Press Escape twice
28
+ /rewind # Same effect
29
+ /checkpoint # Alias
30
+ ```
31
+
32
+ This opens a scrollable list of all prompts from the session. Select the checkpoint you want to revert to.
33
+
34
+ ---
35
+
36
+ ## Step 3: Rewind Options
37
+
38
+ When you select a checkpoint, you have 5 choices:
39
+
40
+ | Option | What it does |
41
+ |--------|-------------|
42
+ | **Restore code and conversation** | Reverts both file changes AND conversation history to that point |
43
+ | **Restore conversation** | Rewinds messages only; keeps current code state |
44
+ | **Restore code** | Reverts file changes only; keeps full conversation history |
45
+ | **Summarize from here** | Compresses conversation from this point forward; early messages stay intact |
46
+ | **Never mind** | Exit without making any changes |
47
+
48
+ After any restore option, the original prompt from the selected message is placed back in your input field.
49
+
50
+ ---
51
+
52
+ ## Step 4: Summarize from Here
53
+
54
+ **"Summarize from here"** is a targeted context management tool — different from `/compact`:
55
+
56
+ ```
57
+ /rewind → select message → "Summarize from here"
58
+ ```
59
+
60
+ - Messages BEFORE the selected point remain in **full detail**
61
+ - Messages AFTER (and including) the selected point are replaced with an AI summary
62
+ - The original messages are still stored in the session transcript (Claude can still reference them)
63
+ - Optionally provide instructions to guide what the summary focuses on
64
+
65
+ | | `/compact` | "Summarize from here" |
66
+ |-|------------|----------------------|
67
+ | Scope | Entire conversation | From selected point forward |
68
+ | Preserves early context in full | No | Yes |
69
+ | Use when | Context is almost full, start fresh | You want to keep early context detailed |
70
+
71
+ ---
72
+
73
+ ## Step 5: Fork a Session
74
+
75
+ To experiment on a branch without losing your current state:
76
+
77
+ ```bash
78
+ # Fork via command (creates a new session from the current point)
79
+ /fork
80
+
81
+ # Fork with a name
82
+ /fork experiment-v2
83
+
84
+ # Fork from CLI (branches off the most recent conversation)
85
+ claude --continue --fork-session
86
+ ```
87
+
88
+ Forked sessions appear **grouped under their root session** in the session picker. The original session stays completely intact.
89
+
90
+ ---
91
+
92
+ ## Step 6: Session Management
93
+
94
+ ### CLI Flags
95
+
96
+ ```bash
97
+ # Resume most recent conversation in the current directory
98
+ claude --continue
99
+
100
+ # Open interactive session picker
101
+ claude --resume
102
+
103
+ # Resume a specific session by name
104
+ claude --resume auth-refactor
105
+
106
+ # Resume the session linked to a specific GitHub PR
107
+ claude --from-pr 123
108
+ ```
109
+
110
+ ### In-Session Commands
111
+
112
+ ```bash
113
+ # Name the current session for easy resuming later
114
+ /rename auth-refactor
115
+
116
+ # Switch to a different conversation without exiting
117
+ /resume
118
+
119
+ # Fork current conversation at this point
120
+ /fork
121
+ ```
122
+
123
+ ### Session Picker Keyboard Shortcuts
124
+
125
+ | Key | Action |
126
+ |-----|--------|
127
+ | `P` | Preview session content |
128
+ | `R` | Rename highlighted session |
129
+ | `/` | Search / filter sessions |
130
+ | `A` | Toggle: current directory / all projects |
131
+ | `B` | Filter by current git branch |
132
+ | `→` / `←` | Expand / collapse grouped sessions |
133
+
134
+ ---
135
+
136
+ ## Quick Reference
137
+
138
+ ```bash
139
+ Esc+Esc # Open rewind menu
140
+ /rewind # Same as Esc+Esc
141
+ /fork # Fork current session at this point
142
+ /compact # Compact the entire conversation
143
+
144
+ claude --continue # Resume most recent conversation
145
+ claude --resume # Interactive session picker
146
+ claude --resume <name> # Resume by name
147
+ claude --from-pr 123 # Resume session linked to a PR
148
+ ```
149
+
150
+ **Restore code only** (keep conversation):
151
+ → `/rewind` → select checkpoint → **Restore code**
152
+
153
+ **Restore conversation only** (keep code):
154
+ → `/rewind` → select checkpoint → **Restore conversation**
155
+
156
+ **Compress context from a point**:
157
+ → `/rewind` → select checkpoint → **Summarize from here**
158
+
159
+ ---
160
+
161
+ **Design intent:** Checkpointing is "local undo" that complements Git's "permanent history". Use Git for versioning your work across the project; use checkpointing for in-session recovery from mistakes.
@@ -0,0 +1,399 @@
1
+ # Tutorial: Create a Custom Subagent
2
+
3
+ A subagent is a specialized AI assistant that runs in its own isolated context window with a custom system prompt, specific tools, and independent permissions. When Claude encounters a matching task, it delegates to the subagent and summarizes the result.
4
+
5
+ ---
6
+
7
+ ## Step 1: Understand When to Use Subagents
8
+
9
+ | Use subagents for... | Use main conversation for... |
10
+ |----------------------|------------------------------|
11
+ | Verbose operations (test runs, log analysis) | Quick edits and targeted changes |
12
+ | Isolated tool access (read-only, specific commands) | Multi-step work needing conversation history |
13
+ | Parallel workloads (research multiple modules) | Iterative refinement with feedback |
14
+ | Consistent domain expertise (always-code-reviewer) | Tasks where context matters |
15
+ | Cost optimization (route cheap tasks to Haiku) | Complex reasoning chains |
16
+
17
+ **Key constraint:** Subagents cannot spawn other subagents. For nested delegation, chain from main conversation.
18
+
19
+ ---
20
+
21
+ ## Step 2: File Format and Location
22
+
23
+ Subagents are Markdown files with YAML frontmatter:
24
+
25
+ ```
26
+ .claude/agents/<name>.md ← Project-level (commit to git, team shares it)
27
+ ~/.claude/agents/<name>.md ← Personal (available in all projects)
28
+ ```
29
+
30
+ **Important:** Subagents are loaded at session start. After adding a file manually, restart Claude Code or run `/agents` to reload without restarting.
31
+
32
+ ---
33
+
34
+ ## Step 3: Full Frontmatter Reference
35
+
36
+ ```yaml
37
+ ---
38
+ name: my-agent # REQUIRED. Unique, lowercase, hyphens only.
39
+ description: | # REQUIRED. When Claude should delegate to this agent.
40
+ Expert [domain] specialist. Use proactively when [specific situation].
41
+ Invoke when user [describes trigger condition].
42
+
43
+ # Tool access (pick one approach):
44
+ tools: Read, Grep, Glob, Bash # Allowlist — only these tools
45
+ disallowedTools: Write, Edit # Denylist — all tools except these
46
+
47
+ # Model selection:
48
+ model: haiku # haiku | sonnet | opus | inherit (default: inherit)
49
+
50
+ # Permissions:
51
+ permissionMode: default # default | acceptEdits | dontAsk | bypassPermissions | plan
52
+
53
+ # Execution:
54
+ maxTurns: 20 # Max agentic turns before stopping
55
+ background: false # true = always run as background task
56
+ isolation: worktree # Run in isolated git worktree (auto-cleaned up)
57
+
58
+ # Advanced:
59
+ skills: # Preload skill content into agent's context
60
+ - api-conventions
61
+ - error-handling-patterns
62
+ memory: user # Persistent memory: user | project | local
63
+ mcpServers: # MCP servers available to this agent
64
+ - github
65
+ - slack
66
+
67
+ # Hooks scoped to this agent's lifecycle:
68
+ hooks:
69
+ PreToolUse:
70
+ - matcher: "Bash"
71
+ hooks:
72
+ - type: command
73
+ command: "./scripts/validate-command.sh"
74
+ ---
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Step 4: Write the System Prompt
80
+
81
+ The markdown body (after frontmatter) is the agent's complete system prompt. Unlike the main conversation, agents start fresh — they don't see conversation history.
82
+
83
+ ### System Prompt Template
84
+
85
+ ```markdown
86
+ You are a [role] specializing in [domain].
87
+
88
+ ## Your Mission
89
+ [1-2 sentences on what this agent's primary job is]
90
+
91
+ ## When Invoked
92
+ [Numbered steps describing the agent's workflow]
93
+ 1. First, [do this]
94
+ 2. Then, [analyze/check/validate]
95
+ 3. Finally, [report/fix/summarize]
96
+
97
+ ## Key Principles
98
+ - [Principle 1]: [explanation]
99
+ - [Principle 2]: [explanation]
100
+ - [Principle 3]: [explanation]
101
+
102
+ ## Output Format
103
+ [Describe how to structure the response]
104
+ - Use severity levels: CRITICAL > WARNING > SUGGESTION
105
+ - Include file:line references for every finding
106
+ - End with a summary of top priorities
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Step 5: Choose the Right Model
112
+
113
+ | Model | When to Use | Cost |
114
+ |-------|-------------|------|
115
+ | `haiku` | Fast lookups, simple searches, file reading | Cheapest |
116
+ | `sonnet` | Balanced tasks — code review, analysis, fixes | Medium |
117
+ | `opus` | Complex reasoning, architecture decisions | Most expensive |
118
+ | `inherit` | Use same model as main conversation (default) | Inherits |
119
+
120
+ Route cheap tasks to Haiku to reduce cost significantly.
121
+
122
+ ---
123
+
124
+ ## Step 6: Control Tool Access
125
+
126
+ ### Allowlist (recommended for restrictive agents)
127
+
128
+ ```yaml
129
+ tools: Read, Grep, Glob, Bash
130
+ ```
131
+
132
+ This agent can ONLY use Read, Grep, Glob, and Bash.
133
+
134
+ ### Denylist (recommended for mostly-capable agents)
135
+
136
+ ```yaml
137
+ disallowedTools: Write, Edit, NotebookEdit
138
+ ```
139
+
140
+ This agent has all tools EXCEPT Write, Edit, and NotebookEdit. Good for "read-mostly but can run Bash" agents.
141
+
142
+ ### Restrict which subagents THIS agent can spawn
143
+
144
+ Only relevant if this is a main-thread agent (`claude --agent`):
145
+
146
+ ```yaml
147
+ tools: Agent(worker, researcher), Read, Bash
148
+ # OR: allow all subagents
149
+ tools: Agent, Read, Bash
150
+ ```
151
+
152
+ ### Bash command restriction (surgical control)
153
+
154
+ ```yaml
155
+ tools: Bash(git *), Bash(npm test *), Read, Grep
156
+ # Only allow git commands and npm test commands
157
+ ```
158
+
159
+ The space before `*` is important: `Bash(git diff *)` matches `git diff --stat` but NOT `git diff-index`.
160
+
161
+ ---
162
+
163
+ ## Step 7: Persistent Memory
164
+
165
+ Enable memory so the agent builds institutional knowledge across conversations:
166
+
167
+ ```yaml
168
+ memory: user # ~/.claude/agent-memory/<name>/ — cross-project
169
+ memory: project # .claude/agent-memory/<name>/ — project-specific, committed
170
+ memory: local # .claude/agent-memory-local/<name>/ — project-specific, gitignored
171
+ ```
172
+
173
+ When memory is enabled:
174
+ - Agent gets Read, Write, Edit tools automatically (for memory files)
175
+ - Agent's system prompt includes first 200 lines of `MEMORY.md`
176
+ - Agent should curate `MEMORY.md` as it learns patterns
177
+
178
+ **System prompt addition for memory agents:**
179
+ ```markdown
180
+ ## Memory Instructions
181
+ After completing your work, update your agent memory with:
182
+ - New patterns or conventions you discovered
183
+ - Key file locations and their purposes
184
+ - Recurring issues and their root causes
185
+ - Architectural decisions worth remembering
186
+
187
+ Keep MEMORY.md concise. Write detailed notes in separate topic files.
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Step 8: Preload Skills
193
+
194
+ Give the agent domain knowledge by preloading skill content:
195
+
196
+ ```yaml
197
+ skills:
198
+ - api-conventions
199
+ - error-handling-patterns
200
+ - nestjs-architecture
201
+ ```
202
+
203
+ The **full content** of each skill is injected at startup — not just descriptions. Use this to give an agent specialized context without bloating its system prompt manually.
204
+
205
+ ---
206
+
207
+ ## Step 9: Define Agent Hooks
208
+
209
+ Hooks run shell commands at specific lifecycle points:
210
+
211
+ ```yaml
212
+ hooks:
213
+ PreToolUse:
214
+ - matcher: "Bash"
215
+ hooks:
216
+ - type: command
217
+ command: "./scripts/validate-bash.sh"
218
+ PostToolUse:
219
+ - matcher: "Edit|Write"
220
+ hooks:
221
+ - type: command
222
+ command: "npm run lint --silent"
223
+ Stop:
224
+ - hooks:
225
+ - type: command
226
+ command: "./scripts/cleanup.sh"
227
+ ```
228
+
229
+ Hook commands receive JSON via stdin with tool details. Exit code 2 blocks the tool call. `Stop` hooks become `SubagentStop` automatically.
230
+
231
+ ---
232
+
233
+ ## Complete Examples
234
+
235
+ ### Example 1: Read-Only Code Reviewer
236
+
237
+ ```markdown
238
+ ---
239
+ name: code-reviewer
240
+ description: Expert code review specialist. Use proactively after code changes. Analyze quality, security, and best practices without modifying files.
241
+ tools: Read, Grep, Glob, Bash
242
+ model: sonnet
243
+ memory: project
244
+ ---
245
+
246
+ You are a senior code reviewer with expertise in TypeScript, NestJS, and React Native.
247
+
248
+ ## Workflow
249
+ 1. Run `git diff HEAD~1` to see recent changes
250
+ 2. Identify modified files and their purpose
251
+ 3. Read the changed files completely
252
+ 4. Review against: security, SOLID principles, error handling, TypeScript discipline, performance, test coverage
253
+
254
+ ## Review Format
255
+ For each issue:
256
+ ```
257
+ **[SEVERITY] Short description**
258
+ File: path/to/file.ts:L42
259
+ Problem: What's wrong and why it matters
260
+ Fix: Concrete improved code
261
+ ```
262
+
263
+ Severity: CRITICAL (security/data loss) > WARNING (architecture) > SUGGESTION (quality) > NITPICK (style)
264
+
265
+ ## Memory Instructions
266
+ Update memory with recurring patterns, common anti-patterns found, and architectural decisions.
267
+ ```
268
+
269
+ ### Example 2: Test Runner and Fixer
270
+
271
+ ```markdown
272
+ ---
273
+ name: test-fixer
274
+ description: Run failing tests, diagnose root causes, and implement fixes. Use when tests fail or before committing code.
275
+ tools: Read, Edit, Bash, Grep, Glob
276
+ model: sonnet
277
+ ---
278
+
279
+ You are a testing expert. Your job is to find failing tests, understand why they fail, and fix them.
280
+
281
+ ## Workflow
282
+ 1. Run the test suite: `npm test -- --passWithNoTests 2>&1 | head -200`
283
+ 2. Identify failing tests and their error messages
284
+ 3. Find the source code causing failures
285
+ 4. Implement minimal fixes — don't change behavior, fix the bug
286
+ 5. Run tests again to confirm fixes
287
+ 6. Report what was fixed and why
288
+
289
+ ## Principles
290
+ - Fix root causes, not symptoms
291
+ - Keep test assertions intact — if the test expectation is wrong, flag it but don't delete
292
+ - One fix per problem — don't refactor surrounding code
293
+ - Run tests after each fix to catch regressions early
294
+ ```
295
+
296
+ ### Example 3: Database Query Validator (with Hook)
297
+
298
+ ```markdown
299
+ ---
300
+ name: db-analyst
301
+ description: Execute read-only database queries to answer questions about data. Never modifies data.
302
+ tools: Bash
303
+ model: haiku
304
+ hooks:
305
+ PreToolUse:
306
+ - matcher: "Bash"
307
+ hooks:
308
+ - type: command
309
+ command: ".claude/agents/scripts/validate-readonly.sh"
310
+ ---
311
+
312
+ You are a database analyst with read-only access.
313
+
314
+ When asked about data, write and execute SELECT queries. Present results clearly with context and key insights.
315
+
316
+ You cannot INSERT, UPDATE, DELETE, DROP, or modify any data. If asked, explain that you have read-only access and suggest the appropriate team contact for data modifications.
317
+ ```
318
+
319
+ And the validation script:
320
+ ```bash
321
+ #!/bin/bash
322
+ # .claude/agents/scripts/validate-readonly.sh
323
+ INPUT=$(cat)
324
+ CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
325
+ if echo "$CMD" | grep -iE '\b(INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|TRUNCATE|REPLACE)\b' > /dev/null 2>&1; then
326
+ echo "Blocked: Only SELECT queries allowed." >&2
327
+ exit 2
328
+ fi
329
+ exit 0
330
+ ```
331
+
332
+ ### Example 4: Background File Processor
333
+
334
+ ```markdown
335
+ ---
336
+ name: file-processor
337
+ description: Process large files or run batch operations in the background. Use for operations that produce verbose output.
338
+ tools: Read, Write, Bash, Glob
339
+ background: true
340
+ model: haiku
341
+ ---
342
+
343
+ You are a file processing agent. Execute the requested batch operation efficiently.
344
+
345
+ Report only the summary when complete:
346
+ - How many files processed
347
+ - How many succeeded / failed
348
+ - Any errors encountered
349
+ - Output location
350
+ ```
351
+
352
+ ---
353
+
354
+ ## Step 10: CLI-Defined Agents (Session-Only)
355
+
356
+ For quick testing or one-off automation, define agents via CLI without creating a file:
357
+
358
+ ```bash
359
+ claude --agents '{
360
+ "code-reviewer": {
361
+ "description": "Expert code reviewer. Use proactively after code changes.",
362
+ "prompt": "You are a senior code reviewer. Focus on quality, security, and best practices.",
363
+ "tools": ["Read", "Grep", "Glob", "Bash"],
364
+ "model": "sonnet"
365
+ }
366
+ }'
367
+ ```
368
+
369
+ Fields in CLI JSON: `description`, `prompt`, `tools`, `disallowedTools`, `model`, `permissionMode`, `maxTurns`, `skills`, `memory`, `hooks`, `mcpServers`.
370
+
371
+ ---
372
+
373
+ ## Managing Agents
374
+
375
+ ```bash
376
+ # Interactive agent manager
377
+ /agents
378
+
379
+ # List all configured agents (CLI)
380
+ claude agents
381
+
382
+ # Ask Claude to use a specific agent
383
+ "Use the code-reviewer agent to review the auth module"
384
+ "Have the test-fixer agent look at the failing tests"
385
+ ```
386
+
387
+ ---
388
+
389
+ ## Checklist Before Publishing
390
+
391
+ - [ ] `name` is lowercase, hyphens only
392
+ - [ ] `description` says "Use proactively when..." so Claude knows to auto-delegate
393
+ - [ ] Tools are restricted to minimum needed (principle of least privilege)
394
+ - [ ] Model is right-sized (haiku for simple, sonnet for complex)
395
+ - [ ] System prompt describes workflow step-by-step
396
+ - [ ] System prompt describes output format clearly
397
+ - [ ] Tested via `/agents` interface
398
+ - [ ] Memory enabled if the agent should learn across sessions
399
+ - [ ] Hooks added if tool validation is needed