@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.
Files changed (180) hide show
  1. package/README.md +73 -7
  2. package/bin/codemie-opencode.js +11 -0
  3. package/dist/agents/codemie-code/agent.d.ts +17 -1
  4. package/dist/agents/codemie-code/agent.d.ts.map +1 -1
  5. package/dist/agents/codemie-code/agent.js +62 -3
  6. package/dist/agents/codemie-code/agent.js.map +1 -1
  7. package/dist/agents/codemie-code/index.d.ts +1 -0
  8. package/dist/agents/codemie-code/index.d.ts.map +1 -1
  9. package/dist/agents/codemie-code/index.js +28 -2
  10. package/dist/agents/codemie-code/index.js.map +1 -1
  11. package/dist/agents/codemie-code/prompts.d.ts +12 -3
  12. package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
  13. package/dist/agents/codemie-code/prompts.js +25 -5
  14. package/dist/agents/codemie-code/prompts.js.map +1 -1
  15. package/dist/agents/codemie-code/types.d.ts +3 -0
  16. package/dist/agents/codemie-code/types.d.ts.map +1 -1
  17. package/dist/agents/codemie-code/types.js.map +1 -1
  18. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  19. package/dist/agents/core/AgentCLI.js +3 -1
  20. package/dist/agents/core/AgentCLI.js.map +1 -1
  21. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  22. package/dist/agents/core/BaseAgentAdapter.js +33 -0
  23. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  24. package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
  25. package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
  26. package/dist/agents/core/session/discovery-types.d.ts +53 -0
  27. package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
  28. package/dist/agents/core/session/discovery-types.js +8 -0
  29. package/dist/agents/core/session/discovery-types.js.map +1 -0
  30. package/dist/agents/core/types.d.ts +45 -0
  31. package/dist/agents/core/types.d.ts.map +1 -1
  32. package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
  33. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  34. package/dist/agents/plugins/claude/claude.plugin.js +214 -0
  35. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  36. package/dist/agents/plugins/claude/plugin/README.md +40 -2
  37. package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
  38. package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
  39. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
  40. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
  41. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
  42. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
  43. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
  44. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
  45. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
  46. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
  47. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
  48. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
  49. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
  50. package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
  51. package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
  52. package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +232 -503
  53. package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
  54. package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
  55. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  56. package/dist/agents/plugins/gemini/gemini.plugin.js +0 -3
  57. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  58. package/dist/agents/plugins/opencode/index.d.ts +8 -0
  59. package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
  60. package/dist/agents/plugins/opencode/index.js +12 -0
  61. package/dist/agents/plugins/opencode/index.js.map +1 -0
  62. package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
  63. package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
  64. package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
  65. package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
  66. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
  67. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
  68. package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
  69. package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
  70. package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
  71. package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
  72. package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
  73. package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
  74. package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
  75. package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
  76. package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
  77. package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
  78. package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
  79. package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
  80. package/dist/agents/plugins/opencode/opencode.session.js +424 -0
  81. package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
  82. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
  83. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
  84. package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
  85. package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
  86. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
  87. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
  88. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
  89. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
  90. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
  91. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
  92. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
  93. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
  94. package/dist/agents/registry.d.ts.map +1 -1
  95. package/dist/agents/registry.js +2 -0
  96. package/dist/agents/registry.js.map +1 -1
  97. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
  98. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
  99. package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
  100. package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
  101. package/dist/cli/commands/install.d.ts.map +1 -1
  102. package/dist/cli/commands/install.js +86 -7
  103. package/dist/cli/commands/install.js.map +1 -1
  104. package/dist/cli/commands/opencode-metrics.d.ts +13 -0
  105. package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
  106. package/dist/cli/commands/opencode-metrics.js +200 -0
  107. package/dist/cli/commands/opencode-metrics.js.map +1 -0
  108. package/dist/cli/commands/setup.d.ts.map +1 -1
  109. package/dist/cli/commands/setup.js +113 -0
  110. package/dist/cli/commands/setup.js.map +1 -1
  111. package/dist/cli/commands/skill.d.ts +6 -0
  112. package/dist/cli/commands/skill.d.ts.map +1 -0
  113. package/dist/cli/commands/skill.js +196 -0
  114. package/dist/cli/commands/skill.js.map +1 -0
  115. package/dist/cli/commands/update.d.ts.map +1 -1
  116. package/dist/cli/commands/update.js +34 -6
  117. package/dist/cli/commands/update.js.map +1 -1
  118. package/dist/cli/index.js +4 -0
  119. package/dist/cli/index.js.map +1 -1
  120. package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
  121. package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
  122. package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
  123. package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
  124. package/dist/migrations/index.d.ts +1 -0
  125. package/dist/migrations/index.d.ts.map +1 -1
  126. package/dist/migrations/index.js +1 -1
  127. package/dist/migrations/index.js.map +1 -1
  128. package/dist/providers/plugins/sso/sso.http-client.js +2 -2
  129. package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
  130. package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
  131. package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
  132. package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
  133. package/dist/skills/core/SkillDiscovery.d.ts +83 -0
  134. package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
  135. package/dist/skills/core/SkillDiscovery.js +237 -0
  136. package/dist/skills/core/SkillDiscovery.js.map +1 -0
  137. package/dist/skills/core/SkillManager.d.ts +86 -0
  138. package/dist/skills/core/SkillManager.d.ts.map +1 -0
  139. package/dist/skills/core/SkillManager.js +155 -0
  140. package/dist/skills/core/SkillManager.js.map +1 -0
  141. package/dist/skills/core/types.d.ts +120 -0
  142. package/dist/skills/core/types.d.ts.map +1 -0
  143. package/dist/skills/core/types.js +20 -0
  144. package/dist/skills/core/types.js.map +1 -0
  145. package/dist/skills/index.d.ts +12 -0
  146. package/dist/skills/index.d.ts.map +1 -0
  147. package/dist/skills/index.js +12 -0
  148. package/dist/skills/index.js.map +1 -0
  149. package/dist/skills/utils/content-loader.d.ts +25 -0
  150. package/dist/skills/utils/content-loader.d.ts.map +1 -0
  151. package/dist/skills/utils/content-loader.js +161 -0
  152. package/dist/skills/utils/content-loader.js.map +1 -0
  153. package/dist/skills/utils/frontmatter.d.ts +60 -0
  154. package/dist/skills/utils/frontmatter.d.ts.map +1 -0
  155. package/dist/skills/utils/frontmatter.js +114 -0
  156. package/dist/skills/utils/frontmatter.js.map +1 -0
  157. package/dist/skills/utils/pattern-matcher.d.ts +60 -0
  158. package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
  159. package/dist/skills/utils/pattern-matcher.js +97 -0
  160. package/dist/skills/utils/pattern-matcher.js.map +1 -0
  161. package/dist/utils/installation-detector.d.ts +22 -0
  162. package/dist/utils/installation-detector.d.ts.map +1 -0
  163. package/dist/utils/installation-detector.js +49 -0
  164. package/dist/utils/installation-detector.js.map +1 -0
  165. package/dist/utils/native-installer.d.ts +49 -0
  166. package/dist/utils/native-installer.d.ts.map +1 -0
  167. package/dist/utils/native-installer.js +194 -0
  168. package/dist/utils/native-installer.js.map +1 -0
  169. package/dist/utils/version-utils.d.ts +50 -0
  170. package/dist/utils/version-utils.d.ts.map +1 -0
  171. package/dist/utils/version-utils.js +92 -0
  172. package/dist/utils/version-utils.js.map +1 -0
  173. package/package.json +5 -2
  174. package/scripts/copy-mr-skill-to-global.ts +252 -0
  175. package/scripts/demo-hooks.sh +125 -0
  176. package/scripts/test-hooks.sh +196 -0
  177. package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
  178. package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
  179. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
  180. 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 Codeie documentation for any project - analyze structure and generate AI-optimized guides
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
- This command analyzes any software project and generates AI-optimized documentation for Claude Code, including:
13
- - Main CLAUDE.md file with project-specific patterns and workflows
14
- - Detailed guides for relevant architectural patterns and practices
15
- - Properly structured .codemie/guides/ directory with categorized documentation
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
- - [ ] You have read access to the codebase
24
- - [ ] Codemie templates are available at `.codemie/claude-templates/templates/`
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 SIZE LIMITS
29
+ ## 🚨 CRITICAL RULES
31
30
 
