- Home
- Skills
- Kaakati
- Rails Enterprise Dev
- Implementation Safety
implementation-safety_skill
- Shell
6
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill kaakati/rails-enterprise-dev --skill implementation-safety- SKILL.md7.2 KB
Overview
This skill provides production-ready safety checklists for Rails implementation to catch common bugs and vulnerabilities before marking files complete. It focuses on nil safety, ActiveRecord patterns, security, error handling, performance, and migration safety. Use it as a quick gate during implementation to reduce runtime failures and regressions.
How this skill works
The skill presents concise, actionable checklists and code patterns to inspect each file during Phase 4 (Implementation). For a given file you review, apply the relevant checklist items (nil checks, eager loading, strong parameters, specific exception handling, query optimizations, migration safety). Fix violations, re-run tests, and only mark the file complete after all checks pass.
When to use it
- Before marking any implementation file complete during Phase 4
- When adding or changing ActiveRecord queries, associations, or scopes
- When writing controllers, services, or API endpoints that accept user input
- Before committing migrations or schema-altering changes
- When diagnosing intermittent NoMethodError, N+1 queries, or slow endpoints
Best practices
- Use safe navigation (&.) and explicit nil handling for potentially missing objects
- Eager-load associations (includes/joins) and add indexes to avoid N+1 and slow queries
- Enforce strong parameters and parameterized queries to prevent SQL injection and mass assignment
- Rescue specific exceptions, log context, and return meaningful error responses
- Use pluck, exists?, and find_each to minimize memory and improve throughput
- Make migrations reversible, add null constraints and indexes, and avoid destructive operations in deploys
Example use cases
- Review a controller that consumes user params to ensure strong parameters and no SQL interpolation
- Inspect a model scope or service object for N+1 risks and add includes or counter caches
- Validate a migration for indexes, null constraints, and reversible operations before deploying
- Audit error handling in API endpoints to replace broad rescues with specific exceptions and proper status codes
- Optimize a background job that processes millions of records by switching from load-all to find_each or pluck
FAQ
The checklists are primarily manual inspections to apply contextual judgment. Combine them with automated linters, Bullet for N+1 detection, and test coverage to improve automation.
Which checklist should I apply first?
Start with nil safety and ActiveRecord checks for runtime stability, then run security, error handling, performance, and migration checks as relevant to the change.