EN
My account

Your privacy, your call. No advertising cookies. May we count your visit in aggregate (Cloudflare, no cookies) and remember where you came from? If you reject, we won’t measure your visit. · Cookies · Privacy

Privacy settings

Choose what we measure and what we keep in this browser. We never sell or share your data.

Essential

Remember your theme, language, saved items and this choice. Without them the site cannot work the way you ask.

Always on

Keeps the source of your first and latest visit for 90 days (utm parameters and referring site). It only leaves your browser if you subscribe to the newsletter.

Cloudflare Web Analytics counts visits in aggregate: page, referring site, country, browser and load times. No cookies, no identifiers and no profiling; nothing is stored in your browser. It only loads if you accept it. If you reject it or switch it off, it does not load (or stops loading from the next page) and we do not count your Telegram clicks either.

Cookies · Privacy

Work · Professional prompt

Document a function or API

Professional structure: role, context, objective, details, steps, format, criteria and self-check. Designed for better results, not guaranteed ones: always review the answer.

Never use real personal data. If you need to, run it through the data cleaner.

Fill in the blanks
## Role
Act as a technical writer who writes documentation for developers.

## Context
My code works, but nobody else knows how to use it.

## Objective
Write clear documentation with runnable examples.

## Details (fill in what is in square brackets)
- [code or specification]
- [audience: internal team or external users]
- [format: README, docstring, OpenAPI]

## Step-by-step instructions
1. Describe the purpose in one sentence.
2. Document parameters, types, defaults and response.
3. Add two usage examples, one basic and one advanced.
4. List possible errors and how to resolve them.

## Output format
Documentation in the stated format, ready to paste.

## Quality criteria
- The examples match the real signature.
- It does not document functions that do not exist.
- It can be understood without reading the code.

## Self-check
Before answering, check every quality criterion. If information is missing, ask me instead of making it up, and at the end state what you have assumed.

The link opens the empty template: what you type is not included.

Objective

Write clear documentation with runnable examples.

When to use it

This prompt is brilliant when you have a messy, undocumented codebase and need to produce professional-grade documentation quickly without manually typing every parameter. It works best for standardising internal APIs or creating clear README files for open-source projects. However, it is not a replacement for code reviews. If your logic is inherently flawed or your naming conventions are nonsensical, the AI cannot fix the underlying structural issues. It is a tool for translation from code to human-readable text, not a refactoring engine.

Worked example: input (fictional data)

Code or specification: function calculateShipping(weight, destinationCountry, express = false) { if (weight <= 0) throw new Error('INVALID_WEIGHT'); const rate = express ? 15.00 : 5.00; return (weight * 0.5) + rate; } Audience: Junior developers on the internal logistics team at SwiftParcel UK. Format: Standard docstring for JSDoc.

Worked example: full response

Purpose: Calculates the total shipping cost for a package based on its weight, destination, and delivery speed preference. Parameters: - weight (number): The mass of the package in kilograms. Must be greater than zero. - destinationCountry (string): The ISO country code (e.g., GB, FR). - express (boolean, optional): Set to true for expedited delivery. Defaults to false. Response: Returns the total cost as a number in GBP. Usage Examples: - Basic: const total = calculateShipping(2, 'GB'); // Returns 6.00 - Advanced: const total = calculateShipping(5, 'FR', true); // Returns 17.50 Errors: - INVALID_WEIGHT: Thrown if the weight parameter is 0 or negative. Ensure the input value is a positive number before calling the function. This function is intended for internal use within the SwiftParcel shipping calculator module. It assumes all inputs have been validated by the frontend before reaching this logic layer.

Variants

Quick Reference Summary

Instead of a full technical breakdown, produce only a concise summary and a single, one-line code example for each function. Focus on brevity and speed. This is perfect for generating a quick reference cheat sheet for your team to stick on their monitors or keep in a Slack channel for instant clarity.

Novice Developer Focus

Write the documentation specifically for a developer who is new to the project or junior in experience. Use plain, jargon-free language to explain complex logic. Include extra context on why certain decisions were made in the code, ensuring the reader understands the reasoning behind the implementation, not just what the parameters do.

API Specification Style

Focus strictly on the OpenAPI (Swagger) format. Organise the output to include request schemas, response objects, and HTTP status codes rather than descriptive prose. Ensure the structure is ready to be copied directly into a YAML configuration file to define a RESTful endpoint, focusing on strict data types.

Common mistakes

Related guide

General and assistant-specific tips

Tips by assistant

  • Claude: ask for the result as an artifact to view and edit it separately from the chat.

Getting the most out of it

  • Paste the prompt as is and only replace what is in [brackets].
  • If the answer does not fit, do not start over: ask for “shorter”, “more formal” or “as a table”.
  • Always review the result before using it: AI can get facts, dates or names wrong.

Before you paste it: quick checklist

  • Remove client names, amounts and internal data before pasting.
  • Say who the text is for and which tone you want.
  • Ask for a specific length: “120 words max” or “three bullet points”.
  • Read the result aloud and fix anything you wouldn’t say yourself.

How to adapt it to your assistant

The template works the same in ChatGPT, Gemini, Copilot or Claude because it only uses plain language. If your assistant supports fixed instructions (custom instructions, Gems or projects), you can store your preferred tone and format there and paste only the variable part. On a free plan, split long requests into two or three shorter messages.

See all Work prompts

More professional prompts

← All prompts