32
- **MANDATORY**: Each generated guide must be **200-400 lines maximum**.
31
+ ### Size Limits (MANDATORY)
32
+ - **CLAUDE.md**: 200-300 lines maximum
33
+ - **Each guide**: 200-400 lines maximum
33
34
 
34
- ### Enforcement Strategy
35
-
36
- **During Generation**:
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 (not multiple variations)
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
- **Validation**:
48
- After generating each guide, count lines:
49
- ```bash
50
- wc -l .codemie/guides/[category]/[guide].md
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: Project Discovery & Analysis
55
+ ### Phase 1: Discovery & Analysis
59
56
 
60
- #### Step 1.1: Analyze Project Structure
57
+ #### Step 1.1: Check Existing Documentation
61
58
 
62
- **Task**: Discover project organization, tech stack, and patterns
59
+ **Task**: Detect existing Codemie documentation
63
60
 
64
61
  **Actions**:
65
- ```bash
66
- # Identify project type and structure
67
- - Check for package.json, requirements.txt, pom.xml, Cargo.toml, etc.
68
- - Identify language(s) and frameworks
69
- - Map directory structure
70
- - Find configuration files
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
- **Output**: Create analysis document with:
74
- - Programming language(s)
75
- - Framework(s) and versions
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
- - Testing frameworks
78
- - Key directories (src/, tests/, config/, etc.)
79
- - Dependency management approach
91
+ - Test framework
92
+ - Key directories
80
93
 
