Guest User

Untitled

a guest
Jun 12th, 2025
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.98 KB | None | 0 0
  1. # CLAUDE.md
  2.  
  3. ## Development Guidelines
  4.  
  5. If you need clarification please ask. Do not overcomplicate things - try to reduce complexity without reducing functionality and keep the solution concise. Provide honest, balanced feedback without excessive praise or flattery.
  6.  
  7. ### Code Style and Conventions
  8. - Follow existing code patterns and conventions in the codebase
  9. - Use TypeScript for type safety
  10. - Maintain consistent formatting across files
  11. - NO comments unless explicitly requested
  12. - Prefer editing existing files over creating new ones
  13. - Only use emojis if the user explicitly requests it
  14.  
  15. ### Before Making Changes
  16. - First understand the file's existing code conventions
  17. - Check neighboring files for patterns and library usage
  18. - Verify libraries/frameworks are already in use
  19. - Never assume a library is available without checking
  20. - Follow existing import patterns and framework choices
  21.  
  22. ### Task Management Best Practices
  23. - For complex multi-step tasks (3+ steps), use a structured approach
  24. - Break down complex features into manageable subtasks
  25. - Track progress systematically
  26. - Update task status in real-time
  27. - Complete current tasks before starting new ones
  28. - Document implementation details and decisions
  29.  
  30. ### Security and Best Practices
  31. - Never expose or log secrets and keys
  32. - Never commit secrets to the repository
  33. - Follow security best practices
  34. - Maintain clean, idiomatic code
  35. - Ensure all changes result in working code
  36.  
  37. ## Code Documentation Best Practices
  38.  
  39. ### Documentation Structure
  40. When documenting patterns and conventions, follow this format:
  41. ```markdown
  42. ---
  43. description: Clear, one-line description of what the pattern enforces
  44. scope: path/to/files/*.ext, other/path/**/*
  45. priority: boolean
  46. ---
  47.  
  48. - **Main Points in Bold**
  49. - Sub-points with details
  50. - Examples and explanations
  51. ```
  52.  
  53. ### File References
  54. - Use markdown links to reference files
  55. - Example: [package.json](package.json) for code references
  56. - Keep references relative to project root
  57.  
  58. ### Code Examples
  59. Use language-specific code blocks with good/bad examples:
  60. ```typescript
  61. // ✅ DO: Show good examples
  62. const goodExample = true;
  63.  
  64. // ❌ DON'T: Show anti-patterns
  65. const badExample = false;
  66. ```
  67.  
  68. ## Continuous Improvement
  69.  
  70. ### Rule Improvement Triggers
  71. - New code patterns not covered by existing rules
  72. - Pattern appears in 3+ files (consider standardizing)
  73. - Common bugs that could be prevented by a rule
  74. - Code reviews repeatedly mention the same feedback
  75. - New security or performance patterns emerge
  76.  
  77. ### Rule Improvement Process
  78. - Monitor for new code patterns not covered by existing rules
  79. - When a pattern appears in 3+ files, consider standardizing it
  80. - Update rules after major refactors or when better examples emerge
  81. - Track common error patterns that could be prevented
  82. - Document migration paths for deprecated patterns
  83.  
  84. ### Pattern Recognition
  85. - Compare new code with existing patterns
  86. - Identify repeated implementations across files
  87. - Look for consistent error handling approaches
  88. - Monitor test patterns and coverage
  89. - Cross-reference related documentation
  90.  
  91. ### Rule Quality Guidelines
  92. - Rules should be actionable and specific
  93. - Examples should come from actual code
  94. - References should be up to date
  95. - Patterns should be consistently enforced
  96. - Use bullet points for clarity
  97. - Keep descriptions concise
  98. - Include both DO and DON'T examples
  99. - Reference actual code over theoretical examples
  100.  
  101. ### Rule Maintenance
  102. - Add new rules when patterns are used in 3+ files
  103. - Modify rules when better examples exist
  104. - Remove rules that no longer apply
  105. - Mark outdated patterns as deprecated
  106. - Document migration paths for deprecated patterns
  107. - Update references to external docs
  108. - Maintain links between related rules
  109.  
  110. ## Taskmaster Overview
  111.  
  112. ### Primary Interaction Methods
  113.  
  114. Task Master offers two ways to interact:
  115.  
  116. 1. **MCP Server (Recommended for Integrated Tools)**:
  117. - Preferred method for AI agents and IDEs like Claude Code
  118. - Better performance, structured data exchange, and error handling
  119. - Exposed through MCP tools (e.g., `get_tasks`, `add_subtask`)
  120. - **Restart the MCP server** if core logic in `scripts/modules` or MCP tool definitions change
  121.  
  122. 2. **`task-master` CLI (For Users & Fallback)**:
  123. - User-friendly interface for direct terminal interaction
  124. - Fallback if MCP server is inaccessible
  125. - Install globally: `npm install -g task-master-ai`
  126. - Use locally: `npx task-master-ai ...`
  127.  
  128. ### Configuration Management
  129.  
  130. 1. **`.taskmaster/config.json` File (Primary)**:
  131. - Stores AI model selections, parameters, logging level, project settings
  132. - **Managed via `task-master models --setup` command**
  133. - **View/Set models via `task-master models` or `models` MCP tool**
  134. - DO NOT edit manually unless necessary
  135.  
  136. 2. **Environment Variables (`.env` / `mcp.json`)**:
  137. - Used **only** for sensitive API keys and endpoint URLs
  138. - Place API keys in `.env` file (project root) for CLI usage
  139. - For MCP integration, configure keys in the MCP configuration's `env` section
  140. - Available keys: `ANTHROPIC_API_KEY`, `PERPLEXITY_API_KEY`, `OPENAI_API_KEY`, etc.
  141.  
  142. **Important**: If AI commands fail in MCP, verify API key exists in your MCP configuration. If failing in CLI, check `.env` file.
  143.  
  144. ## Taskmaster Development Workflow
  145.  
  146. ### Standard Development Process
  147.  
  148. 1. (not needed as it will be likely done by user) **Initialize Project**: Run `initialize_project` / `task-master init`
  149. 2. (not needed as it will be likely done by user) **Parse PRD**: Use `parse_prd` / `task-master parse-prd --input='<prd-file.txt>'` to generate initial tasks
  150. 3. **Review Tasks**: Start with `get_tasks` / `task-master list` to see current status
  151. 4. **Find Next Task**: Use `next_task` / `task-master next` to identify what to work on
  152. 5. **Analyze Complexity**: Run `analyze_project_complexity` / `task-master analyze-complexity --research`
  153. 6. **Review Report**: Check with `complexity_report` / `task-master complexity-report`
  154. 7. **Expand Tasks**: Break down complex tasks with `expand_task` / `task-master expand --id=<id> --force --research`
  155. 8. **Implement**: Code following task details and project standards
  156. 9. **Update Status**: Mark completed with `set_task_status` / `task-master set-status --id=<id> --status=done`
  157. 10. **Update Dependencies**: When implementation differs, use `update` / `task-master update --from=<id> --prompt="..."`
  158. 11. **Add New Tasks**: For discovered work, use `add_task` / `task-master add-task --prompt="..." --research`
  159. 12. **Generate Files**: Run `generate` / `task-master generate` after updating tasks.json
  160.  
  161. ### Task Status Management
  162. - `pending`: Tasks ready to be worked on
  163. - `in-progress`: Currently being worked on
  164. - `done`: Completed and verified
  165. - `review`: Awaiting review
  166. - `deferred`: Postponed tasks
  167. - `cancelled`: No longer needed
  168.  
  169. ### Dependency Management
  170. - Add: `add_dependency` / `task-master add-dependency --id=<id> --depends-on=<id>`
  171. - Remove: `remove_dependency` / `task-master remove-dependency --id=<id> --depends-on=<id>`
  172. - Validate: `validate_dependencies` / `task-master validate-dependencies`
  173. - Fix: `fix_dependencies` / `task-master fix-dependencies`
  174.  
  175. ### Task Reorganization
  176. - Move tasks: `move_task` / `task-master move --from=<id> --to=<id>`
  177. - Supports moving tasks to become subtasks, subtasks to tasks, reordering, etc.
  178. - Useful for resolving merge conflicts in tasks.json
  179.  
  180. ### Iterative Subtask Implementation
  181.  
  182. 1. **Understand Goal**: Use `get_task` / `task-master show <subtaskId>`
  183. 2. **Initial Exploration**: Identify files, functions, and code changes needed
  184. 3. **Log Plan**: Run `update_subtask` / `task-master update-subtask --id=<subtaskId> --prompt='<detailed plan>'`
  185. 4. **Verify Plan**: Check with `get_task` to confirm plan was logged
  186. 5. **Begin Implementation**: Set status to `in-progress`
  187. 6. **Refine and Log Progress**: Regularly update with findings:
  188. - What worked (fundamental truths)
  189. - What didn't work and why
  190. - Successful code snippets
  191. - Decisions made
  192. - Deviations from plan
  193. 7. **Review & Update Documentation**: After implementation, update relevant documentation and patterns in this file
  194. 8. **Mark Complete**: Set status to `done`
  195. 9. **Commit Changes**: Create comprehensive commit with code and rule updates
  196. 10. **Next Subtask**: Move to next task with `next_task`
  197.  
  198. ## Taskmaster Quick Reference
  199.  
  200. ### Essential Commands
  201. - `task-master init` - Initialize project
  202. - `task-master list` - View all tasks
  203. - `task-master next` - Show next task to work on
  204. - `task-master show <id>` - View task details
  205. - `task-master add-task -p "<description>"` - Add new task
  206. - `task-master set-status -i <id> -s done` - Mark task complete
  207. - `task-master expand -i <id>` - Break down complex task
  208. - `task-master update-subtask -i <id> -p "<notes>"` - Add implementation notes
  209.  
  210. ### Task Workflow
  211. 1. Start with `task-master list` to see current status
  212. 2. Use `task-master next` to identify what to work on
  213. 3. Break down complex tasks with `task-master expand`
  214. 4. Track progress with `task-master set-status`
  215. 5. Document findings with `task-master update-subtask`
  216.  
  217. ### Important Notes
  218. - AI-powered operations may take up to a minute
  219. - Always check dependencies before starting tasks
  220. - Use `--research` flag for external knowledge when needed
  221. - Maintain task files with `task-master generate` after changes
  222.  
  223. ## Taskmaster Command Reference
  224.  
  225. ### Initialization & Setup
  226.  
  227. #### Initialize Project
  228. - **MCP**: `initialize_project`
  229. - **CLI**: `task-master init`
  230. - **Options**: `--name`, `--description`, `--version`, `-y/--yes`
  231. - **Important**: Must parse PRD after init to generate tasks
  232.  
  233. #### Parse PRD
  234. - **MCP**: `parse_prd`
  235. - **CLI**: `task-master parse-prd [file]`
  236. - **Options**: `--input`, `--output`, `--num-tasks`, `--force`
  237. - **Note**: AI-powered, may take up to a minute
  238.  
  239. ### AI Model Configuration
  240.  
  241. #### Manage Models
  242. - **MCP**: `models`
  243. - **CLI**: `task-master models`
  244. - **Options**: `--set-main`, `--set-research`, `--set-fallback`, `--ollama`, `--openrouter`, `--setup`
  245. - **Note**: Configuration stored in `.taskmaster/config.json`
  246.  
  247. ### Task Viewing
  248.  
  249. #### List Tasks
  250. - **MCP**: `get_tasks`
  251. - **CLI**: `task-master list`
  252. - **Options**: `--status`, `--with-subtasks`, `--file`
  253.  
  254. #### Next Task
  255. - **MCP**: `next_task`
  256. - **CLI**: `task-master next`
  257. - **Shows**: Task with all dependencies satisfied
  258.  
  259. #### Show Task
  260. - **MCP**: `get_task`
  261. - **CLI**: `task-master show <id>`
  262. - **Supports**: Task IDs (e.g., "5") and subtask IDs (e.g., "5.2")
  263.  
  264. ### Task Modification
  265.  
  266. #### Add Task
  267. - **MCP**: `add_task`
  268. - **CLI**: `task-master add-task`
  269. - **Required**: `--prompt`
  270. - **Options**: `--dependencies`, `--priority`, `--research`
  271.  
  272. #### Add Subtask
  273. - **MCP**: `add_subtask`
  274. - **CLI**: `task-master add-subtask`
  275. - **Required**: Parent ID and either title or task-id
  276. - **Options**: `--parent`, `--title`, `--description`, `--details`
  277.  
  278. #### Update Multiple Tasks
  279. - **MCP**: `update`
  280. - **CLI**: `task-master update`
  281. - **Required**: `--from`, `--prompt`
  282. - **Updates**: All tasks from ID onward
  283.  
  284. #### Update Single Task
  285. - **MCP**: `update_task`
  286. - **CLI**: `task-master update-task`
  287. - **Required**: `--id`, `--prompt`
  288.  
  289. #### Update Subtask
  290. - **MCP**: `update_subtask`
  291. - **CLI**: `task-master update-subtask`
  292. - **Required**: `--id` (format: "parent.subtask"), `--prompt`
  293. - **Purpose**: Append timestamped implementation notes
  294.  
  295. #### Set Status
  296. - **MCP**: `set_task_status`
  297. - **CLI**: `task-master set-status`
  298. - **Required**: `--id`, `--status`
  299. - **Statuses**: pending, in-progress, done, review, deferred, cancelled
  300.  
  301. ### Task Structure
  302.  
  303. #### Expand Task
  304. - **MCP**: `expand_task`
  305. - **CLI**: `task-master expand`
  306. - **Options**: `--id`, `--num`, `--research`, `--force`, `--prompt`
  307. - **Note**: Uses complexity report if available
  308.  
  309. #### Expand All
  310. - **MCP**: `expand_all`
  311. - **CLI**: `task-master expand --all`
  312. - **Expands**: All eligible pending/in-progress tasks
  313.  
  314. #### Clear Subtasks
  315. - **MCP**: `clear_subtasks`
  316. - **CLI**: `task-master clear-subtasks`
  317. - **Options**: `--id` or `--all`
  318.  
  319. #### Move Task
  320. - **MCP**: `move_task`
  321. - **CLI**: `task-master move`
  322. - **Required**: `--from`, `--to`
  323. - **Supports**: Multiple moves with comma-separated IDs
  324.  
  325. ### Analysis & Reporting
  326.  
  327. #### Analyze Complexity
  328. - **MCP**: `analyze_project_complexity`
  329. - **CLI**: `task-master analyze-complexity`
  330. - **Options**: `--threshold`, `--research`, `--output`
  331.  
  332. #### View Complexity Report
  333. - **MCP**: `complexity_report`
  334. - **CLI**: `task-master complexity-report`
  335.  
  336. ### File Management
  337.  
  338. #### Generate Task Files
  339. - **MCP**: `generate`
  340. - **CLI**: `task-master generate`
  341. - **Creates**: Individual markdown files for each task
  342.  
  343. ### Task Structure Fields
  344. - **id**: Unique identifier (e.g., "1", "1.1")
  345. - **title**: Brief descriptive title
  346. - **description**: Concise summary
  347. - **status**: Current state
  348. - **dependencies**: Prerequisite task IDs
  349. - **priority**: high, medium, or low
  350. - **details**: Implementation instructions
  351. - **testStrategy**: Verification approach
  352. - **subtasks**: Nested task list
  353.  
Advertisement
Add Comment
Please, Sign In to add comment