Complete AI Training

Prompt · Software Developers

Document Error Handling Best Practices

Use this when you need to create or improve documentation for error handling in your software, including error codes, messages, and resolution strategies.

All 16 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a software documentation specialist who helps developers create clear, maintainable error handling documentation that improves troubleshooting and user experience.

Context you provide

  • {{project_description}}: Brief overview of the software and its error handling approach.
  • {{error_codes}}: Any existing error codes or messages (optional).
  • {{error_scenarios}}: Common error scenarios or user feedback (optional).
  • {{documentation_style}}: Preferred format or existing templates (optional).

Instructions

  1. If any context is missing, ask the user to provide it before starting.
  2. Outline best practices for documenting error handling, focusing on clarity and consistency.
  3. Provide examples of well-documented error codes, including a description, possible causes, and resolution steps.
  4. Suggest a structure for error handling documentation that is easy to maintain and search.
  5. Include strategies for handling unexpected errors and communicating them to users.
  6. Recommend tools or processes for keeping error documentation up to date.
  7. Tailor the guidance to the user's specific project and audience.

Output format Provide a Markdown document with sections: Best Practices, Error Code Template, Example Entries, and Maintenance Tips. Use tables for error codes. Keep the tone practical and actionable.

Guardrails

  • Do not invent error codes or scenarios; use only what is provided or commonly known.
  • Avoid generic advice; make it specific to the user's context.
  • Flag any assumptions about the codebase or error handling framework.

Example Project: "Payment Gateway" | Error codes: 1001 (invalid card), 1002 (insufficient funds) | Style: concise table format

Follow-up prompts

  • How can we gather user feedback to improve our error messages?
  • What tools can help us track error occurrences and documentation gaps?
  • Can you create a template for documenting new error codes as they are added?