Agent skill
code
Implements features, fixes bugs, refactors code, and writes unit and integration tests. Use when asked to "implement", "fix a bug", "refactor", "add a feature", "write tests", "add test coverage", or "update code".
Stars
1
Forks
1
Install this agent skill to your Project
npx add-skill https://github.com/jiyeol-lee/dotfiles/tree/main/.opencode/skills/code
SKILL.md
Quick Start
- Implements features and fixes bugs based on requirements
- Writes unit tests and integration tests for implemented code
- Follows existing project conventions and quality standards
- Reports blockers and ambiguities to orchestrator — does NOT guess
Workflow
- Understand the requirement — read relevant existing code first
- Plan the approach — identify files to modify, edge cases, dependencies
- Implement — make changes following existing project patterns
- Verify — run through the completion checklist below
- Report — summarize what was done and any concerns
Example: Adding Error Handling to an API Endpoint
Requirement: Add proper error handling to the /users/:id endpoint
Step 1 — Read existing code:
Read src/routes/users.ts and src/middleware/errorHandler.ts
Identified: Project uses custom AppError class with status codes
Step 2 — Plan:
- Wrap handler in try/catch
- Return 404 for missing user (not generic 500)
- Validate ID parameter format before DB query
- Add unit test for each error case
Step 3 — Implement:
Edit src/routes/users.ts:
- Add ID format validation (return 400 for non-numeric)
- Add null check after DB query (return 404)
- Wrap in try/catch using existing AppError pattern
Edit src/routes/__tests__/users.test.ts:
- Add test: "returns 400 for non-numeric ID"
- Add test: "returns 404 for nonexistent user"
Step 4 — Verify:
✓ No syntax errors
✓ Edge cases handled (bad ID, missing user, DB error)
✓ Error handling uses project's AppError pattern
✓ No hardcoded values
✓ Tests cover error paths
Error Handling
| Error Type | Action |
|---|---|
| Build/Compile failure | Include error output, attempt fix up to 2x |
| File conflicts | Stop and report to orchestrator |
| Unclear requirements | Report ambiguity, do NOT guess |
| Missing dependencies | Report which dependencies are needed |
| Large files (>500 LOC) | Warn orchestrator before modifying |
| Large files (>1000 LOC) | Report as blocker, recommend splitting |
Completion Checklist
Before reporting completion, verify ALL of the following:
- Code compiles/parses without syntax errors
- Edge cases are handled appropriately
- Error handling is in place (no silent failures)
- Inline comments explain complex logic
- Code follows existing project conventions (naming, patterns, structure)
- No hardcoded credentials or secrets
- Tests cover the new/changed behavior (when applicable)
Constraints (Never Allowed)
- Git config modifications
- Hardcoded credentials or secrets
- Silent failures (every error must be caught and handled or propagated)
- Using sed/perl/awk/tr for multi-file replacements (use grep + edit)
- Guessing when requirements are unclear — ask instead
Didn't find tool you were looking for?