You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
posts/2025/ai-assisted-coding-rhythm/
Karpathy 的 AI 辅助编程心法,总结下来有七个关键步骤
第一步:上下文拉满 (Stuff everything relevant into context)
这是基础。你需要把项目所有相关的信息都喂给 AI。对于大型项目,这可能需要花些时间。如果是小项目,可以直接打包所有相关文件。Karpathy 甚至给出了一个 files-to-prompt 工具的示例命令: files-to-prompt . -e ts -e tsx -e css -e md --cxml --ignore node_modules -o prompt.xml 这个命令大致意思是,将当前目录下所有的 .ts, .tsx, .css, .md 文件内容(忽略 node_modules 文件夹)打包成一个 XML 格式的 prompt 文件,供 AI 读取。核心思想是:给 AI 足够的全貌信息。
第二步:策略先行,而非代码 (Describe the next single, concrete incremental change)
明确你想要实现的下一个具体、增量的改动是什么。关键点来了:不要直接让 AI 写代码。相反,你应该要求 AI 提出几种实现该目标的高级方法,并分析各自的优缺点(pros/cons)。Karpathy 指出,LLM 的判断力并非总是最佳,通常实现一个功能有好几种方式,先看选项再决定。如果需要,可以再让 AI 把选定的方法具体化
第三步:选定方案,获取初稿 (Pick one approach, ask for first draft code)
https://tubaozi.top/posts/2025/ai-assisted-coding-rhythm/
Beta Was this translation helpful? Give feedback.
All reactions