Gemini Documentation Prompt for Data Scientists
You get documentation a newcomer can follow on the first try: what it is, how to install it, how to use it, with working examples. This prompt is tuned for data scientists working in Gemini: it carries your role context, and the steps below cover what changes in Gemini. Verify that suggested methods fit your data's assumptions, and watch for data leakage between training and test sets in any modeling code.
Write documentation for the code or tool below. ## What it is Name: [project or module name] What it does: [one or two sentences] Who reads this: [e.g. developers new to the project, external API users] ## Source material [paste the code, CLI help output, config options, or function signatures] ## Document type [README, API reference, docstrings, or a how-to guide] ## Instructions - Start with what it does and why someone would use it, in two sentences. - Show a working example before explaining every option. - Every command and code sample must match the source material exactly. Do not invent flags, options or defaults. - Use short sections and plain language. - If something important is unclear from the source, list it as a question at the end instead of guessing. ## Output format Markdown with: overview, install, quick start, options or API, examples, and open questions. About my work - Data shape and types: [e.g. 2M rows, columns: user_id, signup_date, plan, churned (bool)] - Tools and environment: [e.g. Python 3.11, pandas 2, scikit-learn, Jupyter] - Question the analysis must answer: [e.g. which plan features predict churn in the first 90 days] Context - Reference material: [paste it below, or attach the file]
How to use this prompt
- 1
Open Gemini
Start a new chat in Gemini and paste the prompt.
- 2
Give it context
Attach files or images the prompt refers to, or paste the text below the instructions.
- 3
Review and iterate
Reply in the same chat to refine the result.
- 4
Save what you repeat
For a prompt you run often, save it as a Gem with custom instructions.
Working in Gemini
- •Gemini accepts images and files as well as text, so attach a screenshot when the task is visual.
- •Ask for the exact output format; otherwise answers tend to come with extra headings and summaries.
- •If you use Google Docs or Sheets, ask for output you can paste straight in, such as a table.
Worked example
What you give it
Name: csvtidy What it does: a command line tool that trims whitespace from every cell in a CSV and removes empty rows. Readers: developers on my team. CLI help: csvtidy <input> [-o output] [--keep-empty] -o, --output write to a file instead of stdout --keep-empty do not remove empty rows Install: npm install -g csvtidy Type: README
What a good answer looks like (shortened)
# csvtidy csvtidy cleans CSV files by trimming whitespace in every cell and removing empty rows. Use it before importing exported spreadsheets. ## Install npm install -g csvtidy ## Quick start csvtidy contacts.csv -o contacts-clean.csv ## Options - -o, --output: write to a file instead of printing to stdout - --keep-empty: keep empty rows instead of removing them ## Examples Print the cleaned file to the terminal: csvtidy contacts.csv ## Open questions - What happens if the output file already exists? - Does it handle quoted cells that contain commas?
Tips for better results
- •Describe the data with df.dtypes and a few sample rows (with sensitive values removed) instead of words. The AI writes far more accurate code when it sees real column names and types.
- •Paste the actual help output or signatures into Source material. Documentation that drifts from the code is worse than none.
- •Gemini accepts images and files as well as text, so attach a screenshot when the task is visual.
- •Avoid this: Not pasting the real source, CLI help or signatures, so the AI documents flags and defaults that do not exist.
Check before you use it: Verify that suggested methods fit your data's assumptions, and watch for data leakage between training and test sets in any modeling code.
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Docstrings
Change Document type to docstrings and add: Use [Google, NumPy or JSDoc] style, with params, return value and raised errors for each function.
API reference
Replace Source material with your route handlers and add: For each endpoint, show method, path, parameters, an example request and an example response.
Changelog entry
Replace Document type with: A changelog entry for version [x.y.z] from this diff [paste], grouped as Added, Changed, Fixed.
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;writedocs in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;writedocs.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
Can AI choose the right statistical test for my data?
It can suggest options and explain their assumptions, which is a useful check. You still need to confirm the assumptions hold for your data, like independence, sample size and distribution.
How do I keep AI-written docs accurate?
Give it the real source, help text or signatures and tell it not to invent options. Then run every example yourself before publishing.
Can I save this prompt in Gemini?
Yes, as a Gem with the prompt as its instructions. A Retext snippet also works if you switch between Gemini and other tools.
How do I reuse this prompt without copying it every time?
Click Add to Retext to save it as a snippet. Then type ;writedocs in any Mac app, including your AI tool, and the full prompt is pasted in.
Related Templates
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.