Skip to content
Prompt

flow_subscribers — Cursor Rules

by gmascb

AI Summary

Flow Subscribers is a Ruby gem that implements architectural patterns for organizing backend business logic following SOLID principles, designed for Cursor IDE users building well-structured Rails applications.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "flow_subscribers — Cursor Rules" prompt rules to my project.
Repository: https://github.com/gmascb/flow_subscribers

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

A gem that controls the a pattern of services

Overview

This is a Ruby gem that implements a Flow Pattern for organizing backend code following SOLID principles. ---

Class Overview

` ┌─────────────────────────────────────────────────────────────────────────────┐ │ MODULE Flows │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────────────┐ ┌─────────────────────────────────────┐ │ │ │ SIMPLE FLOW │ │ COMPLETE FLOW │ │ │ │ │ │ │ │ │ │ ┌───────────────────────┐ │ │ ┌─────────────────────────────┐ │ │ │ │ │ SimpleFlowController │ │ │ │ CompleteFlowController │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - flows[] │ │ │ │ - flows[] │ │ │ │ │ │ - flow_context │ │ │ │ - flow_context │ │ │ │ │ │ - transactional │ │ │ │ - transactional │ │ │ │ │ └───────────┬───────────┘ │ │ └──────────────┬──────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ ▼ │ │ ▼ │ │ │ │ ┌───────────────────────┐ │ │ ┌─────────────────────────────┐ │ │ │ │ │ SimpleFlowSubscriber │ │ │ │ CompleteFlowSubscriber │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + execute(context) │ │ │ │ + can_execute?(context) │ │ │ │ │ └───────────┬───────────┘ │ │ + valid?(context) │ │ │ │ │ │ │ │ │ + prepare(context) │ │ │ │ │ │ │ │ │ + save(context) │ │ │ │ │ │ extends │ │ │ + dispose(context) │ │ │ │ │ ▼ │ │ └─────────────────────────────┘ │ │ │ │ ┌───────────────────────┐ │ │ │ │ │ │ │SimpleCatchFlowSubscrib│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + execute(context) │ │ │ │ │ │ │ │ + catch(err, context)│ │ │ │ │ │ │ └───────────────────────┘ │ │ │ │ │ └─────────────────────────────┘ └─────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ `

Architecture

FlowSubscribers implements two flow patterns to organize business logic:

Communication Flow - Simple Flow

SimpleFlow executes each subscriber sequentially. Ideal for simple flows where each step depends on the previous one. ` ┌──────────────────────────────────────────────────────────────────────────────┐ │ SimpleFlowController │ │ ┌─────────┘ │ │ ▼ │ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ LOOP: For each flow in @flows │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │ │ │ │ │ Subscriber A │ ──► │ Subscriber B │ ──► │ Subscriber C │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ▼ │ │ ▼ │ │ ▼ │ │ │ │ │ │ execute(context)│ │ execute(context)│ │execute(ctx) │ │ │ │ │ └─────────────────┘ └─────────────────┘ └──────────────┘ │ │ │ │ │ │ │ │ flow_context is passed and modified at each step │ │ │ │ ──────────────────────────────────────────────────────────────► │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ │ │ Returns: flow_context (with all modifications) │ └──────────────────────────────────────────────────────────────────────────────┘ ` SimpleCatchFlowSubscriber adds exception handling: ` ┌─────────────────────────────────────────────────────────────┐ │ SimpleCatchFlowSubscriber │ │ │ │ run(flow_context) │ │ │ │ │ ▼ │ │ ┌─────────────────────┐ │ │ │ try │ │ │ │ execute(context) │────► Success ────► return context │ │ └─────────┬───────────┘ │ │ │ │ │ Exception? │ │ │ │ │ ▼ │ │ ┌─────────────────────┐ │ │ │ catch │ │ │ │ catch(err, ctx) │────► return context │ │ └─────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ ` ---

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 3mo ago
Stale
AdoptionUnder 100 stars
0 ★ · Niche
DocsMissing or thin
Undocumented

GitHub Signals

Issues1
Updated3mo ago
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more