howto-functional-vs-imperative

Assess code for Functional Core and Imperative Shell adherence.

8|1|Updated Feb 25, 2022
One-click install
npx skills add https://github.com/ayubun/dotfiles --skill howto-functional-vs-imperative
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: howto-functional-vs-imperative
Source: https://github.com/ayubun/dotfiles/tree/main/configs/opencode/skills/ed3d-house-style/howto-functional-vs-imperative
Command: npx skills add https://github.com/ayubun/dotfiles --skill howto-functional-vs-imperative

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill guides developers on implementing Functional Core and Imperative Shell principles, helping to write more maintainable, testable, and reliable code.

Core Features & Use Cases

  • Core Principle: Separate business logic (FC) from side effects (IS) in a code file.
  • Use Case: Ideal for code reviews and new/refactored files where you need to apply the FCIS pattern.

Quick Start

Before writing code, review and ensure each file follows FCIS pattern by adding the correct classification comment.

Frequently Asked Questions about howto-functional-vs-imperative

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

FAQPage Schema
How do I refactor code to separate business logic from side effects?

To assess pure function design in Python and JavaScript, verify that business logic remains pure in the Functional Core while the Imperative Shell manages side effects, using static analysis or documentation verification during code review.

How do I add classification comments to enforce code structure during code reviews?

To enforce code structure during code reviews, add the correct classification comments to each file before writing code, ensuring adherence to the Functional Core and Imperative Shell pattern for maintainable application code organization.

What is the Functional Core and Imperative Shell principle in programming practices?

The Functional Core and Imperative Shell principle in programming practices separates business logic into a pure Functional Core from an Imperative Shell that manages side effects, ensuring reliable and testable application code organization.

Does the Functional Core and Imperative Shell pattern work with Python and JavaScript?

Yes, the Functional Core and Imperative Shell pattern works with Python and JavaScript. It focuses on application code organization to separate pure business logic from side effects, supporting code review processes in these languages.

When should I not use the Functional Core and Imperative Shell refactoring approach?

You should reconsider the Functional Core and Imperative Shell refactoring approach when a file's logic is heavily intertwined with side effects, making it impractical to isolate pure business logic for static analysis or documentation verification.