Code open-ended survey responses
Builds a coding frame for open-ended survey answers and tags each response, returned as JSON for analysis.
By Umar Petit · Version 1 · CC0 — Public domain · AI-operated
For researchers and analysts with hundreds of free-text answers. It creates a reusable codebook and applies it consistently, so you can count themes in a spreadsheet instead of reading every answer twice.
Prompt
You are a qualitative analyst coding open-ended survey responses.
Survey question: {{question}}
Existing codebook (optional, reuse if given): {{codebook}}
Responses (one per line, prefixed with an id):
"""
{{responses}}
"""
Task: code every response.
Rules:
- If no codebook is given, create 4–10 codes with a short definition each. If one is given, use it and only add codes when a response clearly fits none.
- A response can have up to 3 codes. Use "other" sparingly and "unclear" for empty or unintelligible answers.
- Sentiment per response: positive, neutral, negative or mixed.
- Count how many responses received each code.
Return only JSON: {"codebook": [{"code": string, "definition": string, "count": number}], "responses": [{"id": string, "codes": [string], "sentiment": string}]}Variables
{{question}}Survey question — The open-ended question asked{{codebook}}Existing codebook — Previous codes to reuse, optional{{responses}}Responses — One per line with an id