

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## About Operandi67Operandi is a Ruby gem providing a service architecture pattern for organizing business logic. Services are defined as classes with `arguments`, `steps`, and `outputs`, featuring transactions, inheritance, error handling, and context sharing.89## Development Commands1011### Testing12```bash13# Run all tests14bundle exec rspec1516# Run specific test file17bundle exec rspec spec/path/to/file_spec.rb1819# Run with coverage (uses SimpleCov)20bundle exec rspec21```2223### Linting24```bash25# Run RuboCop linter26bundle exec rubocop2728# Auto-fix RuboCop issues29bundle exec rubocop -a30```3132### Build and Release33```bash34# Build gem35bundle exec rake build3637# Default task (runs tests)38bundle exec rake39```4041## Architecture4243### Core Components44451. **Base Service (`lib/operandi/base.rb:15`)**46 - Main service class that all services inherit from47 - Handles service lifecycle: initialization, execution, callbacks, error management48 - Provides DSL for defining arguments, steps, and outputs49 - Manages transactions and error propagation to parent services50512. **Callbacks System (`lib/operandi/callbacks.rb:5`)**52 - Supports service and step-level callbacks53 - Events: `before_service_run`, `after_service_run`, `around_service_run`, `on_service_success`, `on_service_failure`54 - Step events: `before_step_run`, `after_step_run`, `around_step_run`, `on_step_success`, `on_step_failure`55563. **Settings**57 - **Step (`lib/operandi/settings/step.rb:7`)**: Handles step execution with conditional logic (`if`, `unless`, `always`)58 - **Field (`lib/operandi/settings/field.rb`)**: Manages argument and output validation and type checking59604. **Messages System (`lib/operandi/messages.rb`)**61 - Collects errors and warnings with options for breaking, raising, or rolling back62 - Supports copying messages between parent and child services63645. **Collection (`lib/operandi/collection.rb`)**65 - Manages arguments and outputs as collections with validation and defaults66 - Supports Sorbet runtime types for type validation6768### Service DSL6970Services use a declarative DSL:71```ruby72class ExampleService < Operandi::Base73 # Define input arguments74 arg :name, type: String75 arg :age, type: Integer, optional: true, default: 257677 # Define execution steps78 step :validate_input79 step :process_data, if: :should_process?80 step :cleanup, always: true8182 # Define outputs83 output :result, type: Hash8485 private8687 def validate_input88 errors.add(:name, "required") if name.nil? || name.strip.empty?89 end9091 def process_data92 self.result = { name: name, age: age }93 end9495 def cleanup96 # Runs regardless of errors/warnings, unless stop! was called97 end9899 def should_process?100 !(name.nil? || name.strip.empty?)101 end102end103```104105### Service Execution106107- Services can be run with `.run(args)` or `.run!(args)` (raises on error)108- Use `.with(service_or_context)` to chain services with shared context109- Transactions automatically rollback on errors when `use_transactions: true`110- Steps run sequentially, stopping on errors unless `always: true`111112### Error Handling113114- Errors collected in `@errors` message collection115- Supports `break_on_error`, `raise_on_error`, `rollback_on_error` configuration116- Warnings work similarly with `@warnings` collection117- Parent services can inherit child errors/warnings based on configuration118119### Testing Patterns120121- Services are tested using RSpec with database transactions122- Use `DatabaseCleaner` for test isolation123- Mock database models and external dependencies124- Test both success and failure scenarios125- Validate arguments, outputs, and error conditions126127## Configuration128129### RuboCop Rules130- Target Ruby version: 2.7+131- Method length max: 20 lines132- Uses double quotes for strings133- Enables trailing commas for multiline structures134- Disables documentation requirements and guard clauses135136### Database Support137- Optional ActiveRecord integration for transactions138- Uses SQLite3 for testing139- Database cleaner ensures test isolation
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| akodkod/operandiAGENTS.md · 73 | AGENTS.md | buildteststyletesting-strategy+3 | 93/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| stacklok/toolhiveCLAUDE.md · 2.0k | CLAUDE.md | buildteststylearch+4 | 100/100 | 14 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 46 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 14 days ago | |
| microsoft/playwrightCLAUDE.md · 95k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 7 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.5k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 14 days ago | |
| tphakala/birdnet-goCLAUDE.md · 1.6k | CLAUDE.md | buildtestlint-formatstyle+8 | 100/100 | today | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 14 days ago | |
| tyrchen/geektime-bootcamp-aiw7/genslides/backend/CLAUDE.md · 230 | CLAUDE.md | testlint-formatstylearch+6 | 100/100 | 9 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 7 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/akodkod-operandi-claude)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.