Agent skill
PreventionPatterns
Known bug patterns and their fixes to prevent regression.
Install this agent skill to your Project
npx add-skill https://github.com/joncrangle/.dotfiles/tree/main/dot_config/opencode/skills/prevention-patterns
SKILL.md
<skill_doc>
Prevention Patterns
When reviewing code or debugging, check against these known issues.
🛡️ React/Frontend Patterns
- Missing Dependency:
useEffectdependency array incomplete? - Stale Closures: Using state in callbacks without refs or functional updates?
- Key Props: Using
indexas key in list rendering? (Bad for re-ordering). - Zod Schema mismatch: Frontend types not aligned with Backend API responses?
🛡️ Node/Backend Patterns
- Unhandled Promise: Missing
.catch()ortry/catchin async handlers? - SQL Injection: String concatenation in queries instead of parameters?
- Env Vars: Hardcoded secrets instead of
process.env? - Race Conditions: Parallel DB updates to the same record?
🛡️ General Code Health
- Slop Variables:
data,info,temp,obj. Rename them. - Deep Nesting: More than 3 levels of indentation? Refactor/Extract.
- Dead Code: Imports unused? Functions never called?
🧪 Post-Mortem Protocol
When a bug is fixed, ask:
- "Could this have been caught by a type?"
- "Could this have been caught by a test?"
- "Could this have been caught by a lint rule?" Add the answer here. </skill_doc>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
lang-javascript
This skill should be used when the user asks to "write JavaScript", "debug a Node.js/Bun app", "create a Hono server", "configure Biome", "run tests with bun test", or mentions .js/.mjs files. Covers ES2024+, Bun, and Hono patterns.
opentui
Comprehensive OpenTUI skill for building terminal user interfaces. Covers the core imperative API, React reconciler, and Solid reconciler. Use for any TUI development task including components, layout, keyboard handling, animations, and testing.
vitest
Specialist in Vitest, a blazing fast unit test framework powered by Vite. Focuses on Jest compatibility, in-source testing, and native ESM support.
lang-typescript
This skill should be used when the user asks to "write TypeScript", "debug TypeScript", "create a SolidJS component", "configure TanStack Start", "validate data with Valibot", or mentions .ts/.tsx files. Covers TypeScript 5.9+, SolidJS, and TanStack patterns.
just-cli
This skill should be used when the user asks to "create a justfile", "write just recipes", "configure just settings", "add just modules", "use just attributes", "set up task automation", mentions justfile, just command runner, or task automation with just.
lang-go
Go 1.23+ development specialist covering Chi, GORM, and concurrent programming patterns. Use when building high-performance microservices, CLI tools, or cloud-native applications.
Didn't find tool you were looking for?