using-rails-ai
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsing Rails-AI: Rails Domain Layer on Superpowers Workflows
使用Rails-AI:基于Superpowers工作流的Rails领域层
<EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
⚠️ DEPENDENCY CHECK: Superpowers Required
⚠️ 依赖项检查:必须安装Superpowers
Rails-AI requires the Superpowers plugin to function.
Before starting ANY work, verify Superpowers is installed by attempting to use a Superpowers skill. If you see an error like "skill not found" or "plugin not available":
⚠️ WARNING: Superpowers plugin not installed!
Rails-AI cannot function without Superpowers. Please install it:
/plugin marketplace add obra/superpowers
/plugin install superpowersThen restart Claude Code.
Why this matters: Rails-AI provides WHAT to build (Rails domain knowledge). Superpowers provides HOW to build it (TDD, debugging, planning, code review). Without Superpowers, you cannot follow the mandatory workflows.
If Superpowers is installed, proceed normally.
Rails-AI需要Superpowers插件才能运行。
在开始任何工作之前,请尝试使用一项Superpowers技能来验证它是否已安装。如果你看到类似“skill not found”或“plugin not available”的错误:
⚠️ 警告:未安装Superpowers插件!
没有Superpowers,Rails-AI无法运行。请按照以下步骤安装:
/plugin marketplace add obra/superpowers
/plugin install superpowers然后重启Claude Code。
为什么这很重要: Rails-AI提供要构建的内容(Rails领域知识)。Superpowers提供构建的方法(TDD、调试、规划、代码评审)。没有Superpowers,你将无法遵循强制工作流。
如果Superpowers已安装,请正常继续。
MANDATORY: Use Superpowers Foundation First
强制要求:先使用Superpowers基础功能
Rails-AI builds on Superpowers. You MUST use the foundation before doing ANY work.
FIRST ACTION when starting any Rails work:
- Use skill (Skill tool)
superpowers:using-superpowers - This establishes mandatory skill-usage protocol
- Then use relevant rails-ai domain skills (see table below)
Why use superpowers:using-superpowers?
- Enforces checking for skills BEFORE any task
- Establishes discipline of using skills with Skill tool
- Prevents rationalizing away skill usage
- Provides proven workflow framework
Without using superpowers:using-superpowers first:
- You will skip using skills when you should
- You will rationalize that tasks are "too simple" for skills
- You will operate without the proven process framework
Rails-AI基于Superpowers构建。在开展任何工作之前,你必须先使用其基础功能。
开始任何Rails工作的第一步:
- 使用技能(Skill工具)
superpowers:using-superpowers - 这将建立强制的技能使用协议
- 然后使用相关的rails-ai领域技能(见下表)
为什么要使用superpowers:using-superpowers?
- 强制在任何任务前检查技能是否可用
- 建立使用Skill工具调用技能的规范
- 避免找借口跳过技能使用
- 提供经过验证的工作流框架
如果不先使用superpowers:using-superpowers:
- 你会在需要使用技能的时候跳过它
- 你会找借口认为任务“太简单”不需要技能
- 你将脱离经过验证的流程框架开展工作
Rails-AI Skill-to-Task Mapping
Rails-AI技能与任务映射表
Superpowers handles skill-usage enforcement. This table tells you WHICH Rails skills to use:
| User Request Involves | Use These Skills |
|---|---|
| Models, databases, ActiveRecord | rails-ai:models |
| Controllers, routes, REST | rails-ai:controllers |
| Views, templates, forms | rails-ai:views |
| Hotwire, Turbo, Stimulus | rails-ai:hotwire |
| CSS, Tailwind, DaisyUI | rails-ai:styling |
| Tests, TDD, Minitest | rails-ai:testing |
| Security, XSS, SQL injection | rails-ai:security |
| Background jobs, caching | rails-ai:jobs |
| Email, ActionMailer | rails-ai:mailers |
| Project setup, validation, gems | rails-ai:project-setup |
| Environment config, Docker | rails-ai:project-setup |
| Debugging Rails issues | rails-ai:debugging |
Each Rails-AI skill contains:
- Required gems and dependencies
- TEAM_RULES.md enforcement for that domain
- Rails 8+ patterns and conventions
- Security requirements
- Code examples and anti-patterns
Superpowers负责技能使用的强制执行。此表告诉你应使用哪些Rails技能:
| 用户请求涉及内容 | 应使用的技能 |
|---|---|
| 模型、数据库、ActiveRecord | rails-ai:models |
| 控制器、路由、REST | rails-ai:controllers |
| 视图、模板、表单 | rails-ai:views |
| Hotwire、Turbo、Stimulus | rails-ai:hotwire |
| CSS、Tailwind、DaisyUI | rails-ai:styling |
| 测试、TDD、Minitest | rails-ai:testing |
| 安全、XSS、SQL注入 | rails-ai:security |
| 后台任务、缓存 | rails-ai:jobs |
| 邮件、ActionMailer | rails-ai:mailers |
| 项目搭建、验证、Gems | rails-ai:project-setup |
| 环境配置、Docker | rails-ai:project-setup |
| Rails问题调试 | rails-ai:debugging |
每个Rails-AI技能包含:
- 所需的gems和依赖项
- 对应领域的TEAM_RULES.md规则执行
- Rails 8+的模式和约定
- 安全要求
- 代码示例与反模式
Planning Rails Features
Rails功能规划
CRITICAL: Load domain skills BEFORE brainstorming or planning.
You can't give expert advice on Rails features if you haven't loaded the relevant domain knowledge. The brainstorming skill is process-agnostic — it doesn't know Rails patterns, TEAM_RULES, or which gems to use. You need to load that context first.
Planning workflow:
- Load relevant rails-ai domain skills (see table below)
- Read the codebase to understand what exists
- THEN use to refine the idea
superpowers:brainstorming - THEN use to create implementation plan
superpowers:writing-plans
Which skills to load for common features:
| Feature Type | Load These Skills |
|---|---|
| Authentication/Authorization | |
| User-facing forms/pages | |
| API endpoints | |
| Background processing | |
| Email features | |
| Data modeling | |
| Interactive UI | |
| New project setup | |
Always include — TDD is non-negotiable (TEAM_RULES #4).
rails-ai:testingWhy this order matters:
- Domain skills give you Rails patterns and constraints
- Reading code shows you what's already there
- Brainstorming with this context produces better designs
- Plans written with domain knowledge specify the right skills for workers
关键提示:在头脑风暴或规划之前,请先加载领域技能。
如果你没有加载相关的领域知识,就无法针对Rails功能提供专业建议。头脑风暴技能是与流程无关的——它不了解Rails模式、TEAM_RULES或应使用哪些gems。你需要先加载这些上下文信息。
规划工作流:
- 加载相关的rails-ai领域技能(见下表)
- 阅读代码库以了解现有内容
- 然后使用来完善想法
superpowers:brainstorming - 再使用创建实施计划
superpowers:writing-plans
常见功能应加载的技能:
| 功能类型 | 应加载的技能 |
|---|---|
| 身份验证/授权 | |
| 用户端表单/页面 | |
| API端点 | |
| 后台处理 | |
| 邮件功能 | |
| 数据建模 | |
| 交互式UI | |
| 新项目搭建 | |
务必包含——TDD是不可协商的(TEAM_RULES第4条)。
rails-ai:testing为什么这个顺序很重要:
- 领域技能为你提供Rails模式和约束
- 阅读代码让你了解现有内容
- 基于这些上下文的头脑风暴能产生更好的设计
- 结合领域知识编写的计划会为执行者指定正确的技能
Superpowers Reference
Superpowers参考
Superpowers provides universal workflows. Here's when to use each in Rails development:
Superpowers提供通用工作流。以下是在Rails开发中各技能的使用场景:
Planning & Design
规划与设计
| Skill | When to Use |
|---|---|
| Refining feature ideas before implementation |
| Creating detailed implementation plans with tasks |
| Running through a plan in controlled batches |
| 技能 | 使用场景 |
|---|---|
| 在实施前完善功能想法 |
| 创建包含任务的详细实施计划 |
| 分批次受控执行计划 |
Implementation
开发实施
| Skill | When to Use |
|---|---|
| Any feature or bugfix — write test first, watch fail, implement |
| Executing plans with fresh workers per task |
| 3+ independent tasks that can run concurrently |
| Isolating feature work from main workspace |
| 技能 | 使用场景 |
|---|---|
| 任何功能开发或bug修复——先写测试,观察失败,再实现 |
| 为每个任务分配新的执行者来执行计划 |
| 3个及以上可并行执行的独立任务 |
| 将功能开发与主工作区隔离 |
Quality & Review
质量与评审
| Skill | When to Use |
|---|---|
| Before merging — dispatches code-reviewer agent |
| Processing review feedback with technical rigor |
| Before claiming work is done — run tests, confirm output |
| Work complete, deciding merge/PR/cleanup |
| 技能 | 使用场景 |
|---|---|
| 合并前——分配代码评审Agent |
| 以技术严谨性处理评审反馈 |
| 声明工作完成前——运行测试,确认输出 |
| 工作完成后,决定合并/PR/清理 |
Debugging & Testing
调试与测试
| Skill | When to Use |
|---|---|
| Any bug or test failure — investigate before fixing |
| Tracing errors back through call stack |
| Avoiding mocking mistakes, test pollution |
| Fixing flaky tests with race conditions |
| 技能 | 使用场景 |
|---|---|
| 任何bug或测试失败——先调查再修复 |
| 追踪错误的调用栈根源 |
| 避免模拟错误、测试污染 |
| 修复存在竞态条件的不稳定测试 |
Defense & Security
防御与安全
| Skill | When to Use |
|---|---|
| Validation at multiple layers to prevent bugs |
| 技能 | 使用场景 |
|---|---|
| 在多个层进行验证以防止bug |
Agents
Agents
| Agent | When to Use |
|---|---|
| Dispatched by requesting-code-review for PR review |
| Agent | 使用场景 |
|---|---|
| 由requesting-code-review分配来进行PR评审 |
Commands (Shortcuts)
命令(快捷方式)
| Command | What it Does |
|---|---|
| Quick access to brainstorming skill |
| Quick access to writing-plans skill |
| Quick access to executing-plans skill |
Rails-specific usage:
- Always load rails-ai domain skills BEFORE superpowers workflows
- wraps
rails-ai:debuggingwith Rails contextsuperpowers:systematic-debugging - enforces TDD via
rails-ai:testingsuperpowers:test-driven-development
| 命令 | 功能 |
|---|---|
| 快速访问头脑风暴技能 |
| 快速访问计划编写技能 |
| 快速访问计划执行技能 |
Rails特定用法:
- 始终在Superpowers工作流之前加载rails-ai领域技能
- 在
rails-ai:debugging基础上增加了Rails上下文superpowers:systematic-debugging - 通过
rails-ai:testing强制执行TDDsuperpowers:test-driven-development
How Rails-AI Works
Rails-AI工作原理
Rails-AI is a two-layer system built on Superpowers:
text
┌─────────────────────────────────────────────┐
│ LAYER 1: Superpowers (Universal Process) │
│ • brainstorming - Refine ideas │
│ • writing-plans - Create plans │
│ • test-driven-development - TDD cycle │
│ • systematic-debugging - Investigation │
│ • subagent-driven-development - Execution │
│ • dispatching-parallel-agents - Coordination│
│ • requesting-code-review - Quality gates │
│ • finishing-a-development-branch - Complete │
│ • receiving-code-review - Handle feedback │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ LAYER 2: Rails-AI (Domain Expertise) │
│ • 12 Rails domain skills │
│ • TEAM_RULES.md enforcement │
│ • Rails 8+ patterns and conventions │
└─────────────────────────────────────────────┘Key Principle:
- Superpowers = HOW to work (process framework)
- Rails-AI = WHAT you're building (domain knowledge)
- The architect loads both as needed
Rails-AI是基于Superpowers构建的双层系统:
text
┌─────────────────────────────────────────────┐
│ 第一层:Superpowers(通用流程) │
│ • brainstorming - 完善想法 │
│ • writing-plans - 创建计划 │
│ • test-driven-development - TDD循环 │
│ • systematic-debugging - 问题调查 │
│ • subagent-driven-development - 任务执行 │
│ • dispatching-parallel-agents - 任务协调│
│ • requesting-code-review - 质量管控门 │
│ • finishing-a-development-branch - 任务完成 │
│ • receiving-code-review - 处理反馈 │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 第二层:Rails-AI(领域专业知识) │
│ • 12个Rails领域技能 │
│ • TEAM_RULES.md规则执行 │
│ • Rails 8+模式与约定 │
└─────────────────────────────────────────────┘核心原则:
- Superpowers = 如何工作(流程框架)
- Rails-AI = 要构建什么(领域知识)
- 架构师根据需要加载两者
Architecture Evolution
架构演进
Previous architecture (complex):
- 5 agents (architect, developer, security, devops, uat)
- Ambiguous delegation chains
- Overlap between agent roles and workflows
Current architecture (simple):
- 1 slash command (/rails-ai:architect) - coordinator
- Superpowers workflows handle process (HOW)
- Rails-AI skills provide domain expertise (WHAT)
- General-purpose workers implement features
- Clean separation of concerns
之前的架构(复杂):
- 5个Agent(架构师、开发者、安全、DevOps、UAT)
- 模糊的委托链
- Agent角色与工作流重叠
当前架构(简洁):
- 1个斜杠命令(/rails-ai:architect) - 协调器
- Superpowers工作流处理流程(如何做)
- Rails-AI技能提供领域专业知识(做什么)
- 通用执行者实现功能
- 关注点清晰分离
How It Works
工作流程
User request → /rails-ai:architect → Uses skills → Dispatches workers → Reviews
用户请求 → /rails-ai:architect → 使用技能 → 分配执行者 → 评审工作
Example: "Add user authentication"
示例:“添加用户身份验证”
-
Coordinator uses superpowers:brainstorming
- Uses rails-ai:models + rails-ai:security for context
- Refines design with user
-
Coordinator uses superpowers:writing-plans
- Creates implementation plan
- Specifies which skills workers should use per task
-
Coordinator uses superpowers:subagent-driven-development
- Dispatches general-purpose workers for each task: • Worker 1: User model → uses rails-ai:models + rails-ai:testing • Worker 2: Sessions controller → uses rails-ai:controllers + rails-ai:testing • Worker 3: Login views → uses rails-ai:views + rails-ai:styling
- Reviews each worker's output
-
Coordinator uses superpowers:finishing-a-development-branch
- Verifies TEAM_RULES.md compliance
- Creates PR or merges
Result: Clean feature with tests, following all conventions
-
协调器使用superpowers:brainstorming
- 结合rails-ai:models + rails-ai:security的上下文
- 与用户一起完善设计
-
协调器使用superpowers:writing-plans
- 创建实施计划
- 指定每个任务执行者应使用的技能
-
协调器使用superpowers:subagent-driven-development
- 为每个任务分配通用执行者: • 执行者1:用户模型 → 使用rails-ai:models + rails-ai:testing • 执行者2:会话控制器 → 使用rails-ai:controllers + rails-ai:testing • 执行者3:登录视图 → 使用rails-ai:views + rails-ai:styling
- 评审每个执行者的输出
-
协调器使用superpowers:finishing-a-development-branch
- 验证是否符合TEAM_RULES.md
- 创建PR或合并分支
结果: 符合所有约定的带测试的整洁功能
Available Rails-AI Skills
可用的Rails-AI技能
12 Domain-Based Skills (Consolidated):
- rails-ai:views - Partials, helpers, forms, accessibility (WCAG 2.1 AA)
- rails-ai:hotwire - Turbo Drive, Turbo Frames, Turbo Streams, Turbo Morph, Stimulus controllers
- rails-ai:styling - Tailwind CSS utility-first framework, DaisyUI component library, theming
- rails-ai:controllers - RESTful actions, nested resources, skinny controllers, concerns, strong parameters
- rails-ai:models - ActiveRecord patterns, validations, associations, callbacks, query objects, form objects
- rails-ai:testing - TDD with Minitest, fixtures, mocking, test helpers
- rails-ai:security - XSS, SQL injection, CSRF, strong parameters, file uploads, command injection
- rails-ai:project-setup - Environment config, credentials, initializers, Docker, RuboCop
- rails-ai:jobs - SolidQueue, SolidCache, SolidCable background processing (TEAM RULE #1: NO Redis/Sidekiq)
- rails-ai:mailers - ActionMailer email templates, delivery, attachments, testing with letter_opener
- rails-ai:debugging - Rails debugging tools (logs, console, byebug) + superpowers:systematic-debugging
- rails-ai:using-rails-ai - This guide - how rails-ai integrates with superpowers workflows
12个基于领域的技能(整合版):
- rails-ai:views - 部分视图、辅助方法、表单、可访问性(WCAG 2.1 AA)
- rails-ai:hotwire - Turbo Drive、Turbo Frames、Turbo Streams、Turbo Morph、Stimulus控制器
- rails-ai:styling - Tailwind CSS实用优先框架、DaisyUI组件库、主题定制
- rails-ai:controllers - RESTful动作、嵌套资源、精简控制器、Concerns、强参数
- rails-ai:models - ActiveRecord模式、验证、关联、回调、查询对象、表单对象
- rails-ai:testing - 基于Minitest的TDD、测试夹具、模拟、测试辅助方法
- rails-ai:security - XSS、SQL注入、CSRF、强参数、文件上传、命令注入防护
- rails-ai:project-setup - 环境配置、凭据、初始化器、Docker、RuboCop
- rails-ai:jobs - SolidQueue、SolidCache、SolidCable后台处理(团队规则第1条:禁止使用Redis/Sidekiq)
- rails-ai:mailers - ActionMailer邮件模板、发送、附件、使用letter_opener测试
- rails-ai:debugging - Rails调试工具(日志、控制台、byebug) + superpowers:systematic-debugging
- rails-ai:using-rails-ai - 本指南——rails-ai如何与superpowers工作流集成
TEAM_RULES.md Enforcement
TEAM_RULES.md规则执行
6 Critical Rules (REJECT violations):
- ❌ NEVER Sidekiq/Redis → ✅ SolidQueue/SolidCache
- ❌ NEVER RSpec → ✅ Minitest only
- ❌ NEVER custom routes → ✅ RESTful resources
- ❌ NEVER skip TDD → ✅ RED-GREEN-REFACTOR
- ❌ NEVER merge without bin/ci → ✅ All quality gates pass
- ❌ NEVER WebMock bypass → ✅ Mock all HTTP in tests
See rules/TEAM_RULES.md for all 20 rules.
6条关键规则(违反将被拒绝):
- ❌ 禁止使用Sidekiq/Redis → ✅ 必须使用SolidQueue/SolidCache
- ❌ 禁止使用RSpec → ✅ 只能使用Minitest
- ❌ 禁止自定义路由 → ✅ 必须使用RESTful资源
- ❌ 禁止跳过TDD → ✅ 必须遵循RED-GREEN-REFACTOR流程
- ❌ 禁止未通过bin/ci就合并 → ✅ 必须通过所有质量管控门
- ❌ 禁止绕过WebMock → ✅ 测试中必须模拟所有HTTP请求
完整20条规则请查看rules/TEAM_RULES.md。
Getting Started
快速开始
Primary interface: command
/rails-ai:architectThe simplest way to use Rails-AI is the convenience command:
/rails-ai:architecttext
/rails-ai:architect add user authentication
/rails-ai:architect fix failing test in user_test.rb
/rails-ai:architect plan payment processing feature
/rails-ai:architect refactor UserControllerThis command acts as the Rails architect coordinator, which:
- Analyzes requests
- Uses superpowers workflows (for process)
- Uses rails-ai skills (for domain expertise)
- Dispatches general-purpose workers to implement features
- Reviews work and enforces TEAM_RULES.md
Example:
text
User: "/rails-ai:architect Add email validation to User model"
Architect (coordinator):
1. Determines this is model work requiring TDD
2. Loads superpowers:test-driven-development for process
3. Loads rails-ai:testing for Minitest patterns
4. Loads rails-ai:models for validation patterns
5. Dispatches general-purpose worker with those skills loaded
6. Worker follows TDD cycle: write test → RED → implement → GREEN → refactor
7. Reviews worker output and verifies TEAM_RULES.md compliance
主要入口: 命令
/rails-ai:architect使用Rails-AI最简单的方式是使用便捷命令:
/rails-ai:architecttext
/rails-ai:architect add user authentication
/rails-ai:architect fix failing test in user_test.rb
/rails-ai:architect plan payment processing feature
/rails-ai:architect refactor UserController该命令充当Rails架构协调器,负责:
- 分析请求
- 使用superpowers工作流(处理流程)
- 使用rails-ai技能(提供领域专业知识)
- 分配通用执行者来实现功能
- 评审工作并执行TEAM_RULES.md规则
示例:
text
用户:"/rails-ai:architect 为User模型添加邮箱验证"
架构师(协调器):
1. 判断这是需要TDD的模型工作
2. 加载superpowers:test-driven-development来处理流程
3. 加载rails-ai:testing获取Minitest模式
4. 加载rails-ai:models获取验证模式
5. 分配加载了这些技能的通用执行者
6. 执行者遵循TDD循环:编写测试→RED→实现→GREEN→重构
7. 评审执行者的输出并验证是否符合TEAM_RULES.md
Learn More
了解更多
Superpowers skills: Use superpowers:using-superpowers for full introduction
Rails-AI rules: See rules/TEAM_RULES.md
<resources>
Official Documentation:
- Rails-AI GitHub - Main repository
- Superpowers GitHub - Workflow dependency
- Claude Code - Platform documentation
Internal References:
- TEAM_RULES.md - Team coding standards and conventions
- All 12 domain skills in skills/ directory
Superpowers技能: 使用superpowers:using-superpowers获取完整介绍
Rails-AI规则: 查看rules/TEAM_RULES.md
<resources>
官方文档:
- Rails-AI GitHub - 主仓库
- Superpowers GitHub - 工作流依赖项
- Claude Code - 平台文档
内部参考:
- TEAM_RULES.md - 团队编码标准与约定
- skills/目录下的所有12个领域技能