claude-code-starter 0.13.0 → 0.14.1
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 +54 -53
- package/dist/cli.js +129 -217
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,9 +48,9 @@ Automatically detects and configures for:
|
|
|
48
48
|
| -------------- | ------------------------------------------------------------------- |
|
|
49
49
|
| **Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, Ruby, Swift, Kotlin |
|
|
50
50
|
| **Frameworks** | Next.js, React, Vue, Svelte, FastAPI, Django, NestJS, Express, etc. |
|
|
51
|
-
| **Tools** | npm, yarn, pnpm, bun, pip, cargo, go modules
|
|
51
|
+
| **Tools** | npm, yarn, pnpm, bun, pip, cargo, go modules |
|
|
52
52
|
| **Testing** | Jest, Vitest, Pytest, Go test, Rust test |
|
|
53
|
-
| **Linting** | ESLint, Biome, Ruff, Pylint
|
|
53
|
+
| **Linting** | ESLint, Biome, Ruff, Pylint |
|
|
54
54
|
|
|
55
55
|
## Generated Configurations
|
|
56
56
|
|
|
@@ -64,13 +64,13 @@ Based on your stack, creates:
|
|
|
64
64
|
|
|
65
65
|
## Commands
|
|
66
66
|
|
|
67
|
-
| Command | Description
|
|
68
|
-
| ----------------- |
|
|
69
|
-
| `/task <desc>` | Start a new task
|
|
70
|
-
| `/status` | Show current task
|
|
71
|
-
| `/done` | Mark task complete
|
|
72
|
-
| `/analyze <area>` | Deep dive into code
|
|
73
|
-
| `/code-review` | Review changes for quality and security
|
|
67
|
+
| Command | Description |
|
|
68
|
+
| ----------------- | --------------------------------------- |
|
|
69
|
+
| `/task <desc>` | Start a new task |
|
|
70
|
+
| `/status` | Show current task |
|
|
71
|
+
| `/done` | Mark task complete |
|
|
72
|
+
| `/analyze <area>` | Deep dive into code |
|
|
73
|
+
| `/code-review` | Review changes for quality and security |
|
|
74
74
|
|
|
75
75
|
## CLI Options
|
|
76
76
|
|
|
@@ -179,41 +179,41 @@ flowchart LR
|
|
|
179
179
|
|
|
180
180
|
### Artifact Generation
|
|
181
181
|
|
|
182
|
-
| Artifact Type
|
|
183
|
-
|
|
184
|
-
| **CLAUDE.md**
|
|
185
|
-
| **settings.json** | Generated with safe default permissions
|
|
186
|
-
| **Skills**
|
|
187
|
-
| **Agents**
|
|
188
|
-
| **Rules**
|
|
189
|
-
| **Commands**
|
|
182
|
+
| Artifact Type | Generation Method |
|
|
183
|
+
| ----------------- | -------------------------------------------------------- |
|
|
184
|
+
| **CLAUDE.md** | Claude CLI deep analysis of your actual source files |
|
|
185
|
+
| **settings.json** | Generated with safe default permissions |
|
|
186
|
+
| **Skills** | Core skills + framework-specific patterns (if detected) |
|
|
187
|
+
| **Agents** | Code reviewer and test writer agents |
|
|
188
|
+
| **Rules** | Language-specific conventions + general code style |
|
|
189
|
+
| **Commands** | Task workflow commands (/task, /status, /done, /analyze) |
|
|
190
190
|
|
|
191
191
|
### Conflict Resolution
|
|
192
192
|
|
|
193
193
|
When running on an existing project with `.claude/` configuration:
|
|
194
194
|
|
|
195
|
-
| Scenario
|
|
196
|
-
|
|
197
|
-
| **New file**
|
|
198
|
-
| **Existing file**
|
|
199
|
-
| **With `-f` flag** | Overwritten
|
|
200
|
-
| **state/task.md**
|
|
195
|
+
| Scenario | Behavior |
|
|
196
|
+
| ------------------ | ------------------- |
|
|
197
|
+
| **New file** | Created |
|
|
198
|
+
| **Existing file** | Skipped (preserved) |
|
|
199
|
+
| **With `-f` flag** | Overwritten |
|
|
200
|
+
| **state/task.md** | Always preserved |
|
|
201
201
|
|
|
202
202
|
### Framework-Specific Patterns
|
|
203
203
|
|
|
204
204
|
When a framework is detected, additional skills are generated:
|
|
205
205
|
|
|
206
|
-
| Framework
|
|
207
|
-
|
|
208
|
-
| Next.js
|
|
209
|
-
| React
|
|
210
|
-
| FastAPI
|
|
211
|
-
| NestJS
|
|
212
|
-
| SwiftUI
|
|
213
|
-
| UIKit
|
|
214
|
-
| Vapor
|
|
215
|
-
| Jetpack Compose | `compose-patterns.md` - Compose UI patterns
|
|
216
|
-
| Android Views
|
|
206
|
+
| Framework | Generated Skill |
|
|
207
|
+
| --------------- | ---------------------------------------------------- |
|
|
208
|
+
| Next.js | `nextjs-patterns.md` - App Router, Server Components |
|
|
209
|
+
| React | `react-components.md` - Hooks, component patterns |
|
|
210
|
+
| FastAPI | `fastapi-patterns.md` - Async endpoints, Pydantic |
|
|
211
|
+
| NestJS | `nestjs-patterns.md` - Modules, decorators, DI |
|
|
212
|
+
| SwiftUI | `swiftui-patterns.md` - Declarative UI patterns |
|
|
213
|
+
| UIKit | `uikit-patterns.md` - View controller patterns |
|
|
214
|
+
| Vapor | `vapor-patterns.md` - Server-side Swift |
|
|
215
|
+
| Jetpack Compose | `compose-patterns.md` - Compose UI patterns |
|
|
216
|
+
| Android Views | `android-views-patterns.md` - XML views |
|
|
217
217
|
|
|
218
218
|
## Requirements
|
|
219
219
|
|
|
@@ -228,14 +228,14 @@ This project uses GitHub Actions for continuous integration and automated releas
|
|
|
228
228
|
|
|
229
229
|
Every pull request targeting `main` runs:
|
|
230
230
|
|
|
231
|
-
| Check
|
|
232
|
-
|
|
233
|
-
| **Lint**
|
|
234
|
-
| **Type Check**
|
|
235
|
-
| **Unit Tests**
|
|
231
|
+
| Check | Description |
|
|
232
|
+
| ---------------- | -------------------------------------------------- |
|
|
233
|
+
| **Lint** | Biome lint and format validation |
|
|
234
|
+
| **Type Check** | TypeScript compilation check |
|
|
235
|
+
| **Unit Tests** | Full test suite with Bun |
|
|
236
236
|
| **Code Quality** | Checks for console.log, `any` types, skipped tests |
|
|
237
|
-
| **Build**
|
|
238
|
-
| **Package Size** | Reports bundle size (warns if > 500KB)
|
|
237
|
+
| **Build** | Verifies package builds successfully |
|
|
238
|
+
| **Package Size** | Reports bundle size (warns if > 500KB) |
|
|
239
239
|
|
|
240
240
|
### Automated Releases (`.github/workflows/release.yml`)
|
|
241
241
|
|
|
@@ -252,24 +252,25 @@ When code is merged to `main`, semantic-release automatically:
|
|
|
252
252
|
|
|
253
253
|
Use these prefixes for automatic versioning:
|
|
254
254
|
|
|
255
|
-
| Prefix
|
|
256
|
-
|
|
257
|
-
| `feat:`
|
|
258
|
-
| `fix:`
|
|
259
|
-
| `perf:`
|
|
260
|
-
| `BREAKING CHANGE:`
|
|
261
|
-
| `docs:`, `chore:`, `ci:` | No release
|
|
255
|
+
| Prefix | Version Bump | Example |
|
|
256
|
+
| ------------------------ | ------------ | ------------------------------ |
|
|
257
|
+
| `feat:` | Minor | `feat: add dark mode support` |
|
|
258
|
+
| `fix:` | Patch | `fix: resolve memory leak` |
|
|
259
|
+
| `perf:` | Patch | `perf: optimize image loading` |
|
|
260
|
+
| `BREAKING CHANGE:` | Major | `feat!: redesign API` |
|
|
261
|
+
| `docs:`, `chore:`, `ci:` | No release | `docs: update README` |
|
|
262
262
|
|
|
263
263
|
### Required Secrets
|
|
264
264
|
|
|
265
265
|
Configure these in your GitHub repository settings:
|
|
266
266
|
|
|
267
|
-
| Secret
|
|
268
|
-
|
|
269
|
-
| `NPM_TOKEN`
|
|
270
|
-
| `GITHUB_TOKEN` | Auto-provided by GitHub
|
|
267
|
+
| Secret | Description | Required For |
|
|
268
|
+
| -------------- | ------------------------ | ----------------- |
|
|
269
|
+
| `NPM_TOKEN` | npm authentication token | Publishing to npm |
|
|
270
|
+
| `GITHUB_TOKEN` | Auto-provided by GitHub | Creating releases |
|
|
271
271
|
|
|
272
272
|
To create an npm token:
|
|
273
|
+
|
|
273
274
|
1. Go to [npmjs.com](https://npmjs.com) -> Access Tokens
|
|
274
275
|
2. Generate a new "Automation" token
|
|
275
276
|
3. Add it as `NPM_TOKEN` in GitHub repo -> Settings -> Secrets
|
|
@@ -298,4 +299,4 @@ bun run typecheck
|
|
|
298
299
|
|
|
299
300
|
## License
|
|
300
301
|
|
|
301
|
-
MIT
|
|
302
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
package/dist/cli.js
CHANGED
|
@@ -511,38 +511,12 @@ function countSourceFiles(rootDir, _languages) {
|
|
|
511
511
|
countFiles(rootDir);
|
|
512
512
|
return count;
|
|
513
513
|
}
|
|
514
|
-
function summarizeTechStack(stack) {
|
|
515
|
-
const parts = [];
|
|
516
|
-
if (stack.primaryLanguage) {
|
|
517
|
-
parts.push(`Language: ${stack.primaryLanguage}`);
|
|
518
|
-
}
|
|
519
|
-
if (stack.primaryFramework) {
|
|
520
|
-
parts.push(`Framework: ${stack.primaryFramework}`);
|
|
521
|
-
}
|
|
522
|
-
if (stack.packageManager) {
|
|
523
|
-
parts.push(`Package Manager: ${stack.packageManager}`);
|
|
524
|
-
}
|
|
525
|
-
if (stack.testingFramework) {
|
|
526
|
-
parts.push(`Testing: ${stack.testingFramework}`);
|
|
527
|
-
}
|
|
528
|
-
if (stack.isMonorepo) {
|
|
529
|
-
parts.push("Monorepo: yes");
|
|
530
|
-
}
|
|
531
|
-
return parts.join(" | ");
|
|
532
|
-
}
|
|
533
514
|
|
|
534
515
|
// src/generator.ts
|
|
535
516
|
import fs2 from "fs";
|
|
536
517
|
import path2 from "path";
|
|
537
518
|
function ensureDirectories(rootDir) {
|
|
538
|
-
const dirs = [
|
|
539
|
-
".claude",
|
|
540
|
-
".claude/skills",
|
|
541
|
-
".claude/agents",
|
|
542
|
-
".claude/rules",
|
|
543
|
-
".claude/commands",
|
|
544
|
-
".claude/state"
|
|
545
|
-
];
|
|
519
|
+
const dirs = [".claude", ".claude/skills", ".claude/agents", ".claude/rules", ".claude/commands"];
|
|
546
520
|
for (const dir of dirs) {
|
|
547
521
|
fs2.mkdirSync(path2.join(rootDir, dir), { recursive: true });
|
|
548
522
|
}
|
|
@@ -658,14 +632,15 @@ ${templateVars}
|
|
|
658
632
|
|
|
659
633
|
1. Read this entire prompt to understand all phases
|
|
660
634
|
2. Execute Phase 1 completely - read files, analyze code, gather all data
|
|
661
|
-
3. Execute Phase 2 - generate the CLAUDE.md using only discovered information
|
|
635
|
+
3. Execute Phase 2 - generate the CLAUDE.md (max 120 lines) using only discovered information
|
|
662
636
|
4. Execute Phase 3 - verify quality before writing
|
|
663
637
|
5. Use the Write tool to create \`.claude/CLAUDE.md\` with the final content
|
|
664
|
-
6. Execute Phase 4 - generate ALL skill files
|
|
638
|
+
6. Execute Phase 4 - generate ALL skill files (4 core + framework-specific if detected)
|
|
665
639
|
7. Execute Phase 5 - generate agent files
|
|
666
640
|
8. Execute Phase 6 - generate rule files
|
|
667
|
-
9. Execute Phase 7 - generate command files
|
|
668
|
-
10.
|
|
641
|
+
9. Execute Phase 7 - generate command files (2 commands: analyze, code-review)
|
|
642
|
+
10. Run the Anti-Redundancy Enforcement checks one final time across ALL generated files \u2014 if any convention is restated, any command is duplicated, or any rule lacks a \`paths:\` filter, fix it before proceeding
|
|
643
|
+
11. Output a brief summary of what was generated and any gaps found
|
|
669
644
|
|
|
670
645
|
Do NOT output file contents to stdout. Write all files to disk using the Write tool.
|
|
671
646
|
Generate ALL files in a single pass \u2014 do not stop after CLAUDE.md.`;
|
|
@@ -807,6 +782,51 @@ something, omit that section entirely - do not fill in generic boilerplate.
|
|
|
807
782
|
|
|
808
783
|
---
|
|
809
784
|
|
|
785
|
+
## Artifact Architecture
|
|
786
|
+
|
|
787
|
+
Understanding the context cost of each artifact type is critical. Artifacts load at different
|
|
788
|
+
frequencies, so place information where it costs the least while remaining accessible:
|
|
789
|
+
|
|
790
|
+
| Artifact | When Loaded | Context Cost |
|
|
791
|
+
|----------|-------------|--------------|
|
|
792
|
+
| CLAUDE.md | Every turn | Highest \u2014 keep concise |
|
|
793
|
+
| Rule without \`paths:\` | Every session | High \u2014 avoid generating these |
|
|
794
|
+
| Rule with \`paths:\` | When matching files are open | Medium \u2014 use sparingly |
|
|
795
|
+
| Skill / Command | On-demand (user invokes) | Low |
|
|
796
|
+
| Agent | Spawned in subprocess | Zero main-context cost |
|
|
797
|
+
|
|
798
|
+
### Placement Rules
|
|
799
|
+
|
|
800
|
+
1. **CLAUDE.md is the single source of truth for conventions.** All naming, style, commit format, and project rules live here and ONLY here.
|
|
801
|
+
2. **NEVER generate rules without \`paths:\` filters.** A rule without \`paths:\` loads every session and competes with CLAUDE.md for context. All general style information belongs in CLAUDE.md.
|
|
802
|
+
3. **Rules must be concise, non-redundant supplements.** A language rule (e.g., \`typescript.md\` with \`paths: ["**/*.ts"]\`) should ONLY contain language-specific gotchas (compiler flags, import quirks, tooling-specific settings) that don't belong in CLAUDE.md.
|
|
803
|
+
4. **Skills are for rich on-demand methodology.** Write "Follow conventions in CLAUDE.md" instead of restating conventions. Focus skills on HOW (methodology), not WHAT (conventions).
|
|
804
|
+
5. **Agents have zero main-context cost.** Put detailed checklists and review criteria in agent files \u2014 they run in subprocesses and don't consume the user's context window.
|
|
805
|
+
6. **Each piece of information must live in exactly ONE place.** If it's in CLAUDE.md, don't repeat it in rules, skills, or commands.
|
|
806
|
+
|
|
807
|
+
### Anti-Redundancy Enforcement
|
|
808
|
+
|
|
809
|
+
Before writing EACH artifact, apply these hard constraints:
|
|
810
|
+
|
|
811
|
+
- **REJECT** any artifact that restates a convention from CLAUDE.md. If a convention appears in CLAUDE.md, it MUST NOT appear in any other file. Not paraphrased, not summarized, not restated in different words.
|
|
812
|
+
- **Test commands, lint commands, and build commands** MUST appear in exactly ONE place: CLAUDE.md's Common Commands section. Skills and agents MUST write "See Common Commands in CLAUDE.md" instead.
|
|
813
|
+
- **All rules MUST have a \`paths:\` filter** \u2014 no unfiltered rules.
|
|
814
|
+
- **Cross-references replace copies** \u2014 write "Follow conventions in CLAUDE.md" instead of restating any convention.
|
|
815
|
+
|
|
816
|
+
#### Forbidden Duplication List
|
|
817
|
+
|
|
818
|
+
The following MUST NOT appear in skills, agents, rules, or commands \u2014 they belong exclusively in CLAUDE.md:
|
|
819
|
+
- Test commands (the literal test runner invocation)
|
|
820
|
+
- Lint commands (the literal linter invocation)
|
|
821
|
+
- Build commands (the literal build invocation)
|
|
822
|
+
- Import convention descriptions (absolute vs relative, ordering, type imports)
|
|
823
|
+
- Naming convention descriptions (camelCase, PascalCase, file naming)
|
|
824
|
+
- Commit format descriptions (conventional commits, message format)
|
|
825
|
+
- Anti-patterns list (things to avoid)
|
|
826
|
+
- Testing framework syntax examples (describe/it/expect \u2014 belongs in test-writer agent only)
|
|
827
|
+
|
|
828
|
+
---
|
|
829
|
+
|
|
810
830
|
## Phase 1: Discovery (Read Before You Write)
|
|
811
831
|
|
|
812
832
|
Perform these analysis steps IN ORDER. Do not skip any step. Do not start writing
|
|
@@ -902,9 +922,13 @@ Read at least 3-5 source files and document the ACTUAL patterns used:
|
|
|
902
922
|
Using ONLY information discovered in Phase 1, generate the \`.claude/CLAUDE.md\` file.
|
|
903
923
|
Every section must contain PROJECT-SPECIFIC content. Skip sections that don't apply.
|
|
904
924
|
|
|
925
|
+
**The CLAUDE.md MUST NOT exceed 120 lines. Prioritize density over completeness.**
|
|
926
|
+
|
|
927
|
+
Do NOT include sections that duplicate information available in package.json, tsconfig.json, or other config files the agent can read directly.
|
|
928
|
+
|
|
905
929
|
### Output Structure
|
|
906
930
|
|
|
907
|
-
The CLAUDE.md MUST follow this structure:
|
|
931
|
+
The CLAUDE.md MUST follow this compact structure:
|
|
908
932
|
|
|
909
933
|
\`\`\`markdown
|
|
910
934
|
# {Project Name}
|
|
@@ -918,17 +942,9 @@ Written for an AI assistant that needs to understand PURPOSE to make good decisi
|
|
|
918
942
|
|
|
919
943
|
## Architecture
|
|
920
944
|
|
|
921
|
-
{
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
\\\`\\\`\\\`
|
|
926
|
-
{Actual directory tree, depth 3, with annotations}
|
|
927
|
-
\\\`\\\`\\\`
|
|
928
|
-
|
|
929
|
-
### Data Flow
|
|
930
|
-
|
|
931
|
-
{How a typical request flows through the system}
|
|
945
|
+
{1-2 sentences describing the actual architecture pattern found, then the Key Files table.
|
|
946
|
+
Do NOT include a Directory Structure ASCII tree or Data Flow subsection \u2014 the agent can
|
|
947
|
+
read the filesystem directly.}
|
|
932
948
|
|
|
933
949
|
### Key Files
|
|
934
950
|
|
|
@@ -936,42 +952,18 @@ Written for an AI assistant that needs to understand PURPOSE to make good decisi
|
|
|
936
952
|
|------|---------|
|
|
937
953
|
| \`path/to/file\` | What it does |
|
|
938
954
|
|
|
939
|
-
## Tech Stack
|
|
940
|
-
|
|
941
|
-
| Category | Technology | Notes |
|
|
942
|
-
|----------|-----------|-------|
|
|
943
|
-
| Language | X | Config details |
|
|
944
|
-
| Framework | Y | How it's used |
|
|
945
|
-
|
|
946
|
-
## Development Setup
|
|
947
|
-
|
|
948
|
-
### Prerequisites
|
|
949
|
-
|
|
950
|
-
{Exact versions and tools needed}
|
|
951
|
-
|
|
952
|
-
### Getting Started
|
|
953
|
-
|
|
954
|
-
\\\`\\\`\\\`bash
|
|
955
|
-
{Actual commands to get running}
|
|
956
|
-
\\\`\\\`\\\`
|
|
957
|
-
|
|
958
|
-
### Environment Variables
|
|
959
|
-
|
|
960
|
-
| Variable | Description | Example |
|
|
961
|
-
|----------|-------------|---------|
|
|
962
|
-
| \`VAR_NAME\` | What it's for | \`example_value\` |
|
|
963
|
-
|
|
964
955
|
## Common Commands
|
|
965
956
|
|
|
966
957
|
\\\`\\\`\\\`bash
|
|
967
|
-
{
|
|
958
|
+
{5 critical commands max, from package.json scripts or equivalent.
|
|
959
|
+
Only the commands developers use daily \u2014 not every script.}
|
|
968
960
|
\\\`\\\`\\\`
|
|
969
961
|
|
|
970
962
|
## Code Conventions
|
|
971
963
|
|
|
972
964
|
### Naming
|
|
973
965
|
|
|
974
|
-
{ACTUAL naming patterns found}
|
|
966
|
+
{ACTUAL naming patterns found \u2014 be brief}
|
|
975
967
|
|
|
976
968
|
### Patterns to Follow
|
|
977
969
|
|
|
@@ -981,27 +973,19 @@ Written for an AI assistant that needs to understand PURPOSE to make good decisi
|
|
|
981
973
|
|
|
982
974
|
{What NOT to do based on codebase conventions}
|
|
983
975
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
### Running Tests
|
|
976
|
+
> **This Code Conventions section is the single source of truth.**
|
|
977
|
+
> Rules and skills cross-reference this section \u2014 they do not repeat it.
|
|
987
978
|
|
|
988
|
-
|
|
989
|
-
{actual test commands}
|
|
990
|
-
\\\`\\\`\\\`
|
|
991
|
-
|
|
992
|
-
### Writing Tests
|
|
979
|
+
## Testing
|
|
993
980
|
|
|
994
|
-
{
|
|
981
|
+
{2-3 lines: test command, test file location, key testing pattern.
|
|
982
|
+
NOT a full guide \u2014 the test-writer agent handles detailed test methodology.}
|
|
995
983
|
|
|
996
984
|
## Domain Knowledge
|
|
997
985
|
|
|
998
986
|
### Core Entities
|
|
999
987
|
|
|
1000
|
-
{
|
|
1001
|
-
|
|
1002
|
-
### Key Workflows
|
|
1003
|
-
|
|
1004
|
-
{3-5 most important workflows}
|
|
988
|
+
{Brief list of main domain objects and relationships}
|
|
1005
989
|
|
|
1006
990
|
## Gotchas & Important Notes
|
|
1007
991
|
|
|
@@ -1015,19 +999,41 @@ Written for an AI assistant that needs to understand PURPOSE to make good decisi
|
|
|
1015
999
|
4. {project-specific rules discovered during analysis}
|
|
1016
1000
|
\`\`\`
|
|
1017
1001
|
|
|
1002
|
+
**Sections NOT to include** (the agent can read these from config files directly):
|
|
1003
|
+
- Directory Structure ASCII tree (agent uses Glob/Read)
|
|
1004
|
+
- Tech Stack table (available in package.json, tsconfig.json, etc.)
|
|
1005
|
+
- Development Setup / Getting Started / Prerequisites
|
|
1006
|
+
- Environment Variables table (available in .env.example)
|
|
1007
|
+
- Skills index table
|
|
1008
|
+
- Agents index table
|
|
1009
|
+
- Key Workflows (duplicates Data Flow / Architecture)
|
|
1010
|
+
|
|
1018
1011
|
---
|
|
1019
1012
|
|
|
1020
1013
|
## Phase 3: Quality Checklist
|
|
1021
1014
|
|
|
1022
1015
|
Before writing the CLAUDE.md, verify:
|
|
1023
1016
|
|
|
1017
|
+
- [ ] The file does NOT exceed 120 lines
|
|
1024
1018
|
- [ ] Every section contains PROJECT-SPECIFIC information (not generic boilerplate)
|
|
1025
1019
|
- [ ] File paths referenced actually exist in the project
|
|
1020
|
+
- [ ] File references use \`path/to/file.ts (functionName)\` format, not line numbers
|
|
1026
1021
|
- [ ] Commands listed are verified from package.json scripts or equivalent
|
|
1027
1022
|
- [ ] Code conventions were observed from ACTUAL source files
|
|
1028
1023
|
- [ ] The "Gotchas" section contains genuinely useful, non-obvious information
|
|
1029
1024
|
- [ ] An AI reading this CLAUDE.md could add a new feature following existing patterns
|
|
1030
1025
|
- [ ] Sections without real content have been omitted entirely
|
|
1026
|
+
- [ ] No section duplicates information available in config files the agent can read
|
|
1027
|
+
|
|
1028
|
+
### Cross-Artifact Deduplication Check
|
|
1029
|
+
|
|
1030
|
+
Before writing ANY artifact (rule, skill, agent, command), verify:
|
|
1031
|
+
- [ ] No conventions from CLAUDE.md are restated (naming, commit format, import order, style)
|
|
1032
|
+
- [ ] No item from the Forbidden Duplication List appears outside CLAUDE.md
|
|
1033
|
+
- [ ] No content from one artifact is duplicated in another
|
|
1034
|
+
- [ ] Cross-references are used instead of copies (e.g., "Follow conventions in CLAUDE.md")
|
|
1035
|
+
- [ ] Every rule file has a \`paths:\` filter \u2014 no unfiltered rules
|
|
1036
|
+
- [ ] Single-language rules are justified (add genuine value beyond CLAUDE.md)
|
|
1031
1037
|
|
|
1032
1038
|
---
|
|
1033
1039
|
|
|
@@ -1035,7 +1041,7 @@ Before writing the CLAUDE.md, verify:
|
|
|
1035
1041
|
|
|
1036
1042
|
1. **Be specific, not generic.** "Uses React with hooks" is useless. "Uses React 18 with Server Components via Next.js App Router, client components in src/components/client/ with 'use client' directive" is useful.
|
|
1037
1043
|
|
|
1038
|
-
2. **Reference real files.** Every pattern should reference an actual file as an example. Use \`path/to/file.ts
|
|
1044
|
+
2. **Reference real files.** Every pattern should reference an actual file as an example. Use \`path/to/file.ts (functionName)\` format \u2014 NOT line numbers, which become stale as code changes.
|
|
1039
1045
|
|
|
1040
1046
|
3. **Prioritize actionable information.** Focus on what helps an AI write correct code: where to put new code, what patterns to follow, what to avoid, how to test.
|
|
1041
1047
|
|
|
@@ -1051,51 +1057,38 @@ var SKILLS_PROMPT = `---
|
|
|
1051
1057
|
Write each skill file to \`.claude/skills/\` using the Write tool. Every skill must have
|
|
1052
1058
|
YAML frontmatter with \`name\`, \`description\`, and optionally \`globs\` for file matching.
|
|
1053
1059
|
|
|
1054
|
-
**Tailor ALL skills to this specific project** \u2014 use the actual
|
|
1055
|
-
|
|
1060
|
+
**Tailor ALL skills to this specific project** \u2014 use the actual file patterns and
|
|
1061
|
+
conventions discovered during Phase 1.
|
|
1056
1062
|
|
|
1057
|
-
###
|
|
1063
|
+
### Skill Content Rules
|
|
1058
1064
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1065
|
+
1. **Cross-reference, don't copy** \u2014 write "Follow conventions in CLAUDE.md" instead of restating naming, style, or commit conventions. Skills focus on methodology (HOW to do something), not conventions (WHAT the conventions are).
|
|
1066
|
+
2. **Use stable references** \u2014 reference code as \`path/to/file.ts (functionName)\`, not line numbers which become stale.
|
|
1067
|
+
3. **No convention duplication** \u2014 if CLAUDE.md already documents commit format, import order, or naming rules, the skill must not repeat them.
|
|
1068
|
+
4. **No command duplication** \u2014 for test, lint, and build commands, write "See Common Commands in CLAUDE.md" instead of repeating the literal command.
|
|
1063
1069
|
|
|
1064
|
-
|
|
1065
|
-
- Name: systematic-debugging
|
|
1066
|
-
- Description: 4-phase debugging methodology \u2014 Reproduce, Locate, Diagnose, Fix
|
|
1067
|
-
- Content: Tailor reproduction steps to the project's actual test runner and dev server commands. Include how to use the project's logging/debugging setup.
|
|
1068
|
-
|
|
1069
|
-
**\`.claude/skills/testing-methodology.md\`**
|
|
1070
|
-
- Name: testing-methodology
|
|
1071
|
-
- Description: AAA testing pattern with project-specific framework syntax
|
|
1072
|
-
- Content: Use the project's actual testing framework syntax. Include real examples of test patterns found in the codebase (describe/it blocks, pytest fixtures, etc.). Reference the actual test command. Include mocking/stubbing patterns specific to the stack.
|
|
1070
|
+
### 4.1 Core Skills (ALWAYS generate all 4)
|
|
1073
1071
|
|
|
1074
1072
|
**\`.claude/skills/iterative-development.md\`**
|
|
1075
1073
|
- Name: iterative-development
|
|
1076
|
-
- Description: TDD workflow with
|
|
1077
|
-
- Content: The TDD loop
|
|
1078
|
-
|
|
1079
|
-
**\`.claude/skills/commit-hygiene.md\`**
|
|
1080
|
-
- Name: commit-hygiene
|
|
1081
|
-
- Description: Atomic commits, conventional format, size thresholds
|
|
1082
|
-
- Content: Size thresholds (\xB1300 lines per commit), when-to-commit triggers, conventional commit format. If the project uses commitlint or similar, reference its config.
|
|
1074
|
+
- Description: TDD workflow with debugging methodology and verification chain
|
|
1075
|
+
- Content: The TDD loop referencing "See Common Commands in CLAUDE.md" for actual commands. Include the project's verification steps (typecheck, build, etc.). Add a Debugging section with: 4-phase methodology (Reproduce, Locate, Diagnose, Fix), project-specific file-to-module mapping for tracing bugs, how to use the project's logging/debugging setup. Add commit guidance: size thresholds (\xB1300 lines per commit), when-to-commit triggers, "Follow commit conventions in CLAUDE.md" for format.
|
|
1083
1076
|
|
|
1084
1077
|
**\`.claude/skills/code-deduplication.md\`**
|
|
1085
1078
|
- Name: code-deduplication
|
|
1086
|
-
- Description: Check-before-write principle and
|
|
1087
|
-
- Content: Search existing code before writing new code. Include project-specific glob patterns for source files. Reference the actual directory structure for where to look.
|
|
1088
|
-
|
|
1089
|
-
**\`.claude/skills/simplicity-rules.md\`**
|
|
1090
|
-
- Name: simplicity-rules
|
|
1091
|
-
- Description: Function and file size limits, decomposition patterns
|
|
1092
|
-
- Content: Function length limits (40 lines), file limits (300 lines), cyclomatic complexity. Decomposition patterns appropriate for the project's architecture style.
|
|
1079
|
+
- Description: Check-before-write principle, search checklist, and size limits
|
|
1080
|
+
- Content: Search existing code before writing new code. Include project-specific glob patterns for source files. Reference the actual directory structure for where to look. Include a "Where to Look" checklist for discovering patterns in THIS project's structure (source directories, key file patterns). Add size limits: function length (40 lines), file length (300 lines), decomposition patterns appropriate for the project's architecture style.
|
|
1093
1081
|
|
|
1094
1082
|
**\`.claude/skills/security.md\`**
|
|
1095
1083
|
- Name: security
|
|
1096
1084
|
- Description: Security patterns and secrets management for this stack
|
|
1097
1085
|
- Content: .gitignore entries appropriate for the detected stack. Environment variable handling patterns. OWASP checklist items relevant to the detected framework. Include actual secrets patterns to watch for (API keys, database URLs, etc.).
|
|
1098
1086
|
|
|
1087
|
+
**\`.claude/skills/testing-methodology.md\`**
|
|
1088
|
+
- Name: testing-methodology
|
|
1089
|
+
- Description: Test design methodology \u2014 what to test, edge cases, test organization
|
|
1090
|
+
- Content: Focus on test DESIGN: what to test, how to identify edge cases, test organization strategy, when to use unit vs integration tests. Include project-specific test file naming and location conventions. Reference "See Common Commands in CLAUDE.md" for the test command. Do NOT include testing framework syntax examples (describe/it/expect, pytest fixtures, etc.) \u2014 those belong in the test-writer agent, not here. The \`testing-methodology\` skill focuses on test DESIGN (what to test, edge cases, test organization). The \`test-writer\` agent focuses on test EXECUTION (writing code, running tests). They must not overlap.
|
|
1091
|
+
|
|
1099
1092
|
### 4.2 Framework-Specific Skills (ONLY if detected)
|
|
1100
1093
|
|
|
1101
1094
|
Generate the matching skill ONLY if the framework was detected in the tech stack:
|
|
@@ -1183,26 +1176,29 @@ Body content \u2014 instructions for the test writer agent:
|
|
|
1183
1176
|
- Follow existing test file naming conventions
|
|
1184
1177
|
- Include edge cases: empty inputs, nulls, errors, boundaries
|
|
1185
1178
|
- Mock external dependencies following project patterns
|
|
1186
|
-
- Run tests after writing to verify they pass
|
|
1179
|
+
- Run tests after writing to verify they pass
|
|
1180
|
+
- Do NOT duplicate the testing-methodology skill content. The skill covers test design (what to test, edge cases, organization); this agent covers writing and running tests (framework syntax, assertions, execution).`;
|
|
1187
1181
|
var RULES_PROMPT = `---
|
|
1188
1182
|
|
|
1189
1183
|
## Phase 6: Generate Rules
|
|
1190
1184
|
|
|
1191
1185
|
Write rule files to \`.claude/rules/\`. Each rule file needs YAML frontmatter.
|
|
1192
1186
|
|
|
1193
|
-
###
|
|
1187
|
+
### Important: No Unfiltered Rules
|
|
1194
1188
|
|
|
1195
|
-
|
|
1189
|
+
Do NOT generate a \`code-style.md\` rule or any rule without a \`paths:\` filter. General style information (formatter, linter commands, comment style, error handling, commit conventions, import ordering) belongs in CLAUDE.md \u2014 not in a rule that loads every session and duplicates it.
|
|
1196
1190
|
|
|
1197
|
-
|
|
1198
|
-
- Which formatter/linter to use and how (include actual commands)
|
|
1199
|
-
- Comment style: "why" not "what", keep comments current
|
|
1200
|
-
- Error handling patterns specific to this project
|
|
1201
|
-
- Git commit message conventions (conventional commits if commitlint is configured)
|
|
1202
|
-
- Import ordering conventions found in the codebase
|
|
1191
|
+
NEVER generate rules without \`paths:\` filters. Every rule must target specific file types.
|
|
1203
1192
|
|
|
1204
1193
|
### Conditional Rules (generate ONLY if the language was detected):
|
|
1205
1194
|
|
|
1195
|
+
**Constraints for all conditional rules:**
|
|
1196
|
+
- Every rule MUST have a \`paths:\` filter targeting language-specific file extensions
|
|
1197
|
+
- Keep rules concise: 5-15 lines of content maximum
|
|
1198
|
+
- Rules must NOT repeat conventions already in CLAUDE.md (naming, style, commit format, import order)
|
|
1199
|
+
- For single-language projects: only generate a language rule if it adds genuine value beyond CLAUDE.md (compiler flags, import quirks, tooling-specific gotchas)
|
|
1200
|
+
- Focus on: compiler/interpreter settings, language-specific gotchas, tooling-specific configuration \u2014 not general naming or style
|
|
1201
|
+
|
|
1206
1202
|
**TypeScript detected** \u2192 Write \`.claude/rules/typescript.md\`
|
|
1207
1203
|
\`\`\`yaml
|
|
1208
1204
|
---
|
|
@@ -1246,39 +1242,11 @@ var COMMANDS_PROMPT = `---
|
|
|
1246
1242
|
|
|
1247
1243
|
## Phase 7: Generate Commands
|
|
1248
1244
|
|
|
1249
|
-
Write
|
|
1245
|
+
Write 2 command files to \`.claude/commands/\`. Each needs YAML frontmatter with
|
|
1250
1246
|
\`allowed-tools\`, \`description\`, and optionally \`argument-hint\`.
|
|
1251
1247
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
---
|
|
1255
|
-
allowed-tools: ["Read", "Write", "Edit", "Glob"]
|
|
1256
|
-
description: "Start or switch to a new task"
|
|
1257
|
-
argument-hint: "<task description>"
|
|
1258
|
-
---
|
|
1259
|
-
\`\`\`
|
|
1260
|
-
Body: Instructions to read current \`.claude/state/task.md\`, update status to "In Progress",
|
|
1261
|
-
record the task description and timestamp. If starting a new task, archive the previous one.
|
|
1262
|
-
|
|
1263
|
-
### \`.claude/commands/status.md\`
|
|
1264
|
-
\`\`\`yaml
|
|
1265
|
-
---
|
|
1266
|
-
allowed-tools: ["Read", "Glob", "Grep", "Bash(git status)", "Bash(git diff --stat)"]
|
|
1267
|
-
description: "Show current task and session state"
|
|
1268
|
-
---
|
|
1269
|
-
\`\`\`
|
|
1270
|
-
Body: Read \`.claude/state/task.md\`, show git status, list recently modified files,
|
|
1271
|
-
summarize current state in a concise format.
|
|
1272
|
-
|
|
1273
|
-
### \`.claude/commands/done.md\`
|
|
1274
|
-
\`\`\`yaml
|
|
1275
|
-
---
|
|
1276
|
-
allowed-tools: ["Read", "Write", "Edit", "Glob", "Grep", "Bash(git:*)", "Bash({test_command})", "Bash({lint_command})"]
|
|
1277
|
-
description: "Mark current task complete"
|
|
1278
|
-
---
|
|
1279
|
-
\`\`\`
|
|
1280
|
-
Body: Run tests and lint checks. If they pass, update \`.claude/state/task.md\`
|
|
1281
|
-
status to "Done". Show a summary of what was accomplished. Suggest next steps.
|
|
1248
|
+
Do NOT generate task management commands (\`task.md\`, \`status.md\`, \`done.md\`) \u2014
|
|
1249
|
+
Claude Code has built-in TaskCreate/TaskUpdate/TaskList tools for task management.
|
|
1282
1250
|
|
|
1283
1251
|
### \`.claude/commands/analyze.md\`
|
|
1284
1252
|
\`\`\`yaml
|
|
@@ -1298,10 +1266,11 @@ allowed-tools: ["Read", "Glob", "Grep", "Bash(git diff)", "Bash(git diff --cache
|
|
|
1298
1266
|
description: "Review code changes for quality and security"
|
|
1299
1267
|
---
|
|
1300
1268
|
\`\`\`
|
|
1301
|
-
Body:
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1269
|
+
Body: This command delegates to the code-reviewer agent for thorough review.
|
|
1270
|
+
1. Run \`git diff\` and \`git diff --cached\` to identify staged and unstaged changes
|
|
1271
|
+
2. Spawn the \`code-reviewer\` agent to perform the full review
|
|
1272
|
+
3. If the agent is unavailable, perform a lightweight review: run the linter and check for obvious issues
|
|
1273
|
+
Do NOT duplicate the code-reviewer agent's checklist here \u2014 the agent has the full review criteria.`;
|
|
1305
1274
|
|
|
1306
1275
|
// src/cli.ts
|
|
1307
1276
|
var __dirname2 = path3.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1681,61 +1650,6 @@ function mapFormatter(linter) {
|
|
|
1681
1650
|
};
|
|
1682
1651
|
return mapping[linter] ?? null;
|
|
1683
1652
|
}
|
|
1684
|
-
function createTaskFile(projectInfo, preferences) {
|
|
1685
|
-
const taskPath = path3.join(projectInfo.rootDir, ".claude", "state", "task.md");
|
|
1686
|
-
fs3.mkdirSync(path3.dirname(taskPath), { recursive: true });
|
|
1687
|
-
if (fs3.existsSync(taskPath)) {
|
|
1688
|
-
return;
|
|
1689
|
-
}
|
|
1690
|
-
let content;
|
|
1691
|
-
if (projectInfo.isExisting) {
|
|
1692
|
-
content = `# Current Task
|
|
1693
|
-
|
|
1694
|
-
## Status: Ready
|
|
1695
|
-
|
|
1696
|
-
No active task. Start one with \`/task <description>\`.
|
|
1697
|
-
|
|
1698
|
-
## Project Summary
|
|
1699
|
-
|
|
1700
|
-
${projectInfo.name}${projectInfo.description ? ` - ${projectInfo.description}` : ""}
|
|
1701
|
-
|
|
1702
|
-
**Tech Stack:** ${summarizeTechStack(projectInfo.techStack)}
|
|
1703
|
-
|
|
1704
|
-
## Quick Commands
|
|
1705
|
-
|
|
1706
|
-
- \`/task\` - Start working on something
|
|
1707
|
-
- \`/status\` - See current state
|
|
1708
|
-
- \`/analyze\` - Deep dive into code
|
|
1709
|
-
- \`/done\` - Mark task complete
|
|
1710
|
-
`;
|
|
1711
|
-
} else {
|
|
1712
|
-
const description = preferences?.description || "Explore and set up project";
|
|
1713
|
-
content = `# Current Task
|
|
1714
|
-
|
|
1715
|
-
## Status: In Progress
|
|
1716
|
-
|
|
1717
|
-
**Task:** ${description}
|
|
1718
|
-
|
|
1719
|
-
## Context
|
|
1720
|
-
|
|
1721
|
-
New project - setting up from scratch.
|
|
1722
|
-
|
|
1723
|
-
${preferences?.framework ? `**Framework:** ${formatFramework(preferences.framework)}` : ""}
|
|
1724
|
-
${preferences?.primaryLanguage ? `**Language:** ${formatLanguage(preferences.primaryLanguage)}` : ""}
|
|
1725
|
-
|
|
1726
|
-
## Next Steps
|
|
1727
|
-
|
|
1728
|
-
1. Define project structure
|
|
1729
|
-
2. Set up development environment
|
|
1730
|
-
3. Start implementation
|
|
1731
|
-
|
|
1732
|
-
## Decisions
|
|
1733
|
-
|
|
1734
|
-
(None yet - starting fresh)
|
|
1735
|
-
`;
|
|
1736
|
-
}
|
|
1737
|
-
fs3.writeFileSync(taskPath, content);
|
|
1738
|
-
}
|
|
1739
1653
|
function formatLanguage(lang) {
|
|
1740
1654
|
const names = {
|
|
1741
1655
|
typescript: "TypeScript",
|
|
@@ -1833,7 +1747,7 @@ function runClaudeAnalysis(projectDir, projectInfo) {
|
|
|
1833
1747
|
text: "Claude is analyzing your project...",
|
|
1834
1748
|
spinner: {
|
|
1835
1749
|
interval: 200,
|
|
1836
|
-
frames: ["\xB7", "\u2722", "\u2733", "\u2736", "\
|
|
1750
|
+
frames: ["\xB7", "\u2722", "\u2733", "\u2736", "\u2733", "\u2722"]
|
|
1837
1751
|
},
|
|
1838
1752
|
color: "cyan"
|
|
1839
1753
|
}).start();
|
|
@@ -1964,7 +1878,6 @@ async function main() {
|
|
|
1964
1878
|
console.log(pc.green("Created:"));
|
|
1965
1879
|
console.log(pc.green(" + .claude/settings.json"));
|
|
1966
1880
|
console.log();
|
|
1967
|
-
createTaskFile(projectInfo, preferences);
|
|
1968
1881
|
const success = await runClaudeAnalysis(projectDir, projectInfo);
|
|
1969
1882
|
if (!success) {
|
|
1970
1883
|
console.error(pc.red("Claude analysis failed. Please try again."));
|
|
@@ -2022,7 +1935,6 @@ try {
|
|
|
2022
1935
|
}
|
|
2023
1936
|
export {
|
|
2024
1937
|
checkClaudeCli,
|
|
2025
|
-
createTaskFile,
|
|
2026
1938
|
formatFramework,
|
|
2027
1939
|
formatLanguage,
|
|
2028
1940
|
getVersion,
|