Inline Edit Prompt
Scopes the inline edit precisely — changes behavior without breaking the interface contract. The 'no any' and 'non-exported helper' rules maintain code quality standards.
Refactor this {{code_element}} to: 1. {{primary_change}} 2. Keep the existing public API / function signature unchanged 3. Add proper TypeScript types (no \`any\`) 4. Handle the error case where {{error_scenario}} 5. Add a JSDoc comment explaining the purpose and parameters Constraints: - Do not rename the export - Do not change how this is called from other files - If you need a helper function, define it in the same file as a non-exported function
Variables to customize
Why this prompt works
Scopes the inline edit precisely — changes behavior without breaking the interface contract. The 'no any' and 'non-exported helper' rules maintain code quality standards.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Get thorough code reviews with actionable feedback tailored to your language, framework, and standards.
Context-Aware Code CompletionProviding the surrounding code and project context lets the model match existing patterns exactly. The constraint against modifying existing code prevents unwanted side effects.
Inline Code SuggestionConstraining suggestions to match existing style and scope produces insertions that feel native to the codebase. The 'no explanation' rule mimics real inline completion behavior.
Code ExplanationThe audience level parameter adjusts complexity automatically. Requiring a usage example ensures the explanation is practical, not just theoretical.