What this prompt does
This prompt locks the AI into a strict pair programming workflow rather than letting it free-form generate code. By asking it to act as a senior pair programming partner and explicitly enforcing the TDD cycle (test first, minimal implementation, refactor), you get incremental, reviewable output instead of a wall of code you have to audit all at once.
The template's existing_patterns variable is the load-bearing piece most people skip. When you give the AI your actual naming conventions, architectural patterns, and file structure, it stops inventing abstractions and instead writes code that fits what already exists. The confirm before coding instruction at the end of step one means the AI surfaces its task decomposition for your review before writing a single line — catching misunderstood requirements early.
The explicit [language] parameter matters too. It keeps the AI from code-switching mid-session on multilingual projects, or from defaulting to TypeScript when you need JavaScript, or Python 3.12 idioms when the codebase targets 3.10.
When to use it
- Adding a new API endpoint with request validation, controller logic, service layer, and tests from scratch
- Implementing a Filament resource for a new domain model, following existing resource patterns
- Building a multi-step form with Livewire where state management needs careful task sequencing
- Scaffolding a queue job with retry logic, failure handling, and integration tests
- Refactoring a large controller into services while keeping tests green at every step
- Onboarding to an unfamiliar codebase by pairing with AI that knows the existing patterns you've described
Example output
For feature_name: "User notification preferences", tech_stack: "Laravel 11 + Livewire 3", the AI returns something like:
Task Breakdown — confirm before I start:
1. Migration: add `notification_preferences` JSON column to `users` table
Test: schema assertion in DatabaseTest
2. Model: cast column, add channel validation logic
Test: unit test NotificationPreference value object
3. Service: NotificationPreferenceService::update() with validation
Test: feature test covering valid/invalid payloads
4. Livewire component: NotificationPreferencesForm
Test: Livewire test for form submission and save confirmation
5. Route + view integration
Test: browser test or Livewire assertion on rendered state
Architectural flag: Should channel config live in a config file or the DB?
Ready to start Task 1 — confirm or adjust?
Pro tips
- Front-load
existing_patternswith real code snippets, not descriptions. Paste your base service class signature or a real FormRequest — the AI mirrors your style instead of guessing it. - Treat the confirmation step as a spec review. The task list the AI produces is your acceptance criteria. Push back on granularity here, not after it writes code.
- Run the AI one task at a time. After it writes a failing test, stop, run it locally, then paste the output before asking for the implementation. This keeps it grounded in real feedback.
- For the
[language]variable, be precise:PHP 8.3 with strict_typesorTypeScript 5.4 strict modenot justPHPorTypeScript— it changes the idioms the AI uses. - Paste actual test failures back into the session. This prompt is designed for dialogue; feeding real output back in makes the AI's next step context-aware rather than speculative.