rails
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRuby on Rails Framework Expert
Ruby on Rails 框架专家
Category
分类
Backend & Frameworks
后端与框架
⚠️ MANDATORY COMPLIANCE ⚠️
⚠️ 强制合规要求 ⚠️
CRITICAL: The 6-step workflow outlined in this document MUST be followed in exact order for EVERY Rails engagement. Skipping steps or deviating from the procedure will result in incomplete or unsafe guidance. This is non-negotiable.
关键提示:对于每一次Rails相关工作,必须严格按照本文档中列出的6步工作流顺序执行。跳过步骤或偏离流程将导致指导不完整或存在安全隐患,这是不可协商的要求。
File Structure
文件结构
- SKILL.md (this file): Main instructions and MANDATORY workflow
- SKILL.md(本文档):主要说明与强制工作流
Step 1: Initial Analysis
步骤1:初始分析
Gather inputs and determine scope and requirements.
收集输入信息,确定项目范围与需求。
Step 2: Load Memory
步骤2:加载内存数据
Load project-specific memory via MemoryStore interface.
通过MemoryStore接口加载项目专属内存数据。
Step 3: Load Context
步骤3:加载上下文信息
Load relevant context files via ContextProvider interface.
通过ContextProvider接口加载相关上下文文件。
Step 4: Core Implementation
步骤4:核心实现
Execute the skill-specific core action.
执行该技能专属的核心操作。
Step 5: Generate Output
步骤5:生成输出成果
Create deliverables and save to following OUTPUT_CONVENTIONS.md.
/claudedocs/按照OUTPUT_CONVENTIONS.md的要求创建交付物并保存至目录。
/claudedocs/Step 6: Update Memory
步骤6:更新内存数据
Update project memory with new patterns and decisions.
将新的模式与决策更新至项目内存中。
Interface References
接口参考
- Context: Loaded via ContextProvider Interface
- Memory: Accessed via MemoryStore Interface
- Shared Patterns: Shared Loading Patterns
- 上下文:通过ContextProvider 接口加载
- 内存:通过MemoryStore 接口访问
- 共享模式:共享加载模式
Focus Areas
重点领域
- Rails Conventions: MVC structure, routes, concerns, service objects
- ActiveRecord: associations, validations, callbacks, query tuning
- Background Jobs: ActiveJob adapters, Sidekiq patterns, retries
- Security: strong params, auth, CSRF, secrets management
- Performance: caching layers, N+1 elimination, instrumentation
- Testing: RSpec/Minitest, factories, system tests
- Deployment: assets, environment configs, CI/CD
- Rails 约定:MVC结构、路由、关注点、服务对象
- ActiveRecord:关联关系、验证、回调、查询调优
- 后台任务:ActiveJob适配器、Sidekiq模式、重试机制
- 安全:强参数、身份验证、CSRF防护、密钥管理
- 性能:缓存层、N+1查询消除、性能监控
- 测试:RSpec/Minitest、工厂类、系统测试
- 部署:资源管理、环境配置、CI/CD流程
Purpose
目的
Ruby on Rails development guidance for building reliable, secure web applications. Covers Rails conventions, MVC architecture, ActiveRecord patterns, background jobs, performance, testing, and deployment.
为构建可靠、安全的Web应用程序提供Ruby on Rails开发指导。涵盖Rails约定、MVC架构、ActiveRecord模式、后台任务、性能调优、测试与部署。
MANDATORY WORKFLOW (MUST FOLLOW EXACTLY)
强制工作流(必须严格执行)
⚠️ STEP 1: Scope the Rails Engagement (REQUIRED)
⚠️ 步骤1:确定Rails项目范围(必填)
YOU MUST:
- Identify Rails version and deployment target
- Clarify the domain (web app, API-only) and primary pain points
- Determine background job stack and database choice
- Ask clarifying questions on routes, models, and auth
- Think through your implementation plan in a block before writing any files or recommending changes
<thinking>
DO NOT PROCEED WITHOUT A CLEAR SCOPE AND PLAN
你必须:
- 确认Rails版本与部署目标
- 明确业务领域(Web应用、纯API)与主要痛点
- 确定后台任务栈与数据库选择
- 针对路由、模型与身份验证提出澄清问题
- 在编写任何文件或推荐修改之前,在块中梳理你的实现方案
<thinking>
未明确范围与方案前,不得继续推进
⚠️ STEP 2: Load Project Memory (REQUIRED)
⚠️ 步骤2:加载项目内存数据(必填)
YOU MUST:
- Load memory with
memoryStore.getSkillMemory("rails", "{project-name}") - Review cross-skill memory with
memoryStore.getByProject("{project-name}") - Note existing conventions and known issues
DO NOT PROCEED WITHOUT CHECKING MEMORY
你必须:
- 通过加载内存数据
memoryStore.getSkillMemory("rails", "{project-name}") - 通过查看跨技能内存数据
memoryStore.getByProject("{project-name}") - 记录现有约定与已知问题
未检查内存数据前,不得继续推进
⚠️ STEP 3: Load Context (REQUIRED)
⚠️ 步骤3:加载上下文信息(必填)
YOU MUST:
- Use for architecture patterns
contextProvider.getDomainIndex("engineering") - Pull security context with
contextProvider.getCrossDomainContext("engineering", ["auth", "security"]) - Stay within the declared file budget
DO NOT PROCEED WITHOUT RELEVANT CONTEXT
你必须:
- 使用获取架构模式
contextProvider.getDomainIndex("engineering") - 通过获取安全上下文
contextProvider.getCrossDomainContext("engineering", ["auth", "security"]) - 遵守已声明的文件预算限制
未加载相关上下文前,不得继续推进
⚠️ STEP 4: Analyze Architecture & Code Paths (REQUIRED)
⚠️ 步骤4:分析架构与代码路径(必填)
YOU MUST:
- Review routes, controllers, and service objects
- Inspect ActiveRecord models, scopes, and callbacks
- Evaluate background job flows and retry strategies
- Check caching and instrumentation setup
DO NOT PROCEED WITHOUT A COMPLETE ANALYSIS
你必须:
- 审核路由、控制器与服务对象
- 检查ActiveRecord模型、作用域与回调
- 评估后台任务流与重试策略
- 核查缓存与监控设置
未完成完整分析前,不得继续推进
⚠️ STEP 5: Provide Rails Guidance (REQUIRED)
⚠️ 步骤5:提供Rails相关指导(必填)
YOU MUST:
- Recommend improvements to models, services, and jobs
- Provide security and performance guidance
- Suggest testing strategies for critical paths
DO NOT PROVIDE GENERIC OR UNSUPPORTED RECOMMENDATIONS
你必须:
- 针对模型、服务与任务提出改进建议
- 提供安全与性能优化指导
- 针对关键路径提出测试策略建议
不得提供通用或无依据的建议
⚠️ STEP 6: Generate Output & Update Memory (REQUIRED)
⚠️ 步骤6:生成输出并更新内存数据(必填)
YOU MUST:
- Produce a structured report in
/claudedocs/rails_{project}_{YYYY-MM-DD}.md - Follow the naming conventions in
../OUTPUT_CONVENTIONS.md - Update memory with :
memoryStore.update("rails", "{project-name}", ...)project_overview.mddomain_models.mdjob_queue_notes.mdperformance_notes.md
DO NOT FINISH WITHOUT SAVING OUTPUT AND UPDATING MEMORY
你必须:
- 在生成结构化报告
/claudedocs/rails_{project}_{YYYY-MM-DD}.md - 遵循中的命名规范
../OUTPUT_CONVENTIONS.md - 通过更新内存数据:
memoryStore.update("rails", "{project-name}", ...)project_overview.mddomain_models.mdjob_queue_notes.mdperformance_notes.md
未保存输出成果与更新内存数据前,不得结束任务
Compliance Checklist
合规检查清单
Before completing ANY Rails task, verify:
- Step 1: Scope defined and plan documented in
<thinking> - Step 2: Project memory loaded via
memoryStore.getSkillMemory() - Step 3: Context loaded via
contextProvider - Step 4: Architecture and code paths analyzed
- Step 5: Rails guidance provided with actionable recommendations
- Step 6: Output saved to and memory updated
/claudedocs/
FAILURE TO COMPLETE ALL STEPS INVALIDATES THE GUIDANCE
在完成任何Rails任务之前,请验证:
- 步骤1:已定义范围并在块中记录方案
<thinking> - 步骤2:已通过加载项目内存数据
memoryStore.getSkillMemory() - 步骤3:已通过加载上下文信息
contextProvider - 步骤4:已完成架构与代码路径分析
- 步骤5:已提供可执行的Rails指导建议
- 步骤6:已将输出保存至并更新内存数据
/claudedocs/
未完成所有步骤的指导建议视为无效
Version History
版本历史
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2026-02-12 | Initial release for Rails framework guidance |
| 版本 | 日期 | 变更内容 |
|---|---|---|
| 1.0.0 | 2026-02-12 | 初始发布Rails框架指导文档 |