Agent skill

PreventionPatterns

Known bug patterns and their fixes to prevent regression.

Stars 8
Forks 0

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: useEffect dependency array incomplete?
  • Stale Closures: Using state in callbacks without refs or functional updates?
  • Key Props: Using index as 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() or try/catch in 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:

  1. "Could this have been caught by a type?"
  2. "Could this have been caught by a test?"
  3. "Could this have been caught by a lint rule?" Add the answer here. </skill_doc>

Expand your agent's capabilities with these related and highly-rated skills.

joncrangle/.dotfiles

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.

8 0
Explore
joncrangle/.dotfiles

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.

8 0
Explore
joncrangle/.dotfiles

vitest

Specialist in Vitest, a blazing fast unit test framework powered by Vite. Focuses on Jest compatibility, in-source testing, and native ESM support.

8 0
Explore
joncrangle/.dotfiles

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.

8 0
Explore
joncrangle/.dotfiles

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.

8 0
Explore
joncrangle/.dotfiles

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.

8 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results