81
- **Confidence Check**: Can you identify the tech stack with 80%+ confidence?
82
- - ✅ YES → Continue to Step 1.2
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.2: Identify Architectural Patterns
100
+ #### Step 1.3: Identify What Actually Exists
88
101
 
89
- **Task**: Detect architectural patterns used in the project
102
+ **Task**: Detect ONLY categories/features that exist in codebase
90
103
 
91
- **Actions**:
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
- **Questions to Answer**:
104
- - What's the main architecture pattern? (MVC, layered, clean architecture, etc.)
105
- - Is there an API layer? What type?
106
- - Is there a service layer?
107
- - Is there a data/repository layer?
108
- - What testing approach is used?
109
- - What external integrations exist?
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 architectural patterns found
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.3: Read Existing Documentation
133
+ #### Step 1.4: Read Existing Project Documentation
116
134
 
117
- **Task**: Check for existing documentation to understand context
135
+ **Task**: Extract context from existing docs
118
136
 
119
- **Actions**:
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 architectural decision records (ADRs)
126
- ```
141
+ - Any ADRs (Architecture Decision Records)
127
142
 
128
143
  **Extract**:
129
144
  - Project purpose
130
- - Setup instructions
131
- - Build/run commands
145
+ - Setup/build/run commands
132
146
  - Testing commands
133
- - Deployment process
134
- - Known patterns or conventions
147
+ - Known conventions
135
148
 
136
149
  ---
137
150
 
138
- ### Phase 2: Template Selection & Customization
151
+ ### Phase 2: Determine Required Guides
139
152
 
140
- #### Step 2.1: Load Reference Templates
153
+ #### Step 2.1: Map Categories to Guides
141
154
 
142
- **Task**: Load the main CLAUDE.md template and understand its structure
155
+ **Task**: Based on Step 1.3, determine which guides to create per category
143
156
 
144
- **Actions**:
145
- ```bash
146
- # Read template
147
- - .codemie/claude-templates/templates/CLAUDE.md.template
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
- **Understand**:
151
- - What sections need to be filled
152
- - What placeholders exist ([PROJECT_NAME], [LANGUAGE], etc.)
153
- - Which sections are universal vs project-specific
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: Identify Required Guides
190
+ #### Step 2.2: Merge with Existing Guides
191
+
192
+ **Task**: Combine new guides with any existing ones
158
193
 
159
- **Task**: Based on Phase 1 analysis, determine which guide templates are relevant
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
- **Decision Matrix**:
202
+ ---
162
203
 
163
- | Found Pattern/Feature | Required Guides | Priority |
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
- **Output**: List of guide templates to use with priorities
206
+ **Present to user**:
181
207
 
