RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/miguelslemos/stock_portfolio

Cursor rule

.cursor/rules/domain-logic.mdc

Business rules and domain logic

Cursor rules

Quality

57/100

Scores the file, not the repository.

Length

173 words

5 headings · 1 code blocks

Repository

40

— · pushed 120 days ago

Last changed

3 days ago

First indexed 3 days ago.
miguelslemos/stock_portfolio/.cursor/rules/domain-logic.mdcRawGitHub
1---
2description: Business rules and domain logic
3globs: web/src/domain/**/*.ts
4alwaysApply: false
5---
6 
7# Business Rules (Domain Layer)
8 
9## Principles
10 
11- **Total isolation**: zero imports from `infrastructure/`, `presentation/`, or external libs
12- **Immutability**: value entities (`Money`, `StockQuantity`) must be immutable
13- **Pure methods**: given the same input, always the same output
14- **Self-validation**: entities validate their own invariants in the constructor
15 
16```typescript
17// ✅ Value entity with validation
18class Money {
19 constructor(
20 readonly amount: number,
21 readonly currency: Currency,
22 ) {
23 if (amount < 0) throw new Error('Amount cannot be negative');
24 }
25 
26 add(other: Money): Money {
27 if (this.currency !== other.currency) throw new Error('Currency mismatch');
28 return new Money(this.amount + other.amount, this.currency);
29 }
30}
31```
32 
33## Domain Services
34 
35- `PortfolioCalculationService`: position calculations, gain/loss, average cost
36- `PortfolioAnalyticsService`: snapshots and analytical aggregations
37- Receive dependencies via interface (e.g., `IExchangeRateService`)
38 
39## Operations
40 
41- `VestingOperation`: represents RSU/ESPP vesting
42- `TradeOperation`: represents stock buy/sell
43- Each operation is an immutable record with all required data
44 
45## When Modifying Business Rules
46 
471. Change only in `domain/` — never in presentation
482. Write unit tests for every scenario
493. Validate against the business guide (`docs/guia_negocio.md`)
50 

Sections

  • Business Rules (Domain Layer)
  • Principles
  • Domain Services
  • Operations
  • When Modifying Business Rules

What it covers

do-not

Stack — with the evidence

typescript

(1.00)

vite

(1.00)

vitest

(1.00)

eslint

(1.00)

node

(0.70)

react

(0.70)

tailwind

(0.70)

javascript

(0.60)

github-actions

(0.60)

Glob targeting

  • web/src/domain/**/*.ts

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
miguelslemos
Language
—
License
—
Archived
no

All configs in this repo

Also in miguelslemos/stock_portfolio

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
miguelslemos/stock_portfolio.cursor/rules/architecture.mdc · 40Cursor rulestypescriptvite+7styledependencies48/1003 days ago
miguelslemos/stock_portfolio.cursor/rules/code-style.mdc · 40Cursor rulestypescriptvite+7lint-formatstyletypesdo-not+165/1003 days ago
miguelslemos/stock_portfolio.cursor/rules/new-features.mdc · 40Cursor rulestypescriptvite+7styledo-not61/1003 days ago
miguelslemos/stock_portfolio.cursor/rules/project-overview.mdc · 40Cursor rulestypescriptvite+7testlint-formatarchdo-not72/1003 days ago
miguelslemos/stock_portfolio.cursor/rules/testing.mdc · 40Cursor rulestypescriptvite+7setupteststylearch+162/1003 days ago
miguelslemos/stock_portfolio.cursor/rules/ui-presentation.mdc · 40Cursor rulestypescriptvite+7ui50/1003 days ago
Diff against .cursor/rules/architecture.mdc Diff against .cursor/rules/code-style.mdc Diff against .cursor/rules/new-features.mdc Diff against .cursor/rules/project-overview.mdc Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/ui-presentation.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack