π¦ ClawHub
Nm Archetypes Architecture Paradigm Functional Core
by @athola
Applies Functional Core, Imperative Shell to isolate logic from side effects
TERMINAL
clawhub install nm-archetypes-architecture-paradigm-functional-coreπ About This Skill
name: architecture-paradigm-functional-core description: | Functional Core, Imperative Shell: isolate deterministic logic from side effects for testability version: 1.9.4 triggers: - architecture - functional-core - imperative-shell - testability - business-logic - side-effects 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
Troubleshooting
Common Issues
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag
β‘ When to Use
π Tips & Best Practices
Common Issues
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag