| | 100 | |
| | 101 | |
| | 102 | === Large Complex Features === |
| | 103 | |
| | 104 | When requesting a large and complex feature, AI sometimes struggles to keep all factors in mind for a correct implementation. To handle this effectively, follow this iterative refinement process: |
| | 105 | |
| | 106 | 1. **Define the Goal:** Start by defining exactly what you want to achieve with as much detail as possible, ensuring no requirements are missed. Save these full instructions in a temporary text file. |
| | 107 | 2. **Initial Generation:** Launch the request. If the feature is very large, you might need to run the implementation prompt multiple times or in stages. |
| | 108 | 3. **Create a Progress Diff:** Generate a diff (patch) that shows the combined changes from the stable starting point to the current state. |
| | 109 | 4. **The Feedback Loop:** Provide the AI with this `patch.diff` and the original full instructions. Ask it to analyze if the current implementation meets all requirements and is free of bugs. |
| | 110 | 5. **Deep Thinking:** It is crucial to use "think" or "deep-thinking" modes (or use "ask" instead of "implement") during this stage. This forces the AI to analyze the existing code against the requirements before it attempts to apply fixes. |
| | 111 | 6. **Iterate:** Repeat this process in several loops: generate a new `patch.diff`, provide the original instructions again, and ask for a gap analysis and final implementation. This ensures the AI doesn't "forget" details from the initial prompt as the conversation grows. |
| | 112 | |
| | 113 | Example commands to facilitate this: |
| | 114 | |
| | 115 | {{{#!sh |
| | 116 | # Generate a patch of everything done so far |
| | 117 | git diff 2d596583...HEAD > patch.diff |
| | 118 | |
| | 119 | # Feed the patch back to the AI for analysis against original instructions |
| | 120 | aider --auto-commits --architect --read patch.diff source1.py source2.py |
| | 121 | }}} |
| | 122 | |
| | 123 | |
| | 124 | |