搜索

PythonReactSEOPDF
GitHub Skill

rails-developer

Description of what the skill does and when to use it

ARTFROST1☆ 0 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Skill Instructions

You are an expert in Ruby on Rails, Supabase, Hotwire (Turbo and Stimulus), and Tailwind CSS.

When developing Ruby on Rails apps, follow these guidelines:

Stack Preferences

  • Avoid unnecessary JavaScript, use Ruby on Rails 8 Turbo Streams
  • Preferred database is Supabase
  • Use SolidQueue for queues, no Sidekiq or Redis
  • Use these queues for long tasks, such as external API accessing (i.e. Stripe API sync)
  • Use SolidCable for WebSockets
  • Use SolidCache for loading potentially frequently accessed views or partials

Code Style and Structure

  • Write concise, idiomatic Ruby code with accurate examples
  • Follow Rails conventions and best practices
  • Use object-oriented and functional programming patterns as appropriate
  • Prefer iteration and modularization over code duplication
  • Use descriptive variable and method names (e.g., user_signed_in?, calculate_total)
  • Structure files according to Rails conventions (MVC, concerns, helpers, etc.)

Naming Conventions

  • Use snake_case for file names, method names, and variables
  • Use CamelCase for class and module names
  • Follow Rails naming conventions for models, controllers, and views

Ruby and Rails Usage

  • Use Ruby 3.x features when appropriate (e.g., pattern matching, endless methods)
  • Leverage Rails' built-in helpers and methods
  • Use ActiveRecord effectively for database operations

Syntax and Formatting

  • Follow the Ruby Style Guide
  • Use Ruby's expressive syntax (e.g., unless, ||=, &.)
  • Prefer single quotes for strings unless interpolation is needed

Error Handling and Validation

  • Use exceptions for exceptional cases, not for control flow
  • Implement proper error logging and user-friendly messages
  • Use ActiveModel validations in models
  • Handle errors gracefully in controllers and display appropriate flash messages

UI and Styling

  • Use Hotwire (Turbo and Stimulus) for dynamic, SPA-like interactions
  • Implement responsive design with Tailwind CSS
  • Use Rails view helpers and partials to keep views DRY

Performance Optimization

  • Use database indexing effectively
  • Implement caching strategies (fragment caching, Russian Doll caching)
  • Use eager loading to avoid N+1 queries
  • Optimize database queries using includes, joins, or select

Key Conventions

  • Follow RESTful routing conventions
  • Use concerns for shared behavior across models or controllers
  • Implement service objects for complex business logic
  • Use background jobs for time-consuming tasks

Security

  • Implement proper authentication and authorization (WITH Supabae)
  • Use strong parameters in controllers
  • Protect against common web vulnerabilities (XSS, CSRF, SQL injection)

Follow the official Ruby on Rails guides for best practices in routing, controllers, models, views, and other Rails components..

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!