Scaffolding New Code & Features

Prompt the model to scaffold new code that matches your project's patterns instead of a generic tutorial skeleton.

TL;DR

  1. Scaffolding is where AI shines: generating the repetitive structure of a new feature.
  2. Show the model an existing example so new code matches your real patterns, not a generic template.
  3. Ask for the full set of files, wiring included, so you are not left connecting the pieces by hand.

Anchor To An Example

    Point At A Sibling

    Reference a similar existing feature as the template to copy.

    "Mirror src/features/orders for a new
    `invoices` feature."
    Match Naming

    Ask it to follow your file and symbol naming conventions.

    "Use the same file names and export
    style as the orders feature."
    Reuse Imports

    Have it import the same shared utilities the example uses.

    "Use the shared `apiClient` and
    `useQuery` hook, like orders does."

Ask For The Whole Slice

    List The Files

    Name every file you expect so nothing in the slice is skipped.

    "Create: type, api, hook, list view,
    detail view, and an index export."
    Include Wiring

    Ask it to connect the new code into routers, stores, or barrels.

    "Register the route and add the
    feature to the nav config."
    States Up Front

    Request loading, empty, and error states so they are not afterthoughts.

    "Each view handles loading, empty,
    and error states."

Keep It Realistic

    Real Data Shape

    Give the actual types so the scaffold compiles against them.

    "Invoice: { id, amount, dueDate,
    status } (paste the full type)."
    No Placeholder Logic

    Ask it to flag TODOs clearly rather than hide fake implementations.

    "Mark anything unimplemented with
    // TODO, do not fake it."
    Minimal, Not Maximal

    Scaffold the structure, not a kitchen sink of features you did not ask for.

    "Just the CRUD slice; no export,
    print, or filters yet."

Review The Skeleton

    Check The Wiring

    Confirm the new files are actually connected and reachable.

    Does the route render? Is the
    export added to the barrel?
    Find The Gaps

    Look for missing states, validation, and TODOs before building on it.

    Empty list? Error path? Loading?
    Then Refine

    Treat the scaffold as step one, then prompt for the real logic.

    "Now implement the real update
    logic in the hook."

Tips

  1. Paste a similar existing feature as the template and say 'follow this structure and naming'.
  2. List the files you expect so the model produces the whole slice, not just the happy-path component.

Warnings

  1. Generic scaffolds use conventions that clash with yours; anchor to an existing example to avoid rework.
  2. Scaffolds look complete but often skip error states, loading states, and wiring; check for the gaps.

In Practice

FAQ