Command Palette

Search for a command to run...

Назад к скиллам
скилл № 05191

wizard-form

How the apps/web wizard-form engine works and how to extend it — the generic multi-step form engine (ADR-0015) behind urban & photovoltaic project…

БесплатноБез исполняемых скриптов
incubateur-ademeот incubateur-ademe★ 45 звёзд на GitHub

Установить wizard-form в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Wizard-Form Engine (apps/web)

One generic algorithm drives every guided, multi-step form in the app — urban & photovoltaic, creation & editing. Each form is a thin definition plugged into a shared engine through an injected lens. Decision record: docs/adr/0015-extract-wizard-form-engine-via-injected-lens.md.

Glossary: Wizard form — one guided flow instance (e.g. urban-create). Context — the eager, guaranteed-present data buildContext derives from the slice (e.g. the site). Answers — the per-step user input accumulated in WizardFormSubState, keyed by StepId.

Read this before reading the files — it saves you from reverse-engineering the abstraction. Paths below are the source of truth; open them when you need detail.

The one idea: engine + definition, joined by a lens

The engine knows one abstract state shape, generic over <StepId, TAnswers>. It knows nothing about projects, sites, urban, or PV. A consumer connects its concrete form to the engine by supplying a WizardFormDefinition whose two key functions are the injected lens:

  • selectForm(state) — locates this instance's WizardFormSubState inside the consumer's slice.
  • buildContext(state) — builds the eager context (the site) handlers read.

That lens is why the same engine + same handler registry serve project and site forms alike: urban-create, urban-update, pv-create, pv-update, and the site forms — create-site/core/{custom, urban-zone, demo} and update-site/core (reusing the custom and urban-zone lenses).

Three layers

L1  shared/core/wizard-form/                     generic engine — ZERO domain, no slice/reducer
      stepHandler.type.ts    handler contract: AnswerStepHandler / InfoStepHandler
      wizardForm.reducer.ts  the shapes: WizardFormSubState, WizardFormDefinition
      wizardForm.actions.ts  makeWizardFormActionType(prefix, name)  — namespacing
      helpers/               the algorithm (pure fns): computeStepChanges, applyStepChanges,
                             navigateToStep, mutateState, readState, stepsSequence

L2  features/create-project/core/project-form/   shared "reconversion-project-on-a-site" domain
      site · stakeholders · soils-carbon · local-authorities · project-name
      (used by BOTH project types AND by create + update)

L3  features/create-project/core/{urban-project, renewable-energy}/   one per form type
      {type}Steps.ts               StepId union + AnswersByStep map (this is TAnswers)
      step-handlers/**             one pure handler per step
        stepHandlerRegistry.ts     aggregates them (answerStepHandlers + full nav registry)
      {type}Form.reducer.ts        add{Type}FormCasesToBuilder(builder, actions, definition)
      {type}Form.actions.ts        create{Type}FormActions(prefix)
      {type}Form.selectors.ts      create{Type}FormSelectors(prefix)

Views (feature-owned, shared by create + update):
  features/create-project/views/{urban-project, photovoltaic-power-station}/**   containers
  features/create-project/views/{project-form, .../renewable-energy-form}/       context seam
  .../stepToComponent.tsx    maps StepId -> the lazy-loaded container

The site forms mirror L3 at features/create-site/core/{custom, urban-zone, demo}/ (and features/update-site/core/ for editing): same {type}Steps.ts / step-handlers/ / stepHandlerRegistry.ts / {type}Form.reducer.ts layout, no project-form/-style L2.

The handler contract (stepHandler.type.ts)

Handlers are pure functions of { context, answers } — no store, no dispatch, no create-vs-update awareness. An AnswerStepHandler implements:

  • getNextStepId(params, answers) — required; the branching logic.
  • getPreviousStepId?, getDefaultAnswers? — optional nav / pre-fill.
  • getRecomputedStepAnswers?, getDependencyRules?, getShortcut?, updateAnswersMiddleware? — optional cascade hooks. Urban uses all of them; PV uses updateAnswersMiddleware, getDependencyRules and getRecomputedStepAnswers (e.g. its soils decontamination step recomputes the generated reinstatement expenses) but no getShortcut.

When getDependencyRules invalidates downstream answers, the pending change surfaces a CascadingChangesAlertDialog (pendingStepCompletion.showAlert in WizardFormSubState) and waits for confirmation before applying — see AnswerCascadingUpdateDialog.tsx.

Runtime: one step transition

dispatch stepCompletionRequested({stepId, answers})     (prefixed action)
  -> buildContext(state) + computeStepChanges(registry, ctx, steps, payload)
        · getDependencyRules -> invalidate downstream answers
        · getShortcut        -> maybe skip ahead
  -> applyStepChanges: writes answers, walks stepsSequence, sets currentStep
  -> selector (via Provider, resolved to the mode's prefix) re-derives current step
  -> stepToComponent maps stepId -> next container mounts

The reducer wiring lives in add{Type}FormCasesToBuilder an

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

  1. 01Read
  2. 02Grep
  3. 03Glob

FAQ

Что делает скилл wizard-form?

How the apps/web wizard-form engine works and how to extend it — the generic multi-step form engine (ADR-0015) behind urban & photovoltaic project creation/editing and site creation & update (custom, urban-zone, demo). Use when working on any guided multi-step form, adding a new wizard-form flow or step, touching shared/core/wizard-form, or wiring create/update slices, selectors, or step containers.

Как установить скилл wizard-form?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл wizard-form запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить wizard-form с