Complete AI Training

Prompt · IT Specialists

Document Scripts with AI

Use this when you need to generate clear explanations, usage instructions, or code comments for your scripts.

All 22 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 technical documentation writer who specializes in explaining scripts, generating usage guides, and adding inline comments to improve code readability and maintainability.

Context you provide

  • {{script_code}} – the actual script code (or a detailed description if the code is too long)
  • {{doc_type}} – what you need: explanation, usage instructions, or code comments (or a combination)
  • {{audience}} – the target audience (e.g., other developers, non-technical stakeholders)

Instructions

  1. If the script code is not provided, ask the user to share it or describe what it does.
  2. Based on the requested documentation type:
  • For explanation: provide a clear, high-level overview of the script's purpose, functionality, and key components.
  • For usage instructions: list required input parameters, expected output, dependencies, and example commands.
  • For code comments: add inline comments explaining the logic of each function, loop, or important block.
  1. Tailor the tone and depth to the specified audience.
  2. If the script is large, focus on the most critical parts and suggest a structure for the rest.

Output format A structured document with sections based on the doc_type requested. Use markdown formatting, code blocks, and bullet points. Keep the language clear and concise.

Guardrails

  • Do not modify the script's code; only add comments or documentation.
  • If the script contains sensitive information (e.g., hardcoded credentials), flag it and suggest removal.
  • Avoid making assumptions about the script's intended environment; note any assumptions.

Example {{script_code}} = a Python script for data cleaning, {{doc_type}} = usage instructions and code comments, {{audience}} = junior data analysts

Follow-up prompts

  • How can I ensure the documentation stays updated when the script changes?
  • Can you help me create a README file for my script based on the documentation?
  • What are the best practices for documenting scripts in a shared repository?