Rails Agent Skills
This skill coordinates disciplined Rails development by sequencing atomic skills for each task. It defines what to run, in what order, and how to validate each step.
Core principle: Atomic, task-specific instructions that turn AI coding assistants into reliable Rails collaborators through TDD and idiomatic patterns.
Activating Atomic Skills
To activate an atomic skill, read its corresponding Markdown file from the skills bundle and follow its instructions as the operative prompt for that step. If a skill file is unavailable, use the inline fallback guidance in the Skill Catalog below rather than halting entirely — note any gaps in output and proceed with best-effort idiomatic Rails conventions.
HARD-GATES
1. Context First (Pre-flight)
- Do not perform any implementation or review action without first running
load-context.
- Synchronize with the host application's schema, routes, and established patterns before producing any output.
2. Tests Gate Implementation
- Implementation code cannot be written until a test exists for the target behaviour.
- The test must be executed via
bundle exec rspec <spec_file> before implementation begins.
- The test must fail for the correct reason (feature missing, not a syntax error) before proceeding.
Core Process
- Context Initialization (CRITICAL): Activate
load-context. Confirm schema, routes, and patterns are loaded before any other step.
- Discovery: Identify which atomic skills from the catalog match the current task.
- Execution Loop:
- Plan: Activate
plan-tests. Output: a list of pending test cases with descriptions.
- Act: Activate
write-tests. Run bundle exec rspec <spec_file> — confirm output shows red (failure for the right reason). Then activate implement. Run bundle exec rspec <spec_file> — confirm green. Then activate apply-code-conventions.
- Polish: Activate
write-yard-docs and code-review.
- Validation: After each atomic skill completes, verify its declared
Output Style checklist before proceeding to the next step. If a step produces unexpected failures, re-run load-context before retrying.
Worked Example: Adding a Service Object with Tests
Step 1 — load-context
Input: project root directory
Action: Read schema.rb, routes.rb, and existing service objects
Output: Confirmed patterns (e.g., services inherit ApplicationService, use call)
Step 2 — plan-tests
Input: "Create an OrderFulfillmentService"
Output: [
"returns success when inventory is available",
"returns failure when inventory is insufficient",
"enqueues FulfillmentJob on success"
]
Step 3 — write-tests
Input: test plan above
Output: spec/services/order_fulfillment_service_spec.rb (written, not passing)
Validate: bundle exec rspec spec/services/order_fulfillment_service_spec.rb
→ Expect: 3 examples, 3 failures (NameError or similar — feature missing)
Step 4 — implement
Input: failing spec
Output: app/services/order_fulfillment_service.rb
Validate: bundle exec rspec spec/services/order_fulfillment_service_spec.rb
→ Expect: 3 examples, 0 failures
Step 5 — apply-code-conventions + write-yard-docs + code-review
Output: Linted file with YARD docs and review comments resolved
Skill Catalog
| Category |
Skill |
Fallback Guidance (if file unavailable) |
| Context |
load-context |
Read schema.rb, routes.rb, and a sample service/model; note conventions manually |
| Testing |
plan-tests |
List expected behaviours as RSpec it descriptions before writing code |
| Testing |
write-tests |
Write RSpec examples using described_class, let, expect, have_received idioms |
| Testing |
test-service, triage-bug |
Follow standard RSpec unit-test patterns; isolate dependencies with doubles |
| DDD |
define-domain-language, model-domain, review-domain-boundaries |
Apply standard DDD vocabulary; group by bounded context |
| Quality |
code-review, security-check, apply-code-conventions, refactor-code |
Apply Rails best practices, Brakeman findings, and RuboCop rules inline |
| API/Infra |
implement-graphql, integrate-api-client, implement-background-job, review-migration |
Follow graphql-ruby conventions, ActiveJob patterns, and strong-migration rules |
| Engines |
create-engine, test-engine, release-engine, document-engine |
Use rails plugin new --mountable; isolate specs under spec/ inside the engine root |
| Patterns |
create-service-object, write-yard-docs |
Inherit ApplicationService, expose .call, document with @param/@return YARD tags |
| Setup |
setup-environment |
Verify Ruby version, bundle install, and bin/rails db:setup |
The complete list of all 28 local atomic skills and 9 personas is defined in directory.json at the project root. This repository also depends on igmarin/ruby-core-skills for 15 additional core skills (Process, Code Quality, Orchestration, DDD, and Ruby patterns).
Integration
directory.json (project root): Canonical registry of all 28 local atomic skills and 9 personas — names, file paths, and metadata. This is the source of truth for skill discovery.
docs/reference/skill-catalog.md: Human-readable reference with usage notes for each skill; useful for manual lookup when directory.json is unavailable.
skill-router: Orchestration layer that maps incoming tasks to the correct atomic skill sequence; invoked automatically when this entry-point skill is activated.
Core Dependencies
This repository depends on igmarin/ruby-core-skills for foundational DDD and Ruby pattern skills. The following 15 core skills are auto-detected and available when this plugin is installed alongside ruby-core-skills:
DDD Skills (3):
define-domain-language — Domain terms glossary
review-domain-boundaries — Review bounded contexts and language leakage
model-domain — Map DDD to Rails (models, services, value objects)
Ruby Pattern Skills (4):
create-service-object — .call pattern, response contract, YARD
integrate-api-client — Layered architecture for external APIs
implement-calculator-pattern — Variant-based calculators
write-yard-docs — Inline documentation with YARD
Process Skills (5):
tdd-process — TDD discipline and workflow
refactor-process — Refactor preserving behavior
review-process — Systematic code review
security-review-process — Security audit workflow
test-planning-process — Test planning and selection
Code Quality Skills (2):
triage-bug — Bug diagnosis and reproduction
respond-to-review — Respond to review feedback
Orchestration Skills (1):
skill-router — Routes to correct specialized skill
1---2name: rails-agent-skills3description: Use when starting Rails work and the matching atomic skill is not obvious. Coordinates the Rails skill catalog. Trigger words: Rails, RSpec, TDD, GraphQL, engine, migration, code review, background job.4---56# Rails Agent Skills78This skill coordinates disciplined Rails development by sequencing atomic skills for each task. It defines what to run, in what order, and how to validate each step.910**Core principle:** Atomic, task-specific instructions that turn AI coding assistants into reliable Rails collaborators through TDD and idiomatic patterns.1112## Activating Atomic Skills1314To activate an atomic skill, read its corresponding Markdown file from the skills bundle and follow its instructions as the operative prompt for that step. If a skill file is unavailable, use the inline fallback guidance in the Skill Catalog below rather than halting entirely — note any gaps in output and proceed with best-effort idiomatic Rails conventions.1516## HARD-GATES1718### 1. Context First (Pre-flight)19201. Do not perform any implementation or review action without first running `load-context`.212. Synchronize with the host application's schema, routes, and established patterns before producing any output.2223### 2. Tests Gate Implementation24251. Implementation code cannot be written until a test exists for the target behaviour.262. The test must be executed via `bundle exec rspec <spec_file>` before implementation begins.273. The test must fail for the correct reason (feature missing, not a syntax error) before proceeding.2829## Core Process30311. **Context Initialization (CRITICAL):** Activate `load-context`. Confirm schema, routes, and patterns are loaded before any other step.322. **Discovery:** Identify which atomic skills from the catalog match the current task.333. **Execution Loop:**34 - **Plan:** Activate `plan-tests`. Output: a list of pending test cases with descriptions.35 - **Act:** Activate `write-tests`. Run `bundle exec rspec <spec_file>` — confirm output shows red (failure for the right reason). Then activate `implement`. Run `bundle exec rspec <spec_file>` — confirm green. Then activate `apply-code-conventions`.36 - **Polish:** Activate `write-yard-docs` and `code-review`.374. **Validation:** After each atomic skill completes, verify its declared `Output Style` checklist before proceeding to the next step. If a step produces unexpected failures, re-run `load-context` before retrying.3839## Worked Example: Adding a Service Object with Tests4041```42Step 1 — load-context43 Input: project root directory44 Action: Read schema.rb, routes.rb, and existing service objects45 Output: Confirmed patterns (e.g., services inherit ApplicationService, use call)4647Step 2 — plan-tests48 Input: "Create an OrderFulfillmentService"49 Output: [50 "returns success when inventory is available",51 "returns failure when inventory is insufficient",52 "enqueues FulfillmentJob on success"53 ]5455Step 3 — write-tests56 Input: test plan above57 Output: spec/services/order_fulfillment_service_spec.rb (written, not passing)58 Validate: bundle exec rspec spec/services/order_fulfillment_service_spec.rb59 → Expect: 3 examples, 3 failures (NameError or similar — feature missing)6061Step 4 — implement62 Input: failing spec63 Output: app/services/order_fulfillment_service.rb64 Validate: bundle exec rspec spec/services/order_fulfillment_service_spec.rb65 → Expect: 3 examples, 0 failures6667Step 5 — apply-code-conventions + write-yard-docs + code-review68 Output: Linted file with YARD docs and review comments resolved69```7071## Skill Catalog7273| Category | Skill | Fallback Guidance (if file unavailable) |74|----------|-------|------------------------------------------|75| **Context** | `load-context` | Read `schema.rb`, `routes.rb`, and a sample service/model; note conventions manually |76| **Testing** | `plan-tests` | List expected behaviours as RSpec `it` descriptions before writing code |77| **Testing** | `write-tests` | Write RSpec examples using `described_class`, `let`, `expect`, `have_received` idioms |78| **Testing** | `test-service`, `triage-bug` | Follow standard RSpec unit-test patterns; isolate dependencies with doubles |79| **DDD** | `define-domain-language`, `model-domain`, `review-domain-boundaries` | Apply standard DDD vocabulary; group by bounded context |80| **Quality** | `code-review`, `security-check`, `apply-code-conventions`, `refactor-code` | Apply Rails best practices, Brakeman findings, and RuboCop rules inline |81| **API/Infra** | `implement-graphql`, `integrate-api-client`, `implement-background-job`, `review-migration` | Follow graphql-ruby conventions, ActiveJob patterns, and strong-migration rules |82| **Engines** | `create-engine`, `test-engine`, `release-engine`, `document-engine` | Use `rails plugin new --mountable`; isolate specs under `spec/` inside the engine root |83| **Patterns** | `create-service-object`, `write-yard-docs` | Inherit `ApplicationService`, expose `.call`, document with `@param`/`@return` YARD tags |84| **Setup** | `setup-environment` | Verify Ruby version, `bundle install`, and `bin/rails db:setup` |8586*The complete list of all 28 local atomic skills and 9 personas is defined in `directory.json` at the project root. This repository also depends on `igmarin/ruby-core-skills` for 15 additional core skills (Process, Code Quality, Orchestration, DDD, and Ruby patterns).*8788## Integration8990- **`directory.json`** (project root): Canonical registry of all 28 local atomic skills and 9 personas — names, file paths, and metadata. This is the source of truth for skill discovery.91- **`docs/reference/skill-catalog.md`**: Human-readable reference with usage notes for each skill; useful for manual lookup when `directory.json` is unavailable.92- **`skill-router`**: Orchestration layer that maps incoming tasks to the correct atomic skill sequence; invoked automatically when this entry-point skill is activated.9394## Core Dependencies9596This repository depends on `igmarin/ruby-core-skills` for foundational DDD and Ruby pattern skills. The following 15 core skills are auto-detected and available when this plugin is installed alongside `ruby-core-skills`:9798**DDD Skills (3):**99- `define-domain-language` — Domain terms glossary100- `review-domain-boundaries` — Review bounded contexts and language leakage101- `model-domain` — Map DDD to Rails (models, services, value objects)102103**Ruby Pattern Skills (4):**104- `create-service-object` — `.call` pattern, response contract, YARD105- `integrate-api-client` — Layered architecture for external APIs106- `implement-calculator-pattern` — Variant-based calculators107- `write-yard-docs` — Inline documentation with YARD108109**Process Skills (5):**110- `tdd-process` — TDD discipline and workflow111- `refactor-process` — Refactor preserving behavior112- `review-process` — Systematic code review113- `security-review-process` — Security audit workflow114- `test-planning-process` — Test planning and selection115116**Code Quality Skills (2):**117- `triage-bug` — Bug diagnosis and reproduction118- `respond-to-review` — Respond to review feedback119120**Orchestration Skills (1):**121- `skill-router` — Routes to correct specialized skill122123---