Build EDSL surveys with question types, routing, piping, and memory. For follow-ups explaining a decision, use set-memory --target FOLLOWUP=PRIOR to include the earlier question and answer.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Edsl Surveys?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/expectedparrot-edsl-surveys)
---
name: edsl-surveys
description: Build EDSL surveys with question types, routing, piping, and memory. For follow-ups explaining a decision, use set-memory --target FOLLOWUP=PRIOR to include the earlier question and answer.
tags: [edsl, surveys]
---
# Build an EDSL survey
Web presentation and respondent navigation (pages, styling, the Back button) are configured in a Humanize schema. Use `ep humanize schema create --help` for local edits to those settings.
Use this skill for EDSL API questions about survey construction and for implementing survey objects. Check installed-version help and schemas when CLI details may differ.
When someone asks for a survey draft, save it as a local `.ep` file. Reopen it with `ep surveys show survey.ep` (use the filename you saved), check the questions, and give the researcher the file path. If they haven’t said how they’ll use it, offer to pilot it with simulated respondents or send it to people by link or email. Wait for their choice before running or sharing the survey.
When different participants own steps and one waits for another’s answer, use a respondent workflow. A Survey describes the questions one respondent answers. A `WorkflowExperiment` assigns each step to a participant, can release independent steps together and can skip optional steps. Read `ep skills show edsl-orchestration --reference SKILL.md`. Rehearse the saved definition with the supplied `step`, `participant`, and `answers` rows using `ep orchestration run --file experiment.json --responses responses.json --output rehearsal/`.
For TypeSafe judgments or option probabilities in a batched Evaluation, use `ep skills show edsl-judgment-evaluations --reference SKILL.md`. Verify the delivered workload with `ep validate --file review.ep --type evaluation`.
EDSL questions are stateless by default. To reuse an earlier answer in later wording, pipe it with `{{ question_name.answer }}`.
When a respondent must **explain a rating or decision**, give the follow-up targeted memory of the question that elicited it. For example, after adding a free-text question named `why` following `rating`, run `ep surveys set-memory survey.ep --target why=rating` (Python: `survey.add_targeted_memory("why", "rating")`). The follow-up receives the earlier question and its answer, including scenario details rendered in that question. If essential details appeared elsewhere, include those details explicitly. Inspect a saved follow-up prompt and check for both the actual answer and the evidence the respondent saw.
To edit an existing memory plan, inspect `memory_plan` with `ep surveys show`. Use `ep surveys set-memory survey.ep --clear-for rating --forget followup=region --output revised.ep` to blind one question and remove one answer from another. To replace all memories of a question, combine `--clear-for` with repeated `--target FOCAL=PRIOR`. Verify the rendered prompts with `ep surveys preview-prompt`, supplying earlier `--answers` and repeating `--expect-text` or `--forbid-text` for distinctive sample values.
For a separate auditor or judge on one item, keep the original question type. Use `ep surveys set-question-model survey.ep audit --service openai --model gpt-4o-mini --system-prompt "Apply the eligibility criteria."`. Pipe the earlier choice into the audit question or configure targeted memory. Reopen the package with `ep surveys preview-prompt survey.ep audit --answers '{"application":"renewal"}'` and check the model, system prompt, and actual choice in the user prompt.
For directions on a grouped browser page, use `ep surveys add-instruction survey.ep --name directions --text "Count visits during the past month." --before clinic_visits`. Group the questions using their names. Inspect `item_order` in `ep surveys show survey.ep` to verify that the instruction precedes the first question on the intended page.
To extend an existing answer-order experiment, use `ep surveys set-option-randomization pilot.ep --add --question stall --pin-options '{"stall":["No preference"]}' --output updated.ep`. Check both `questions_to_randomize` and `options_to_pin` in the response. Each interview’s recorded options and prompt establish which label an answer code selected.
For branching surveys, **before building or editing**, write named cases in `paths.json` from the research brief. Include screen-outs, both sides of each cutoff, each branch and the join. Reopen the saved survey with `ep surveys check-paths survey.ep --cases paths.json`. If it fails on an existing rule, inspect `ep surveys show survey.ep`, then use `ep surveys replace-rule survey.ep --question NAME --expression EXPR --output revised.ep`. This changes the existing rule at its original priority. Rerun the same cases on the file you deliver. See [question path cases](references/question-path-cases.md) for the JSON format.
To audit piping, memory or scenario-dependent wording across respondents, run `ep surveys check-prompts survey.ep --cases prompts.json --output report.csv`. Each named case supplies the respondent's full answer history, optional scenario and traits, and question-level text assertions. For a changing sample table, add `--rows visits.csv` and bind case values to columns with `{"$field":"column"}`. See [prompt case examples](references/prompt-cases.md).
To combine existing questionnaires, run `ep surveys compose first.ep second.ep -o combined.ep`. Normal completion continues into the next module. Explicit stop rules end the whole survey. Resolve duplicate question names using `ep surveys rename-question first.ep old new -o revised.ep` before composing. Verify the join and early exits with `ep surveys check-paths`.
To restore selected fields from an approved draft, find the revision with `ep log survey.ep` and read its wording and choices with `ep surveys questions survey.ep --ref COMMIT`. Apply those fields to the current package with `ep surveys update-question`. This also updates the wording stored in its memory plan.
Use `ep surveys update-question survey.ep debrief --interview-guide-file moderator.md --max-turns 3 --output review.ep` to install an approved interviewer guide and keep the original instrument. The same two options work on `create` and `add-question`. Read back the saved `interview_guide`, `max_turns`, and participant-facing `question_text` with `ep surveys questions review.ep`.
To change an existing question's type, use `ep surveys replace-question intake.ep rating --question-json '{"type":"linear_scale","options":[1,2,3,4,5]}'`. This keeps its name, position, routes and memory. The replacement inherits wording if omitted. Supply all settings for the new type, such as `interview_guide` for an AI interview. For browser follow-ups, pipe the earlier answer into that guide. Read back the saved survey and exercise each language and path.
For a survey with multiple versions, use `ep jobs variants` to find a representative interview index for each assignment group. On each version check a valid boundary with `ep jobs test-case --expect` and an invalid one with `--expect-rejection QUESTION`. For count-only questions use `ep jobs preview-prompt --expect-comments false` and inspect the rendered wording.
For an offline regression test of a saved job, run `ep jobs test-case study.ep --interview-index 0 --responses replies.json --expect answers.json -o checked.ep`. For a full rehearsal, use `ep jobs test-case study.ep --all -n 4 --responses replies.json -o rehearsal.ep` to run four iterations per assignment and save their prompts, raw test replies and decoded answers. For a saved treatment schedule, omit `-n` to use its planned iterations. `ep run --local` runs on this machine and still calls the provider for a hosted model. Both JSON objects map question names to values. Write each expected answer from the research brief before running the case. A budget reply can name the options directly, e.g. `{"bus":75,"rail":25}`. The corresponding final answer to check in `--expect` is `[{"bus":75},{"rail":25}]`. The command exercises the actual interview, returns a nonzero exit for a mismatch or validation error, and saves the completed case as Results on success.
For a ratings grid based on an earlier checkbox named `used`, create a matrix with
`--param 'question_items={{ used.answer }}'` and repeat `--option` for the rating scale.
This supplies the complete row list for each respondent. Use repeated `--question-item`
for individually specified rows. Test with someone who picked two services and check
that they can give each service a different rating. A `NESTED_MATRIX_ROWS` warning
includes a JSON patch for `ep surveys update-question`.
For local edits, start with `ep surveys questions survey.ep`. Change wording or choices with `ep surveys update-question survey.ep NAME --question-text "..."` or repeated `--option` flags (the full ordered list). Use `--patch` for other fields, and `rename-question` for names used in piping, memory, or rules. Add `--output revised.ep` to keep the source. Use `ep surveys set-groups` to replace page boundaries, `ep humanize schema create --base-schema existing.json` to preserve browser settings, and `ep surveys check-paths survey.ep --schema humanize.json --routes routes.json --page-csv screens.csv` to trace the visible pages for named sets of sample answers, including fixed outcomes for staff-only routing questions.
For a fixed allocation such as 60 points across three programs, use `budget` with `budget_sum=60`. Check a valid split such as 0/20/40 and a split totaling 59. Use `distribution` for probability shares and `demand` for quantities at specified prices. Get the installed example with `ep schema show --question_type budget`.
To choose a question type, use `ep schema list` for the installed catalog or
`ep schema list --search prices` to match a word in its descriptions. Use
`ep schema show --question-type demand` for a real serialized example.
To test an instrument's saved answer constraints without running a job, use
`ep surveys check-answers survey.ep --cases checks.json`. Supply a JSON array
of cases such as `{"case_id":"zero","question":"quantity","answer":0,"expected":"accept"}`.
Rejected values, normalized answers and expectation mismatches appear in the JSON receipt.
Use `--output audit.csv` to save all decisions, including mismatches. Repeat
`--column` to choose the report fields and their order.
For checkbox limits, test an empty selection, a valid boundary, and one over the
maximum. Each check reports the submitted `selection_count`. If an out-of-range
answer is accepted because `permissive` is true, the observation explains why.
For a hard limit, change that question's `permissive` setting to false and
repeat the checks against the saved survey.
For an integration or codebook, `ep surveys response-schema survey.ep QUESTION...` shows the saved response records, including nested fields and option values. Use `--output contracts.json` for a mapping of question names to independent JSON Schemas. Cross-field rules such as ordered endpoints and allocation totals can require `check-answers`.
Choose the grid type by the answer you need for **each row**. For one rating per row,
use `matrix`. Its rows can come from an earlier checkbox through
`--param 'question_items={{ used.answer }}'`. For several selections per fixed
row, use `checkbox_matrix`. Compare the related types with
`ep schema show --question-type checkbox_matrix`.
To offer only the respondent's selected choices in a follow-up, pass the earlier checkbox answer as the entire `question_options` string. This example asks for two priorities, then one favorite.
```bash
ep surveys create --question-type checkbox --question-name priorities --question-text "Which two matter most?" --option Lighting --option Signage --option Cleanliness --min-selections 2 --max-selections 2 --output priorities.ep
ep surveys add-question priorities.ep --question-type multiple_choice --question-name favorite --question-text "Which is your favorite?" --question-json '{"question_options":"{{ priorities.answer }}"}'
```
Reopen the survey and render the follow-up with two known selections. Lighting and Signage should be the only available choices.
```bash
python -c "from edsl import Survey; q = Survey.git.load('priorities.ep', sync_coop=False).get('favorite'); selected = ['Lighting', 'Signage']; assert q.render({'priorities': {'answer': selected}}).question_options == selected"
```
To retire a question, use `ep surveys drop-question source.ep --question entrance --output revised.ep`. Remaining questions keep their section membership. The editor updates sampling and shuffle settings and preserves the requested draw size. If the remaining pool is too small, or a surviving rule reads the removed answer, the edit returns a validation error and preserves the source and any existing output. Read the affected rule expressions or the remaining pool and draw counts before revising the design.
To move a question in a saved survey, use its neighbor's name. For example, `ep surveys move-question source.ep --question entrance --before closing --output revised.ep` keeps the source and writes the new order, routing, and memory to the output. Use `--after` for the other side of a neighbor or `--index` for a zero-based position.
For simulated surveys that quote a previous free-text answer exactly, use `{{ reported.answer | verbatim }}` in the follow-up. This keeps literal placeholders, template-like text and unfinished braces in pasted email subjects, receipts or code. Put `verbatim` last when displaying a transformed value. Check both the recorded user prompt and question text with a sample that actually contains braces.
For a checkbox with hard selection limits, set `min_selections` and
`max_selections` and keep `permissive` false. Set `permissive` true for
advisory counts. The checkbox still requires choices from its option list.
Read each question’s `permissive` flag alongside its bounds in `ep surveys questions survey.ep`. Verify the saved survey with empty, in-range, and over-limit examples.
To present a saved survey in a terminal, run `ep surveys show survey.ep --markdown`. Add `--with-question-names` or `--with-question-types` to label the headings. Add `--expand-options` to list every dropdown choice. On success, stdout is Markdown you can include directly in your reply. Use `ep surveys show survey.ep` for the JSON summary. Its `item_order` interleaves named instructions and questions in authored order. Read scale-point text from each question’s `option_labels` and matrix rows from `question_items`.
For a translation or copy-editing worksheet, run `ep surveys export-wording survey.ep --source-heading English --translation-heading Spanish --output wording.csv`. The CSV preserves authored text, placeholders and line breaks. Its Code column identifies scale anchors. For piped choices or matrix rows, the worksheet includes the source template and any saved text additions. Check the warnings for values supplied only at runtime. This exports the survey definition; deployment-specific messages and runtime substitutions are separate.
For a vendor's Word proof, use `ep validate --file proof.docx` to check the
visible programming specification before saving it with `ep surveys import-docx`.
Check the reconstructed routes against the researcher's intended paths. If the
source is an ordinary Word questionnaire, use the paragraph preview and original
document to build questions and rules with `ep surveys`.
For branching, the last matching rule added to the same question and phase wins. Make a fallback exclude cases already routed elsewhere. Reopen the saved survey and execute each respondent path with `Survey.next_question`, including declined consent, fractional scores just beyond each tier’s cutoff, and the join. See [checking survey routes](references/checking-survey-routes.md). For repeated-measures designs, verify period balance, ordered transitions and the rendered question order together using the [counterbalancing example](references/counterbalancing.md).
For a Qualtrics import, choose the [workflow for a survey URL or an offline QSF export](references/qualtrics-migration.md).
For detailed API behavior, use [survey reference](references/survey-reference.md), [full reference](references/full-reference.md), [composition contracts](references/composition-contracts.md), and [probabilistic responses](references/probabilistic-responses.md).
Related EDSL guidance: `edsl:edsl-quirks` and `edsl:edsl-study-files`.
Optional EP Agent cross-references may appear as `ep-agent:<skill-name>`. They describe research workflows or platform processes and are not part of the EDSL API.
For simulated respondents who need guidance at specific questions, use `ep surveys add-instruction menu.ep --name budget --text reminder.txt --for-question price_first --for-question price_revised --output pilot.ep`. Repeat `--for-question` for every intended question. This leaves approved question wording intact. Check the reported `instruction_questions`, then reopen the package with `ep surveys check-prompts` to verify the cue's presence at the targeted questions and absence at blind controls. Specify earlier answers in the cases when testing memory.
When field notes identify an older draft by wording or ordered choices, use `ep surveys find-revisions pilot.ep --question '{"question_text":"Why?"}' --output appendix.ep`. Include all known fields for one question in the same JSON object. Repeat `--question` for another question. Check `match_count` and cite the original commit. Only a unique match can be exported.
For a review of the last survey save, run `ep surveys diff SURVEY.ep`. To compare two supplied versions, use `ep surveys diff approved.ep revision.ep`. For several incoming copies, run `ep surveys diff approved.ep north.ep east.ep west.ep`.
In each comparison, `before` is the master and `after` is the named copy.
Read `removed_fields` as fields the named copy has already removed. To undo
an unauthorized removal, restore the value in `fields.FIELD.before`. An empty change
list means the copy also lacks any *required* revision that was absent in the master.
For a release that requires changing *only* specified question fields, add
`--expect-field QUESTION FIELD` for each required edit. For example,
`ep surveys diff master.ep canal.ep ridge.ep --expect-field sessions permissive`
checks both releases. A mismatch exits 5 and returns every comparison in
`error.details[0]`. Read each `field_check` for missing or unexpected changes,
then inspect the values to confirm that the edit did what the researcher authorized.
Check the assignment settings as well as the changed questions before describing what a participant would experience.
After editing response choices, check `warnings` in `ep surveys show SURVEY.ep` or `ep validate --file SURVEY.ep`. Read `data.routing_label_check` to see how many fixed-choice labels were checked and which comparisons use a free-text answer. A routing label warning identifies a comparison against a choice the respondent can no longer select. To hand off the findings as a CSV, use `ep validate --file SURVEY.ep --warnings-csv review.csv` and check the returned count and path. Select just the requested fields with repeated `--warning-column`. Check the affected paths after changing the rule.
Before fielding a survey with shuffled options, run `ep validate --file SURVEY.ep`. Check its warnings for stale pins and shuffles that cannot vary. For each question in `data.option_order_check.requires_interview_data`, verify the expected option order with representative inputs.