你们是怎么解决 CodeX 写代码过于难看的问题的

2 小时 2 分钟前
 Pig930

RT ,最近主力切换到 CodeX 之后发现 CodeX 会写无穷无尽的胶水代码、兜底代码和一些根本不存在的转换/try-catch 等等,哪怕在 prompt 里详细写清楚需要做的事情,或者用 Opus 4.7 写 plan 再执行也不会有很大改善。仿佛这种倾向刻进 CodeX 骨子里了。今天让它写一个简单的训练脚本,100 行的脚本里有一半是对一个命令行参数是否正确输入的判断,彻底晕了。 之前自己在网上找了一些方法写进 AGENTS.md 里,

## Coding Standard
1. Simplicity First.
2. Failfast instead of over-design, over-engineering, over-error-handling and over-fallbacks
   - Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
   - A simple feature doesn't need extra configurability.
   - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code andframework guarantees. Only validate at system boundaries (user input, external APIs).Don't use feature flagsor backwards-compatibility shims when you can just change the code.
   - Don't create helpers, utilities, or abstractions for one-time operations.Don't design for hypotheticalfuture requirements. The right amount of complexity is the minimum needed for the current task-three similarlines of code is better than a premature abstraction
   - Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removedcomments for removed code, etc. If you are certain that something is unused, you can delete it completely

And also the coding-rules and other guidelines/skills

也装了 andrej-kaparthy-guidelines, superpowers 之类的 skill ,实在是限制不了。大家有什么建议/经验吗,或者还是说回到 Claude 是更好的选择😭

315 次点击
所在节点    问与答
7 条回复
Cycle0079
1 小时 59 分钟前
是用的什么模型啊,照理说 GPT5.4 xhigh 以上没有提示词也还可以啊.
Pig930
1 小时 57 分钟前
@Cycle0079 GPT5.5 xHigh ,而且听说思考强度越低胶水代码越少
Pig930
1 小时 57 分钟前
@Cycle0079 从实现效果上来说确实还挺好的
Cycle0079
1 小时 34 分钟前
可以加到 AGENTS.md 试试是不是想要的风格

```prompt
### 编写代码时的风格要求

当你编写代码时, 采用典型的 Weak Typing 面向过程脚本代码, 代码风格类似写 kernel, 极少注释(代码本身就是最好的注释)。
```
yooomu
1 小时 23 分钟前
说实话没有太好的方法,可能训练的时候就让他偏向输出正确但是丑陋的代码
SingeeKing
1 小时 18 分钟前
我和你的感觉刚好相反,Claude 基本上就是完全不做任何的参数校验和错误处理,而我非常不喜欢…
GeruzoniAnsasu
1 小时 18 分钟前
https://www.v2ex.com/t/1202715?p=1#r_17478888
https://www.v2ex.com/t/1207049?p=1#r_17548593

亦有记录。

我的建议是回归古法,给 codex 把伪代码和函数名写好,让它根据标记修改回正常的代码。放任 codex 自流它 tm 上下文又长 review 又困难,模型还傻逼,评价是给自己找罪受

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1213319

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX