Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问许可证需确认审计通过

rails-stack-conventionsRails stack conventions 命令行

Agent Skill

rails-stack-conventions 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

792

周安装

34

GitHub Stars

15

下载量

277
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:rails-stack-conventions(Rails stack conventions 命令行)
来源仓库:https://github.com/igmarin/rails-agent-skills
仓库路径:skills/rails-stack-conventions
安装命令:
npx skills add https://github.com/igmarin/rails-agent-skills --skill rails-stack-conventions
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/igmarin/rails-agent-skills --skill rails-stack-conventions

简介

rails-stack-conventions 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 它属于前端设计类工具,适用于多种宿主环境。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Rails Stack Conventions

When writing or generating code for this project, follow these conventions. Stack: Ruby on Rails, PostgreSQL, Hotwire (Turbo + Stimulus), Tailwind CSS.

Style: If the project uses a linter, treat it as the source of truth for formatting. For cross-cutting design principles (DRY, YAGNI, structured logging, rules by directory), use rails-code-conventions.

HARD-GATE: Tests Gate Implementation

ALL new code MUST have its test written and validated BEFORE implementation.
  1. Write the spec: bundle exec rspec spec/[path]_spec.rb
  2. Verify it FAILS — output must show the feature does not exist yet
  3. Write the implementation code
  4. Verify it PASSES — run the same spec and confirm green
  5. Refactor if needed, keeping tests green
See rspec-best-practices for the full gate cycle.

Feature Development Workflow

For a typical feature, compose stack patterns in this order:

  1. Model — add validations, associations, scopes; eager-load with includes for any association used in loops
  2. Service object — extract non-trivial business logic from the controller (see ruby-service-objects)
  3. Controller — keep actions thin; delegate to services; respond with turbo_stream and html formats
  4. View / Turbo wiring — wrap dynamic sections in <turbo-frame> tags; broadcast turbo_stream responses from the controller
  5. Stimulus — add a controller only when client-side interactivity cannot be handled by Turbo alone
  6. Tailwind — apply utility classes to the view; extract repeated patterns into partials or Stimulus targets

Each step should remain testable in isolation before wiring to the next layer.

Quick Reference

AspectConvention
StyleRuboCop project config when present; otherwise Ruby Style Guide, single quotes
ModelsMVC — service objects for complex logic, concerns for shared behavior
QueriesEager load with includes; never iterate over associations without preloading
FrontendHotwire (Turbo + Stimulus); Tailwind CSS
TestingRSpec with FactoryBot; TDD
SecurityStrong params, guard XSS/CSRF/SQLi; Devise/Pundit for auth

Key Code Patterns

Hotwire: Turbo Frames

<%# Wrap a section to be replaced without a full page reload %>
<turbo-frame id="order-<%= @order.id %>">
  <%= render "orders/details", order: @order %>
</turbo-frame>

<%# Link that targets only this frame %>
<%= link_to "Edit", edit_order_path(@order), data: { turbo_frame: "order-#{@order.id}" } %>

Hotwire: Turbo Streams (broadcast from controller)

respond_to do |format|
  format.turbo_stream do
    render turbo_stream: turbo_stream.replace(
      "order_#{@order.id}",
      partial: "orders/order",
      locals: { order: @order }
    )
  end
  format.html { redirect_to @order }
end

Avoiding N+1 — Eager Loading

# BAD — triggers one query per order
@orders = Order.where(user: current_user)
@orders.each { |o| o.line_items.count }

# GOOD — single JOIN via includes
@orders = Order.includes(:line_items).where(user: current_user)

Service Object (complex business logic out of the controller)

# Controller stays thin — delegate to service
result = Orders::CreateOrder.call(user: current_user, params: order_params)
if result[:success]
  redirect_to result[:order], notice: "Order created"
else
  @order = Order.new(order_params)
  render :new, status: :unprocessable_entity
end

See ruby-service-objects for the full .call pattern and response format.

Security

  • Strong params on every controller action that writes data
  • Guard against XSS (use html_escape, avoid raw), CSRF (Rails default on), SQLi (use AR query methods or sanitize_sql for raw SQL)
  • Auth: Devise for authentication, Pundit for authorization

Common Mistakes

MistakeCorrect approach
Business logic in viewsUse helpers, presenters, or Stimulus controllers
N+1 queries in loopsEager load with includes before the loop
Raw SQL without parameterizationUse AR query methods or ActiveRecord::Base.sanitize_sql
Skipping FactoryBot for "quick" testFixtures are brittle — always use factories

Red Flags

  • Controller action with more than 15 lines of business logic
  • Model with no validations on required fields
  • View with embedded Ruby conditionals spanning 10+ lines
  • No includes on associations used in loops
  • Hardcoded strings that belong in I18n

Integration

SkillWhen to chain
rails-code-conventionsFor design principles, structured logging, and path-specific rules
rails-code-reviewWhen reviewing existing code against these conventions
ruby-service-objectsWhen extracting business logic into service objects
rspec-best-practicesFor testing conventions and full red/green/refactor TDD cycle
rails-architecture-reviewFor structural review beyond conventions

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.87%
按下载量换算91

Claude

31.27%
按下载量换算87

Cursor

20.31%
按下载量换算56

Gemini CLI

10.13%
按下载量换算28

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills