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,375 @@
|
|
|
1
|
+
# Tutorial: CLAUDE.md & Memory
|
|
2
|
+
|
|
3
|
+
Claude starts every session fresh with no memory of previous conversations. Two mechanisms carry knowledge across sessions: **CLAUDE.md files** (instructions you write) and **auto memory** (notes Claude writes itself).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: Understand the Two Systems
|
|
8
|
+
|
|
9
|
+
| | CLAUDE.md files | Auto memory |
|
|
10
|
+
|--|----------------|-------------|
|
|
11
|
+
| **Who writes** | You | Claude |
|
|
12
|
+
| **Contains** | Instructions, rules, context | Learnings, patterns, discoveries |
|
|
13
|
+
| **Scope** | Project, user, or org-wide | Per working tree (git repo) |
|
|
14
|
+
| **Loaded** | Every session, fully | First 200 lines of `MEMORY.md` |
|
|
15
|
+
| **Use for** | Coding standards, workflows, architecture | Build commands, debugging insights, preferences |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 2: Where CLAUDE.md Files Live
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/Library/Application Support/ClaudeCode/CLAUDE.md ← macOS org-wide (managed, can't be excluded)
|
|
23
|
+
/etc/claude-code/CLAUDE.md ← Linux org-wide (managed)
|
|
24
|
+
~/.claude/CLAUDE.md ← Your personal preferences (all projects)
|
|
25
|
+
./CLAUDE.md or ./.claude/CLAUDE.md ← Project-level (commit to git)
|
|
26
|
+
./CLAUDE.local.md ← Project-local, gitignored (your personal project prefs)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Loading order:** more specific wins over broader.
|
|
30
|
+
- Organization-wide → user → project → local
|
|
31
|
+
- When files conflict, the more specific one applies
|
|
32
|
+
|
|
33
|
+
**How they load at startup:**
|
|
34
|
+
- Claude walks UP the directory tree from your cwd and loads all CLAUDE.md files it finds
|
|
35
|
+
- CLAUDE.md files in **subdirectories** load on-demand when Claude reads files in those directories
|
|
36
|
+
- This means a monorepo can have `frontend/CLAUDE.md`, `backend/CLAUDE.md`, etc.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 3: Create a Project CLAUDE.md
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Quick start: let Claude generate it from your codebase
|
|
44
|
+
/init
|
|
45
|
+
|
|
46
|
+
# Or create manually:
|
|
47
|
+
touch CLAUDE.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Good CLAUDE.md content:**
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
# Project Instructions
|
|
54
|
+
|
|
55
|
+
## Tech Stack
|
|
56
|
+
- Backend: NestJS + MongoDB + Redis
|
|
57
|
+
- Frontend: Next.js 15 App Router + Tailwind + shadcn/ui
|
|
58
|
+
- Mobile: React Native + Expo
|
|
59
|
+
- Testing: Jest + Supertest
|
|
60
|
+
|
|
61
|
+
## Build & Test Commands
|
|
62
|
+
- Install: `bun install`
|
|
63
|
+
- Backend dev: `cd backend && bun run dev`
|
|
64
|
+
- Frontend dev: `cd frontend && bun run dev`
|
|
65
|
+
- Tests: `bun test` (run before any commit)
|
|
66
|
+
- Lint: `bun run lint`
|
|
67
|
+
|
|
68
|
+
## Architecture Decisions
|
|
69
|
+
- Use `@features/` path alias for feature modules (backend)
|
|
70
|
+
- API responses always return `{ data, meta }` for lists, `{ data }` for single items
|
|
71
|
+
- Errors use `{ error: { code, message, details } }` format
|
|
72
|
+
- All new endpoints need Swagger `@ApiOperation()` decorators
|
|
73
|
+
|
|
74
|
+
## Code Style
|
|
75
|
+
- TypeScript strict mode — no `any`, use `unknown` + type guards
|
|
76
|
+
- Prefer early returns over nested if/else
|
|
77
|
+
- Functions > 30 lines should be split
|
|
78
|
+
- Test files co-located in `__tests__/` next to source
|
|
79
|
+
|
|
80
|
+
## Workflows
|
|
81
|
+
- PRs need: tests pass, no lint errors, Swagger docs updated
|
|
82
|
+
- Commit format: `type(scope): description` (feat/fix/refactor/docs/test/chore)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Size target:** under 200 lines. Longer files consume more context and reduce adherence.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Step 4: Import Other Files
|
|
90
|
+
|
|
91
|
+
Use `@path/to/file` syntax to import content into CLAUDE.md:
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
# Project Context
|
|
95
|
+
See @README.md for project overview.
|
|
96
|
+
Available commands: @package.json
|
|
97
|
+
|
|
98
|
+
# Git workflow
|
|
99
|
+
@docs/git-workflow.md
|
|
100
|
+
|
|
101
|
+
# API conventions
|
|
102
|
+
@docs/api-standards.md
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Both relative and absolute paths work
|
|
106
|
+
- Imports are expanded at launch into context
|
|
107
|
+
- Max import depth: 5 hops
|
|
108
|
+
- First time Claude sees an import, it shows an approval dialog
|
|
109
|
+
|
|
110
|
+
For personal per-project preferences not committed to git, use `CLAUDE.local.md` (auto-gitignored):
|
|
111
|
+
```markdown
|
|
112
|
+
# My local settings
|
|
113
|
+
My sandbox URL: http://localhost:3001
|
|
114
|
+
My test user: testuser@example.com
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Step 5: Path-Specific Rules with `.claude/rules/`
|
|
120
|
+
|
|
121
|
+
For large projects, organize instructions into files that load **only when relevant**:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
project/
|
|
125
|
+
├── CLAUDE.md ← Loaded every session
|
|
126
|
+
└── .claude/
|
|
127
|
+
└── rules/
|
|
128
|
+
├── api-design.md ← Loaded every session (no paths = always)
|
|
129
|
+
├── testing.md ← Loaded only when Claude reads test files
|
|
130
|
+
└── security.md ← Loaded only for auth module files
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**`rules/testing.md`** (loaded always, no frontmatter):
|
|
134
|
+
```markdown
|
|
135
|
+
# Testing Conventions
|
|
136
|
+
- Each test file maps to one source file with `.spec.ts` extension
|
|
137
|
+
- Use `describe('ClassName') > it('should methodName when condition')` naming
|
|
138
|
+
- Mock external dependencies with Jest auto-mocking
|
|
139
|
+
- Always have Arrange-Act-Assert sections
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**`rules/api-design.md`** (path-specific — only for API files):
|
|
143
|
+
```markdown
|
|
144
|
+
---
|
|
145
|
+
paths:
|
|
146
|
+
- "src/api/**/*.ts"
|
|
147
|
+
- "src/features/*/controller.ts"
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
# API Design Rules
|
|
151
|
+
- All endpoints must have `@ApiOperation()` and `@ApiResponse()` decorators
|
|
152
|
+
- Validate all inputs with class-validator DTOs
|
|
153
|
+
- Return 201 for POST, 200 for GET/PATCH, 204 for DELETE
|
|
154
|
+
- Never expose database IDs directly — use UUIDs
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**`rules/security.md`** (multiple path patterns):
|
|
158
|
+
```markdown
|
|
159
|
+
---
|
|
160
|
+
paths:
|
|
161
|
+
- "src/auth/**"
|
|
162
|
+
- "src/features/users/**"
|
|
163
|
+
- "**/*.guard.ts"
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
# Security Rules
|
|
167
|
+
- All auth tokens must be httpOnly cookies, never localStorage
|
|
168
|
+
- ALWAYS verify userId from JWT, never trust request body userId
|
|
169
|
+
- Rate limit all auth endpoints
|
|
170
|
+
- Log failed auth attempts with IP and timestamp
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Path patterns:**
|
|
174
|
+
| Pattern | Matches |
|
|
175
|
+
|---------|---------|
|
|
176
|
+
| `**/*.ts` | All TypeScript files |
|
|
177
|
+
| `src/**/*` | Everything under src/ |
|
|
178
|
+
| `*.md` | Markdown in project root |
|
|
179
|
+
| `src/**/*.{ts,tsx}` | TS and TSX anywhere in src/ |
|
|
180
|
+
|
|
181
|
+
Rules in `.claude/rules/` without `paths` frontmatter load every session (same as CLAUDE.md). Path-scoped rules load when Claude reads matching files.
|
|
182
|
+
|
|
183
|
+
**User-level rules** (`~/.claude/rules/`) apply to all your projects.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Step 6: Auto Memory
|
|
188
|
+
|
|
189
|
+
Auto memory lets Claude build knowledge across sessions without your input.
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
~/.claude/projects/<project>/memory/
|
|
193
|
+
├── MEMORY.md ← Index, first 200 lines loaded every session
|
|
194
|
+
├── debugging.md ← Detailed debugging insights (loaded on demand)
|
|
195
|
+
├── api-patterns.md ← API patterns discovered (loaded on demand)
|
|
196
|
+
└── architecture.md ← Architecture notes (loaded on demand)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Auto memory is **on by default**. To toggle:
|
|
200
|
+
```bash
|
|
201
|
+
/memory # In Claude Code — use toggle
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Or in settings:
|
|
205
|
+
```json
|
|
206
|
+
{ "autoMemoryEnabled": false }
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Or env var: `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`
|
|
210
|
+
|
|
211
|
+
**How it works:**
|
|
212
|
+
- First 200 lines of `MEMORY.md` are injected at every session start
|
|
213
|
+
- Claude reads topic files on demand when it needs that info
|
|
214
|
+
- Claude writes new learnings into appropriate topic files
|
|
215
|
+
- All worktrees and subdirectories of the same git repo share one memory directory
|
|
216
|
+
- Machine-local — not synced across machines
|
|
217
|
+
|
|
218
|
+
**What Claude saves:** build commands, test patterns, debugging insights, architectural decisions, style preferences you've corrected it on.
|
|
219
|
+
|
|
220
|
+
**Ask Claude to save something:**
|
|
221
|
+
```
|
|
222
|
+
Remember: always use bun, not npm, in this project
|
|
223
|
+
Remember that the API tests require a local Redis instance running on port 6379
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**View your memory:** run `/memory` to browse and edit memory files.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Step 7: Writing Effective Instructions
|
|
231
|
+
|
|
232
|
+
**Be specific:**
|
|
233
|
+
```markdown
|
|
234
|
+
✅ "Use 2-space indentation" not ❌ "Format code properly"
|
|
235
|
+
✅ "Run `bun test` before committing" not ❌ "Test your changes"
|
|
236
|
+
✅ "API handlers live in src/api/" not ❌ "Keep files organized"
|
|
237
|
+
✅ "No `any` — use `unknown` + type guards" not ❌ "Use TypeScript properly"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Be concise:** instructions are loaded into context (consuming tokens). The more you write, the less headroom Claude has for your conversation.
|
|
241
|
+
|
|
242
|
+
**Avoid conflicts:** if two rules contradict, Claude may pick one arbitrarily. Review your CLAUDE.md files periodically.
|
|
243
|
+
|
|
244
|
+
**Keep CLAUDE.md under 200 lines.** Move detailed content to:
|
|
245
|
+
- `@docs/detailed-guide.md` imports
|
|
246
|
+
- `.claude/rules/` path-specific files
|
|
247
|
+
- Subdirectory CLAUDE.md files
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Step 7b: Loading CLAUDE.md from Additional Directories
|
|
252
|
+
|
|
253
|
+
By default, CLAUDE.md files are only loaded from the project directory and its parents. To also load from directories added via `--add-dir`:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 claude
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Or add permanently in `.claude/settings.json`:
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"env": {
|
|
264
|
+
"CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD": "1"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
This is useful in monorepos where shared libraries live in sibling directories: `--add-dir ../shared-lib` will then also pick up `../shared-lib/CLAUDE.md`.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Step 7c: What to Put in CLAUDE.md (and What Not To)
|
|
274
|
+
|
|
275
|
+
**Include:**
|
|
276
|
+
- Bash commands Claude can't guess (build, test, deploy commands)
|
|
277
|
+
- Code style rules that differ from language defaults
|
|
278
|
+
- Test runners and how to run specific test suites
|
|
279
|
+
- Repo etiquette (branch naming, PR conventions, commit format)
|
|
280
|
+
- Architectural decisions specific to this project
|
|
281
|
+
- Dev environment quirks (required env vars, local setup steps)
|
|
282
|
+
- Common gotchas and non-obvious behaviors
|
|
283
|
+
|
|
284
|
+
**Exclude:**
|
|
285
|
+
- Things Claude can infer from code (obvious patterns, standard conventions)
|
|
286
|
+
- Standard language/framework conventions
|
|
287
|
+
- Detailed API docs (link to them instead with `@path/to/docs`)
|
|
288
|
+
- Frequently-changing information (put that in docs, link via `@`)
|
|
289
|
+
- Long tutorials or explanations (move to `.claude/rules/` or `docs/`)
|
|
290
|
+
- File-by-file descriptions of the entire codebase
|
|
291
|
+
- Self-evident practices like "write clean code"
|
|
292
|
+
|
|
293
|
+
**For critical rules that must always apply**, use emphasis:
|
|
294
|
+
```markdown
|
|
295
|
+
IMPORTANT: Never commit directly to main — always create a PR.
|
|
296
|
+
YOU MUST run `bun test` before committing. Failing tests block PRs.
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Step 8: Managing in Monorepos
|
|
302
|
+
|
|
303
|
+
In a monorepo with other teams' CLAUDE.md files, exclude irrelevant ones:
|
|
304
|
+
|
|
305
|
+
**`.claude/settings.local.json`:**
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"claudeMdExcludes": [
|
|
309
|
+
"**/other-team/CLAUDE.md",
|
|
310
|
+
"**/legacy-service/.claude/rules/**"
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Patterns use glob syntax matched against absolute file paths. Managed policy CLAUDE.md files (org-wide) cannot be excluded.
|
|
316
|
+
|
|
317
|
+
**Monorepo structure with per-package CLAUDE.md:**
|
|
318
|
+
```
|
|
319
|
+
monorepo/
|
|
320
|
+
├── CLAUDE.md ← Loaded for all work in this repo
|
|
321
|
+
├── backend/
|
|
322
|
+
│ └── CLAUDE.md ← Loaded when Claude reads backend files
|
|
323
|
+
├── frontend/
|
|
324
|
+
│ └── CLAUDE.md ← Loaded when Claude reads frontend files
|
|
325
|
+
└── mobile/
|
|
326
|
+
└── CLAUDE.md ← Loaded when Claude reads mobile files
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Step 9: Subagent Memory
|
|
332
|
+
|
|
333
|
+
Agents can maintain their own persistent memory. See [create-agent.md](create-agent.md) — the `memory` frontmatter field.
|
|
334
|
+
|
|
335
|
+
When `memory` is set on an agent:
|
|
336
|
+
- Agent gets its own memory directory
|
|
337
|
+
- First 200 lines of that agent's `MEMORY.md` loaded at agent startup
|
|
338
|
+
- Agent proactively updates its memory as it works
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Quick Reference
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Generate CLAUDE.md from your codebase
|
|
346
|
+
/init
|
|
347
|
+
|
|
348
|
+
# View all loaded CLAUDE.md files and memory
|
|
349
|
+
/memory
|
|
350
|
+
|
|
351
|
+
# Ask Claude to remember something persistently
|
|
352
|
+
"Remember: always use bun not npm"
|
|
353
|
+
"Add this to CLAUDE.md: API endpoints must return { data, meta } format"
|
|
354
|
+
|
|
355
|
+
# Check what CLAUDE.md files are loaded in current session
|
|
356
|
+
/memory ← Lists all loaded files
|
|
357
|
+
|
|
358
|
+
# Share project instructions with team
|
|
359
|
+
git add CLAUDE.md .claude/rules/ # Commit these
|
|
360
|
+
git add CLAUDE.local.md # DON'T commit this (gitignored)
|
|
361
|
+
|
|
362
|
+
# Org-wide instructions (requires admin)
|
|
363
|
+
# macOS: /Library/Application Support/ClaudeCode/CLAUDE.md
|
|
364
|
+
# Linux: /etc/claude-code/CLAUDE.md
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Location decision guide:**
|
|
368
|
+
|
|
369
|
+
| Where | Use when |
|
|
370
|
+
|-------|----------|
|
|
371
|
+
| `CLAUDE.md` (project root) | Team-shared: architecture, coding standards, workflows |
|
|
372
|
+
| `.claude/rules/*.md` | Topic-specific or path-scoped rules |
|
|
373
|
+
| `~/.claude/CLAUDE.md` | Personal preferences across all projects |
|
|
374
|
+
| `CLAUDE.local.md` | Your personal project-specific prefs (not shared) |
|
|
375
|
+
| Auto memory | Things Claude learns from your corrections |
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Tutorial: Output Styles
|
|
2
|
+
|
|
3
|
+
Output styles modify how Claude Code communicates — changing its tone, verbosity, and teaching style. Unlike CLAUDE.md (which adds project instructions as a user message), output styles replace sections of Claude's default **system prompt**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: The Three Built-in Styles
|
|
8
|
+
|
|
9
|
+
| Style | Behavior |
|
|
10
|
+
|-------|----------|
|
|
11
|
+
| `default` | Standard Claude Code — efficient software engineering mode |
|
|
12
|
+
| `explanatory` | Adds **Insights** between actions: explains implementation choices, patterns, and the "why" behind decisions |
|
|
13
|
+
| `learning` | Collaborative mode: shares Insights AND asks you to write small code pieces. Adds `TODO(human)` markers in code for you to fill in |
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
/output-style # Opens selection menu
|
|
17
|
+
/output-style explanatory # Switch to explanatory style
|
|
18
|
+
/output-style learning # Collaborative learning mode
|
|
19
|
+
/output-style default # Reset to standard mode
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 2: How Output Styles Differ from Other Mechanisms
|
|
25
|
+
|
|
26
|
+
| Mechanism | What it does | Always active? | Modifies system prompt? |
|
|
27
|
+
|-----------|-------------|----------------|------------------------|
|
|
28
|
+
| **Output Style** | Changes Claude's tone/teaching mode | Yes (once set) | Replaces sections of it |
|
|
29
|
+
| **CLAUDE.md** | Adds project instructions | Yes (loaded at start) | No — added as a user message |
|
|
30
|
+
| **Skill** | Runs a specific workflow on demand | No — invoked manually | No |
|
|
31
|
+
| **Subagent** | Specialized sub-task in its own context | No — delegated task | Agent has its own system prompt |
|
|
32
|
+
| `--append-system-prompt` | Appends text to system prompt | Yes (per session only) | Appends to it |
|
|
33
|
+
|
|
34
|
+
**Key distinction:** Output styles and `--append-system-prompt` both modify the system prompt. Output styles are **saved persistently per project**; `--append-system-prompt` applies only for that CLI session.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Step 3: Create a Custom Output Style
|
|
39
|
+
|
|
40
|
+
**Locations:**
|
|
41
|
+
```
|
|
42
|
+
~/.claude/output-styles/<name>.md ← Personal (available in all projects)
|
|
43
|
+
.claude/output-styles/<name>.md ← Project-level (commit to share with team)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**File format:**
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
---
|
|
50
|
+
name: Pair Programmer
|
|
51
|
+
description: Collaborative pair programmer — asks questions, challenges assumptions, proposes alternatives
|
|
52
|
+
keep-coding-instructions: false
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
You are a collaborative pair programmer. When working with the user:
|
|
56
|
+
|
|
57
|
+
1. Before implementing, briefly restate the problem to confirm understanding
|
|
58
|
+
2. When you see multiple valid approaches, name them and explain trade-offs (2-3 sentences each)
|
|
59
|
+
3. After implementing, call out any edge cases or assumptions the user should review
|
|
60
|
+
4. If something looks fragile nearby (not just what you changed), mention it as a side note
|
|
61
|
+
|
|
62
|
+
Be concise. Don't lecture — be a peer.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Frontmatter Fields
|
|
66
|
+
|
|
67
|
+
| Field | Type | Description |
|
|
68
|
+
|-------|------|-------------|
|
|
69
|
+
| `name` | string | Display name shown in `/output-style` menu |
|
|
70
|
+
| `description` | string | Brief description shown in the menu |
|
|
71
|
+
| `keep-coding-instructions` | boolean | Retain Claude Code's built-in coding instructions (tests, commit messages, etc.). Default: `false` |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Step 4: `keep-coding-instructions` Explained
|
|
76
|
+
|
|
77
|
+
**`false` (default):** Your style content is the primary behavior guide. Claude's built-in "always verify builds", "run tests" guidance is removed.
|
|
78
|
+
- Best for: tone/communication styles, teaching modes, domain personas
|
|
79
|
+
|
|
80
|
+
**`true`:** Your instructions are added on top of Claude's coding discipline.
|
|
81
|
+
- Best for: adding personality or specific rules while keeping rigorous coding behavior
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 5: Where Styles Are Saved
|
|
86
|
+
|
|
87
|
+
When you run `/output-style explanatory`, it saves to:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
// .claude/settings.local.json (gitignored — personal only)
|
|
91
|
+
{
|
|
92
|
+
"outputStyle": "explanatory"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**To share a style with your team:**
|
|
97
|
+
1. Put the style file in `.claude/output-styles/<name>.md` (commit to git)
|
|
98
|
+
2. Set the default in `.claude/settings.json` (commit to git):
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"outputStyle": "your-style-name"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**To keep it personal (gitignored):**
|
|
107
|
+
```json
|
|
108
|
+
// .claude/settings.local.json
|
|
109
|
+
{
|
|
110
|
+
"outputStyle": "your-style-name"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Example Custom Styles
|
|
117
|
+
|
|
118
|
+
### Security-Focused
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
---
|
|
122
|
+
name: Security Reviewer
|
|
123
|
+
description: Always considers security implications in every implementation
|
|
124
|
+
keep-coding-instructions: true
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
Always apply a security lens to every change:
|
|
128
|
+
- Before implementing: identify any attack surface the change introduces
|
|
129
|
+
- During implementation: follow OWASP Top 10 guidelines by default
|
|
130
|
+
- After implementing: call out any security assumptions or risks to verify
|
|
131
|
+
|
|
132
|
+
Flag CRITICAL issues immediately. Mention WARNINGS as concise side notes.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Concise Mode
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
---
|
|
139
|
+
name: Concise
|
|
140
|
+
description: Ultra-brief responses — code only, minimal explanation
|
|
141
|
+
keep-coding-instructions: true
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
Be extremely concise:
|
|
145
|
+
- Show code changes directly, no preamble
|
|
146
|
+
- One sentence summary max after a change (skip if obvious)
|
|
147
|
+
- No "Here's what I did" or "I've implemented..." openers
|
|
148
|
+
- Only explain if something non-obvious was done
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Mentor Mode
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
---
|
|
155
|
+
name: Mentor
|
|
156
|
+
description: Teaches while coding — explains patterns, suggests alternatives, builds understanding
|
|
157
|
+
keep-coding-instructions: false
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
You are a senior engineer mentoring a junior developer. For every meaningful change:
|
|
161
|
+
|
|
162
|
+
1. Explain the "why" behind the approach you chose
|
|
163
|
+
2. Name the pattern being used (e.g., "this is the Repository pattern")
|
|
164
|
+
3. Mention one alternative and why you didn't use it here
|
|
165
|
+
4. Point out one thing they should watch for or test
|
|
166
|
+
|
|
167
|
+
Use analogies when helpful. Assume they're smart but inexperienced with this specific area.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Domain Expert
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
---
|
|
174
|
+
name: NestJS Expert
|
|
175
|
+
description: Responds as a NestJS/TypeScript expert with opinionated guidance
|
|
176
|
+
keep-coding-instructions: true
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
You are a NestJS expert. Apply these defaults to every suggestion:
|
|
180
|
+
|
|
181
|
+
- Prefer decorators and class-based patterns (NestJS idioms)
|
|
182
|
+
- Always use dependency injection — never instantiate services directly
|
|
183
|
+
- Validate inputs with class-validator DTOs, never raw objects
|
|
184
|
+
- Controllers are thin — all logic lives in services
|
|
185
|
+
- Use Guards for auth, Interceptors for cross-cutting concerns, Pipes for transformation
|
|
186
|
+
|
|
187
|
+
Call out when code deviates from these patterns and why it matters.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Quick Reference
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
/output-style # Open style picker
|
|
196
|
+
/output-style explanatory # Switch to explanatory (shows Insights)
|
|
197
|
+
/output-style learning # Learning mode (you write some code too)
|
|
198
|
+
/output-style default # Reset to standard
|
|
199
|
+
|
|
200
|
+
# Custom styles are referenced by filename (without .md)
|
|
201
|
+
/output-style my-custom-style
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**File locations:**
|
|
205
|
+
```
|
|
206
|
+
~/.claude/output-styles/ ← Personal styles (all projects)
|
|
207
|
+
.claude/output-styles/ ← Project styles (commit to git to share)
|
|
208
|
+
```
|