Back/Engineering/Cursor
AdvancedEngineeringCursor

How to Build a Multi-Device App Using a Structured AI Coding Workflow in Cursor

Implement a disciplined, three-phase AI development cycle using Cursor and Xcode to build complex applications. This workflow uses custom rules for creating requirements, reviewing plans, and executing code in small, manageable steps to ensure high quality and maintainability.

From How I AI

How I AI: Terry Lin's Vibe Coding Workflow for Building an Apple Watch Fitness App

with Claire Vo

How to Build a Multi-Device App Using a Structured AI Coding Workflow in Cursor

Tools Used

Cursor

AI-first code editor

Step-by-Step Guide

1

Validate the Core Concept

Before building a full application, validate your core idea with a scrappy V1. For example, use a voice memo app to record data, then a simple Python script with GPT-4 to transcribe and structure the information into a spreadsheet. This proves the concept without the overhead of app development.

2

Set Up a 'Dual-Wielding' Development Environment

Use two tools in tandem for optimal results. Point Cursor to your project folder for all AI-assisted code generation, feature creation, and refactoring. Use Xcode simultaneously for compiling, building, and debugging the iOS/Apple Watch application to catch platform-specific errors.

3

Create a Product Requirements Document (PRD)

Kick off new features by running a custom 'PRD Create' rule in Cursor. This rule should take a basic ticket from your project management tool (e.g., Linear) and expand it into a full PRD, complete with goals, references, and user stories in Gherkin format (Given-When-Then).

4

Review the PRD with a Second AI Agent

Create a 'PRD Review' rule that acts as a quality check. Have a second AI agent analyze the PRD generated in the previous step and score its clarity for another AI to execute. Iterate on the PRD until it scores at least a 9 out of 10.

Prompt:
If another model were to take this plan, how would you rate this out of 10 if they had no context and they had to execute on this?
Pro Tip: This step is crucial for preventing AI hallucinations or incorrect implementations by ensuring the instructions are exceptionally clear before writing any code.
5

Execute Code in Small, Reversible Chunks

Use a 'PRD Execute' rule that breaks the development work into a checklist of small phases. Configure the AI to pause after each phase and automatically run a git commit. This creates a detailed commit history, making it easy to roll back any mistakes and safely manage risk.

6

Refactor Code for AI Collaboration

Use a custom 'Vibe Refactoring' rule in Cursor to clean up and organize the codebase specifically for the AI. The primary goal is to break down large files (over 400 lines) into smaller, more focused modules. This reduces the token count and makes the context easier for the LLM to understand, improving its performance.

7

Use AI to Learn and Verify Code

Implement a 'Rubber Duck' rule where you ask the AI to explain the code it just wrote. Take it a step further by having it generate a pop quiz on the new functions and logic to ensure you fully understand the implementation and remain in control of the project.

Become a 10x PM.
For just $5 / month.

We've made ChatPRD affordable so everyone from engineers to founders to Chief Product Officers can benefit from an AI PM.

How to Build a Multi-Device App Using a Structured AI Coding Workflow in Cursor | AI Workflows