Agent skill
business-logic-coder
Implement business logic with ActiveInteraction and AASM state machines. Routes to specialized skills for typed operations and state management.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/business-logic-coder
SKILL.md
Business Logic Patterns
Orchestrator for structured business logic in Rails.
Skill Routing
| Need | Skill | Use When |
|---|---|---|
| Typed operations | active-interaction-coder |
Creating business operations, refactoring service objects |
| State machines | aasm-coder |
Implementing workflows, managing state transitions |
When to Use Each
ActiveInteraction
Use for operations - things that happen once:
- User registration
- Order placement
- Payment processing
- Data imports
- Report generation
# Example: One-time operation with typed inputs
outcome = Users::Create.run(email: email, name: name)
AASM
Use for state management - things with lifecycle:
- Order status (pending → paid → shipped)
- Subscription state (trial → active → cancelled)
- Document workflow (draft → review → published)
- Task status (todo → in_progress → done)
# Example: Stateful entity with transitions
order.pay! # pending → paid
order.ship! # paid → shipped
Combined Pattern
Often used together - interactions trigger state changes:
module Orders
class Process < ActiveInteraction::Base
object :order, class: Order
def execute
order.process! # AASM transition
fulfill_order(order)
order
end
end
end
Setup
# Gemfile
gem "active_interaction", "~> 5.3"
gem "aasm", "~> 5.5"
Quick Reference
ActiveInteraction:
.run- Returns outcome (check.valid?).run!- Raises on failurecompose- Call nested interactions
AASM:
.event!- Transition or raise.event- Transition or return false.may_event?- Check if transition valid.aasm.events- List available events
Related Skills
event-sourcing-coder- Record domain events from state transitions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?