This project provides a set of prompts for Cursor to implement a structured, spec-driven "Plan & Execute" workflow, inspired by the principles of AWS Kiro. It's designed to move beyond reactive "vibe coding" towards a proactive process that produces well-documented, maintainable, and production-ready code.
The primary motivation behind this methodology is to enable a consistent, spec-driven development process across any AI coding assistant. By standardizing the project's rules and specifications, you can seamlessly switch between tools like Kiro, Cursor, Claude, or Gemini without friction. If one assistant gets stuck or hits a limitation, you can simply move to another, confident that your structured coding style remains intact.
For a high-level introduction, read the blog post: How I Apply Spec-Driven AI Coding. For a deep dive into the technical philosophy and architecture, see METHODOLOGY.md.
The methodology is split into two distinct phases, each handled by a dedicated custom mode in Cursor.
- Planning Phase (Planner Mode): The AI acts as a junior architect. You provide a high-level feature description, and the AI guides you through an interactive process to create a complete technical specification.
- Execution Phase (Executor Mode): The AI acts as a meticulous engineer. It reads the approved specification and implements the feature one task at a time, ensuring strict adherence to the plan.
This workflow relies on a specific directory structure to organize AI-related artifacts. The goal is to create a "single source of truth" that can be used with different AI tools.
.ai-rules/: A tool-agnostic directory containing global "steering" files (product.md,tech.md,structure.md). These provide project-wide context to the AI.specs/: Contains feature-specific specification files. Each feature gets its own subdirectory. The entirespecs/your-feature-name/directory, including its contents, is generated automatically by the Planner mode.
.
├── .ai-rules/
│ ├── product.md # The "Why": Project vision and goals
│ ├── tech.md # The "With What": Tech stack and tools
│ └── structure.md # The "Where": File structure and conventions
└── specs/
└── your-feature-name/
├── requirements.md # The "What": User stories & acceptance criteria
├── design.md # The "How": Technical architecture & components
└── tasks.md # The "To-Do": A step-by-step implementation plan
To ensure all your AI tools use the same .ai-rules/ directory, you can create symbolic links. This allows you to maintain a single, canonical set of rules while satisfying the specific directory requirements of tools like Cursor and Kiro.
1. Create the target directories (if they don't exist):
mkdir -p .cursor
mkdir -p .kiro2. Create the symbolic links: Now, run the appropriate commands for your operating system.
This links .cursor/rules to your central .ai-rules directory.
On macOS / Linux:
ln -s ../.ai-rules .cursor/rulesOn Windows (run as Administrator):
mklink /D .cursor\\rules ..\\.ai-rulesThis links .kiro/steering to your central .ai-rules directory.
On macOS / Linux:
ln -s ../.ai-rules .kiro/steeringOn Windows (run as Administrator):
mklink /D .kiro\\steering ..\\.ai-rulesThis workflow is centered around three custom modes in Cursor, each with a specific role.
Before using the Planner or Executor modes, you must populate the .ai-rules/ directory. This directory provides the essential, high-level context for the AI. The setup process differs for new and existing projects.
If you are starting a new project from scratch, you need to create the steering files yourself.
- Create the directory:
mkdir -p .ai-rules
- Create the core files:
.ai-rules/product.md: Describe the project's vision, goals, target audience, and core features. Answer the question: "What are we building and why?".ai-rules/tech.md: Outline the technology stack, libraries, frameworks, and coding conventions. Answer the question: "What tools and patterns do we use?".ai-rules/structure.md: Explain the project's file and directory structure, and the purpose of key components. Answer the question: "Where does code go?"
For an existing project, you can use the Steering Architect mode to analyze your codebase and generate the rules automatically.
- Switch to the "Steering Architect" mode in Cursor.
- Ask the agent to "Create the steering files for this project."
- The agent will analyze your codebase and ask clarifying questions to generate the
product.md,tech.md, andstructure.mdfiles for you.
This mode guides you through creating the specification files for a new feature.
Setup:
- Create a new custom mode in Cursor called "Planner".
- Model: Use a powerful model like Gemini 2.5 Pro or OpenAI o3 max.
- Prompt: Paste the contents of
planner.md. - Context: Enable full folder context in settings.
Usage:
- Switch to Planner mode.
- Provide a high-level feature description (e.g., "Add user authentication").
- The Planner will guide you through an interactive process to define
requirements.md,design.md, andtasks.mdin a newspecs/your-feature-name/directory. - Review and approve each step to complete the plan.
This mode reads the tasks.md file and implements the code, one task at a time.
Setup:
- Create a new custom mode called "Executor".
- Model: Use a fast and capable model like Claude 4 Sonnet.
- Prompt: Paste the contents of
executor.md. - Tools: Enable all tools.
- Automation (Optional): Enable auto-apply edits, auto-run, and auto-fix errors for a more autonomous experience.
Usage:
- Switch to Executor mode.
- Provide the path to the
tasks.mdfile (e.g.,specs/user-authentication/tasks.md). - The Executor will read the first incomplete task, implement it, and update
tasks.mdto mark it as complete. - Run the Executor repeatedly to work through all tasks in the plan.
This mode helps you create and maintain the global .ai-rules/ files that steer the AI's behavior across the entire project.
Setup:
- Create a new custom mode called "Steering Architect".
- Model: Use a powerful model (e.g., Gemini 2.5 Pro or o3 max).
- Prompt: Paste the contents of
steering.md. - Tools: Enable file editing tools.
Usage:
- Switch to Steering Architect mode.
- Ask the agent to "Create the steering files for this project."
- The agent will analyze your codebase and ask you questions to create
product.md,tech.md, andstructure.md.
While this workflow is designed for Kiro style planning with Cursor, its principles are tool-agnostic. For chat-based assistants like Claude or Gemini that don't have a file-based rules system, you can generate a "master context file".
This process relies on using the AI itself to build its context.
-
Ensure
.ai-rulesis Ready: First, make sure your.ai-rulesdirectory is fully populated, using either the manual or AI-assisted method described above. -
Generate Context with Claude:
- Start a new chat in Claude.
- Instruct it to act as a software architect and analyze your entire codebase, including the crucial
.ai-rulesdirectory. You can use a prompt like:/init Please analyze the attached codebase, paying close attention to the.ai-rulesdirectory, to create a comprehensive summary of the project's goals, tech stack, and structure. Output this as a markdown-formatted context file. - Save the output from Claude as
CLAUDE.md.
-
Add Core Prompts:
- Manually copy the full contents of
prompts/planner.mdandprompts/executor.md. - Paste them into the
CLAUDE.mdfile, under a "Core Personas & Prompts" section.
- Manually copy the full contents of
-
Use with Gemini:
- To use the workflow with Gemini, simply make a copy of the finalized
CLAUDE.mdand copy it toGEMINI.md.
- To use the workflow with Gemini, simply make a copy of the finalized
Now you can attach CLAUDE.md or GEMINI.md to your chat session to provide the AI with all the necessary context to follow your spec-driven workflow.
- Start a new chat with your AI assistant (e.g., Claude or Gemini).
- Attach the appropriate master context file (
CLAUDE.mdorGEMINI.md). - Since the
plannerandexecutorpersonas are now defined within the context file, you can directly invoke the desired mode without a lengthy introductory prompt.
To begin planning a new feature, use a direct prompt:
You are in Planner mode. Let's specify a new feature: "Add user authentication".
The AI will recognize the persona and follow the interactive process to help you create the specification files.
Once the specification is complete, you can instruct the AI to start building:
You are in Executor mode. Go and execute the tasks in
specs/user-authentication/tasks.md.
The AI will adopt the engineer persona, read the tasks.md file, and begin implementing the feature one task at a time.