@codemieai/code 0.0.33 → 0.0.34
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 +73 -7
- package/bin/codemie-opencode.js +11 -0
- package/dist/agents/codemie-code/agent.d.ts +17 -1
- package/dist/agents/codemie-code/agent.d.ts.map +1 -1
- package/dist/agents/codemie-code/agent.js +62 -3
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/index.d.ts +1 -0
- package/dist/agents/codemie-code/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/index.js +28 -2
- package/dist/agents/codemie-code/index.js.map +1 -1
- package/dist/agents/codemie-code/prompts.d.ts +12 -3
- package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
- package/dist/agents/codemie-code/prompts.js +25 -5
- package/dist/agents/codemie-code/prompts.js.map +1 -1
- package/dist/agents/codemie-code/types.d.ts +3 -0
- package/dist/agents/codemie-code/types.d.ts.map +1 -1
- package/dist/agents/codemie-code/types.js.map +1 -1
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +3 -1
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +33 -0
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
- package/dist/agents/core/session/discovery-types.d.ts +53 -0
- package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
- package/dist/agents/core/session/discovery-types.js +8 -0
- package/dist/agents/core/session/discovery-types.js.map +1 -0
- package/dist/agents/core/types.d.ts +45 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +214 -0
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/README.md +40 -2
- package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
- package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
- package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
- package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +232 -503
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
- package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini/gemini.plugin.js +0 -3
- package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
- package/dist/agents/plugins/opencode/index.d.ts +8 -0
- package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/index.js +12 -0
- package/dist/agents/plugins/opencode/index.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
- package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.js +424 -0
- package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +2 -0
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +86 -7
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/opencode-metrics.d.ts +13 -0
- package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
- package/dist/cli/commands/opencode-metrics.js +200 -0
- package/dist/cli/commands/opencode-metrics.js.map +1 -0
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +113 -0
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/skill.d.ts +6 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +196 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +34 -6
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
- package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
- package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
- package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +1 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.js +2 -2
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/skills/core/SkillDiscovery.d.ts +83 -0
- package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
- package/dist/skills/core/SkillDiscovery.js +237 -0
- package/dist/skills/core/SkillDiscovery.js.map +1 -0
- package/dist/skills/core/SkillManager.d.ts +86 -0
- package/dist/skills/core/SkillManager.d.ts.map +1 -0
- package/dist/skills/core/SkillManager.js +155 -0
- package/dist/skills/core/SkillManager.js.map +1 -0
- package/dist/skills/core/types.d.ts +120 -0
- package/dist/skills/core/types.d.ts.map +1 -0
- package/dist/skills/core/types.js +20 -0
- package/dist/skills/core/types.js.map +1 -0
- package/dist/skills/index.d.ts +12 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +12 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/utils/content-loader.d.ts +25 -0
- package/dist/skills/utils/content-loader.d.ts.map +1 -0
- package/dist/skills/utils/content-loader.js +161 -0
- package/dist/skills/utils/content-loader.js.map +1 -0
- package/dist/skills/utils/frontmatter.d.ts +60 -0
- package/dist/skills/utils/frontmatter.d.ts.map +1 -0
- package/dist/skills/utils/frontmatter.js +114 -0
- package/dist/skills/utils/frontmatter.js.map +1 -0
- package/dist/skills/utils/pattern-matcher.d.ts +60 -0
- package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
- package/dist/skills/utils/pattern-matcher.js +97 -0
- package/dist/skills/utils/pattern-matcher.js.map +1 -0
- package/dist/utils/installation-detector.d.ts +22 -0
- package/dist/utils/installation-detector.d.ts.map +1 -0
- package/dist/utils/installation-detector.js +49 -0
- package/dist/utils/installation-detector.js.map +1 -0
- package/dist/utils/native-installer.d.ts +49 -0
- package/dist/utils/native-installer.d.ts.map +1 -0
- package/dist/utils/native-installer.js +194 -0
- package/dist/utils/native-installer.js.map +1 -0
- package/dist/utils/version-utils.d.ts +50 -0
- package/dist/utils/version-utils.d.ts.map +1 -0
- package/dist/utils/version-utils.js +92 -0
- package/dist/utils/version-utils.js.map +1 -0
- package/package.json +5 -2
- package/scripts/copy-mr-skill-to-global.ts +252 -0
- package/scripts/demo-hooks.sh +125 -0
- package/scripts/test-hooks.sh +196 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/project-structure.md.template +0 -127
|
@@ -1,731 +1,523 @@
|
|
|
1
1
|
# Codemie Init - Generate Project Documentation
|
|
2
2
|
|
|
3
3
|
**Command Name**: `codemie-init`
|
|
4
|
-
**Description**: Initialize
|
|
4
|
+
**Description**: Initialize documentation for any project using CodeMie approach - analyze structure and generate AI-optimized guides
|
|
5
5
|
**Category**: Documentation Generation
|
|
6
|
-
**Complexity**: High
|
|
7
6
|
|
|
8
7
|
---
|
|
9
8
|
|
|
9
|
+
## Additional user's input
|
|
10
|
+
Additional context/input from user: $ARGUMENTS. Might be empty by default.
|
|
11
|
+
|
|
10
12
|
## Purpose
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
- Main CLAUDE.md file with project-specific
|
|
14
|
-
- Detailed guides for relevant
|
|
15
|
-
- Properly structured .codemie/guides/ directory
|
|
14
|
+
Analyze any software project and generate AI-optimized documentation for Claude Code:
|
|
15
|
+
- Main CLAUDE.md file with project-specific workflows
|
|
16
|
+
- Detailed guides for relevant patterns (only those that exist in codebase)
|
|
17
|
+
- Properly structured .codemie/guides/ directory
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
19
21
|
## Prerequisites
|
|
20
22
|
|
|
21
|
-
Before running this command:
|
|
22
23
|
- [ ] Project is cloned and accessible
|
|
23
|
-
- [ ]
|
|
24
|
-
- [ ]
|
|
25
|
-
|
|
26
|
-
**Note**: The templates directory should be located in `.codemie/claude-templates/` within the project.
|
|
24
|
+
- [ ] Read access to the codebase
|
|
25
|
+
- [ ] Templates available at `.codemie/claude-templates/templates/`
|
|
27
26
|
|
|
28
27
|
---
|
|
29
28
|
|
|
30
|
-
## 🚨 CRITICAL
|
|
29
|
+
## 🚨 CRITICAL RULES
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
### Size Limits (MANDATORY)
|
|
32
|
+
- **CLAUDE.md**: 200-300 lines maximum
|
|
33
|
+
- **Each guide**: 200-400 lines maximum
|
|
33
34
|
|
|
34
|
-
###
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- ✅ Use brief code examples (5-15 lines max, never > 20)
|
|
38
|
-
- ✅ Focus on contracts: function signatures, return types, status codes
|
|
35
|
+
### Generation Principles
|
|
36
|
+
- ✅ Create guides ONLY for patterns/categories that exist in codebase
|
|
37
|
+
- ✅ Brief code examples (5-15 lines, max 20)
|
|
39
38
|
- ✅ Use tables for patterns instead of long explanations
|
|
40
|
-
- ✅ ONE example per pattern
|
|
39
|
+
- ✅ ONE example per pattern
|
|
41
40
|
- ✅ Reference file:line instead of copying entire functions
|
|
41
|
+
- ✅ Multiple .md files per category allowed (e.g., component-specific guides in development/)
|
|
42
|
+
- ❌ NO guides for non-existent features (no API = no API guide)
|
|
42
43
|
- ❌ NO extensive code blocks
|
|
43
44
|
- ❌ NO multiple examples for same pattern
|
|
44
|
-
- ❌ NO verbose explanations
|
|
45
|
-
- ❌ NO tutorial walkthroughs
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
If > 400 lines: **STOP and condense before continuing**.
|
|
46
|
+
### Existing Documentation Handling
|
|
47
|
+
- If CLAUDE.md exists → Analyze and UPDATE/ADJUST (don't overwrite blindly)
|
|
48
|
+
- If guides exist in .codemie/guides/ → READ, INCLUDE in CLAUDE.md, and ADJUST if needed
|
|
49
|
+
- Preserve user customizations where possible
|
|
53
50
|
|
|
54
51
|
---
|
|
55
52
|
|
|
56
53
|
## Execution Steps
|
|
57
54
|
|
|
58
|
-
### Phase 1:
|
|
55
|
+
### Phase 1: Discovery & Analysis
|
|
59
56
|
|
|
60
|
-
#### Step 1.1:
|
|
57
|
+
#### Step 1.1: Check Existing Documentation
|
|
61
58
|
|
|
62
|
-
**Task**:
|
|
59
|
+
**Task**: Detect existing Codemie documentation
|
|
63
60
|
|
|
64
61
|
**Actions**:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
62
|
+
1. Check if `CLAUDE.md` exists in project root
|
|
63
|
+
2. Check if `.codemie/guides/` directory exists
|
|
64
|
+
3. If guides exist, read each one and extract:
|
|
65
|
+
- Category and purpose
|
|
66
|
+
- Key patterns documented
|
|
67
|
+
- Quality and completeness
|
|
68
|
+
|
|
69
|
+
**Decision**:
|
|
70
|
+
- Existing CLAUDE.md found → Load and prepare for adjustment
|
|
71
|
+
- Existing guides found → Include in final CLAUDE.md, adjust if outdated
|
|
72
|
+
- Nothing exists → Fresh generation from templates
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
#### Step 1.2: Analyze Project Structure
|
|
77
|
+
|
|
78
|
+
**Task**: Discover project organization, tech stack, and patterns
|
|
79
|
+
|
|
80
|
+
**Discover**:
|
|
81
|
+
- Package manager files (package.json, requirements.txt, pom.xml, go.mod, Cargo.toml)
|
|
82
|
+
- Programming language(s) and framework(s)
|
|
83
|
+
- Directory structure (src/, lib/, app/, tests/, etc.)
|
|
84
|
+
- Configuration files
|
|
85
|
+
- Build and run scripts
|
|
86
|
+
|
|
87
|
+
**Output**: Project analysis summary:
|
|
88
|
+
- Language + version
|
|
89
|
+
- Framework + version
|
|
76
90
|
- Build tools
|
|
77
|
-
-
|
|
78
|
-
- Key directories
|
|
79
|
-
- Dependency management approach
|
|
91
|
+
- Test framework
|
|
92
|
+
- Key directories
|
|
80
93
|
|
|
81
|
-
**Confidence Check**:
|
|
82
|
-
- ✅ YES → Continue
|
|
94
|
+
**Confidence Check**: Tech stack identified with 80%+ confidence?
|
|
95
|
+
- ✅ YES → Continue
|
|
83
96
|
- ❌ NO → Ask user for clarification
|
|
84
97
|
|
|
85
98
|
---
|
|
86
99
|
|
|
87
|
-
#### Step 1.
|
|
100
|
+
#### Step 1.3: Identify What Actually Exists
|
|
88
101
|
|
|
89
|
-
**Task**: Detect
|
|
102
|
+
**Task**: Detect ONLY categories/features that exist in codebase
|
|
90
103
|
|
|
91
|
-
**
|
|
92
|
-
```bash
|
|
93
|
-
# Use Glob and Grep to identify patterns
|
|
94
|
-
- Check for layered architecture (controllers/routes, services, repositories)
|
|
95
|
-
- Identify if REST API, GraphQL, or other
|
|
96
|
-
- Look for ORM usage (models directory)
|
|
97
|
-
- Find database configurations
|
|
98
|
-
- Check for agent/AI patterns (if LangChain, LangGraph, etc.)
|
|
99
|
-
- Identify testing structure
|
|
100
|
-
- Check for CI/CD configuration
|
|
101
|
-
```
|
|
104
|
+
**Analyze codebase for each category**:
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
| Category | What to Look For | Detection Signals |
|
|
107
|
+
|----------|------------------|-------------------|
|
|
108
|
+
| **Architecture** | Project structure, layer separation, design patterns | Directory organization, module boundaries, dependency flow |
|
|
109
|
+
| **API Development** | REST/GraphQL endpoints, routing, request handling | Route decorators, controllers, endpoint definitions, API schemas |
|
|
110
|
+
| **Data & Database** | ORM usage, models, repositories, migrations | Model classes, database configs, migration files, query patterns |
|
|
111
|
+
| **Testing** | Test files, test configuration, mocking | Test directories, test framework config, fixture files |
|
|
112
|
+
| **Development Practices** | Code patterns, error handling, logging, components | Custom exceptions, logger setup, shared utilities, UI components |
|
|
113
|
+
| **Integrations** | External services, third-party APIs, messaging | API clients, SDK usage, queue consumers/producers, webhooks |
|
|
114
|
+
| **Workflows** | Business logic, state machines, process flows | Workflow definitions, state handlers, domain services |
|
|
115
|
+
| **Security** | Authentication, authorization, validation | Auth middleware, permission checks, input validators, security configs |
|
|
110
116
|
|
|
111
|
-
**Output**: List of
|
|
117
|
+
**Output**: List of confirmed categories with evidence (file paths)
|
|
118
|
+
|
|
119
|
+
**Example Output**:
|
|
120
|
+
```
|
|
121
|
+
✅ Architecture - Found: src/controllers/, src/services/, src/repositories/
|
|
122
|
+
✅ API Development - Found: REST routes in src/api/, OpenAPI spec
|
|
123
|
+
✅ Data & Database - Found: PostgreSQL config, SQLAlchemy models in src/models/
|
|
124
|
+
✅ Testing - Found: pytest.ini, tests/ directory with 50+ test files
|
|
125
|
+
✅ Development Practices - Found: Custom exceptions, logging config, React components
|
|
126
|
+
❌ Integrations - Not found: No external API clients detected
|
|
127
|
+
❌ Workflows - Not found: No state machines or workflow definitions
|
|
128
|
+
✅ Security - Found: JWT auth middleware, input validation schemas
|
|
129
|
+
```
|
|
112
130
|
|
|
113
131
|
---
|
|
114
132
|
|
|
115
|
-
#### Step 1.
|
|
133
|
+
#### Step 1.4: Read Existing Project Documentation
|
|
116
134
|
|
|
117
|
-
**Task**:
|
|
135
|
+
**Task**: Extract context from existing docs
|
|
118
136
|
|
|
119
|
-
**
|
|
120
|
-
```bash
|
|
121
|
-
# Read existing docs (if they exist)
|
|
137
|
+
**Check and read**:
|
|
122
138
|
- README.md
|
|
123
139
|
- CONTRIBUTING.md
|
|
124
140
|
- docs/ directory
|
|
125
|
-
- Any
|
|
126
|
-
```
|
|
141
|
+
- Any ADRs (Architecture Decision Records)
|
|
127
142
|
|
|
128
143
|
**Extract**:
|
|
129
144
|
- Project purpose
|
|
130
|
-
- Setup
|
|
131
|
-
- Build/run commands
|
|
145
|
+
- Setup/build/run commands
|
|
132
146
|
- Testing commands
|
|
133
|
-
-
|
|
134
|
-
- Known patterns or conventions
|
|
147
|
+
- Known conventions
|
|
135
148
|
|
|
136
149
|
---
|
|
137
150
|
|
|
138
|
-
### Phase 2:
|
|
151
|
+
### Phase 2: Determine Required Guides
|
|
139
152
|
|
|
140
|
-
#### Step 2.1:
|
|
153
|
+
#### Step 2.1: Map Categories to Guides
|
|
141
154
|
|
|
142
|
-
**Task**:
|
|
155
|
+
**Task**: Based on Step 1.3, determine which guides to create per category
|
|
143
156
|
|
|
144
|
-
**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
**Guide Categories Reference**:
|
|
158
|
+
|
|
159
|
+
| Category | User Intent / Purpose | Guide Folder | Possible Guides |
|
|
160
|
+
|----------|----------------------|--------------|-------------------------------------------------------------------------|
|
|
161
|
+
| **Architecture** | System structure, design decisions, patterns, planning features | .codemie/guides/architecture/ | architecture.md, patterns.md |
|
|
162
|
+
| **API Development** | REST/GraphQL endpoints, routing, request/response handling | .codemie/guides/api/ | api-patterns.md, [specific-api].md |
|
|
163
|
+
| **Data & Database** | Database operations, queries, migrations, models, repositories | .codemie/guides/data/ | data-patterns.md |
|
|
164
|
+
| **Testing** | Writing/fixing tests, coverage, mocking, test infrastructure | .codemie/guides/testing/ | testing-patterns.md, [framework]-testing.md |
|
|
165
|
+
| **Development Practices** | Code quality, error handling, components, standards | .codemie/guides/development/ | development-practices.md, frontend-patterns.md, [component]-patterns.md |
|
|
166
|
+
| **Integrations** | External services, third-party APIs, cloud services, messaging | .codemie/guides/integrations/ | [service-name].md, external-apis.md |
|
|
167
|
+
| **Workflows** | Business logic, state machines, process flows, domain operations | .codemie/guides/workflows/ | workflow-patterns.md, [workflow-name].md |
|
|
168
|
+
| **Security** | Authentication, authorization, input validation, secrets | .codemie/guides/security/ | security-patterns.md |
|
|
169
|
+
|
|
170
|
+
**Rules for Guide Creation**:
|
|
171
|
+
- ❌ Category NOT detected → DO NOT create any guides for it
|
|
172
|
+
- ✅ Category detected → Create relevant guides with real examples
|
|
173
|
+
- ✅ Multiple guides per category allowed (e.g., separate component guides in development/)
|
|
174
|
+
- ✅ Existing guide found → Review, include, adjust if needed
|
|
175
|
+
|
|
176
|
+
**Determine Specific Guides**:
|
|
149
177
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
178
|
+
For each detected category, identify specific guides needed:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
Example for detected "Development Practices" category:
|
|
182
|
+
- Error handling patterns found → development/error-handling.md
|
|
183
|
+
- Logging configuration found → development/logging.md
|
|
184
|
+
- React components found → development/react-components.md
|
|
185
|
+
- Shared utilities found → development/utilities.md
|
|
186
|
+
```
|
|
154
187
|
|
|
155
188
|
---
|
|
156
189
|
|
|
157
|
-
#### Step 2.2:
|
|
190
|
+
#### Step 2.2: Merge with Existing Guides
|
|
191
|
+
|
|
192
|
+
**Task**: Combine new guides with any existing ones
|
|
158
193
|
|
|
159
|
-
**
|
|
194
|
+
**Actions**:
|
|
195
|
+
1. List guides to create (from Step 2.1)
|
|
196
|
+
2. List existing guides (from Step 1.1)
|
|
197
|
+
3. Merge lists:
|
|
198
|
+
- Existing guide covers same topic → Review and adjust existing
|
|
199
|
+
- New guide needed, no existing → Create new
|
|
200
|
+
- Existing guide, no longer relevant → Keep but note as legacy
|
|
160
201
|
|
|
161
|
-
|
|
202
|
+
---
|
|
162
203
|
|
|
163
|
-
|
|
164
|
-
|----------------------|-----------------|----------|
|
|
165
|
-
| REST API endpoints | api/api-patterns.md | P0 (Required) |
|
|
166
|
-
| Layered architecture | architecture/layered-architecture.md | P0 (Required) |
|
|
167
|
-
| Database/ORM usage | data/database-patterns.md | P0 (Required) |
|
|
168
|
-
| Service layer | architecture/service-layer-patterns.md | P1 (Optional) |
|
|
169
|
-
| Testing framework | testing/testing-patterns.md | P0 (Required) |
|
|
170
|
-
| Error handling | development/error-handling.md | P0 (Required) |
|
|
171
|
-
| Logging | development/logging-patterns.md | P0 (Required) |
|
|
172
|
-
| Security features | development/security-patterns.md | P0 (Required) |
|
|
173
|
-
| Setup/installation | development/setup-guide.md | P0 (Required) |
|
|
174
|
-
| Git repository | standards/git-workflow.md | P0 (Required) |
|
|
175
|
-
| Linting/formatting | standards/code-quality.md | P0 (Required) |
|
|
176
|
-
| Agent patterns (LangChain) | agents/agent-patterns.md | P0 (if found) |
|
|
177
|
-
| Workflow orchestration | workflows/workflow-patterns.md | P1 (if found) |
|
|
178
|
-
| External APIs | integration/external-integrations.md | P1 (if found) |
|
|
204
|
+
#### Step 2.3: User Confirmation
|
|
179
205
|
|
|
180
|
-
**
|
|
206
|
+
**Present to user**:
|
|
181
207
|
|
|
182
|
-
**User Confirmation**: Present the list and ask:
|
|
183
208
|
```
|
|
184
|
-
|
|
209
|
+
Based on codebase analysis, I'll create/update guides for these categories:
|
|
210
|
+
|
|
211
|
+
**Categories Detected**:
|
|
212
|
+
|
|
213
|
+
📁 Architecture
|
|
214
|
+
- To create: architecture.md (system layers and patterns)
|
|
185
215
|
|
|
186
|
-
|
|
187
|
-
-
|
|
216
|
+
📁 API Development
|
|
217
|
+
- To create: api-patterns.md (REST conventions found in src/api/)
|
|
188
218
|
|
|
189
|
-
|
|
190
|
-
-
|
|
219
|
+
📁 Data & Database
|
|
220
|
+
- To create: database-patterns.md (PostgreSQL + SQLAlchemy patterns)
|
|
191
221
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
222
|
+
📁 Testing
|
|
223
|
+
- To create: testing-patterns.md (pytest patterns)
|
|
224
|
+
- Existing: integration-testing.md ✓ (will include, no changes needed)
|
|
225
|
+
|
|
226
|
+
📁 Development Practices
|
|
227
|
+
- To create: error-handling.md, logging.md
|
|
228
|
+
- To create: react-components.md (UI component patterns)
|
|
229
|
+
|
|
230
|
+
📁 Security
|
|
231
|
+
- To create: security-patterns.md (JWT auth, validation)
|
|
232
|
+
|
|
233
|
+
**Categories Skipped** (not found in codebase):
|
|
234
|
+
⏭️ Integrations - No external API clients detected
|
|
235
|
+
⏭️ Workflows - No state machines or workflow definitions
|
|
236
|
+
|
|
237
|
+
Proceed with this plan? (Yes / Customize)
|
|
196
238
|
```
|
|
197
239
|
|
|
198
240
|
---
|
|
199
241
|
|
|
200
|
-
### Phase 3:
|
|
242
|
+
### Phase 3: Generate Guides
|
|
201
243
|
|
|
202
|
-
#### Step 3.1: Create
|
|
203
|
-
|
|
204
|
-
**Task**: Create base .codemie/guides/ directory
|
|
244
|
+
#### Step 3.1: Create Directory Structure
|
|
205
245
|
|
|
206
246
|
**Actions**:
|
|
207
247
|
```bash
|
|
208
|
-
# Create base directory ONLY
|
|
209
248
|
mkdir -p .codemie/guides
|
|
249
|
+
# Create category subdirectories ONLY for categories with guides being generated
|
|
210
250
|
```
|
|
211
251
|
|
|
212
|
-
**IMPORTANT**: Do NOT create category subdirectories yet. Only create them when you actually generate a guide for that category.
|
|
213
|
-
|
|
214
252
|
---
|
|
215
253
|
|
|
216
|
-
#### Step 3.2: Generate Each Guide
|
|
254
|
+
#### Step 3.2: Generate Each Guide
|
|
217
255
|
|
|
218
|
-
**For
|
|
256
|
+
**For each guide in approved list**:
|
|
219
257
|
|
|
220
|
-
**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
- Read .codemie/claude-templates/templates/guides/[category]/[guide].md.template
|
|
224
|
-
```
|
|
258
|
+
**3.2.1: Load Template**
|
|
259
|
+
- Read from `.codemie/claude-templates/templates/guides/[category]/[guide].md.template`
|
|
260
|
+
- If no specific template exists, use category base template
|
|
225
261
|
|
|
226
|
-
**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
**For Error Handling Guide**:
|
|
231
|
-
- Search for exception classes
|
|
232
|
-
- Find error handler implementations
|
|
233
|
-
- Identify error response patterns
|
|
234
|
-
- Example: `grep -r "class.*Exception" src/`
|
|
235
|
-
|
|
236
|
-
**For API Patterns Guide**:
|
|
237
|
-
- Find route/endpoint definitions
|
|
238
|
-
- Identify request/response models
|
|
239
|
-
- Find authentication middleware
|
|
240
|
-
- Example: `grep -r "@app.route\|@router\|@RestController" src/`
|
|
241
|
-
|
|
242
|
-
**For Database Patterns Guide**:
|
|
243
|
-
- Find model definitions
|
|
244
|
-
- Identify query patterns
|
|
245
|
-
- Find transaction usage
|
|
246
|
-
- Example: `grep -r "class.*Model\|@Entity\|models.Model" src/`
|
|
247
|
-
|
|
248
|
-
**For Architecture Guide**:
|
|
249
|
-
- Map out layer structure
|
|
250
|
-
- Find examples of layer communication
|
|
251
|
-
- Identify dependency injection patterns
|
|
252
|
-
|
|
253
|
-
**For Testing Guide**:
|
|
254
|
-
- Find test structure
|
|
255
|
-
- Identify testing frameworks used
|
|
256
|
-
- Find fixture/mock patterns
|
|
257
|
-
- Example: `ls -la tests/`
|
|
258
|
-
|
|
259
|
-
**For Setup Guide**:
|
|
260
|
-
- Extract setup commands from README
|
|
261
|
-
- Find environment configuration
|
|
262
|
-
- Identify dependency installation process
|
|
263
|
-
|
|
264
|
-
**Output**: Collection of:
|
|
265
|
-
- File paths with line numbers
|
|
266
|
-
- Code examples
|
|
267
|
-
- Pattern instances
|
|
268
|
-
- Configuration snippets
|
|
269
|
-
|
|
270
|
-
**Step 3.2.3: Fill Template Placeholders**
|
|
271
|
-
|
|
272
|
-
**🚨 SIZE LIMIT ENFORCEMENT**:
|
|
273
|
-
**Target: 200-400 lines for the final guide**
|
|
274
|
-
|
|
275
|
-
**Replace Generic Placeholders**:
|
|
276
|
-
- `[PROJECT_NAME]` → Actual project name
|
|
277
|
-
- `[LANGUAGE]` → Detected language(s)
|
|
278
|
-
- `[FRAMEWORK]` → Detected framework(s)
|
|
279
|
-
- `[DATABASE_NAME]` → Detected database
|
|
280
|
-
- `[TEST_FRAMEWORK]` → Detected test framework
|
|
281
|
-
- `[file.ext:lines]` → Actual file paths from analysis
|
|
282
|
-
- `[code_example]` → **BRIEF** code snippets (5-15 lines, never > 20)
|
|
283
|
-
|
|
284
|
-
**Add Project-Specific Content** (KEEP CONCISE):
|
|
285
|
-
- Fill "FILL IN" sections with **essential patterns only**
|
|
286
|
-
- Add **ONE brief code example** per pattern (5-15 lines)
|
|
287
|
-
- Document **key commands only** (not every variation)
|
|
288
|
-
- Include **minimal** configuration snippets (< 10 lines)
|
|
289
|
-
- Use **file:line references** instead of copying entire functions
|
|
290
|
-
- Use **tables** for multiple patterns instead of code blocks
|
|
291
|
-
|
|
292
|
-
**Examples of Brevity**:
|
|
293
|
-
```python
|
|
294
|
-
# GOOD: Brief, focused (8 lines)
|
|
295
|
-
@router.post("/users")
|
|
296
|
-
async def create_user(user: UserCreate):
|
|
297
|
-
try:
|
|
298
|
-
return await UserService.create(user)
|
|
299
|
-
except ValidationError as e:
|
|
300
|
-
raise HTTPException(400, str(e))
|
|
301
|
-
# Source: api/users.py:23-28
|
|
302
|
-
|
|
303
|
-
# BAD: Too long (50+ lines showing entire function with error handling, logging, etc.)
|
|
304
|
-
```
|
|
262
|
+
**3.2.2: Analyze Codebase for This Guide**
|
|
263
|
+
- Find relevant code examples
|
|
264
|
+
- Extract actual patterns used
|
|
265
|
+
- Note file paths with line numbers
|
|
305
266
|
|
|
306
|
-
**
|
|
267
|
+
**3.2.3: Populate Template**
|
|
307
268
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
269
|
+
Replace placeholders with real project data:
|
|
270
|
+
- `[PROJECT_NAME]` → Actual name
|
|
271
|
+
- `[LANGUAGE]` → Detected language
|
|
272
|
+
- `[FRAMEWORK]` → Detected framework
|
|
273
|
+
- `[code_example]` → Real code from codebase (5-15 lines)
|
|
274
|
+
- `[file:lines]` → Actual file paths
|
|
312
275
|
|
|
313
|
-
|
|
314
|
-
# Save to .codemie/guides/[category]/[guide].md
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
**🚨 MANDATORY SIZE VALIDATION**:
|
|
276
|
+
**3.2.4: Validate Size**
|
|
318
277
|
```bash
|
|
319
|
-
# Count lines immediately after writing
|
|
320
278
|
LINE_COUNT=$(wc -l < .codemie/guides/[category]/[guide].md)
|
|
321
|
-
|
|
322
|
-
# Check if within limit
|
|
323
279
|
if [ $LINE_COUNT -gt 400 ]; then
|
|
324
|
-
|
|
325
|
-
echo "MUST condense before continuing!"
|
|
326
|
-
# STOP and condense the guide
|
|
280
|
+
# STOP - condense before continuing
|
|
327
281
|
fi
|
|
328
282
|
```
|
|
329
283
|
|
|
330
|
-
**
|
|
331
|
-
- [
|
|
332
|
-
-
|
|
333
|
-
- [ ] Code examples are brief (5-15 lines, max 20)
|
|
334
|
-
- [ ] File paths are accurate
|
|
335
|
-
- [ ] Commands are correct
|
|
336
|
-
- [ ] No "FILL IN" or "[PLACEHOLDER]" remains
|
|
337
|
-
- [ ] Used tables for patterns (not long code blocks)
|
|
338
|
-
- [ ] ONE example per pattern (not multiple)
|
|
339
|
-
|
|
340
|
-
**If > 400 Lines**:
|
|
341
|
-
1. Remove redundant code examples
|
|
342
|
-
2. Convert multiple examples to ONE representative example
|
|
343
|
-
3. Use tables instead of code blocks where possible
|
|
344
|
-
4. Replace code blocks with file:line references
|
|
345
|
-
5. Remove verbose explanations
|
|
346
|
-
6. Re-validate line count
|
|
284
|
+
**3.2.5: Write Guide**
|
|
285
|
+
- Save to `.codemie/guides/[category]/[guide].md`
|
|
286
|
+
- Verify no placeholders remain
|
|
347
287
|
|
|
348
288
|
---
|
|
349
289
|
|
|
350
290
|
#### Step 3.3: Track Progress
|
|
351
291
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
- [ ] Create development/error-handling.md
|
|
356
|
-
- [ ] Create development/logging-patterns.md
|
|
357
|
-
- [ ] Create development/security-patterns.md
|
|
358
|
-
- [ ] Create development/setup-guide.md
|
|
359
|
-
- [ ] Create api/api-patterns.md
|
|
360
|
-
- [ ] Create architecture/layered-architecture.md
|
|
361
|
-
- [ ] Create data/database-patterns.md
|
|
362
|
-
- [ ] Create testing/testing-patterns.md
|
|
363
|
-
- [ ] Create standards/code-quality.md
|
|
364
|
-
- [ ] Create standards/git-workflow.md
|
|
292
|
+
Use TodoWrite to track by category:
|
|
365
293
|
```
|
|
294
|
+
Architecture:
|
|
295
|
+
- [ ] architecture/architecture.md
|
|
366
296
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
---
|
|
297
|
+
API Development:
|
|
298
|
+
- [ ] api/api-patterns.md
|
|
370
299
|
|
|
371
|
-
|
|
300
|
+
Data & Database:
|
|
301
|
+
- [ ] data/database-patterns.md
|
|
372
302
|
|
|
373
|
-
|
|
303
|
+
Testing:
|
|
304
|
+
- [ ] testing/testing-patterns.md
|
|
374
305
|
|
|
375
|
-
|
|
306
|
+
Development Practices:
|
|
307
|
+
- [ ] development/error-handling.md
|
|
308
|
+
- [ ] development/logging.md
|
|
309
|
+
- [ ] development/react-components.md
|
|
376
310
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
- `[PROJECT_NAME]` → Actual project name
|
|
381
|
-
- `[LANGUAGE]` → Programming language
|
|
382
|
-
- `[FRAMEWORK]` → Main framework
|
|
383
|
-
- `[DATABASE_NAME]` → Database name
|
|
384
|
-
- Environment policy placeholders
|
|
311
|
+
Security:
|
|
312
|
+
- [ ] security/security-patterns.md
|
|
313
|
+
```
|
|
385
314
|
|
|
386
|
-
|
|
315
|
+
---
|
|
387
316
|
|
|
388
|
-
|
|
317
|
+
### Phase 4: Generate CLAUDE.md
|
|
389
318
|
|
|
390
|
-
|
|
391
|
-
**API Development**:
|
|
392
|
-
- API patterns: .codemie/guides/api/api-patterns.md
|
|
319
|
+
#### Step 4.1: Load Template
|
|
393
320
|
|
|
394
|
-
|
|
395
|
-
- Layered architecture: .codemie/guides/architecture/layered-architecture.md
|
|
321
|
+
- Read `.codemie/claude-templates/templates/CLAUDE.md.template`
|
|
396
322
|
|
|
397
|
-
|
|
398
|
-
- Database patterns: .codemie/guides/data/database-patterns.md
|
|
323
|
+
---
|
|
399
324
|
|
|
400
|
-
|
|
401
|
-
- Error handling: .codemie/guides/development/error-handling.md
|
|
402
|
-
- Logging patterns: .codemie/guides/development/logging-patterns.md
|
|
403
|
-
- Security patterns: .codemie/guides/development/security-patterns.md
|
|
404
|
-
- Setup guide: .codemie/guides/development/setup-guide.md
|
|
325
|
+
#### Step 4.2: Populate Sections
|
|
405
326
|
|
|
406
|
-
**
|
|
407
|
-
-
|
|
408
|
-
- Git workflow: .codemie/guides/standards/git-workflow.md
|
|
327
|
+
**4.2.1: Basic Info**
|
|
328
|
+
- Replace `[PROJECT_NAME]`, `[LANGUAGE]`, `[FRAMEWORK]`, etc.
|
|
409
329
|
|
|
410
|
-
**
|
|
411
|
-
-
|
|
412
|
-
|
|
330
|
+
**4.2.2: Critical Rules**
|
|
331
|
+
- Set environment rule based on project type (venv, nvm, docker, etc.)
|
|
332
|
+
- Remove rule row if not applicable
|
|
413
333
|
|
|
414
|
-
**4.
|
|
334
|
+
**4.2.3: Guide Imports Table**
|
|
415
335
|
|
|
416
|
-
|
|
336
|
+
List ALL guides grouped by category:
|
|
417
337
|
|
|
418
338
|
```markdown
|
|
419
|
-
|
|
|
420
|
-
|
|
421
|
-
|
|
|
422
|
-
|
|
|
423
|
-
|
|
|
424
|
-
|
|
|
339
|
+
| Category | Guide Path | Purpose |
|
|
340
|
+
|----------|------------|---------|
|
|
341
|
+
| Architecture | .codemie/guides/architecture/architecture.md | System layers and design patterns |
|
|
342
|
+
| API Development | .codemie/guides/api/api-patterns.md | REST endpoint conventions |
|
|
343
|
+
| Data & Database | .codemie/guides/data/database-patterns.md | PostgreSQL and SQLAlchemy patterns |
|
|
344
|
+
| Testing | .codemie/guides/testing/testing-patterns.md | Pytest patterns and fixtures |
|
|
345
|
+
| Development Practices | .codemie/guides/development/error-handling.md | Exception handling patterns |
|
|
346
|
+
| Development Practices | .codemie/guides/development/logging.md | Logging configuration |
|
|
347
|
+
| Development Practices | .codemie/guides/development/react-components.md | UI component patterns |
|
|
348
|
+
| Security | .codemie/guides/security/security-patterns.md | JWT auth and validation |
|
|
425
349
|
```
|
|
426
350
|
|
|
427
|
-
**4.
|
|
351
|
+
**4.2.4: Task Classifier**
|
|
428
352
|
|
|
429
|
-
|
|
353
|
+
Create intent-based category mapping (ONLY for categories that have guides):
|
|
430
354
|
|
|
431
|
-
**Error Handling Quick Ref**:
|
|
432
355
|
```markdown
|
|
433
|
-
|
|
|
434
|
-
|
|
435
|
-
|
|
|
436
|
-
|
|
|
356
|
+
| Category | User Intent / Purpose | Example Requests | P0 Guide | P1 Guide |
|
|
357
|
+
|----------|----------------------|------------------|----------|----------|
|
|
358
|
+
| **Architecture** | System structure, design decisions, planning features | "How should I structure?", "Where should this go?" | .codemie/guides/architecture/architecture.md | - |
|
|
359
|
+
| **API Development** | Creating/modifying endpoints, routing, validation | "Create endpoint", "Add API for..." | .codemie/guides/api/api-patterns.md | - |
|
|
360
|
+
| **Data & Database** | Database operations, queries, models, migrations | "Query database", "Add new table" | .codemie/guides/data/database-patterns.md | - |
|
|
361
|
+
| **Testing** | Writing tests, fixing tests, coverage, mocking | "Write tests for...", "Fix failing test" | .codemie/guides/testing/testing-patterns.md | - |
|
|
362
|
+
| **Development Practices** | Code quality, error handling, logging, components | "Add error handling", "Create component" | .codemie/guides/development/error-handling.md | .codemie/guides/development/react-components.md |
|
|
363
|
+
| **Security** | Authentication, authorization, input validation | "Secure endpoint", "Add auth" | .codemie/guides/security/security-patterns.md | - |
|
|
437
364
|
```
|
|
438
365
|
|
|
439
|
-
**
|
|
440
|
-
```markdown
|
|
441
|
-
| ✅ DO | ❌ DON'T | Why | Related |
|
|
442
|
-
|-------|----------|-----|---------|
|
|
443
|
-
| [Project-specific best practice] | [Anti-pattern] | [Reason] | [Guide] |
|
|
444
|
-
```
|
|
366
|
+
**Note**: Exclude categories that don't have guides (e.g., if no Integrations guides, don't include Integrations row)
|
|
445
367
|
|
|
446
|
-
**4.
|
|
368
|
+
**4.2.5: Commands**
|
|
369
|
+
- Extract from package.json scripts, Makefile, pyproject.toml, etc.
|
|
370
|
+
- Include setup, run, lint, format, test, build
|
|
447
371
|
|
|
448
|
-
|
|
372
|
+
**4.2.6: Project Context**
|
|
373
|
+
- Technology stack table
|
|
374
|
+
- Project structure diagram
|
|
375
|
+
- Key integrations (if any)
|
|
449
376
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
| **Setup** | npm install | First time setup |
|
|
454
|
-
| **Run Server** | npm run dev | Dev server (port 3000) |
|
|
455
|
-
| **Lint** | npm run lint | ESLint check |
|
|
456
|
-
| **Format** | npm run format | Prettier format |
|
|
457
|
-
| **Test** ⚠️ | npm test | ONLY if user requests |
|
|
458
|
-
```
|
|
377
|
+
**4.2.7: Troubleshooting**
|
|
378
|
+
- Common issues from README/CONTRIBUTING
|
|
379
|
+
- Environment setup problems
|
|
459
380
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
Based on common issues found in README or CONTRIBUTING:
|
|
463
|
-
|
|
464
|
-
```markdown
|
|
465
|
-
| Symptom | Likely Cause | Fix | Prevention |
|
|
466
|
-
|---------|--------------|-----|------------|
|
|
467
|
-
| [Common error] | [Root cause] | [Solution] | [Prevention] |
|
|
468
|
-
```
|
|
381
|
+
---
|
|
469
382
|
|
|
470
|
-
|
|
383
|
+
#### Step 4.3: Handle Existing CLAUDE.md
|
|
471
384
|
|
|
472
|
-
**
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
| Database | PostgreSQL | 15+ | Primary DB |
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
**Core Components**:
|
|
482
|
-
```markdown
|
|
483
|
-
| Component | Path | Purpose | Guide |
|
|
484
|
-
|-----------|------|---------|-------|
|
|
485
|
-
| API | src/api/ | FastAPI routers | .codemie/guides/api/api-patterns.md |
|
|
486
|
-
| Services | src/services/ | Business logic | .codemie/guides/architecture/layered-architecture.md |
|
|
487
|
-
```
|
|
385
|
+
**If CLAUDE.md already exists**:
|
|
386
|
+
1. Compare existing vs generated
|
|
387
|
+
2. Preserve user customizations (custom rules, notes)
|
|
388
|
+
3. Update outdated sections (commands, guides list)
|
|
389
|
+
4. Add new guides to imports
|
|
390
|
+
5. Merge, don't overwrite
|
|
488
391
|
|
|
489
392
|
---
|
|
490
393
|
|
|
491
|
-
#### Step 4.
|
|
492
|
-
|
|
493
|
-
**Actions**:
|
|
494
|
-
```bash
|
|
495
|
-
# Write completed CLAUDE.md
|
|
496
|
-
- Save to ./CLAUDE.md (project root)
|
|
497
|
-
```
|
|
394
|
+
#### Step 4.4: Write CLAUDE.md
|
|
498
395
|
|
|
499
|
-
|
|
500
|
-
-
|
|
501
|
-
-
|
|
502
|
-
- [ ] Commands are tested
|
|
503
|
-
- [ ] Task classifier is populated
|
|
504
|
-
- [ ] Quick references are filled
|
|
505
|
-
- [ ] Project context is complete
|
|
506
|
-
- [ ] No "FILL IN" or "[PLACEHOLDER]" remains
|
|
507
|
-
- [ ] All internal links work
|
|
396
|
+
- Save to `./CLAUDE.md` (project root)
|
|
397
|
+
- Validate size (200-300 lines)
|
|
398
|
+
- Verify no placeholders remain
|
|
508
399
|
|
|
509
400
|
---
|
|
510
401
|
|
|
511
|
-
### Phase 5: Validation
|
|
402
|
+
### Phase 5: Validation
|
|
512
403
|
|
|
513
|
-
#### Step 5.1: Verify
|
|
404
|
+
#### Step 5.1: Verify All References
|
|
514
405
|
|
|
515
|
-
**
|
|
406
|
+
**Check**:
|
|
407
|
+
- [ ] Every guide path in CLAUDE.md exists
|
|
408
|
+
- [ ] All file:line references in guides are valid
|
|
409
|
+
- [ ] Commands are accurate (match package.json/Makefile)
|
|
410
|
+
- [ ] No `[PLACEHOLDER]` or `FILL IN` text remains
|
|
411
|
+
- [ ] Task Classifier only includes categories with actual guides
|
|
516
412
|
|
|
517
|
-
|
|
518
|
-
```bash
|
|
519
|
-
# Verify all referenced guides exist
|
|
520
|
-
- Check that each guide in CLAUDE.md actually exists
|
|
521
|
-
- Verify correct paths
|
|
522
|
-
```
|
|
413
|
+
---
|
|
523
414
|
|
|
524
|
-
|
|
525
|
-
```bash
|
|
526
|
-
# Check internal links
|
|
527
|
-
- All guide references in CLAUDE.md point to existing files
|
|
528
|
-
- All cross-references between guides are valid
|
|
529
|
-
```
|
|
415
|
+
#### Step 5.2: Validate Sizes
|
|
530
416
|
|
|
531
|
-
**5.1.3: Test Commands**
|
|
532
417
|
```bash
|
|
533
|
-
#
|
|
534
|
-
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
418
|
+
# CLAUDE.md
|
|
419
|
+
wc -l CLAUDE.md # Should be 200-300
|
|
420
|
+
|
|
421
|
+
# Each guide
|
|
422
|
+
for guide in .codemie/guides/**/*.md; do
|
|
423
|
+
lines=$(wc -l < "$guide")
|
|
424
|
+
if [ $lines -gt 400 ]; then
|
|
425
|
+
echo "⚠️ $guide exceeds 400 lines ($lines)"
|
|
426
|
+
fi
|
|
427
|
+
done
|
|
538
428
|
```
|
|
539
429
|
|
|
540
|
-
**5.1.4: Review Content Quality**
|
|
541
|
-
- [ ] Code examples are real (not placeholders)
|
|
542
|
-
- [ ] File paths include line numbers
|
|
543
|
-
- [ ] Patterns are project-specific
|
|
544
|
-
- [ ] No generic placeholders remain
|
|
545
|
-
- [ ] Guides follow AI-first writing principles (pattern-first, examples, structured)
|
|
546
|
-
|
|
547
430
|
---
|
|
548
431
|
|
|
549
|
-
#### Step 5.
|
|
432
|
+
#### Step 5.3: Generate Summary Report
|
|
550
433
|
|
|
551
|
-
**Task**: Create a summary of what was generated
|
|
552
|
-
|
|
553
|
-
**Report Structure**:
|
|
554
434
|
```markdown
|
|
555
|
-
#
|
|
435
|
+
# Codemie Init Complete
|
|
556
436
|
|
|
557
|
-
## Generated Files
|
|
437
|
+
## Generated/Updated Files
|
|
558
438
|
|
|
559
|
-
|
|
560
|
-
- ✅ CLAUDE.md (root directory)
|
|
439
|
+
**Main**: CLAUDE.md ✅
|
|
561
440
|
|
|
562
|
-
|
|
441
|
+
## Guides by Category
|
|
563
442
|
|
|
564
|
-
**
|
|
565
|
-
- ✅ .codemie/guides/
|
|
566
|
-
- ✅ .codemie/guides/development/logging-patterns.md
|
|
567
|
-
- ✅ .codemie/guides/development/security-patterns.md
|
|
568
|
-
- ✅ .codemie/guides/development/setup-guide.md
|
|
443
|
+
**Architecture** (1 guide):
|
|
444
|
+
- ✅ .codemie/guides/architecture/architecture.md
|
|
569
445
|
|
|
570
|
-
**API** (
|
|
446
|
+
**API Development** (1 guide):
|
|
571
447
|
- ✅ .codemie/guides/api/api-patterns.md
|
|
572
448
|
|
|
573
|
-
**
|
|
574
|
-
- ✅ .codemie/guides/
|
|
575
|
-
|
|
576
|
-
**Data** ([X] guides):
|
|
577
|
-
- ✅ .codemie/guides/data/database-patterns.md
|
|
449
|
+
**Data & Database** (1 guide):
|
|
450
|
+
- ✅ .codemie/guides/data/data-patterns.md
|
|
578
451
|
|
|
579
|
-
**Testing** (
|
|
580
|
-
- ✅ .codemie/guides/testing/testing-patterns.md
|
|
452
|
+
**Testing** (2 guides):
|
|
453
|
+
- ✅ .codemie/guides/testing/testing-patterns.md (created)
|
|
454
|
+
- ✅ .codemie/guides/testing/integration-testing.md (existing, kept)
|
|
581
455
|
|
|
582
|
-
**
|
|
583
|
-
- ✅ .codemie/guides/
|
|
584
|
-
- ✅ .codemie/guides/
|
|
456
|
+
**Development Practices** (3 guides):
|
|
457
|
+
- ✅ .codemie/guides/development/development-practices.md
|
|
458
|
+
- ✅ .codemie/guides/development/frontend-patterns.md
|
|
459
|
+
- ✅ .codemie/guides/development/react-components.md
|
|
585
460
|
|
|
586
|
-
|
|
461
|
+
**Security** (1 guide):
|
|
462
|
+
- ✅ .codemie/guides/security/security-patterns.md
|
|
587
463
|
|
|
588
|
-
**
|
|
589
|
-
-
|
|
590
|
-
-
|
|
591
|
-
- Database: [Database]
|
|
592
|
-
- Testing: [Test Framework]
|
|
593
|
-
- Build Tool: [Build Tool]
|
|
464
|
+
**Categories Skipped**:
|
|
465
|
+
- ⏭️ Integrations - No external services detected
|
|
466
|
+
- ⏭️ Workflows - No workflow patterns detected
|
|
594
467
|
|
|
595
|
-
|
|
596
|
-
- [Pattern 1]
|
|
597
|
-
- [Pattern 2]
|
|
598
|
-
- [Pattern 3]
|
|
468
|
+
## Project Summary
|
|
599
469
|
|
|
600
|
-
|
|
601
|
-
|
|
470
|
+
| Component | Value |
|
|
471
|
+
|-----------|-------|
|
|
472
|
+
| Language | [Language] [Version] |
|
|
473
|
+
| Framework | [Framework] [Version] |
|
|
474
|
+
| Database | [Database or "None"] |
|
|
475
|
+
| Testing | [Framework] |
|
|
602
476
|
|
|
603
477
|
## Next Steps
|
|
604
478
|
|
|
605
|
-
1. Review generated documentation
|
|
606
|
-
2.
|
|
607
|
-
3.
|
|
608
|
-
4. Update guides as project evolves
|
|
609
|
-
|
|
610
|
-
## How to Use
|
|
611
|
-
|
|
612
|
-
Claude Code will now:
|
|
613
|
-
1. Check guides first before searching codebase
|
|
614
|
-
2. Use documented patterns consistently
|
|
615
|
-
3. Follow project-specific workflows
|
|
616
|
-
4. Reference actual code examples from your project
|
|
617
|
-
|
|
618
|
-
Try asking Claude Code to:
|
|
619
|
-
- "Add a new API endpoint following project patterns"
|
|
620
|
-
- "Fix error handling in [file]"
|
|
621
|
-
- "Write tests for [component]"
|
|
479
|
+
1. Review generated documentation
|
|
480
|
+
2. Test by asking Claude Code to perform a task
|
|
481
|
+
3. Customize any sections needing refinement
|
|
622
482
|
```
|
|
623
483
|
|
|
624
484
|
---
|
|
625
485
|
|
|
626
|
-
## Decision Gates
|
|
627
|
-
|
|
628
|
-
### Gate 1: After Project Discovery (Step 1.3)
|
|
629
|
-
**Question**: Do I understand the tech stack and architecture?
|
|
630
|
-
- ✅ 80%+ confidence → Continue
|
|
631
|
-
- ❌ < 80% confidence → Ask user for clarification
|
|
632
|
-
|
|
633
|
-
### Gate 2: After Template Selection (Step 2.2)
|
|
634
|
-
**Question**: Have I identified the right guides to generate?
|
|
635
|
-
- ✅ YES → Present list to user for confirmation
|
|
636
|
-
- ❌ UNCERTAIN → Ask user which patterns/areas are important
|
|
486
|
+
## Decision Gates
|
|
637
487
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
- ❌ NO → Continue filling sections
|
|
647
|
-
|
|
648
|
-
### Gate 5: After Validation (Step 5.1)
|
|
649
|
-
**Question**: Do all links work and commands run?
|
|
650
|
-
- ✅ YES → Generate summary report and finish
|
|
651
|
-
- ❌ NO → Fix issues and re-validate
|
|
488
|
+
| Gate | After Step | Question | If NO |
|
|
489
|
+
|------|------------|----------|-------|
|
|
490
|
+
| 1 | 1.2 | Tech stack identified (80%+ confidence)? | Ask user |
|
|
491
|
+
| 2 | 1.3 | Categories correctly identified? | Verify with user |
|
|
492
|
+
| 3 | 2.3 | User confirmed guide list? | Adjust list |
|
|
493
|
+
| 4 | 3.2.4 | Guide within size limit? | Condense |
|
|
494
|
+
| 5 | 4.4 | CLAUDE.md complete, no placeholders? | Fix issues |
|
|
495
|
+
| 6 | 5.1 | All references valid? | Fix broken refs |
|
|
652
496
|
|
|
653
497
|
---
|
|
654
498
|
|
|
655
499
|
## Troubleshooting
|
|
656
500
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
### Issue: No Code Examples Found for Pattern
|
|
666
|
-
|
|
667
|
-
**Symptoms**: Template sections can't be filled with real code
|
|
668
|
-
**Action**:
|
|
669
|
-
1. Check if pattern actually exists in project
|
|
670
|
-
2. If not, ask user if they want this guide (might be aspirational)
|
|
671
|
-
3. If yes but code not found, create guide with TODO for user to fill
|
|
672
|
-
|
|
673
|
-
### Issue: Multiple Frameworks/Patterns Detected
|
|
674
|
-
|
|
675
|
-
**Symptoms**: Mixed patterns (e.g., both REST and GraphQL)
|
|
676
|
-
**Action**:
|
|
677
|
-
1. Ask user which is primary
|
|
678
|
-
2. Document both if both are important
|
|
679
|
-
3. Create separate guides for each pattern
|
|
680
|
-
|
|
681
|
-
### Issue: Documentation Takes Too Long
|
|
682
|
-
|
|
683
|
-
**Symptoms**: Many guides, large codebase
|
|
684
|
-
**Action**:
|
|
685
|
-
1. Start with P0 guides only
|
|
686
|
-
2. Generate P1 guides in follow-up
|
|
687
|
-
3. Focus on most-used patterns first
|
|
501
|
+
| Issue | Action |
|
|
502
|
+
|-------|--------|
|
|
503
|
+
| Can't identify architecture | Ask user; offer common patterns as options |
|
|
504
|
+
| No code examples for pattern | Verify pattern exists; skip guide if not |
|
|
505
|
+
| Multiple frameworks detected | Ask user which is primary; document both if needed |
|
|
506
|
+
| Existing guide conflicts with template | Preserve existing customizations; update only outdated parts |
|
|
507
|
+
| Guide exceeds 400 lines | Remove redundant examples; use tables; add file:line refs |
|
|
508
|
+
| Category detected but minimal code | Create minimal guide or ask user if needed |
|
|
688
509
|
|
|
689
510
|
---
|
|
690
511
|
|
|
691
512
|
## Success Criteria
|
|
692
513
|
|
|
693
|
-
|
|
694
|
-
- ✅
|
|
695
|
-
- ✅ All
|
|
696
|
-
- ✅
|
|
697
|
-
- ✅
|
|
698
|
-
- ✅ All
|
|
699
|
-
- ✅ All
|
|
700
|
-
- ✅
|
|
701
|
-
- ✅ No
|
|
702
|
-
- ✅ User
|
|
703
|
-
|
|
704
|
-
---
|
|
705
|
-
|
|
706
|
-
## Example Invocation
|
|
707
|
-
|
|
708
|
-
**User**: "Generate project documentation for my FastAPI project"
|
|
709
|
-
|
|
710
|
-
**Claude Code**:
|
|
711
|
-
1. Analyzes project structure (finds FastAPI, PostgreSQL, pytest)
|
|
712
|
-
2. Identifies patterns (layered architecture, REST API, SQLAlchemy)
|
|
713
|
-
3. Selects templates (API, architecture, database, testing, etc.)
|
|
714
|
-
4. Generates 8 guides with real code examples
|
|
715
|
-
5. Creates CLAUDE.md with project-specific content
|
|
716
|
-
6. Validates all links and commands
|
|
717
|
-
7. Presents summary report
|
|
718
|
-
|
|
719
|
-
**Result**: Complete, project-specific Claude Code documentation ready to use
|
|
720
|
-
|
|
721
|
-
---
|
|
722
|
-
|
|
723
|
-
## Notes
|
|
724
|
-
|
|
725
|
-
- **Time Estimate**: 10-30 minutes depending on project size and complexity
|
|
726
|
-
- **Token Usage**: High - lots of reading and writing
|
|
727
|
-
- **User Interaction**: 2-3 confirmation points for guide selection
|
|
728
|
-
- **Customization**: Output should be 80% ready, 20% may need user refinement
|
|
729
|
-
- **Maintenance**: Documentation should be updated as project evolves
|
|
730
|
-
|
|
731
|
-
---
|
|
514
|
+
- ✅ CLAUDE.md exists (200-300 lines)
|
|
515
|
+
- ✅ Only relevant guides created (categories with actual code patterns)
|
|
516
|
+
- ✅ All guides within 200-400 lines
|
|
517
|
+
- ✅ Existing guides integrated
|
|
518
|
+
- ✅ Task Classifier matches generated guides
|
|
519
|
+
- ✅ All code examples from actual codebase
|
|
520
|
+
- ✅ All file paths accurate
|
|
521
|
+
- ✅ All commands verified
|
|
522
|
+
- ✅ No placeholder text remains
|
|
523
|
+
- ✅ User confirmed accuracy
|