← Back to library
Add features

Add a feature to existing code

The project already runs; now you add to it

  • extend
  • iterate
  • refactor

The prompt

I want to add a feature to existing code. Understand the current state before writing anything.

Current code:
```
{{paste the relevant code, or describe the file structure}}
```

Feature to add: {{describe it}}

Please:
1. First restate your understanding of the current structure (so I can catch misreadings).
2. Say where the new code goes, whether new files are needed, and what it might affect.
3. If there are multiple approaches, give 2 with tradeoffs (smaller diff vs cleaner design).
4. After I confirm, give the full change and mark which files changed where.

Rules:
- Do not rewrite parts I did not ask you to touch.
- Match the existing style and naming conventions.
- Tell me exactly what I need to verify manually.

Replace the {{}} parts with your own content

Why it works

  1. Restating the structure first is the key step: you correct misreadings before any code exists, not after it is written
  2. Two options instead of one lets you choose by project phase (rushed vs long-lived)
  3. "Do not rewrite parts I did not ask" stops AI from refactoring on the side, which makes the diff unreviewable
  4. Marking changed spots per file cuts your merge and verification cost

What it looks like

Adding search to an existing list, AI first identifies which hook supplies the data, then offers "filter client-side" vs "add a query param" for you to choose.

Where it bites

  • Saying "add search" without pasting code gets you something that does not match your project at all
  • Not bounding the scope, so AI "improves" other places and the diff becomes impossible to review
When to use it
When the codebase has real size and you must extend without breaking what exists.
Models
Claude / GPT; long-context models suit larger codebases

Browse categories