---
name: "add-a-feature-to-an-unfamiliar-codebase-method"
description: "Use when you need to Add a feature to an unfamiliar codebase. Add a feature to an unfamiliar codebase"
---

# Add a feature to an unfamiliar codebase

Job: [Add a feature to an unfamiliar codebase](https://aiagents.org/canai/add-a-feature-to-an-unfamiliar-codebase)

## Need

- ai agent: [Cursor](https://aiagents.org/agents/cursor)

## Steps

1. Before changing anything, ask the agent to walk you through the part of the code you will touch: the components, routes and services involved and the data flow. Follow up on gaps, such as where a calculation happens and where the new behavior would plug in.
2. Switch to plan mode and have the agent outline the feature as an approach and a task list. Trim anything too large for a first release, keep the core flow, then build it.
3. If a test still fails after the build, ask the agent to find the root cause of the failure rather than patch the symptom, and ask it to display the old and new values it computes at every stage.
4. Have the agent review your whole change for bugs, gaps in error handling, unusual inputs and fit with the existing code. Where cloud agents are available, launch some to probe unusual cases you did not think of.
5. Write what you learned into a rule file so the agent follows it next time, for example the order in which discounts should be applied.
6. The source walks through adding discount codes to a checkout flow and ends by asking what to do first when a teammate wants gift cards next: explore and plan again.

## Credit

Method author Cursor
Source: https://cursor.com/learn/putting-it-together
