skills/agent-engineering/SKILL.md
Battle-tested engineering principles for AI coding agents. Covers plan-first workflow, subagent delegation, self-improvement loops, verification gates, elegant solutions, autonomous bug fixing, and structured task management. Use when configuring agent behavior, writing AGENTS.md files, or improving agent reliability and code quality.
npx skillsauth add ckorhonen/claude-skills agent-engineeringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Battle-tested principles for AI coding agents that produce reliable, high-quality work.
AGENTS.md / CLAUDE.md / CURSOR.md file for a projectWhen to skip: Simple, single-file edits with obvious solutions.
Example plan format (tasks/todo.md):
## Task: Migrate auth to JWT
### Plan
- [ ] Audit current session-based auth flow
- [ ] Design JWT payload schema (user_id, roles, expiry)
- [ ] Implement token generation in auth service
- [ ] Update middleware to validate JWT
- [ ] Write tests for edge cases (expired, invalid, revoked)
- [ ] Update docs
### Done
- [x] Audit complete — 4 routes need updating
Key insight: Context window pollution is the #1 cause of agent quality degradation. Subagents are cheap — use them.
When to spawn a subagent vs. do it inline:
| Use a subagent | Do inline | |---|---| | Research task (>10 files) | Simple 1-file edit | | Independent parallel work | Quick config change | | Long-running compilation or test run | Single command with clear output | | Isolated experiment (risky change) | Trivial refactor |
After ANY correction from the user:
tasks/lessons.md (or equivalent) with the pattern## Lesson: [Short title]
- **Trigger:** What went wrong
- **Rule:** What to do instead
- **Added:** [date]
Example lesson:
## Lesson: Don't mutate shared config objects
- **Trigger:** Modified `config.defaults` directly, breaking other callers
- **Rule:** Always deep-clone config before modifying; treat config objects as read-only
- **Added:** 2026-03-15
This is the most underused agent pattern. Most agents make the same mistakes repeatedly because they have no feedback mechanism. A lessons file closes the loop.
Anti-pattern: "I've made the changes" without evidence they work.
Verification checklist before marking done:
npm test / pytest / go test ./...)The balance: Elegance matters for code that will be maintained. For throwaway scripts, ship it.
Elegance signals: Code reads like prose. New engineers understand it without explanation. The abstraction boundaries are obvious. There's nothing to add, and nothing to remove.
Over-engineering signals: 3 abstraction layers for a 20-line problem. Generic framework for a one-time use. "We might need this later" reasoning.
Rule of thumb: If you can see the error and understand the codebase, fix it. Only ask when genuinely blocked.
Blocked means:
For any non-trivial task, follow this 6-step cycle:
tasks/todo.md with checkable itemstasks/todo.mdtasks/lessons.md after correctionsAgent keeps retrying the same failing approach with minor variations. Fix: Stop, re-read the error, consult the lessons file, try a fundamentally different approach.
After 20+ tool calls, the agent loses track of the original goal and starts solving adjacent problems. Fix: Re-read the original task at each major milestone.
Agent marks a task done based on "the code looks right" without running it. Fix: Always run tests/commands, never assume.
Fixing a bug, agent also refactors unrelated code "while it's in there." Fix: One change, one commit. Refactors go in separate PRs.
Command exits with 0 but nothing actually changed (e.g., dry-run mode left on). Fix: Verify the change happened (check logs, diff, reload config).
Add the relevant principles directly to your project's agent configuration:
## Engineering Standards
### Before Starting
- [ ] Read tasks/lessons.md for this project
- [ ] Plan non-trivial work in tasks/todo.md
- [ ] Verify plan before implementing
### While Working
- [ ] One task per subagent
- [ ] Verify each step works before moving on
- [ ] Track progress in todo.md
### Before Marking Done
- [ ] Run tests / check logs
- [ ] "Would a staff engineer approve this?"
- [ ] Update lessons.md if any corrections were made
These principles map well to PR review automation:
For a new codebase with no tasks/ directory:
mkdir tasks
echo "# Todo\n\n(empty)" > tasks/todo.md
echo "# Lessons\n\n(empty)" > tasks/lessons.md
Then add both files to .gitignore if they're agent-local, or track them if the team shares them.
Inspired by community-shared agent engineering patterns (March 2026).
documentation
Create or expand an Idea.md / IDEA.md file from a rough description, existing repo, conversation history, notes, or other early-stage product inputs. Use when the user asks to "write an Idea.md", "turn this into an idea file", "capture this product idea", "expand this concept", or wants a repo-grounded concept brief before validation, PRD, or implementation work.
development
Write structured implementation plans from specs or requirements before touching code. Use when given a spec, requirements doc, or feature description, when user says "plan this out", "write a plan for", "how should we implement", or before starting any multi-step coding task.
testing
Expert guidance for video editing with ffmpeg, encoding best practices, and quality optimization. Use when working with video files, transcoding, remuxing, encoding settings, color spaces, or troubleshooting video quality issues.
development
Opinionated constraints for building better interfaces with agents. Use when building UI components, implementing animations, designing layouts, reviewing frontend accessibility, or working with Tailwind CSS, motion/react, or accessible primitives like Radix/Base UI.