我给 AI 编码智能体加了 5 个 Skill,它不再反复重写同一批文件
Original title: I Gave My AI Coding Agent 5 Skills and It Stopped Rewriting the Same Files
The title and summary in the selected language are awaiting translation.
作者为 AI 编码智能体配置了 5 个 Skill,解决三周后智能体反复重写同一个 helper 文件、忘记项目约定、不写测试的问题。
Most AI coding setup advice stops at "install Claude Code." That's the easy part.
The hard part is what happens three weeks in: the agent keeps rewriting the same helper file, forgets the project conventions, writes code without tests, and you spend more time reverting than shipping.
Skills are just instructions your agent reads
An agent skill is a markdown file with a name, a description, and a procedure. No plugin system, no framework, no build step. Drop it in a directory the agent watches and it applies that procedure when the task matches.
The difference is between hoping the agent does the right thing and telling it exactly what right means for your codebase.
The five that changed my workflow
feature-plan - before writing any code, produce a plan: what changes, which files, what could break. Skipping this is how you get 400 lines of code nobody wanted.
test-write - write the test first, then make it pass. The skill encodes the pattern and makes the agent follow it instead of retrofitting tests onto code it already wrote.
code-review - a review pass with a specific checklist. Catches the things you skim past at 1am: unhandled null, a missing await, an N+1 query that won't matter until you have 10,000 users.
bug-fix - reproduce, isolate, fix, verify. In that order. The most common waste in agent-assisted debugging is changing code before you can reproduce the bug, then changing it again.
refactor - safe refactoring with verification at each step, so cleanup doesn't become an outage.
Wiring it up
Drop the folder in. Point your agent at the skills directory. For Claude Code the config is a JSON file; for Cursor there's a .cursorrules file. Both are in the pack.
The real payoff isn't the individual procedures. It's that they're consistent, so your agent stops improvising a different approach every session.
What this doesn't replace
Type hints, tests, and code review. Skills make your agent more consistent, not more competent. A skill that says "write good code" is useless; a skill that says "before editing any file, read CLAUDE.md and follow the existing naming convention" changes behavior.
Be specific or be ignored.
The one that gets skipped
Nobody wires up their MCP servers and skills on day one. They install the editor, write a prompt, feel productive, and never revisit it.
The setup takes twenty minutes. Not doing it costs you the same three weeks of drift every three weeks, forever.
Source: DEV Community · MCP · dev.to