Skip to content

sapegin/two-step-ai-coding-modes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Two-step approach to AI coding

This project provides a set of prompts for Cursor and other AI coding assistants to implement a structured, two-step 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 reduce time and number of prompts you need to achieve the initial version of the code, and to increase code quality and minimize manual fixes after initial code generation. This approach also allows you to switch between the tools within one project depending on the task.

This approach is based on Kiro-style Prompts for Spec-Driven Development, but significantly simpler. Instead of four steps (requirement document, design document, task list, execution) it only has two: design and execution. It also doesn’t use Markdown file – the design is shared between Planner and Executor modes via the prompt context.

Washing your code. A book on clean code for frontend developers

The core workflow: plan & execute

The methodology is split into two distinct phases, each handled by a dedicated custom AI agent mode.

  1. 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.
  2. Execution phase (Executor mode): The AI acts as a meticulous engineer. It reads the approved specification and implements the feature, ensuring strict adherence to the plan.

Setting up the workflow in different AI tools

This workflow uses two distinct AI personas, each with a specific role. The setup process varies between different AI coding tools.

Cursor (custom modes)

1. Planner mode

  • Name: “Planner”
  • Model: Gemini 2.5 Pro or OpenAI o3 max (powerful models for complex planning)
  • Prompt: Copy the entire content from prompts/planner.md
  • Context: Enable “Full folder context”
  • Tools: Enable “Search codebase”, “Read file” (read-only access to the codebase)
  • Automation: Disable auto-apply, auto-run, auto-fix (manual review required)

2. Executor mode

  • Name: “Executor”
  • Model: Claude 4 Sonnet (fast, capable model)
  • Prompt: Copy the entire content from prompts/executor.md
  • Context: Enable “Full folder context”
  • Tools: Enable all tools (file editing, terminal, etc.)
  • Automation: Disable auto-apply, auto-run, auto-fix (manual review required)

Kilo Code (modes)

1. Planner mode

  • Name: “Planner”
  • API configuration: Gemini 2.5 Pro or OpenAI o3 max (powerful models for complex planning)
  • Save location: “Global” (available in all workspaces)
  • Role definition: Copy the <role> tag content from prompts/planner.md
  • Short description (for humans): “Plan and design tech spec”
  • Available tools: Enable “Read Files”, “Use Browser”
  • Custom instructions: Copy the entire content except the <role> tag from prompts/planner.md

2. Executor mode

  • Name: “Executor”
  • API configuration: Claude 4 Sonnet (fast, capable model)
  • Save location: “Global” (available in all workspaces)
  • Role definition: Copy the <role> tag content from prompts/executor.md
  • Short description (for humans): “Implement features based on pre-approved tech specs”
  • Available tools: Enable “Read Files”, “Edit Files”, “Use Browser”, “Use MCP”
  • Custom instructions: Copy the entire content except the <role> tag from prompts/executor.md

GitHub Copliot (custom modes)

To edit modes, select Configure Modes... in the mode dropdown in the chat.

1. Planner mode

  • Name: “Planner”
  • The content of the Markdown mode file should be like so:
---
description: 'Plan and design tech spec'
tools: ['codebase', 'usages', 'fetch', 'githubRepo', 'search']
---

Copy the entire content from `prompts/planner.md`.

2. Executor mode

  • Name: “Executor”
  • The content of the Markdown mode file should be like so:
---
description: 'Implement features based on pre-approved tech specs'
tools: ['codebase', 'usages', 'vscodeAPI', 'problems', 'changes', 'testFailure', 'terminalSelection', 'terminalLastCommand', 'openSimpleBrowser', 'fetch', 'findTestFiles', 'searchResults', 'githubRepo', 'extensions', 'editFiles', 'runNotebooks', 'search', 'new', 'runCommands', 'runTasks']
---

Copy the entire content from `prompts/executor.md`.

Check out how to set up custom modes in other tools

Workflow usage

  1. Switch to Planner persona in your chosen AI tool.
  2. Provide an in-depth feature description.
  3. The Planner will guide you through an interactive process to create a tech spec.
  4. Review and approve to complete the plan.
  5. Switch to Executor persona.
  6. The Executor will automatically pick up the plan created by the Planner.

Other approaches

Sponsoring

Software enineering is essentially converting coffee to code, buy me one more cup to keep it going.

Buy Me A Coffee

Author and license

Artem Sapegin, a frontend engineer at Stage+ and the creator of React Styleguidist. I also write about frontend at my blog.

CC0 1.0 Universal license, see the included License.md file.

About

Custom modes for AI agents

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks