發表文章

Should You Let AI Write Your Tests? An Honest Take

Yes, but only for the parts that don't decide whether your code is correct. AI is excellent at the mechanical layer of testing: scaffolding, mocks, boilerplate, filling coverage gaps. It's dangerous the moment it writes the assertions , because it tends to test what the code does, not what the code should do. That distinction is the whole argument. I've been letting AI write tests on real projects for months now, and my opinion landed somewhere uncomfortable for both camps. The “never let a robot near your tests” crowd is wrong. So is the “generate the whole suite and move on” crowd. The truth is in the boring middle, and it took a few bugs slipping through green test runs for me to see exactly where the line sits. What does AI actually do well in testing? AI shines at the repetitive, low-judgment parts of a test file: setup, teardown, mock wiring, fixtures, and the dozen near-identical cases you'd otherwise copy-paste. In my testing, this is where it save...

AI Coding Agents vs Chatbots: When to Use Which

A chatbot answers; an agent acts. A chat model like ChatGPT or Claude hands you text you copy-paste yourself. A coding agent like Claude Code reads your real files, edits them, and runs commands on your machine. Use the chatbot to think and learn; use the agent to actually change code. It took me a while to feel this difference in my hands rather than just understand it on paper. For months I pasted snippets back and forth into a chat window and called it “coding with AI.” The first time I let an agent edit files and run my test suite directly, the workflow felt like a different category of tool entirely. Here's how I now decide which one to open. What's the actual difference between a chatbot and an agent? The core difference is autonomy and access. A chatbot is a conversation: it produces text, and you are the hands that copy, paste, save, and run things. An agent has hands of its own: it can open your files, write changes to disk, run terminal commands, read the o...

How to Get Pixel-Perfect UI From Claude Code (Stop Describing Buttons in Words)

圖片
AI coding tools don't have a taste problem. They have a spec problem. Ask Claude Code for “a clean, modern button” and you get a coin flip. Give it exact values (radius, padding, per-state colors, transition timing) and the output matches your design almost deterministically. In my blind test, a spec-grade prompt reproduced a button with all 11 measured CSS properties identical. I ship UI with Claude Code and Cursor daily, and for months my least favorite loop was the visual one: generate a component, squint at it, then spend twenty minutes typing follow-ups like “a bit rounder” and “the hover feels too dark.” The logic was right on the first try; the pixels never were. So I stopped describing components in adjectives and started writing specs. Here's the exact method, and the experiment that convinced me it works. Why do AI tools get UI “almost right”? Because adjectives are lossy. When you write “modern button...