Data & Code

Prompts for code generation, data analysis, and docs.

← Back to Domain Guides
Overview

Ship faster with safer code and clearer docs

Use these prompts to generate maintainable code, analyze data, and write documentation that other engineers actually want to read.

Quick start

Function-first generation

Write a function named [name] that [responsibility].
Signature: [language + types].
Requirements: pure, total, documented, and with 5 table-driven tests.

Bug triage

Given this stack trace and snippet, identify the root cause,
minimal reproduction, and the smallest safe fix. Include a test.

Exploratory data analysis

In [language], load [dataset].
Output: schema, missingness, 3 key distributions, outliers, and 2 hypotheses.
Provide plotting code and a summary paragraph.
Templates

Reusable prompt templates

Refactor plan

Code quality

Create a refactor plan for [module].
Goals, risks, test strategy, and a step-by-step migration plan.

API contract

Backend

Design an API for [resource].
Include OpenAPI spec, error model, pagination, and auth notes.

Docstring generator

Docs

Generate docstrings for this file using [style].
Include param/returns, invariants, and complexity notes.

SQL query optimizer

Data

Analyze this SQL for performance issues.
Suggest indexes, rewrite joins, and provide EXPLAIN rationale.
Best practices
FAQs
How do I keep generated code maintainable?
Constrain scope, request tests, and require clear docstrings and types.
What about security?
Ask for threat modeling and validate inputs on boundaries, not internals.
Start free Browse all domains