Coding
API docs prompts for README and Quickstarts
A pack of 8 to 12 copy-ready prompts to create API reference, README, quickstarts, code samples and CI-friendly docs-as-code steps from OpenAPI or repo context.
The prompts
Copy a prompt, then replace the parts in [BRACKETS] with your own details.
You are an API technical writer. Generate a concise quickstart for this API using the provided OpenAPI file. Inputs: [OPENAPI_JSON_OR_YAML], target audience: [TARGET_AUDIENCE], primary endpoint: [ENDPOINT_PATH], languages: [curl, javascript, python]. Output format: Markdown with sections: Prereqs, Authentication, Example request, Example response, Next steps. Requirements: extract auth and required params from OpenAPI and cite source lines like "source: OpenAPI line X"; include a runnable curl that uses {API_KEY} placeholder; mark any uncertain fields with TODO. Keep quickstart under 200 words. Tip: Paste the exact OpenAPI snippet for the endpoint so the model can cite lines and avoid hallucinations.
You are an API technical writer. Create a full reference for this endpoint using this OpenAPI snippet: [OPENAPI_ENDPOINT_SNIPPET]. Include: endpoint path, method, description (from spec), path/query/header/body parameters with types and required flags, request body schema, example request and example response. Add a table of HTTP status codes from the spec. For each parameter show "source: OpenAPI line X". If any field is missing in the snippet, add TODO and explain why.
Tip: Provide the exact YAML lines for the endpoint to force source citations and accurate params.
You are a README author. Given these files or excerpts: [REPO_FILES_OR_PATHS], produce a README skeleton with: Project summary, Setup, Quickstart, API overview, Authentication, SDKs, Contributing, and Changelog entry template. For API overview extract endpoints and link to generated reference files. Mark any assumptions or missing info with TODO and list files used.
Tip: List the main source files and the OpenAPI path so the model can map README sections to actual code.
You are a code sample generator. Using this endpoint spec: [OPENAPI_ENDPOINT_SNIPPET], produce runnable examples in: curl, JavaScript (fetch or axios), and Python (requests). Each sample must run with only the {API_KEY} placeholder and include minimal imports. Verify that JSON request bodies match the schema from the spec. Add a short note if the model had to guess any field. Tip: Request exact library names, for example "fetch" or "axios", to get consistent idioms.
You are a docs validator. Given: [GENERATED_DOC_MARKDOWN] and [OPENAPI_JSON_OR_YAML], compare the docs to the spec. Output: a validation summary listing matches, mismatches, and missing items; for each mismatch show spec line number and the doc line number. Mark speculative text with TODO. Recommend up to three fixes.
Tip: Attach both the generated docs and the exact OpenAPI file for line-accurate checks.
You are a CI bot. Input: OpenAPI file at [OPENAPI_PATH] and PR diff or list of changed files: [PR_DIFF]. Produce: a docs update plan listing only endpoints changed, the exact doc files to update, and a generated Quickstart or reference fragment for each changed endpoint. Include a validation summary for each fragment and a final pass/fail flag for the PR.
Tip: Provide a clear PR diff or changed files list so the model can limit output to changed endpoints.
You are a release writer. Inputs: previous OpenAPI file [OPENAPI_V1] and new OpenAPI file [OPENAPI_V2]. Produce a changelog and upgrade notes with headings: Added, Changed, Deprecated, Removed, Migration steps. For each entry give: endpoint, param or schema changed, impact on clients, and suggested code fixes or tests. Cite spec line numbers for each change.
Tip: Provide both full OpenAPI files and set a threshold for what counts as breaking change, for example change in required flag or response schema.
You are a security-aware doc writer. Given: [OPENAPI_OR_DOC_SNIPPET], produce examples that do not contain real secrets. Replace keys with {API_KEY} or {ACCESS_TOKEN}, and replace real emails or IDs with example values. Add a short checklist telling a human reviewer what to check before publishing. Tip: Remind the model to redact any strings that match secret patterns like long hex keys or JWT forms.
You are a docs writer. Input: [OPENAPI_JSON_OR_YAML] and target user persona: [PERSONA]. Generate 8 FAQ questions and short answers tailored to that persona. Each answer should reference the exact spec section or example that supports it and include a short runnable example if relevant. Mark uncertain answers with TODO.
Tip: Specify the persona clearly, such as "frontend integrator" or "mobile app developer", to shape the FAQ tone and examples.
Answer first: use these prompts to generate copy-pasteable API docs that match your OpenAPI or repo files and include runnable code samples with safe placeholders.
Who this pack is for
You are a developer, technical writer, or maintainer who wants machine-assisted docs that map to code. Use the prompts when you have an OpenAPI/Swagger file, a repo path, or a PR diff. They work with ChatGPT, Claude, Gemini, or similar LLMs.
How to use the prompts
- Provide exact inputs. Always paste or attach the OpenAPI YAML/JSON, endpoint snippet, or repo file excerpts. Specify the target audience and the languages for code samples, for example curl, JavaScript, and Python.
- Run the prompt in a chat or in a CI step. For CI, save the prompt as a file and call it from a GitHub Action or a pre-commit hook.
- Validate outputs. The prompts instruct the model to list assumptions, cite source lines in the OpenAPI, and mark uncertain fields with TODO.
How to adapt prompts
Shorten outputs by adding a max words or max lines constraint, for example "Limit quickstart to 120 words and one code sample." Change the persona to "backend engineer" or "frontend integrator" to adjust tone. Swap languages to Java, Go, or Ruby when you need other SDK examples.
Common mistakes and how these prompts avoid them
Missing or wrong parameters: prompts force extraction of parameters directly from OpenAPI and require "source: OpenAPI line X" notes. Non-runnable samples: prompts require a runnable curl and one SDK example and use {API_KEY} placeholders only. Secrets leakage: prompts instruct the model to redact secrets and use pseudo-credentials. Stale docs: CI prompts include an option to run only on changed endpoints from a PR diff.
Sources and tools
Prompt patterns follow Documentation.AI prompts, PromptByJob examples, and the Twilio Labs docs-ai-buddy repo. For quick SEO checks or to export a PDF of a finished README, use FreeToolr tools at SEO Tools or PDF Tools.
Use the prompts below as templates. Each one tells the model what to include, what to avoid, and how to mark uncertain items for human review.
Frequently asked questions
Can I generate docs from only a code folder, not OpenAPI?
Yes. Provide the key source files or representative endpoint code. The model can extract route names, parameters, and example responses. Add a sample request and response to reduce hallucinations. Ask the model to mark all assumptions with TODO so a human can verify.
How do I make generated code samples actually runnable?
Request runnable curl plus one SDK example and require placeholders like {API_KEY}. Tell the model to avoid real credentials. Then run the curl locally, compare the output to the example response, and fix any mismatches flagged in the validation section.
How can I use these prompts in CI or a docs-as-code flow?
Use the CI prompt that accepts a PR diff or list of changed files. Run it in a GitHub Action or pre-commit hook. Configure the job to fail if the validation summary reports missing docs for changed endpoints, so reviewers must update docs before merging.
How do I ensure the model does not invent endpoints or parameters?
Require extraction from the OpenAPI file and ask for source line citations. Also require a validation summary that lists fields the model could not find in the spec and tags them TODO. Attach the exact OpenAPI file to the prompt for line accuracy.
What languages should I include for code samples?
Start with curl plus one or two SDK languages your customers use, for example JavaScript (fetch) and Python (requests). Add Java, Go, or Ruby only if you have test suites to validate those samples before publishing.
More in Coding
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.