Kredal Docs
How to

Add a Questionnaire Question

Add a question to the readiness questionnaire and feed it into scoring.

The readiness questionnaire is data-driven. Its structure lives in kredal-app/src/lib/questionnaire/schema.ts, keyed by the eight sections defined in src/lib/constants.ts (QUESTIONNAIRE_SECTIONS).

Steps

  1. Add the question to the right section in src/lib/questionnaire/schema.ts. Each question has:

    • key — a unique, stable snake_case identifier (this becomes the question_key stored in questionnaire_responses).
    • label — the question text.
    • typetext, textarea, number, select, or radio.
    • options — for select/radio.
    • optional helpText, placeholder, required, and showIf (conditional display keyed off another question in the same section).
  2. No migration needed. Answers are stored as (company_id, question_key, answer_json) rows with a unique constraint on (company_id, question_key), so new keys just work.

  3. Wire it into scoring (optional). If the answer should affect the score, add a rule that reads answers.<your_key> — see Add a scoring rule.

  4. Verify. Run the app, open a company's questionnaire, confirm the question renders, saves per-section, and (if scored) changes the assessment.

    cd kredal-app && npm run build

Conventions

  • Keep keys stable once shipped — they are the storage contract. Renaming a key orphans existing answers.
  • Put conditional follow-ups behind showIf rather than a separate section.
  • Match the existing plain, non-jargon phrasing; the ICP is often a non-native English speaker.

On this page