business-logic

Codify domain rules into explicit service-layer guards with unit tests.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mrsknetwork/nemodev --skill business-logic-mrsknetwork
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: business-logic
Source: https://github.com/mrsknetwork/nemodev/tree/main/skills/domains/references/business-logic
Command: npx skills add https://github.com/mrsknetwork/nemodev --skill business-logic-mrsknetwork

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Business logic is the layer where the product lives. It is the difference between "save a row to the database" (data access) and "process a refund only if the order satisfies business constraints" (enforcing rules that define how a feature behaves). This skill centralizes complex workflows, state transitions, and calculations that would otherwise be scattered across routes, repositories, and UI logic.

Core Features & Use Cases

  • Explicit guards in the service layer that codify domain rules at the hinge points of business operations.
  • A state machine pattern that restricts transitions to allowed paths (Draft → Submitted → Under Review → Approved → Fulfilled, etc.).
  • Domain events to decouple side effects (emails, analytics, webhooks) from core business logic.
  • Testability through clear rule-driven unit tests mapped to each business requirement.

Quick Start

Define domain rules for a new feature, implement a service function with explicit guards, and validate each rule with unit tests.

Frequently Asked Questions about business-logic

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce business logic and domain rules in a service layer?

To enforce business logic, you extract domain rules and codify them as explicit guards within the service layer. This centralizes constraints at the hinge points of operations, ensuring correct behavior before processing multi-step workflows.

What is the best way to manage state transitions for complex domain rules?

Managing state transitions for domain rules is best handled using a state machine pattern. This restricts transitions to allowed paths, such as Draft to Submitted to Approved, preventing invalid states and ensuring workflow integrity.

How do domain events help decouple side effects in business logic?

Domain events decouple side effects in business logic by separating notifications like emails and analytics from core operations. This allows the service layer to trigger an event without directly managing the downstream webhook or processing logic.

How do I write unit tests for service layer business logic?

Write unit tests for business logic by mapping clear rule-driven tests to each domain requirement. Validate explicit guards, state transitions, and pure calculation functions independently to ensure comprehensive coverage of expected behavior.

Do I need a specific framework to implement domain rules and state machines?

You do not need a specific framework to implement domain rules or state machines. The approach uses explicit guards, pure calculation functions, and domain events within your existing service layer, making it framework-agnostic and highly testable.