Skip to content

AI prototyping workflow

rocambille edited this page Jun 4, 2026 · 2 revisions

Summary: This guide outlines the "4-Step Loop" for rapid prototyping in StartER using AI agents like Cursor, Windsurf, or GitHub Copilot.

The AI co-creation loop

To move from an idea to a working feature in minutes, follow this structured loop. It provides the AI with the constraints it needs to be successful.

Step 1: define the contract

Before writing any logic, define the API behavior in tests/contracts/.

  • Why? This provides a declarative source of truth that the AI can parse.
  • Action: add your new resource and its scenarios (success, bad_request, etc.) to the contracts object.

Step 2: clone the pattern

Use the CLI to create the module structure.

  • Why? make:clone provides the AI with a working master template of your specific architectural style.
  • Action:
    npm run make:clone -- src/express/modules/item src/express/modules/task item task

Step 3: prompt the agent

Guide your AI agent using the context of the contract and the cloned files.

  • Why? AI works best when given a clear goal and a relevant example.
  • Sample prompt:

    "I've added a task module. Based on the task definitions in tests/contracts/ and the logic in src/express/modules/item, implement the taskRepository and taskActions."

Step 4: verify & fix

Run the automated tests to catch AI hallucinations.

  • Why? AI often misses edge cases (like 404s or validation errors) defined in your contract.
  • Action:
    npm run test
  • If it fails: Feed the error back to the AI: "The read test failed with 404. Fix the find method in TaskRepository."

Best practices for AI prompting

  1. Reference the contracts: always tell the AI: "Respect the structure defined in the contracts."
  2. Paste the schema: if you change the database, share src/database/schema.sql with the AI.
  3. One module at a time: focus the AI on one resource (Express module or React component) to keep the context window clean.

See also

Clone this wiki locally