行业动态
dev.to ·
@Alexander
更好的提示,更准的猜测:编码代理的上下文挑战
文章指出编码代理无法理解视觉意图,需通过提示补充上下文。介绍Pixy工具,可在网站运行时记录视觉上下文(如目标元素、属性变化),帮助代理更准确实现前端修改。
AI推荐理由 讨论编码代理在视觉任务中的上下文缺失问题,提出Pixy工具记录视觉上下文以改进提示,对AI辅助开发有实际启发。
70
正文
You are looking at a page thinking, "Move this down, use the same spacing as that card, but only on mobile." You know exactly what you mean because you're looking at it. Your coding agent is looking at a repository.
Your coding agent cannot read your mind
So you translate what you see into a prompt. Which element, which page, which breakpoint, this instance or every instance. Add a screenshot and the agent can see the pixels, but it still has to connect them to the right element, component, rule, and scope.
That's the guessing game.
For visual work, the useful context is already there when you make the change. You know the target, the property, the old and new values, the viewport width, and whether you changed one element or a shared rule. Throw that context away and you get to describe it all again in English.
This is the idea behind Pixy. Make the change on the running site and Pixy records the visual context for your coding agent. The agent still decides how to implement it because it has the repository and knows whether that 16px lives in Tailwind, a CSS module, a prop, or somewhere in globals.css you'd rather not discuss.
You already made the change. Describing it again just gives your agent another chance to misunderstand you.