agentleFS
bkjain655bkjain655/agent-skills/skills/multi-step-wizard-flow/SKILL.md

multi-step-wizard-flow

Skill0 starsChanged 3 months agoMITView on GitHub

Builds multi-step wizard/onboarding flows in React: step registry, progress indicator, grouped sections, navigation, Zustand persistence, and intro overview numbering. Use when creating wizards, onboarding, step-by-step forms, or guided setup flows in Next.js or React apps.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If step 1 is intro, overview cards show upcoming sections — not step 1 itself:

    line 98
  2. Very specific:

    Keep card step labels derived from WIZARD_STEPS indices, not hand-maintained offsets.

    line 106
  3. Very specific:

    No route changes per step (single /wizard page) unless SEO requires URLs

    line 130

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Multi-Step Wizard Flow

Architecture

lib/types.ts          → WIZARD_STEPS constant + WizardStep union
lib/store.ts          → Zustand + persist (localStorage)
components/wizard/
  wizard-shell.tsx    → renders current step component
  step-indicator.tsx  → progress UI
  wizard-nav.tsx      → Back / Next / Skip
  steps/*.tsx         → one component per step

Step registry

Single source of truth — never hardcode step numbers in multiple files:

export type WizardStep = "intro" | "profile" | "settings" | "review";

export const WIZARD_STEPS: WizardStep[] = [
  "intro",
  "profile",
  "settings",
  "review",
];

Display number = WIZARD_STEPS.indexOf(step) + 1.

Zustand store essentials

interface WizardStore {
  currentStep: WizardStep;
  data: AppData;
  setCurrentStep: (step: WizardStep) => void;
  nextStep: () => void;
  prevStep: () => void;
  reset: () => void;
}

// Navigation
nextStep: () => {
  const idx = WIZARD_STEPS.indexOf(get().currentStep);
  if (idx < WIZARD_STEPS.length - 1) set({ currentStep: WIZARD_STEPS[idx + 1] });
},

Persist + migrate

persist(store, {
  name: "app-wizard",
  merge: (persisted, current) => {
    const p = persisted as Partial<WizardStore>;
    return {
      ...current,
      ...p,
      currentStep: migrateStep(p.currentStep), // handle renamed/removed steps
      data: normalizeData(p.data ?? current.data),
    };
  },
});

migrateStep: if step not in WIZARD_STEPS, fall back to first valid step.

Step indicator

Two modes:

  1. Expanded: dot per step, index + 1 label, click to jump (only to completed steps)
  2. Grouped: collapse related steps (e.g. Start / Profile / Finances)
const STEP_GROUPS = [
  { label: "Start", steps: ["intro"] as WizardStep[] },
  { label: "Profile", steps: ["profile"] as WizardStep[] },
  { label: "Finish", steps: ["settings", "review"] as WizardStep[] },
];

Group is active when currentStep is in group; complete when all group steps visited.

Intro step overview cards

If step 1 is intro, overview cards show upcoming sections — not step 1 itself:

Card sectionStep numbers (example 9-step flow)
Profile block (4 sub-steps)2–5
Next major section6
...7, 8, 9

Keep card step labels derived from WIZARD_STEPS indices, not hand-maintained offsets.

WizardNav component

interface WizardNavProps {
  showBack?: boolean;
  onNext?: () => void;
  onBack?: () => void;
  nextLabel?: string;
  nextDisabled?: boolean;
  showSkip?: boolean;
  onSkip?: () => void;
}

Per-step validation: pass nextDisabled until required fields valid.

Step component contract

Each step:

  • Reads/writes store slices (not prop drilling entire tree)
  • Calls nextStep / prevStep via WizardNav
  • Optional steps: show Skip → still advances
  • No route changes per step (single /wizard page) unless SEO requires URLs

URL sync (optional)

For shareable progress: ?step=profile synced via useSearchParams + router.replace. Validate against WIZARD_STEPS.

Analytics hooks

Fire on step enter and completion:

trackEvent("wizard_step_view", { step: currentStep, step_index: idx + 1 });
trackEvent("wizard_complete", { total_steps: WIZARD_STEPS.length });

UX checklist

- [ ] Back preserves entered data (persist handles this)
- [ ] Intro explains sections with correct step numbers
- [ ] Review step shows read-only summary before submit
- [ ] Reset clears storage and returns to intro
- [ ] Mobile: indicator scrolls horizontally if many steps

Pair with: zustand-persist-state, react-hooks-patterns, specialized-form-inputs.

Anti-patterns

  • Duplicating step order in intro cards, indicator, and store separately
  • Using React Router steps when a single page + store is simpler
  • Losing data on refresh without persist/middleware

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.