Syntic

Skills may execute instructions and code that could affect your environment. Marketplace scans reduce risk but do not guarantee safety. Always review files, run your own security checks, and use at your own risk.

LanguagesFree Safe

Rails Expert

Security Scan Summary

Status: Safe

Source: Syntic Skills registry

Automated security scan completed with no high-risk patterns detected. Manual review is still required.

About This Skill

Use when building full-stack Rails 7+ applications with Hotwire, ActiveRecord patterns, Turbo, and Stimulus.

Downloadable SKILL.md

Download SKILL.md and place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review contents, and run in a controlled environment first. Acknowledge the risk notice above to enable the download.

SKILL.md
---
name: Rails Expert
description: Use when building full-stack Rails 7+ applications with Hotwire, ActiveRecord patterns, Turbo, and Stimulus.
category: Languages
version: 1.0.0
tools: []
---

# Rails 7+ Development

Build applications using Rails 7+ conventions, Hotwire for interactivity, and ActiveRecord patterns that scale.

## Core Principles

- Follow Rails conventions; if fighting the framework, reconsider the approach
- Use Hotwire first: Turbo and Stimulus before reaching for JavaScript frameworks
- Keep models focused on associations, validations, scopes; extract business logic to service objects
- Every foreign key and `WHERE` column gets an index; database indexes are not optional

## Project Conventions

```
app/
  controllers/    # Thin controllers, one action per concern
  models/         # ActiveRecord models, validations, scopes
  services/       # Business logic (PlaceOrderService, SendNotificationService)
  queries/        # Complex query objects
  views/          # ERB templates with Turbo Frames
  components/     # ViewComponent classes for reusable UI
  jobs/           # ActiveJob background processors
```

## ActiveRecord Patterns

- Use scopes for reusable query fragments: `scope :active, -> { where(status: :active) }`
- Use `has_many :through` for many-to-many relationships; avoid `has_and_belongs_to_many`
- Use `counter_cache: true` on `belongs_to` for frequently counted associations
- Use `find_each` or `in_batches` for large datasets; never load entire tables
- Enable `config.active_record.strict_loading_by_default` to catch N+1 queries in development
- Use `strong_migrations` gem; verify safety before using `safety_assured` blocks

## Hotwire Stack

- Use Turbo Drive for SPA-like navigation without JavaScript
- Use Turbo Frames to update specific page sections: `<turbo-frame id="user_profile">`
- Use Turbo Streams for real-time updates: `broadcast_append_to`, `broadcast_replace_to`
- Use Stimulus for small JavaScript behaviors: toggles, form validation, clipboard copy
- Use `turbo_stream.erb` response templates for multi-target updates

## Background Jobs & Testing

- Use Sidekiq with Redis for background processing; configure `config.active_job.queue_adapter = :sidekiq`
- Make every job idempotent; design for at-least-once execution
- Use separate queues: `default`, `mailers`, `critical`, `low_priority`
- Set `retry: 5` with exponential backoff; move to dead letter queue after exhaustion
- Use RSpec with `factory_bot` and `shoulda-matchers`
- Use `VCR` or `WebMock` for external HTTP mocking; never hit real APIs in tests
- Use `DatabaseCleaner` with transaction strategy for speed

## Performance & Security

- Use `includes` for eager-loading; use `bullet` gem to detect N+1 queries
- Cache view fragments: `cache [user, user.updated_at]` with `touch: true`
- Use `Rails.cache.fetch` for expensive computations
- Profile with `rack-mini-profiler` and `memory_profiler` gems
- Run `bundle exec brakeman` for security vulnerability scanning

## Before Completing

- Run `bundle exec rspec` to verify specs pass
- Run `bundle exec rubocop` for code style compliance
- Run `bin/rails db:migrate:status` to verify migration state
- Run `bundle exec brakeman` for security scanning

Bundle Download

Includes SKILL.md and bundled support files where provided. Risk acknowledgement is required.

Install Targets

Syntic App

  1. 1. Create a dedicated folder for this skill in your local skills library.
  2. 2. Place SKILL.md into that folder.
  3. 3. Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1. Save SKILL.md in your local Syntic Code skills directory.
  2. 2. Keep related files in the same skill folder.
  3. 3. Run in a safe environment and validate outputs.

Source

https://github.com/rohitg00/awesome-claude-code-toolkit/blob/main/agents/language-experts/rails-expert.md

Open Source Link
Languages

Related Skills