code-structure

Extract duplicated operational logic into a shared service layer.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/manjunathva2018/urban-invention --skill code-structure-manjunathva2018
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-structure
Source: https://github.com/manjunathva2018/urban-invention/tree/main/code-structure
Command: npx skills add https://github.com/manjunathva2018/urban-invention --skill code-structure-manjunathva2018

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicated operational logic across multiple workflows leads to bugs, inconsistent behavior, and hard maintenance. By separating orchestration (actions) from reusable mechanics (service layer), teams can share common functionality and reduce drift.

Core Features & Use Cases

  • Orchestrate business rules in actions while centralizing reusable operations in a service layer.
  • Eliminate code duplication across callers (e.g., sandbox setup, notifications, integrations) and enforce consistent behavior.
  • Provide clear guidelines for deciding when to extract shared logic and how to migrate existing flows.

Quick Start

Refactor a duplicated workflow by moving the shared logic into a new or existing service function and update the callers to use the service.

Frequently Asked Questions about code-structure

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

FAQPage Schema
How do I reduce duplicated operational logic across multiple workflows?

To reduce duplicated operational logic, you extract shared mechanics such as sandbox setup or email sending into a centralized service layer. This separates orchestration from provider interactions, ensuring consistent behavior and eliminating code drift across callers.

When should I extract shared logic into a service layer?

You should extract shared logic into a service layer when multiple callers share common mechanics, such as external integrations or notifications. If the same operational steps are duplicated across workflows, centralizing them reduces bugs and maintenance overhead.

What is the difference between orchestration and a service layer in code architecture?

In code architecture, orchestration refers to actions that manage business rules, while the service layer handles reusable mechanics like provider interactions and error handling. Separating them eliminates code duplication and enforces consistent behavior across workflows.

How do I refactor a workflow to use a shared service layer?

To refactor a workflow for a shared service layer, move the duplicated operational logic into a new or existing service function. Then, update the original workflow callers to orchestrate business rules by invoking that centralized service.

Does extracting shared operations into a service layer require specific dependencies?

Extracting shared operations into a service layer requires no specific external dependencies. It is an architectural design pattern for code refactoring, applicable whenever multiple workflows share common mechanics like sandbox setup or external integrations.