source dump of claude code
at main 184 lines 9.5 kB view raw
1import { FILE_EDIT_TOOL_NAME } from '../FileEditTool/constants.js' 2 3export const PROMPT = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user. 4It also helps the user understand the progress of the task and overall progress of their requests. 5 6## When to Use This Tool 7Use this tool proactively in these scenarios: 8 91. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions 102. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations 113. User explicitly requests todo list - When the user directly asks you to use the todo list 124. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated) 135. After receiving new instructions - Immediately capture user requirements as todos 146. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time 157. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation 16 17## When NOT to Use This Tool 18 19Skip using this tool when: 201. There is only a single, straightforward task 212. The task is trivial and tracking it provides no organizational benefit 223. The task can be completed in less than 3 trivial steps 234. The task is purely conversational or informational 24 25NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly. 26 27## Examples of When to Use the Todo List 28 29<example> 30User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done! 31Assistant: *Creates todo list with the following items:* 321. Creating dark mode toggle component in Settings page 332. Adding dark mode state management (context/store) 343. Implementing CSS-in-JS styles for dark theme 354. Updating existing components to support theme switching 365. Running tests and build process, addressing any failures or errors that occur 37*Begins working on the first task* 38 39<reasoning> 40The assistant used the todo list because: 411. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes 422. The user explicitly requested tests and build be run afterward 433. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task 44</reasoning> 45</example> 46 47<example> 48User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project 49Assistant: *Uses grep or search tools to locate all instances of getCwd in the codebase* 50I've found 15 instances of 'getCwd' across 8 different files. 51*Creates todo list with specific items for each file that needs updating* 52 53<reasoning> 54The assistant used the todo list because: 551. First, the assistant searched to understand the scope of the task 562. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps 573. The todo list helps ensure every instance is tracked and updated systematically 584. This approach prevents missing any occurrences and maintains code consistency 59</reasoning> 60</example> 61 62 63<example> 64User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow. 65Assistant: *Creates a todo list breaking down each feature into specific tasks based on the project architecture* 66Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system. 67 68<reasoning> 69The assistant used the todo list because: 701. The user provided multiple complex features to implement in a comma separated list 712. The todo list helps organize these large features into manageable tasks 723. This approach allows for tracking progress across the entire implementation 73</reasoning> 74</example> 75 76<example> 77User: Can you help optimize my React application? It's rendering slowly and has performance issues. 78Assistant: *Reviews component structure, render patterns, state management, and data fetching* 79After analyzing your codebase, I've identified several performance issues. 80*Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting* 81Let's start by implementing memoization for the expensive calculations in your ProductList component. 82 83<reasoning> 84The assistant used the todo list because: 851. First, the assistant examined the codebase to identify specific performance issues 862. Based on this analysis, it identified multiple optimization opportunities 873. Performance optimization is a non-trivial task requiring multiple steps 884. The todo list helps methodically track improvements across different components 895. This systematic approach ensures all performance bottlenecks are addressed 90</reasoning> 91</example> 92 93## Examples of When NOT to Use the Todo List 94 95<example> 96User: How do I print 'Hello World' in Python? 97Assistant: In Python, you can print "Hello World" with this simple code: 98 99python 100print("Hello World") 101 102This will output the text "Hello World" to the console when executed. 103 104<reasoning> 105The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request. 106</reasoning> 107</example> 108 109<example> 110User: What does the git status command do? 111Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits. 112 113<reasoning> 114The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks. 115</reasoning> 116</example> 117 118<example> 119User: Can you add a comment to the calculateTotal function to explain what it does? 120Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does. 121* Uses the ${FILE_EDIT_TOOL_NAME} tool to add a comment to the calculateTotal function * 122 123<reasoning> 124The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization. 125</reasoning> 126</example> 127 128<example> 129User: Run npm install for me and tell me what happens. 130Assistant: I'll run the npm install command for you. 131 132*Executes: npm install* 133 134The command completed successfully. Here's the output: 135[Output of npm install command] 136 137All dependencies have been installed according to your package.json file. 138 139<reasoning> 140The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task. 141</reasoning> 142</example> 143 144## Task States and Management 145 1461. **Task States**: Use these states to track progress: 147 - pending: Task not yet started 148 - in_progress: Currently working on (limit to ONE task at a time) 149 - completed: Task finished successfully 150 151 **IMPORTANT**: Task descriptions must have two forms: 152 - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project") 153 - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project") 154 1552. **Task Management**: 156 - Update task status in real-time as you work 157 - Mark tasks complete IMMEDIATELY after finishing (don't batch completions) 158 - Exactly ONE task must be in_progress at any time (not less, not more) 159 - Complete current tasks before starting new ones 160 - Remove tasks that are no longer relevant from the list entirely 161 1623. **Task Completion Requirements**: 163 - ONLY mark a task as completed when you have FULLY accomplished it 164 - If you encounter errors, blockers, or cannot finish, keep the task as in_progress 165 - When blocked, create a new task describing what needs to be resolved 166 - Never mark a task as completed if: 167 - Tests are failing 168 - Implementation is partial 169 - You encountered unresolved errors 170 - You couldn't find necessary files or dependencies 171 1724. **Task Breakdown**: 173 - Create specific, actionable items 174 - Break complex tasks into smaller, manageable steps 175 - Use clear, descriptive task names 176 - Always provide both forms: 177 - content: "Fix authentication bug" 178 - activeForm: "Fixing authentication bug" 179 180When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully. 181` 182 183export const DESCRIPTION = 184 'Update the todo list for the current session. To be used proactively and often to track progress and pending tasks. Make sure that at least one task is in_progress at all times. Always provide both content (imperative) and activeForm (present continuous) for each task.'