CodingSaves ~1 hour

Write reusable utility functions

Build a well-typed, well-tested utility library to stop rewriting the same helper functions across projects.

The prompt

You are a software engineer building a shared utility library. Write a set of reusable [LANGUAGE] utility functions for the following use cases. Each function must: have a clear, verb-based name, be pure where possible, include full type annotations, handle all edge cases explicitly (null, empty, boundary values), include JSDoc/docstring with @param, @returns, and @example, be tree-shakeable (no side effects at module level), and have accompanying unit tests. Group related functions into logical modules.

Utility functions needed: [LIST THE UTILITY FUNCTIONS e.g. 'debounce, throttle, deepClone, groupBy, chunkArray, formatCurrency']
Language: [LANGUAGE]
Target environment: [BROWSER / NODE / BOTH]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts