Rule

0 installs · 0 said it worked

PatrickJS@patrickjs·
CodingRule· for Cursor

Cursor rules pack of 7 production coding guidelines

A set of seven Cursor rules covering dependency discipline, error handling, comments, state management, parallel fetching, webhook security, and database query safety for a coding project.

People use this for

  • cursor rules coding guidelines
  • production coding rules for cursor
  • cursor rules for webhook security
  • enforce error handling in code generation
  • state management rules for react apps
Name
cursor-rules-pack-of-7-production-coding-guidelines
Works with
Cursor
License
CC0(as observed at the source)
Version
v1 · updated Nov 29, 2026
Imported · UnclaimedCC0

Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.

Are you the author?Claim this profileRequest removal

Use this rule

$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-pack-of-7-production-coding-guidelines-hpx7/export/mdc" -o .cursor/rules/cursor-rules-pack-of-7-production-coding-guidelines.mdc

Then open a new session; Cursor picks it up from .cursor/rules/.

Download cursor-rules-pack-of-7-production-coding-guidelines.mdc
Manual install

Save cursor-rules-pack-of-7-production-coding-guidelines.mdc as .cursor/rules/cursor-rules-pack-of-7-production-coding-guidelines.mdc for this project or ~/.cursor/rules/cursor-rules-pack-of-7-production-coding-guidelines.mdc for every project, then start a new session.

Rule


description: "7 sample production-tested rules (dependency discipline, error handling, state management, webhook security, and more). See the pack README for full-pack details." globs: */ alwaysApply: false

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).

No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.

Tried it

Reports from people who added this rule to their editor. They roll up into the badges above.

No one has filed a report yet. Try the prompt and be the first.

License: CC0v1 · published Nov 29, 2026

Comments

No comments yet. If you tried this prompt, say how it went.