diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-25 16:16:42 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:46:35 +0200 |
| commit | 2c0fd4f86b011bbc8c0d86c61f96ade3ea249508 (patch) | |
| tree | 660cbe303457d212d4c1d5398b02ed64945b7099 /.cursor/rules/separation-of-concerns.mdc | |
| parent | 5e2b829f8a682a619cd0de6681ddd9f542235ebf (diff) | |
| download | opencut-2c0fd4f86b011bbc8c0d86c61f96ade3ea249508.tar.gz | |
untrack .cursor/
Diffstat (limited to '.cursor/rules/separation-of-concerns.mdc')
| -rw-r--r-- | .cursor/rules/separation-of-concerns.mdc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/.cursor/rules/separation-of-concerns.mdc b/.cursor/rules/separation-of-concerns.mdc deleted file mode 100644 index 4abb8808..00000000 --- a/.cursor/rules/separation-of-concerns.mdc +++ /dev/null @@ -1,51 +0,0 @@ ---- -alwaysApply: false ---- -# Separation of Concerns - -## Core Principle - -Each file should have one single purpose/responsibility. Related functionality should be grouped together, unrelated functionality should be separated. - -## Good Separation - -- One file per major concern (auth, validation, data transformation) -- Group related utilities together -- Extract shared logic into dedicated files -- Keep API routes focused on their specific endpoint logic - -Examples: - -```javascript -// ✅ Good: Each file has clear responsibility -/lib/rate-limit.ts // Rate limiting utilities -/lib/validation.ts // Input validation schemas -/lib/freesound-api.ts // External API integration -/api/sounds/search/route.ts // Route handler only -``` - -## Bad Mixing of Concerns - -Avoid cramming multiple responsibilities into one file: - -```javascript -// ❌ Bad: Route file doing everything -/api/sounds/search/route.ts -- Rate limiting logic -- Validation schemas -- API transformation -- External API calls -- Response formatting -- Error handling utilities -``` - -## When to Separate - -- File is getting long (>500 lines) -- Multiple distinct responsibilities in one file -- Logic could be reused elsewhere -- Complex utilities that distract from main purpose - -## Rule - -One file, one responsibility. Extract shared concerns into focused utility files
\ No newline at end of file |