182
- **User Confirmation**: Present the list and ask:
183
208
  ```
184
- I've identified the following guides to create for your project:
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
- Required (P0):
187
- - [List P0 guides]
216
+ 📁 API Development
217
+ - To create: api-patterns.md (REST conventions found in src/api/)
188
218
 
189
- Optional (P1):
190
- - [List P1 guides]
219
+ 📁 Data & Database
220
+ - To create: database-patterns.md (PostgreSQL + SQLAlchemy patterns)
191
221
 
192
- Would you like me to:
193
- 1. Generate all required and optional guides
194
- 2. Generate only required guides
195
- 3. Customize this list
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: Guide Generation
242
+ ### Phase 3: Generate Guides
201
243
 
202
- #### Step 3.1: Create Base Directory
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 (Iterative)
254
+ #### Step 3.2: Generate Each Guide
217
255
 
218
- **For Each Selected Guide Template**:
256
+ **For each guide in approved list**:
219
257
 
220
- **Step 3.2.1: Load Template**
221
- ```bash
222
- # Load guide template
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
- **Step 3.2.2: Analyze Project for Guide-Specific Patterns**
227
-
228
- **Actions**: Use Glob, Grep, and Read to find relevant code examples
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
- **Step 3.2.4: Write Guide File**
267
+ **3.2.3: Populate Template**
307
268
 
308
- **Actions**:
309
- ```bash
310
- # Create category directory if it doesn't exist
311
- mkdir -p .codemie/guides/[category]
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
- # Write completed guide
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
- echo "⚠️ WARNING: Guide is $LINE_COUNT lines (limit: 400)"
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
- **Validation Checklist**:
331
- - [ ] **Guide is 200-400 lines** (MANDATORY)
332
- - [ ] All placeholders replaced
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
- **Use TodoWrite** to track guide creation:
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
- Mark each as in_progress when working on it, completed when done.
368
-
369
- ---
297
+ API Development:
298
+ - [ ] api/api-patterns.md
370
299
 
371
- ### Phase 4: Generate Main CLAUDE.md
300
+ Data & Database:
301
+ - [ ] data/database-patterns.md
372
302
 
373
- #### Step 4.1: Load and Customize CLAUDE.md Template
303
+ Testing:
304
+ - [ ] testing/testing-patterns.md
374
305
 
375
- **Task**: Create the main CLAUDE.md file with project-specific content
306
+ Development Practices:
307
+ - [ ] development/error-handling.md
308
+ - [ ] development/logging.md
309
+ - [ ] development/react-components.md
376
310
 
377
- **Actions**:
378
-
379
- **4.1.1: Replace Basic Placeholders**
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
- **4.1.2: Fill Guide References Section**
315
+ ---
387
316
 
388
- Based on generated guides, populate the "Guide References by Category" section:
317
+ ### Phase 4: Generate CLAUDE.md
389
318
 
390
- ```markdown
391
- **API Development**:
392
- - API patterns: .codemie/guides/api/api-patterns.md
319
+ #### Step 4.1: Load Template
393
320
 
394
- **Architecture**:
395
- - Layered architecture: .codemie/guides/architecture/layered-architecture.md
321
+ - Read `.codemie/claude-templates/templates/CLAUDE.md.template`
396
322
 
397
- **Data & Database**:
398
- - Database patterns: .codemie/guides/data/database-patterns.md
323
+ ---
399
324
 
400
- **Development Practices**:
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
- **Standards**:
407
- - Code quality: .codemie/guides/standards/code-quality.md
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
- **Testing**:
411
- - Testing patterns: .codemie/guides/testing/testing-patterns.md
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.1.3: Create Task Classifier Table**
334
+ **4.2.3: Guide Imports Table**
415
335
 
416
- Based on project patterns, create keyword → guide mappings:
336
+ List ALL guides grouped by category:
417
337
 
418
338
  ```markdown
419
- | Keywords | Complexity | Load Guide (P0=Required) | Also Load (P1=Optional) |
420
- |----------|-----------|--------------------------|-------------------------|
421
- | **api, endpoint, router** | Medium | .codemie/guides/api/api-patterns.md | - |
422
- | **test, pytest** | Medium | .codemie/guides/testing/testing-patterns.md | - |
423
- | **database, sql, postgres** | Medium-High | .codemie/guides/data/database-patterns.md | - |
424
- | **error, exception** | Medium | .codemie/guides/development/error-handling.md | .codemie/guides/development/logging-patterns.md |
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.1.4: Fill Pattern Quick Reference**
351
+ **4.2.4: Task Classifier**
428
352
 
429
- Extract key patterns from generated guides and create quick reference tables:
353
+ Create intent-based category mapping (ONLY for categories that have guides):
430
354
 
431
- **Error Handling Quick Ref**:
432
355
  ```markdown
