让 Claude 在 Web 开发中更具自主性的提示
3 分•作者: louison11•5 个月前
让你的 Claude 把这些内容放到 MEMORY.md 文件里,以便进行更自主的开发会话。<p>这让我的 Claude 在过去一周的工作效率提高了 2 倍。很多时候,它构建完东西后,我会发现一个 bug。现在,它自己就能发现 bug,并反复迭代,直到它确定一切都完美运行。这很简单,但它在自主性方面提升到了一个新的水平。<p>提示:<p>“将以下内容添加到你的 MEMORY.md 文件中(或进行调整以更好地匹配我们的项目):<p>## 关键规则<p>### 交付前务必测试<p>- 永远不要在没有自己验证的情况下告诉用户某件事有效<p>- 每次代码更改后:重新构建、重启服务器,然后测试实际页面/API 响应<p>- 重新构建 Next.js 后:务必重启服务器——旧构建中的过时 JS 代码块会导致客户端错误<p>- 通过公共 URL 进行测试,而不仅仅是 localhost<p>- 同时检查服务器端渲染(curl 获取 HTML)和客户端(验证 JS 代码块加载)<p>- *使用 PLAYWRIGHT 进行 UI 测试*——不要仅仅 curl 页面。使用 Playwright 和无头 Chrome 实际渲染页面、点击按钮、填写表单并截取屏幕截图。这是唯一可以捕获客户端 JS 错误、损坏的布局和 UX 问题的途径。<p>- 屏幕截图保存到 `/tmp/playwright-screenshots/`——阅读它们以直观地验证 UI<p>- 不要让用户测试。在交付之前自己找到 bug。”
查看原文
Tell your Claude to put this in MEMORY.md file for much more autonomous development sessions.<p>It's made my Claude work 2x easier in the last week. So many times it'd build something then I'd find a bug. Now it finds the bugs on its own and reiterates until it's sure everything works perfectly. It's so simple but it brings it to the next level in terms of autonomy.<p>Prompt:<p>"Add this to your MEMORY.md file (or adapt the following to match our project best):<p>## Critical Rules<p>### Always test before delivering<p>- NEVER tell the user something works without verifying it yourself first<p>- After every code change: rebuild, restart server, then test the actual page/API response<p>- After rebuilding Next.js: ALWAYS restart the server — stale JS chunks from old builds cause client-side errors<p>- Test through the public URL, not just localhost<p>- Check both server-side rendering (curl the HTML) AND client-side (verify JS chunks load)<p>- *USE PLAYWRIGHT FOR UI TESTING* — don't just curl pages. Use Playwright with headless Chrome to actually render pages, click buttons, fill forms, and take screenshots. This is the ONLY way to catch client-side JS errors, broken layouts, and UX issues.<p>- Screenshots go to `/tmp/playwright-screenshots/` — read them to visually verify the UI<p>- Do NOT ask the user to test. Find the bugs yourself before delivering."