agentleFS
sagarithmsagarithm/sagarithm-kit/.cursor/rules/architecture-system-design.mdc

sagarithm-kit / rules

Cursor rule17 starsChanged 12 days agoApache-2.0View on GitHub

The file

We split this architecture-system-design.mdc into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Define Explicit Boundaries: Every module must expose a strict public API (e.g.

    line 16
  2. Distinctive:

    Cohesion Over Fragmentation: Avoid arbitrary file splitting.

    line 19

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
architecture-system-design.mdc
<!-- SAGARITHM:START - DO NOT EDIT DIRECTLY -->
---
description: "Decompose complex systems into highly cohesive, loosely coupled modules with explicit public interfaces, bounded contexts, and acyclic dependencies."
globs: ["**/*"]
alwaysApply: false
---

# System Design & Modularity

# System Design & Modularity

## Overview
This skill guides AI agents and engineers in decomposing system requirements into maintainable, modular components while preventing architectural decay, circular dependencies, and leaky abstractions.

## Core Directives
1. **Define Explicit Boundaries**: Every module must expose a strict public API (e.g. index file or port interface) and hide internal implementation helpers.
2. **Enforce Directional Dependencies**: High-level business policies must never depend on low-level technical mechanisms (database drivers, network protocols). Apply Dependency Inversion.
3. **Prevent Circular References**: Maintain a strict Directed Acyclic Graph (DAG) across modules and packages.
4. **Cohesion Over Fragmentation**: Avoid arbitrary file splitting. Keep concepts that change together within the same domain boundary.
5. **Protect the Domain with ACLs**: Isolate third-party schemas and external API changes through an Anti-Corruption Layer (ACL).
6. **Automate Architecture Verification**: Codify layer boundaries into automated Architectural Fitness Functions.

## 🛑 Anti-Rationalization Matrix

| Agent Excuse / Shortcut | Architectural Reality | Mandatory Action |
|---|---|---|
| *"I'll just add this function to an existing module to save time."* | Unrelated functions pollute bounded contexts and increase coupling ($Ce$). | Place the function in its own cohesive domain or create a clean port interface. |
| *"A circular import between these two files is harmless."* | Circular dependencies cause runtime undefined imports and brittle initialization bugs. | Refactor shared abstractions into a common contract or use event emission. |
| *"I'll create a `utils/` folder for miscellaneous helpers."* | Prohibited by policy. Generic helper dumps become unmaintainable junk drawers. | Group helpers directly with the domain logic they serve. |

## Detailed Guidance
- [Modularity and Coupling Guidelines](references/modularity-and-coupling.md)
- [Domain Boundaries & Event-Driven Decoupling](references/domain-boundaries-and-events.md)
- [Architectural Fitness Functions](references/architectural-fitness-functions.md)
- [Modular vs. Tightly Coupled Examples](examples/modular-vs-tightly-coupled.md)
- [Architecture Review Checklist](checklists/architecture-review-checklist.md)
<!-- SAGARITHM:END -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.