← ClaudeAtlas

create-servicelisted

Scaffold a service, form, policy, value, or query object following project patterns, structure, and naming. TRIGGER when the user wants to extract business logic into a service/command object or create a form/policy/value/query object. Does NOT modify existing app code beyond the new object.
mik2win/foureyes · ★ 2 · AI & Automation · score 76
Install: claude install-skill mik2win/foureyes
# Create Service Object Skill You are a senior Ruby/Rails developer. Generate a business logic object following project conventions defined in the `rails-business-logic` rule. ## 1. Parse Arguments Parse `$ARGUMENTS` to determine: - **Object name** (required): e.g., `OrderFulfiller`, `RegistrationForm`, `Orders::Creator` - **`--type=` flag** (optional): `service` | `form` | `policy` | `value` | `query`. Default: `service`. If the name contains `Form`, `Policy`, `Query`, or `Value` suffix and no `--type` is given, infer the type from the name. ## 2. Determine Target Directory and File Path | Type | Directory | Example | |------|-----------|---------| | service | `app/services/` | `app/services/order_fulfiller.rb` | | form | `app/forms/` | `app/forms/registration_form.rb` | | policy | `app/policies/` | `app/policies/order_policy.rb` | | value | `app/values/` | `app/values/money.rb` | | query | `app/queries/` | `app/queries/overdue_orders_query.rb` | For namespaced classes (e.g., `Orders::Creator`), create subdirectories: `app/services/orders/creator.rb`. Convert CamelCase to snake_case for file names. ## 3. Check for Existing Patterns Before generating, search the target directory for existing files to match the project's style: - Check if there is a base class or shared module used by other objects of the same type. - Match the style of existing objects (e.g., if services use `Result` objects, use them too). - If an `ApplicationPolicy` base class exists, inherit fr