Home / Market / architecture-paradigm-functional-core

architecture-paradigm-functional-core

Applies Functional Core, Imperative Shell to isolate logic from side effects

skill★ 00 dlclawhubMIT-0Install in CosmosUpstream Source

Documentation & Preview

--- name: architecture-paradigm-functional-core description: Applies Functional Core, Imperative Shell to isolate logic from side effects version: 1.10.3 triggers:

metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/archetypes", "emoji": "\ud83c\udfd7\ufe0f"}} source: claude-night-market source_plugin: archetypes

---

> Night Market Skill: ported from claude-night-market/archetypes. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

The Functional Core, Imperative Shell Paradigm

When To Use

When NOT To Use

When to Employ This Paradigm

Adoption Steps

  1. Inventory Side Effects: Create a map of all side effects in the system, such as database writes, external API calls, UI events, and filesystem access. Explicitly assign these responsibilities to the "shell."
  2. Model the Core Logic: Represent business rules and policies as pure functions. These functions should take domain data as input and return decisions or commands as output, avoiding shared mutable state.
  3. Design the Command Schema: Define a small, explicit set of command objects that the core can return and the shell can interpret (e.g., PersistOrder, PublishEvent, NotifyUser).
  4. Refactor Incrementally: Begin with high-churn or critical modules. Wrap legacy imperative code behind adapters while progressively extracting pure calculations into the functional core.
  5. Enforce Boundaries: Use code reviews and automated architecture tests to validate a strict separation. The shell should only handle orchestration, sequencing, and retries, while the core should never call directly into frameworks or I/O libraries.

Key Deliverables

Risks & Mitigations

Concrete Components

Vocabulary for the tools and abstractions an implementation of this paradigm tends to carry. Not dependencies, and not `tools:` frontmatter.

Exit Criteria

before any refactoring begins.

> 90% deterministic coverage.

contains zero imports from I/O or framework libraries.

before migration and compared after to demonstrate the pattern's value.