clauderc 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 +221 -0
- package/bin/cli.js +802 -0
- package/package.json +44 -0
- package/src/detector.js +387 -0
- package/src/project.js +435 -0
- package/src/stacks.js +299 -0
- package/templates/agents/project-setup-wizard.md +230 -0
- package/templates/commands/lint.md +33 -0
- package/templates/commands/pr.md +46 -0
- package/templates/commands/setup.md +51 -0
- package/templates/commands/test.md +33 -0
- package/templates/commands/verify.md +69 -0
- package/templates/manifest.json +93 -0
- package/templates/project-setup/AGENTS_TEMPLATE.md +100 -0
- package/templates/project-setup/CLAUDE_MD_TEMPLATE.md +49 -0
- package/templates/project-setup/COMMANDS_TEMPLATE.md +92 -0
- package/templates/project-setup/SKILLS_TEMPLATE.md +113 -0
- package/templates/project-setup/TEAM_DOCS_TEMPLATE.md +102 -0
- package/templates/skills/claude-code-templates/SKILL.md +260 -0
- package/templates/skills/project-analysis/SKILL.md +184 -0
package/src/stacks.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack detection and commands for multiple languages/frameworks
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const STACKS = {
|
|
6
|
+
// ==================== Node.js / TypeScript ====================
|
|
7
|
+
node: {
|
|
8
|
+
name: 'Node.js',
|
|
9
|
+
detect: ['package.json'],
|
|
10
|
+
packageManagers: {
|
|
11
|
+
bun: { lockfile: 'bun.lockb', install: 'bun install', run: 'bun run' },
|
|
12
|
+
pnpm: { lockfile: 'pnpm-lock.yaml', install: 'pnpm install', run: 'pnpm run' },
|
|
13
|
+
yarn: { lockfile: 'yarn.lock', install: 'yarn install', run: 'yarn' },
|
|
14
|
+
npm: { lockfile: 'package-lock.json', install: 'npm install', run: 'npm run' },
|
|
15
|
+
},
|
|
16
|
+
commands: {
|
|
17
|
+
test: ['test', 'test:unit', 'vitest', 'jest'],
|
|
18
|
+
lint: ['lint', 'lint:fix', 'eslint'],
|
|
19
|
+
format: ['format', 'prettier'],
|
|
20
|
+
typecheck: ['typecheck', 'tsc', 'type-check'],
|
|
21
|
+
build: ['build', 'compile'],
|
|
22
|
+
dev: ['dev', 'start', 'serve'],
|
|
23
|
+
},
|
|
24
|
+
frameworks: {
|
|
25
|
+
next: { detect: 'next', dev: 'next dev', build: 'next build' },
|
|
26
|
+
nuxt: { detect: 'nuxt', dev: 'nuxt dev', build: 'nuxt build' },
|
|
27
|
+
remix: { detect: '@remix-run', dev: 'remix dev', build: 'remix build' },
|
|
28
|
+
astro: { detect: 'astro', dev: 'astro dev', build: 'astro build' },
|
|
29
|
+
vite: { detect: 'vite', dev: 'vite', build: 'vite build' },
|
|
30
|
+
express: { detect: 'express', dev: 'node src/index.js' },
|
|
31
|
+
fastify: { detect: 'fastify', dev: 'node src/index.js' },
|
|
32
|
+
nestjs: { detect: '@nestjs/core', dev: 'nest start --watch', build: 'nest build' },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// ==================== Python ====================
|
|
37
|
+
python: {
|
|
38
|
+
name: 'Python',
|
|
39
|
+
detect: ['pyproject.toml', 'requirements.txt', 'setup.py', 'Pipfile'],
|
|
40
|
+
packageManagers: {
|
|
41
|
+
poetry: { lockfile: 'poetry.lock', install: 'poetry install', run: 'poetry run' },
|
|
42
|
+
pipenv: { lockfile: 'Pipfile.lock', install: 'pipenv install', run: 'pipenv run' },
|
|
43
|
+
uv: { lockfile: 'uv.lock', install: 'uv sync', run: 'uv run' },
|
|
44
|
+
pip: { lockfile: 'requirements.txt', install: 'pip install -r requirements.txt', run: '' },
|
|
45
|
+
},
|
|
46
|
+
commands: {
|
|
47
|
+
test: 'pytest',
|
|
48
|
+
lint: 'ruff check .',
|
|
49
|
+
format: 'ruff format .',
|
|
50
|
+
typecheck: 'mypy .',
|
|
51
|
+
},
|
|
52
|
+
frameworks: {
|
|
53
|
+
django: { detect: 'django', dev: 'python manage.py runserver', test: 'python manage.py test' },
|
|
54
|
+
fastapi: { detect: 'fastapi', dev: 'uvicorn app.main:app --reload' },
|
|
55
|
+
flask: { detect: 'flask', dev: 'flask run --reload' },
|
|
56
|
+
pytorch: { detect: 'torch' },
|
|
57
|
+
tensorflow: { detect: 'tensorflow' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// ==================== Go ====================
|
|
62
|
+
go: {
|
|
63
|
+
name: 'Go',
|
|
64
|
+
detect: ['go.mod'],
|
|
65
|
+
commands: {
|
|
66
|
+
test: 'go test ./...',
|
|
67
|
+
lint: 'golangci-lint run',
|
|
68
|
+
format: 'gofmt -w .',
|
|
69
|
+
build: 'go build ./...',
|
|
70
|
+
dev: 'go run .',
|
|
71
|
+
tidy: 'go mod tidy',
|
|
72
|
+
},
|
|
73
|
+
frameworks: {
|
|
74
|
+
gin: { detect: 'github.com/gin-gonic/gin' },
|
|
75
|
+
echo: { detect: 'github.com/labstack/echo' },
|
|
76
|
+
fiber: { detect: 'github.com/gofiber/fiber' },
|
|
77
|
+
chi: { detect: 'github.com/go-chi/chi' },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// ==================== Rust ====================
|
|
82
|
+
rust: {
|
|
83
|
+
name: 'Rust',
|
|
84
|
+
detect: ['Cargo.toml'],
|
|
85
|
+
commands: {
|
|
86
|
+
test: 'cargo test',
|
|
87
|
+
lint: 'cargo clippy',
|
|
88
|
+
format: 'cargo fmt',
|
|
89
|
+
formatCheck: 'cargo fmt --check',
|
|
90
|
+
build: 'cargo build',
|
|
91
|
+
buildRelease: 'cargo build --release',
|
|
92
|
+
dev: 'cargo run',
|
|
93
|
+
check: 'cargo check',
|
|
94
|
+
},
|
|
95
|
+
frameworks: {
|
|
96
|
+
actix: { detect: 'actix-web' },
|
|
97
|
+
axum: { detect: 'axum' },
|
|
98
|
+
rocket: { detect: 'rocket' },
|
|
99
|
+
tauri: { detect: 'tauri', dev: 'cargo tauri dev', build: 'cargo tauri build' },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// ==================== Java / Kotlin ====================
|
|
104
|
+
java: {
|
|
105
|
+
name: 'Java/Kotlin',
|
|
106
|
+
detect: ['pom.xml', 'build.gradle', 'build.gradle.kts'],
|
|
107
|
+
packageManagers: {
|
|
108
|
+
maven: { detect: 'pom.xml', install: 'mvn install', run: 'mvn' },
|
|
109
|
+
gradle: { detect: 'build.gradle', install: 'gradle build', run: 'gradle' },
|
|
110
|
+
gradleKts: { detect: 'build.gradle.kts', install: 'gradle build', run: 'gradle' },
|
|
111
|
+
},
|
|
112
|
+
commands: {
|
|
113
|
+
test: { maven: 'mvn test', gradle: 'gradle test' },
|
|
114
|
+
lint: { maven: 'mvn checkstyle:check', gradle: 'gradle checkstyleMain' },
|
|
115
|
+
build: { maven: 'mvn package', gradle: 'gradle build' },
|
|
116
|
+
dev: { maven: 'mvn spring-boot:run', gradle: 'gradle bootRun' },
|
|
117
|
+
},
|
|
118
|
+
frameworks: {
|
|
119
|
+
spring: { detect: 'spring-boot' },
|
|
120
|
+
quarkus: { detect: 'quarkus', dev: 'quarkus dev' },
|
|
121
|
+
micronaut: { detect: 'micronaut' },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// ==================== PHP ====================
|
|
126
|
+
php: {
|
|
127
|
+
name: 'PHP',
|
|
128
|
+
detect: ['composer.json'],
|
|
129
|
+
commands: {
|
|
130
|
+
install: 'composer install',
|
|
131
|
+
test: 'vendor/bin/phpunit',
|
|
132
|
+
lint: 'vendor/bin/phpcs',
|
|
133
|
+
format: 'vendor/bin/php-cs-fixer fix',
|
|
134
|
+
},
|
|
135
|
+
frameworks: {
|
|
136
|
+
laravel: { detect: 'laravel/framework', dev: 'php artisan serve', test: 'php artisan test' },
|
|
137
|
+
symfony: { detect: 'symfony/framework-bundle', dev: 'symfony server:start' },
|
|
138
|
+
wordpress: { detect: 'wordpress' },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
// ==================== Ruby ====================
|
|
143
|
+
ruby: {
|
|
144
|
+
name: 'Ruby',
|
|
145
|
+
detect: ['Gemfile'],
|
|
146
|
+
commands: {
|
|
147
|
+
install: 'bundle install',
|
|
148
|
+
test: 'bundle exec rspec',
|
|
149
|
+
lint: 'bundle exec rubocop',
|
|
150
|
+
format: 'bundle exec rubocop -a',
|
|
151
|
+
},
|
|
152
|
+
frameworks: {
|
|
153
|
+
rails: { detect: 'rails', dev: 'rails server', test: 'rails test' },
|
|
154
|
+
sinatra: { detect: 'sinatra' },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// ==================== C# / .NET ====================
|
|
159
|
+
dotnet: {
|
|
160
|
+
name: '.NET/C#',
|
|
161
|
+
detect: ['*.csproj', '*.sln', '*.fsproj'],
|
|
162
|
+
commands: {
|
|
163
|
+
restore: 'dotnet restore',
|
|
164
|
+
test: 'dotnet test',
|
|
165
|
+
build: 'dotnet build',
|
|
166
|
+
dev: 'dotnet run',
|
|
167
|
+
format: 'dotnet format',
|
|
168
|
+
},
|
|
169
|
+
frameworks: {
|
|
170
|
+
aspnet: { detect: 'Microsoft.AspNetCore' },
|
|
171
|
+
maui: { detect: 'Microsoft.Maui' },
|
|
172
|
+
blazor: { detect: 'Microsoft.AspNetCore.Components' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// ==================== Elixir ====================
|
|
177
|
+
elixir: {
|
|
178
|
+
name: 'Elixir',
|
|
179
|
+
detect: ['mix.exs'],
|
|
180
|
+
commands: {
|
|
181
|
+
deps: 'mix deps.get',
|
|
182
|
+
test: 'mix test',
|
|
183
|
+
lint: 'mix credo',
|
|
184
|
+
format: 'mix format',
|
|
185
|
+
dev: 'mix phx.server',
|
|
186
|
+
},
|
|
187
|
+
frameworks: {
|
|
188
|
+
phoenix: { detect: 'phoenix' },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
// ==================== Swift ====================
|
|
193
|
+
swift: {
|
|
194
|
+
name: 'Swift',
|
|
195
|
+
detect: ['Package.swift', '*.xcodeproj', '*.xcworkspace'],
|
|
196
|
+
commands: {
|
|
197
|
+
build: 'swift build',
|
|
198
|
+
test: 'swift test',
|
|
199
|
+
dev: 'swift run',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// ==================== Dart / Flutter ====================
|
|
204
|
+
dart: {
|
|
205
|
+
name: 'Dart/Flutter',
|
|
206
|
+
detect: ['pubspec.yaml'],
|
|
207
|
+
commands: {
|
|
208
|
+
deps: 'dart pub get',
|
|
209
|
+
test: 'dart test',
|
|
210
|
+
lint: 'dart analyze',
|
|
211
|
+
format: 'dart format .',
|
|
212
|
+
},
|
|
213
|
+
frameworks: {
|
|
214
|
+
flutter: { detect: 'flutter', deps: 'flutter pub get', test: 'flutter test', dev: 'flutter run' },
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Monorepo detection
|
|
221
|
+
*/
|
|
222
|
+
export const MONOREPO_TOOLS = {
|
|
223
|
+
turborepo: { detect: 'turbo.json', run: 'turbo run' },
|
|
224
|
+
nx: { detect: 'nx.json', run: 'nx run' },
|
|
225
|
+
lerna: { detect: 'lerna.json', run: 'lerna run' },
|
|
226
|
+
rush: { detect: 'rush.json', run: 'rush' },
|
|
227
|
+
pnpmWorkspace: { detect: 'pnpm-workspace.yaml' },
|
|
228
|
+
yarnWorkspaces: { detect: 'package.json' }, // check workspaces field
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* CI/CD detection
|
|
233
|
+
*/
|
|
234
|
+
export const CI_PLATFORMS = {
|
|
235
|
+
github: { detect: '.github/workflows' },
|
|
236
|
+
gitlab: { detect: '.gitlab-ci.yml' },
|
|
237
|
+
circleci: { detect: '.circleci' },
|
|
238
|
+
jenkins: { detect: 'Jenkinsfile' },
|
|
239
|
+
travis: { detect: '.travis.yml' },
|
|
240
|
+
azure: { detect: 'azure-pipelines.yml' },
|
|
241
|
+
bitbucket: { detect: 'bitbucket-pipelines.yml' },
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Testing frameworks by language
|
|
246
|
+
*/
|
|
247
|
+
export const TEST_FRAMEWORKS = {
|
|
248
|
+
node: ['jest', 'vitest', 'mocha', 'ava', 'tap', 'playwright', 'cypress'],
|
|
249
|
+
python: ['pytest', 'unittest', 'nose2', 'hypothesis'],
|
|
250
|
+
go: ['testing', 'testify', 'ginkgo'],
|
|
251
|
+
rust: ['cargo test'],
|
|
252
|
+
java: ['junit', 'testng', 'mockito'],
|
|
253
|
+
php: ['phpunit', 'pest', 'codeception'],
|
|
254
|
+
ruby: ['rspec', 'minitest'],
|
|
255
|
+
dotnet: ['xunit', 'nunit', 'mstest'],
|
|
256
|
+
elixir: ['exunit'],
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Linting/Formatting tools by language
|
|
261
|
+
*/
|
|
262
|
+
export const LINT_TOOLS = {
|
|
263
|
+
node: {
|
|
264
|
+
linters: ['eslint', 'biome', 'oxlint'],
|
|
265
|
+
formatters: ['prettier', 'biome', 'dprint'],
|
|
266
|
+
typecheckers: ['typescript', 'tsc'],
|
|
267
|
+
},
|
|
268
|
+
python: {
|
|
269
|
+
linters: ['ruff', 'flake8', 'pylint', 'pyflakes'],
|
|
270
|
+
formatters: ['ruff', 'black', 'autopep8', 'yapf'],
|
|
271
|
+
typecheckers: ['mypy', 'pyright', 'pyre'],
|
|
272
|
+
},
|
|
273
|
+
go: {
|
|
274
|
+
linters: ['golangci-lint', 'staticcheck', 'revive'],
|
|
275
|
+
formatters: ['gofmt', 'goimports'],
|
|
276
|
+
},
|
|
277
|
+
rust: {
|
|
278
|
+
linters: ['clippy'],
|
|
279
|
+
formatters: ['rustfmt'],
|
|
280
|
+
},
|
|
281
|
+
java: {
|
|
282
|
+
linters: ['checkstyle', 'pmd', 'spotbugs'],
|
|
283
|
+
formatters: ['google-java-format', 'spotless'],
|
|
284
|
+
},
|
|
285
|
+
php: {
|
|
286
|
+
linters: ['phpcs', 'phpstan', 'psalm'],
|
|
287
|
+
formatters: ['php-cs-fixer', 'phpcbf'],
|
|
288
|
+
},
|
|
289
|
+
ruby: {
|
|
290
|
+
linters: ['rubocop', 'reek'],
|
|
291
|
+
formatters: ['rubocop'],
|
|
292
|
+
},
|
|
293
|
+
dotnet: {
|
|
294
|
+
linters: ['dotnet format'],
|
|
295
|
+
formatters: ['dotnet format'],
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export default STACKS;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-setup-wizard
|
|
3
|
+
description: Setup Claude Code for any project - creates CLAUDE.md, commands, skills, subagents, and docs following best practices.
|
|
4
|
+
model: inherit
|
|
5
|
+
color: purple
|
|
6
|
+
allowed_tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
- Bash
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
You are a **Claude Code Setup Wizard**. You analyze projects and create optimized Claude Code configurations.
|
|
16
|
+
|
|
17
|
+
## Core Principles
|
|
18
|
+
|
|
19
|
+
1. **Explore First** - Understand stack, workflow, pain points before proposing
|
|
20
|
+
2. **Executable Config** - Every command must work immediately
|
|
21
|
+
3. **Context Economy** - CLAUDE.md < 100 lines, use @imports for details
|
|
22
|
+
4. **Verification First** - All workflows include validation steps
|
|
23
|
+
5. **Plan Mode Default** - Complex tasks start in Plan Mode
|
|
24
|
+
|
|
25
|
+
## Phase 1: Analysis (REQUIRED)
|
|
26
|
+
|
|
27
|
+
**Start in Plan Mode. Do NOT create files until plan is approved.**
|
|
28
|
+
|
|
29
|
+
### Stack Detection
|
|
30
|
+
|
|
31
|
+
Check these files to identify the stack:
|
|
32
|
+
|
|
33
|
+
| File | Indicates |
|
|
34
|
+
|------|-----------|
|
|
35
|
+
| `package.json` | Node.js - check scripts, deps |
|
|
36
|
+
| `requirements.txt`, `pyproject.toml` | Python |
|
|
37
|
+
| `go.mod` | Go |
|
|
38
|
+
| `Cargo.toml` | Rust |
|
|
39
|
+
| `composer.json` | PHP |
|
|
40
|
+
| `pom.xml`, `build.gradle` | Java |
|
|
41
|
+
|
|
42
|
+
### Extract Key Info
|
|
43
|
+
|
|
44
|
+
1. **Package Manager**: npm/pnpm/bun/yarn/pip/poetry/cargo
|
|
45
|
+
2. **Test Framework**: jest/vitest/pytest/go test/cargo test
|
|
46
|
+
3. **Linter/Formatter**: eslint/prettier/black/ruff/golangci-lint/clippy
|
|
47
|
+
4. **Build Tool**: vite/webpack/esbuild/turbo/nx
|
|
48
|
+
5. **Project Type**: monorepo/single, frontend/backend/fullstack
|
|
49
|
+
|
|
50
|
+
### Check Existing Docs
|
|
51
|
+
|
|
52
|
+
- `README.md` - Setup instructions?
|
|
53
|
+
- `CONTRIBUTING.md` - Guidelines?
|
|
54
|
+
- `CLAUDE.md` - Already configured?
|
|
55
|
+
- `.claude/` - Existing commands/skills?
|
|
56
|
+
|
|
57
|
+
### Present Plan
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
# Claude Code Setup Plan
|
|
61
|
+
|
|
62
|
+
## Stack Detected
|
|
63
|
+
- Language: [X]
|
|
64
|
+
- Framework: [Y]
|
|
65
|
+
- Package Manager: [Z]
|
|
66
|
+
- Testing: [W]
|
|
67
|
+
- Type: [monorepo/single]
|
|
68
|
+
|
|
69
|
+
## Proposed Configuration
|
|
70
|
+
|
|
71
|
+
### CLAUDE.md
|
|
72
|
+
- [ ] Stack summary
|
|
73
|
+
- [ ] Dev/test/build commands
|
|
74
|
+
- [ ] Code style rules
|
|
75
|
+
- [ ] Workflow guidelines
|
|
76
|
+
|
|
77
|
+
### Commands (.claude/commands/)
|
|
78
|
+
- `/test` - [test command]
|
|
79
|
+
- `/lint` - [lint command]
|
|
80
|
+
- `/verify` - [full validation]
|
|
81
|
+
- `/pr` - Create PR
|
|
82
|
+
|
|
83
|
+
### Skills (.claude/skills/)
|
|
84
|
+
- `debug-workflow/` - Systematic debugging
|
|
85
|
+
- `verification-workflow/` - Test-first development
|
|
86
|
+
|
|
87
|
+
### Subagents (.claude/agents/)
|
|
88
|
+
- `security-reviewer.md` - Security audit
|
|
89
|
+
- `test-writer.md` - Test generation
|
|
90
|
+
|
|
91
|
+
### Team Docs
|
|
92
|
+
- CLAUDE_CODE_GUIDE.md
|
|
93
|
+
- CONTRIBUTING_WITH_CLAUDE.md
|
|
94
|
+
|
|
95
|
+
## Questions
|
|
96
|
+
- [Any clarifications needed]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Wait for approval before Phase 2.**
|
|
100
|
+
|
|
101
|
+
## Phase 2: Create CLAUDE.md
|
|
102
|
+
|
|
103
|
+
Read template: `~/.claude/templates/project-setup/CLAUDE_MD_TEMPLATE.md`
|
|
104
|
+
|
|
105
|
+
Create `CLAUDE.md` in project root. Requirements:
|
|
106
|
+
- Under 100 lines
|
|
107
|
+
- Commands must be copy-pasteable
|
|
108
|
+
- Use @imports for detailed docs
|
|
109
|
+
- Include verification commands
|
|
110
|
+
|
|
111
|
+
## Phase 3: Create .claude/ Structure
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
.claude/
|
|
115
|
+
├── commands/
|
|
116
|
+
│ ├── test.md
|
|
117
|
+
│ ├── lint.md
|
|
118
|
+
│ ├── verify.md
|
|
119
|
+
│ └── pr.md
|
|
120
|
+
├── skills/
|
|
121
|
+
│ ├── debug-workflow/SKILL.md
|
|
122
|
+
│ └── verification-workflow/SKILL.md
|
|
123
|
+
├── agents/
|
|
124
|
+
│ ├── security-reviewer.md
|
|
125
|
+
│ └── test-writer.md
|
|
126
|
+
└── settings.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### settings.json Format
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"permissions": {
|
|
134
|
+
"allow": [
|
|
135
|
+
"Bash(npm:*)", "Bash(pnpm:*)", "Bash(bun:*)",
|
|
136
|
+
"Bash(git:*)", "Bash(gh:*)"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"hooks": {
|
|
140
|
+
"PostToolUse": [
|
|
141
|
+
{
|
|
142
|
+
"matcher": "Edit|Write",
|
|
143
|
+
"hooks": ["{{LINT_FIX_COMMAND}}"]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Read templates from `~/.claude/templates/project-setup/` for:
|
|
151
|
+
- Commands: `COMMANDS_TEMPLATE.md`
|
|
152
|
+
- Skills: `SKILLS_TEMPLATE.md`
|
|
153
|
+
- Agents: `AGENTS_TEMPLATE.md`
|
|
154
|
+
|
|
155
|
+
## Phase 4: Team Documentation
|
|
156
|
+
|
|
157
|
+
Read: `~/.claude/templates/project-setup/TEAM_DOCS_TEMPLATE.md`
|
|
158
|
+
|
|
159
|
+
Create in project root:
|
|
160
|
+
- `CLAUDE_CODE_GUIDE.md` - How to use Claude Code in this project
|
|
161
|
+
- `CONTRIBUTING_WITH_CLAUDE.md` - Contribution workflow with Claude
|
|
162
|
+
|
|
163
|
+
## Phase 5: Validation
|
|
164
|
+
|
|
165
|
+
Test each command:
|
|
166
|
+
```bash
|
|
167
|
+
# Verify commands exist and are readable
|
|
168
|
+
ls -la .claude/commands/
|
|
169
|
+
cat .claude/commands/test.md
|
|
170
|
+
|
|
171
|
+
# Verify CLAUDE.md is under 100 lines
|
|
172
|
+
wc -l CLAUDE.md
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Final Output
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
# Setup Complete
|
|
179
|
+
|
|
180
|
+
## Created
|
|
181
|
+
- CLAUDE.md ([X] lines)
|
|
182
|
+
- [N] commands in .claude/commands/
|
|
183
|
+
- [N] skills in .claude/skills/
|
|
184
|
+
- [N] agents in .claude/agents/
|
|
185
|
+
- settings.json with hooks
|
|
186
|
+
- Team documentation
|
|
187
|
+
|
|
188
|
+
## Quick Start
|
|
189
|
+
\`\`\`bash
|
|
190
|
+
claude
|
|
191
|
+
/test
|
|
192
|
+
/verify
|
|
193
|
+
\`\`\`
|
|
194
|
+
|
|
195
|
+
## Next Steps
|
|
196
|
+
1. Review CLAUDE.md
|
|
197
|
+
2. Test commands
|
|
198
|
+
3. Share CLAUDE_CODE_GUIDE.md with team
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## When NOT to Use
|
|
202
|
+
|
|
203
|
+
- Single-file scripts (overkill)
|
|
204
|
+
- Already has complete setup (review instead)
|
|
205
|
+
- User only wants CLAUDE.md (create directly)
|
|
206
|
+
|
|
207
|
+
## Stack-Specific Notes
|
|
208
|
+
|
|
209
|
+
### Node.js/TypeScript
|
|
210
|
+
- Check for pnpm-lock.yaml/bun.lockb/yarn.lock
|
|
211
|
+
- Look for turbo.json/nx.json (monorepo)
|
|
212
|
+
- Common: `npm run test`, `npm run lint`
|
|
213
|
+
|
|
214
|
+
### Python
|
|
215
|
+
- Check for pyproject.toml (poetry) vs requirements.txt
|
|
216
|
+
- Look for pytest.ini/setup.cfg
|
|
217
|
+
- Common: `pytest`, `ruff check --fix`
|
|
218
|
+
|
|
219
|
+
### Go
|
|
220
|
+
- Standard: `go test ./...`, `go build`
|
|
221
|
+
- Check for golangci.yml
|
|
222
|
+
- Common: `golangci-lint run`
|
|
223
|
+
|
|
224
|
+
### Rust
|
|
225
|
+
- Standard: `cargo test`, `cargo build`
|
|
226
|
+
- Common: `cargo clippy`, `cargo fmt`
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
**Begin with Phase 1 analysis. Plan Mode first, then systematic execution.**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Run linter and formatter
|
|
2
|
+
|
|
3
|
+
Detect and run the appropriate lint/format command for this project.
|
|
4
|
+
|
|
5
|
+
## Implementation
|
|
6
|
+
```bash
|
|
7
|
+
# Node.js
|
|
8
|
+
if [ -f "package.json" ]; then
|
|
9
|
+
if grep -q '"lint"' package.json; then
|
|
10
|
+
npm run lint
|
|
11
|
+
elif [ -f ".eslintrc" ] || [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ]; then
|
|
12
|
+
npx eslint . --fix
|
|
13
|
+
fi
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Python
|
|
17
|
+
if [ -f "pyproject.toml" ] || [ -f "ruff.toml" ]; then
|
|
18
|
+
ruff check --fix .
|
|
19
|
+
ruff format .
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Go
|
|
23
|
+
if [ -f "go.mod" ]; then
|
|
24
|
+
gofmt -w .
|
|
25
|
+
golangci-lint run
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Rust
|
|
29
|
+
if [ -f "Cargo.toml" ]; then
|
|
30
|
+
cargo fmt
|
|
31
|
+
cargo clippy
|
|
32
|
+
fi
|
|
33
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Create a Pull Request
|
|
2
|
+
|
|
3
|
+
Commit changes, push to remote, and create a PR with generated description.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
1. Stage all changes
|
|
7
|
+
2. Generate commit message from diff
|
|
8
|
+
3. Push to current branch
|
|
9
|
+
4. Create PR with description
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
- `gh` CLI installed and authenticated
|
|
13
|
+
- Changes ready to commit
|
|
14
|
+
|
|
15
|
+
## Implementation
|
|
16
|
+
```bash
|
|
17
|
+
# Get current branch
|
|
18
|
+
BRANCH=$(git branch --show-current)
|
|
19
|
+
|
|
20
|
+
# Check for changes
|
|
21
|
+
if [ -z "$(git status --porcelain)" ]; then
|
|
22
|
+
echo "No changes to commit"
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Stage changes
|
|
27
|
+
git add -A
|
|
28
|
+
|
|
29
|
+
# Show what will be committed
|
|
30
|
+
echo "📝 Changes to commit:"
|
|
31
|
+
git status --short
|
|
32
|
+
|
|
33
|
+
# Commit (message should be provided by Claude)
|
|
34
|
+
# git commit -m "..."
|
|
35
|
+
|
|
36
|
+
# Push
|
|
37
|
+
git push -u origin $BRANCH
|
|
38
|
+
|
|
39
|
+
# Create PR
|
|
40
|
+
gh pr create --fill
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
- Claude will generate an appropriate commit message
|
|
45
|
+
- PR description is auto-generated from commits
|
|
46
|
+
- Use `--draft` flag for draft PRs
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Project setup
|
|
2
|
+
|
|
3
|
+
Install dependencies and prepare development environment.
|
|
4
|
+
|
|
5
|
+
## Implementation
|
|
6
|
+
```bash
|
|
7
|
+
echo "🚀 Setting up project..."
|
|
8
|
+
|
|
9
|
+
# Node.js
|
|
10
|
+
if [ -f "package.json" ]; then
|
|
11
|
+
# Detect package manager
|
|
12
|
+
if [ -f "bun.lockb" ]; then
|
|
13
|
+
echo "→ Installing with bun"
|
|
14
|
+
bun install
|
|
15
|
+
elif [ -f "pnpm-lock.yaml" ]; then
|
|
16
|
+
echo "→ Installing with pnpm"
|
|
17
|
+
pnpm install
|
|
18
|
+
elif [ -f "yarn.lock" ]; then
|
|
19
|
+
echo "→ Installing with yarn"
|
|
20
|
+
yarn install
|
|
21
|
+
else
|
|
22
|
+
echo "→ Installing with npm"
|
|
23
|
+
npm install
|
|
24
|
+
fi
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Python
|
|
28
|
+
if [ -f "pyproject.toml" ]; then
|
|
29
|
+
if grep -q "poetry" pyproject.toml; then
|
|
30
|
+
echo "→ Installing with poetry"
|
|
31
|
+
poetry install
|
|
32
|
+
else
|
|
33
|
+
echo "→ Installing with pip"
|
|
34
|
+
pip install -e ".[dev]" 2>/dev/null || pip install -r requirements.txt
|
|
35
|
+
fi
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Go
|
|
39
|
+
if [ -f "go.mod" ]; then
|
|
40
|
+
echo "→ Downloading Go modules"
|
|
41
|
+
go mod download
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Rust
|
|
45
|
+
if [ -f "Cargo.toml" ]; then
|
|
46
|
+
echo "→ Building Rust project"
|
|
47
|
+
cargo build
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
echo "✅ Setup complete"
|
|
51
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Run project tests
|
|
2
|
+
|
|
3
|
+
Detect and run the appropriate test command for this project.
|
|
4
|
+
|
|
5
|
+
## Detection Order
|
|
6
|
+
1. Check package.json for test script
|
|
7
|
+
2. Check for pytest/go test/cargo test
|
|
8
|
+
3. Fall back to common patterns
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
```bash
|
|
12
|
+
# Node.js
|
|
13
|
+
if [ -f "package.json" ]; then
|
|
14
|
+
if grep -q '"test"' package.json; then
|
|
15
|
+
npm test
|
|
16
|
+
fi
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Python
|
|
20
|
+
if [ -f "pytest.ini" ] || [ -f "pyproject.toml" ]; then
|
|
21
|
+
pytest
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Go
|
|
25
|
+
if [ -f "go.mod" ]; then
|
|
26
|
+
go test ./...
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Rust
|
|
30
|
+
if [ -f "Cargo.toml" ]; then
|
|
31
|
+
cargo test
|
|
32
|
+
fi
|
|
33
|
+
```
|