Extract Function
File: $1
Lines: $2
- Read the file, locate the specified lines.
- Analyze the block:
- What are the inputs? (variables read from outer scope)
- What are the outputs? (values written to or returned)
- What is the single responsibility of this block?
- Propose a function name that describes what it does (verb phrase).
- Show the extracted function with:
- Proper TypeScript/language types
- JSDoc if the file uses JSDoc
- The call site replacement
- Ask for confirmation, then:
- Add the new function (above the calling function, or in a utils file if appropriate)
- Replace the original block with the function call
- Note if this function would be useful elsewhere in the codebase.