433
- | When | Exception | Import From | Related Patterns |
434
- |------|-----------|-------------|------------------|
435
- | Validation failed | ValidationError | myproject.exceptions | Logging, API Patterns |
436
- | Not found | NotFoundException | myproject.exceptions | API Patterns |
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
- **Logging Quick Ref**:
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.1.5: Fill Development Commands**
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
- Extract from setup guide and project analysis:
372
+ **4.2.6: Project Context**
373
+ - Technology stack table
374
+ - Project structure diagram
375
+ - Key integrations (if any)
449
376
 
450
- ```markdown
451
- | Task | Command | Notes |
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
- **4.1.6: Fill Troubleshooting Section**
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
- **4.1.7: Fill Project Context**
383
+ #### Step 4.3: Handle Existing CLAUDE.md
471
384
 
472
- **Technology Stack**:
473
- ```markdown
474
- | Component | Tool | Version | Purpose |
475
- |-----------|------|---------|---------|
476
- | Language | Python | 3.11+ | Core language |
477
- | Framework | FastAPI | 0.104+ | REST API |
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.2: Write Final CLAUDE.md
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
- **Validation**:
500
- - [ ] All placeholders replaced
501
- - [ ] Guide references are accurate
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 & Finalization
402
+ ### Phase 5: Validation
512
403
 
513
- #### Step 5.1: Verify Documentation
404
+ #### Step 5.1: Verify All References
514
405
 
515
- **Actions**:
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
- **5.1.1: Check File Existence**
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
- **5.1.2: Validate Links**
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
- # Try running documented commands
534
- - Setup command
535
- - Lint command
536
- - Test command (if documented)
537
- - Build command
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.2: Generate Summary Report
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
- # Documentation Generation Complete
435
+ # Codemie Init Complete
556
436
 
557
- ## Generated Files
437
+ ## Generated/Updated Files
558
438
 
559
- ### Main Documentation
560
- - ✅ CLAUDE.md (root directory)
439
+ **Main**: CLAUDE.md ✅
561
440
 
562
- ### Guides Generated ([N] guides)
441
+ ## Guides by Category
563
442
 
564
- **Development** ([X] guides):
565
- - ✅ .codemie/guides/development/error-handling.md
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** ([X] guides):
446
+ **API Development** (1 guide):
571
447
  - ✅ .codemie/guides/api/api-patterns.md
572
448
 
573
- **Architecture** ([X] guides):
574
- - ✅ .codemie/guides/architecture/layered-architecture.md
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** ([X] guides):
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
- **Standards** ([X] guides):
583
- - ✅ .codemie/guides/standards/code-quality.md
584
- - ✅ .codemie/guides/standards/git-workflow.md
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
- ## Project Analysis Summary
461
+ **Security** (1 guide):
462
+ - ✅ .codemie/guides/security/security-patterns.md
587
463
 
588
- **Technology Stack**:
589
- - Language: [Language]
590
- - Framework: [Framework]
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
- **Architecture Patterns Documented**:
596
- - [Pattern 1]
597
- - [Pattern 2]
598
- - [Pattern 3]
468
+ ## Project Summary
599
469
 
600
- **Total Code Examples**: [N] examples from actual codebase
601
- **Total Line References**: [N] file:line references
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 for accuracy
606
- 2. Customize any project-specific sections that need refinement
607
- 3. Test CLAUDE.md by asking Claude Code to perform a task
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 Throughout Process
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
- ### Gate 3: After Each Guide Generation (Step 3.2.4)
639
- **Question**: Is this guide filled with real project content (not placeholders)?
640
- - YES Mark complete, move to next guide
641
- - NO Continue analyzing and filling content
642
-
643
- ### Gate 4: After CLAUDE.md Generation (Step 4.2)
644
- **Question**: Is CLAUDE.md complete and project-specific?
645
- - YES Proceed to validation
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
- ### Issue: Can't Identify Architecture Pattern
658
-
659
- **Symptoms**: Unclear project structure
660
- **Action**:
661
- 1. Ask user: "What architecture pattern does your project use?"
662
- 2. If user unsure, provide options based on directory structure
663
- 3. Offer to create generic layered architecture guide
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
- Documentation generation is complete when:
694
- - ✅ CLAUDE.md exists in project root
695
- - ✅ All referenced guides exist
696
- - ✅ All code examples are from actual project (no placeholders)
697
- - ✅ All file paths are accurate with line numbers
698
- - ✅ All commands are tested and work
699
- - ✅ All internal links are valid
700
- - ✅ Project-specific patterns are documented
701
- - ✅ No "FILL IN" or "[PLACEHOLDER]" text remains
702
- - ✅ User has reviewed and confirmed accuracy
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