single-responsibility-principle

single-responsibility-principle is a cursor rule for Cursor from lacymorrow/paperclip-hub. It costs 0 tokens per session (707 once invoked), scanned A, original, MIT.

A code-organisation rule based on the Single Responsibility Principle (SRP): each class, function, or module should have one clear purpose and one main reason to change.

In plain words
What is it for?
Use it when designing or reviewing services and modules, such as keeping user, team, and payment operations separate. It helps identify classes or functions that are handling too many unrelated tasks.
Why use it?
It helps prevent tangled code where unrelated changes affect the same file or service. It also reduces duplicated logic and unclear ownership of data.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when designing or reviewing services and modules, such as keeping user, team, and payment operations separate. It helps identify classes or functions that are handling too many unrelated tasks.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/lacymorrow/paperclip-hub/single-responsibility-principle
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/lacymorrow/paperclip-hub

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for single-responsibility-principle

README.md
[![agentmods](https://agentmods.dev/badge/rules/lacymorrow/paperclip-hub/single-responsibility-principle/github.svg)](https://agentmods.dev/rules/lacymorrow/paperclip-hub/single-responsibility-principle)
Your own site
<a href="https://agentmods.dev/rules/lacymorrow/paperclip-hub/single-responsibility-principle"><img src="https://agentmods.dev/badge/rules/lacymorrow/paperclip-hub/single-responsibility-principle/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for single-responsibility-principle

Your own site · 80×15
<a href="https://agentmods.dev/rules/lacymorrow/paperclip-hub/single-responsibility-principle"><img src="https://agentmods.dev/badge/rules/lacymorrow/paperclip-hub/single-responsibility-principle.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 707 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00707
Opus 5.5 $0.00000 $0.00283
Sonnet 5.5 $0.00000 $0.00141
Haiku 4.5 $0.00000 $0.00071

Measured yesterday against content hash 0d202ca7f2a1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

single-responsibility-principle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/single-responsibility-principle.mdc · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Single Responsibility Principle (SRP)

Definition

The Single Responsibility Principle states that "A module should be responsible to one, and only one, actor." In simpler terms, a class or function should have only one reason to change.

Core Principles

  • Each module has one clearly defined purpose
  • Services handle only their domain concerns
  • User creation belongs only in UserService
  • Payment processing belongs only in PaymentService
  • Side effects are managed by their respective services
  • Cross-cutting concerns use service composition

Signs of SRP Violations

  • Methods doing multiple unrelated things
  • Large service files (>300 lines)
  • Services creating/managing entities outside their domain
  • Duplicated logic across services
  • A change in one feature requires changes in multiple services
  • Conditional logic based on entity types
  • Direct database access across domain boundaries

Best Practices

Service Organization

  • Services should only manipulate their own domain entities
  • UserService should be the ONLY place creating/updating users
  • TeamService should be the ONLY place creating/updating teams
  • PaymentService should NEVER create users directly
  • Use service composition instead of cross-domain logic

Correct Patterns

// ✅ Good: PaymentService calls UserService for user creation
const user = await userService.ensureUserExists({
  email: payment.email,
  name: payment.name
});
await this.linkPaymentToUser(payment, user.id);

// ✅ Good: UserService manages all user creation side effects
async createUser(data) {
  const user = await this.insert(data);
  await this.createPersonalTeam(user.id);
  await this.createDefaultApiKey(user.id);
  return user;
}

Incorrect Patterns

// ❌ Bad: PaymentService creating users directly
const [user] = await db.insert(users).values({
  email: payment.email,
  name: payment.name
}).returning();

// ❌ Bad: Duplicated team creation logic
await db.insert(teams).values({
  id: randomUUID(),
  name: "Personal",
  userId: user.id
});

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 110 lines · 0 tokens per session scan A 0d202ca7f2a1

Subscribe to this mod's changes

single-responsibility-principle is a cursor rule published in the GitHub repository lacymorrow/paperclip-hub (15 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 707 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-10.

Related

single-responsibility-principle compared with cursor rules from other repositories

single-responsibility-principle next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
single-responsibility-principlelacymorrow/paperclip-hubCursor rule15yesterdayMITA0Cursor
ultraciteelie222/inbox-zeroCursor rule13ktodaynoneA0Cursor
always-push-pritsmemeworks/adhxCursor rule195d agoMITA279Cursor
refactoring-skillKaelSensei/MagicAIBuilderCursor rule2yesterdayMITA119Cursor
tech-lead-skillKaelSensei/MagicAIBuilderCursor rule2yesterdayMITA112Cursor
code-style-and-improvementsWebDevPeterGriffin/The-VibeCode-BibleCursor rule427d agononeA104Cursor
single-responsibility-principleshipkit-io/bonesCursor rule21yesterdaynoneA0Cursor