Repository navigation
Add Cursor Rules Pack v2 — 7 sample production-tested rules #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d40c4b3
Add cursor-rules-pack-v2 sample rules
oliviacraft edb1226
Add cursor-rules-pack-v2 sample rules
oliviacraft 93036d3
Add Cursor Rules Pack v2 to README
oliviacraft 6fbc5ec
fix: use relative link for Cursor Rules Pack v2, sort Mobile Developm…
oliviacraft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
rules/cursor-rules-pack-v2-cursorrules-prompt-file/.cursorrules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Cursor Rules Pack v2 — Sample Rules | ||
| # 7 production-tested rules from the full 50-rule pack | ||
| # Full pack: https://oliviacraftlat.gumroad.com/l/wyaeil | ||
|
|
||
| ## Rule 1 — Dependency Discipline | ||
| Before suggesting a new npm package: (1) state what it does in one sentence, (2) check if it's actively maintained (last publish < 6 months), (3) confirm whether we could implement it in < 30 lines without the dependency. Prefer fewer, well-maintained packages. Never add a dependency for a task under 20 lines of code. | ||
|
|
||
| ## Rule 2 — Explicit Error Handling | ||
| Always wrap async operations in try/catch. Never swallow errors silently. Return typed error objects using a Result pattern or throw typed errors. Log errors with context: logger.error('[FunctionName] description', { error, context }). Always provide user-facing error states in UI components. | ||
|
|
||
| ## Rule 3 — Comments Policy | ||
| Write self-documenting code first. Add comments only for: (1) non-obvious business logic — explain WHY, not WHAT, (2) workarounds — explain why the workaround exists and link to the issue, (3) complex algorithms — reference the algorithm name. Never comment what the code clearly does. | ||
|
|
||
| ## Rule 4 — State Management Hierarchy | ||
| Follow this state hierarchy strictly: | ||
| - URL state → filters, pagination, search (useSearchParams) | ||
| - React state → UI-only, ephemeral (useState) | ||
| - Zustand → cross-component app state | ||
| - React Query → all server state | ||
| Never use Zustand to cache server data — that's React Query's job. Never reach for Redux. | ||
|
|
||
| ## Rule 5 — Parallel Data Fetching | ||
| Identify and parallelize independent data fetches. Never await sequentially when operations are independent — use Promise.all. When making a sequential await, add a comment explaining the dependency that forces the sequence. | ||
|
|
||
| ## Rule 6 — Webhook Security | ||
| For incoming webhooks: verify the signature in the first 3 lines of the handler — reject immediately if invalid. Respond with HTTP 200 within 5 seconds — offload processing to a background job. Store the raw webhook event before processing. Implement idempotency using the event ID. | ||
|
|
||
| ## Rule 7 — Database Query Safety | ||
| Never return full database records to the client — always use select to specify exactly which fields are needed. This prevents accidentally exposing password hashes, reset tokens, internal flags, and other sensitive fields. For queries that could return more than 50 rows, always add pagination (take/skip or cursor-based). |
25 changes: 25 additions & 0 deletions
25
rules/cursor-rules-pack-v2-cursorrules-prompt-file/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Cursor Rules Pack v2 — Sample | ||
|
|
||
| 7 production-tested rules from the [Cursor Rules Pack v2](https://oliviacraftlat.gumroad.com/l/wyaeil). | ||
|
|
||
| These cover dependency management, error handling, comments policy, state management, data fetching, webhook security, and database safety — with before/after examples. | ||
|
|
||
| ## Usage | ||
|
|
||
| Copy `.cursorrules` to your project root. Cursor picks it up immediately. | ||
|
|
||
| ## Full Pack | ||
|
|
||
| The complete pack includes 50 rules across 5 sections: | ||
| - General Coding (10 rules) | ||
| - Next.js & React (10 rules) | ||
| - Database & Backend (10 rules) | ||
| - AI Behavior (10 rules) | ||
| - Project-Specific Templates (10 rules) | ||
|
|
||
| → **[$27 — instant download](https://oliviacraftlat.gumroad.com/l/wyaeil)** | ||
|
|
||
| ## Source | ||
|
|
||
| - Author: [@OliviaCraftLat](https://x.com/OliviaCraftLat) | ||
| - Sample repo: [github.com/oliviacraft/cursor-rules-pack-sample](https://github.com/oliviacraft/cursor-rules-pack-sample) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.