Beyond prompts or .cursorrules, I explored whether code structure itself can serve as context an AI can understand. Most models’ context windows are small and hinder free-form exploratory coding; if structure can act as additional context, it could be a big win.
Test:
Two codebases implement the same behavior but differ in structure.
Code A: goal-driven, structure-agnostic.
Code B: lightly refactored with some structural improvements.
Both were 100% AI-written. I fed the same model the two bases separately and issued the same modification request.
Results:
On Code A, the AI grafted features onto a structureless base; subsequent edits easily broke existing behavior.
On Code B, the AI respected the existing composition/structure/pattern; follow-up edits were far less likely to cause regressions.
Conclusion:
The AI does leverage existing code structure; on a good structure, it tends to produce sturdier, higher-quality code.
Personal note:
This is an interesting direction for AI-assisted development. The write-up is short but setup-heavy; to really grasp the test, hands-on is needed. A tighter focus on the test, results, and implications would make it stronger.
hexpeek•3h ago
Beyond prompts or .cursorrules, I explored whether code structure itself can serve as context an AI can understand. Most models’ context windows are small and hinder free-form exploratory coding; if structure can act as additional context, it could be a big win.
Test:
Two codebases implement the same behavior but differ in structure.
Code A: goal-driven, structure-agnostic.
Code B: lightly refactored with some structural improvements.
Both were 100% AI-written. I fed the same model the two bases separately and issued the same modification request.
Results:
On Code A, the AI grafted features onto a structureless base; subsequent edits easily broke existing behavior.
On Code B, the AI respected the existing composition/structure/pattern; follow-up edits were far less likely to cause regressions.
Conclusion:
The AI does leverage existing code structure; on a good structure, it tends to produce sturdier, higher-quality code.
Personal note:
This is an interesting direction for AI-assisted development. The write-up is short but setup-heavy; to really grasp the test, hands-on is needed. A tighter focus on the test, results, and implications would make it stronger.