I’ve been testing different approaches with AI coding assistants and found a method that really helps maintain project structure. When I need the AI to build new functionality or improve existing code, I use this framework:
PHASE 1: UNDERSTAND PROJECT SCOPE
AI, review the guidelines in my project-rules.md file, then think through this systematically before moving forward.
PAUSE. Confirm you grasp these key points:
- This focuses on code optimization and reusability
- New file creation needs strong reasoning
- All recommendations must link to current codebase
- Breaking these guidelines makes responses unusable
BACKGROUND: Last contractor ignored existing structure and made duplicates everywhere. Need to show you can work with what’s already built.
REQUIRED WORKFLOW:
- Begin with “UNDERSTOOD: I will focus on extending existing code”
- Review current files BEFORE proposing changes
- Point to actual files from your review
- Add verification steps in your response
- Close with confirmation of approach
GUIDELINES (breaking these invalidates everything):
No new files without thorough justification
No complete rewrites when updates work
No vague suggestions - give concrete solutions
No bypassing current architecture
Build on existing modules
Merge redundant code
Show exact file locations
Include transition plans
PHASE 2: EXAMINE EXISTING CODE
Look at current project structure and find files related to what I’m requesting.
PHASE 3: BUILD ACTION PLAN
Using your findings, make a clear plan for implementing the feature.
PHASE 4: TECHNICAL IMPLEMENTATION
Show specific code modifications, API updates, and how everything connects.
PHASE 5: WRAP UP DELIVERABLES
Finish with testing approach, deployment notes, and final suggestions.
This structured approach stopped the AI from inventing files or breaking my organization. It behaves more like a careful teammate instead of creating chaos.
My project-rules.md contains:
- Don’t generate files that don’t exist
- Don’t invent features not in my actual project
- Don’t bypass my current setup
- Only modify existing files and structure
- Stay accurate and respect the codebase
I also get another AI to examine my codebase first, then review the implementation plan afterward. This double-check process works great for adding features. Anyone have other ideas to improve this further?