/ruby:ruby-service-objectfrom ruby
Use when creating or refactoring Ruby service classes following the `def self.call(...)` → `new(...).call` entry point pattern with a strict `{ success: true/false, response: { ... } }` response contract. Handles error shape (`{ success: false, response: { error: { message: string } } }`), `StandardError` rescue with `logger.error` logging, `UPPER_SNAKE_CASE` error constants, and mandatory module READMEs. Enforces test-first workflow: spec written and confirmed failing before implementation. Covers 4 core patterns (Standard, Batch, Static/Class-only, Orchestrator), `.call` ≤ 20 lines, and YARD documentation on `self.call` and `#call`. File layout: spec at `spec/services/[module]/[name]_spec.rb`, impl at `services/[module]/[name].rb`. Trigger words: service object, .call pattern, services, service module, response hash, success/response shape, YARD on self.call, service skeleton, module README, orchestrator.
Ships in ruby. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Before adopting the result contract: reconcile the
{ success:, response: }shape below with the host codebase's existing service conventions (e.g. ubbu-platform-be) before writing any new service. Where the host already has an established convention that conflicts, prefer the host's convention.
TESTS GATE IMPLEMENTATION:
EVERY service object MUST have its test written and validated BEFORE implementation.
1. Write the spec/test for .call (with contexts for success, error, edge cases)
2. Run the spec/test — verify it fails because the service does not exist yet
3. ONLY THEN write the service implementation
The final artifact must include the test command and the failure message
before implementation. Use the observed failure when available; otherwise show
the exact expected failure class/message for the missing service.
See tdd-process for the full gate cycle.
spec/services/<module_name>/<service_name>_spec.rb (or test/services/). Cover success and error paths for .call. Run it to confirm it fails (see HARD-GATE). Tests must assert success: and response: top-level keys and the meaningful payload shape.services/<module_name>/<service_name>.rb with the correct module namespace.initialize, no instance variables).self.call and #call. Response must always be { success: true, response: { ... } } or { success: false, response: { error: { message: '...' } } }. Keep call ≤ 20 lines; extract sub-services if longer. Validate inputs at top of call; return error hash if invalid. Return serialized data only — no raw persistence model objects (e.g. ActiveRecord, ROM) in response.StandardError (and domain exceptions). Log with the application logger (e.g., logger.error). Use UPPER_SNAKE_CASE constants for all user-facing error strings — never inline in a rescue. Never re-raise to caller.@param, @return [Hash], and @raise tags to self.call and every other public method. Document self.call separately from #call. For class-only services (Pattern 3), if the class returns a non-standard shape (e.g. nil / error string), document that explicitly in YARD and the README.services/<module_name>/README.md explaining domain context. Required even for single-service modules.| Aspect | Rule |
|---|---|
| Transactions | Only wrap multi-step database operations that must be atomic |
| Scope | Return data only (no HTTP/UI concerns); single responsibility per service |
| SQL | Use query sanitization for any dynamic queries |
| Shared logic | Extract validators to class-only services (Pattern 3) |
.call Patterndef self.call(params)
new(params).call
end
def call
# ... processing ...
{ success: true, response: { data: result } }
rescue StandardError => e
logger.error("Processing Error: #{e.message}")
logger.error(e.backtrace.join("\n"))
{ success: false, response: { error: { message: ERROR_MESSAGE } } }
end
def call
results = @items.each_with_object({ successful: [], failed: [] }) do |item, acc|
# process...
rescue StandardError => e
logger.error("Unexpected item error: #{e.message}")
acc[:failed] << { sku: item[:sku], error: e.message }
end
{ success: true, response: results }
end
When no instance state is needed, use ONLY class methods — no initialize, no instance variables. Suitable for validators, formatters, and argument-only helpers.
class Orders::QuantityValidator
def self.call(quantity:)
return { success: false, response: { error: { message: INVALID_QUANTITY } } } unless quantity.positive?
{ success: true, response: { valid: true } }
end
end
call)def call
user_result = UserCreationService.call(@params)
return user_result unless user_result[:success]
# ... continue ...
end
Load these files only when their specific content is needed:
| Skill | When to chain |
|---|---|
| integrate-api-client | External API integrations |
| implement-calculator-pattern | Variant-based calculators |
| write-tests | General testing structure |
| refactor-process | Refactoring service objects |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub vmaia00/claude-specs --plugin ruby17 skills in this plugin
/brakemanStatic analysis security vulnerability scanner for Ruby on Rails applications. Use when analyzing Rails code for security issues, running security audits, reviewing code for vulnerabilities, setting up security scanning in CI/CD, managing security warnings, or investigating specific vulnerability types (SQL injection, XSS, command injection, etc.). Also use when configuring Brakeman, reducing false positives, or integrating with automated workflows./hwc-forms-validationHandle Hotwire form workflows: form submission lifecycle, inline editing, validation errors, typeahead/autocomplete, modal forms, and external form controls. Prefer this skill when the core problem is correctness and UX of form interaction. Use hwc-navigation-content for pagination/tabs/filter navigation, hwc-realtime-streaming for WebSocket/Turbo Stream broadcasting, hwc-ux-feedback for generic loading/transition polish, and hwc-stimulus-fundamentals for framework-level Stimulus APIs not tied to forms./hwc-navigation-contentBuild Hotwire navigation and content-discovery flows: Turbo Frame pagination, tabbed navigation, lazy loading, faceted filtering/search, cache lifecycle, scroll restoration, and visit/render control. Prefer this skill when the core problem is request/response navigation state and browser history behavior. Use hwc-forms-validation for form validation and inline edit flows, hwc-realtime-streaming for WebSocket/Turbo Stream push updates, hwc-ux-feedback for generic loading/progress/transition polish, and hwc-stimulus-fundamentals for Stimulus APIs not centered on navigation.Other plugins' skills for the same job