Show HN: Cursor AI Rules Directory (Open Source) (cursor.directory)

51 points by pontusabb ↗ HN
While Cursor has already revolutionized coding, you can still configure it to perform even better based on your language and framework.

That's why we created Cursor Directory, a collection of the best cursor rules for your framework and language from the community. It's fully open source and you can contribute to it by submitting your own rules.

Just copy and add a .cursorrules file to your project root!

Let me know what you think!

19 comments

[ 3.1 ms ] story [ 64.1 ms ] thread
Are these system prompts actually adding any value? I use Claude for coding a lot and haven't seen any meaningful difference from just giving it the code and asking for a change. Telling it to "be an expert" in something feels like a type of thing that sounds cool in theory but has no actual impact in practice.
it does, especially when you have libraries that you use and want to instruct how to write the code!
I suspect it's not so much the "expert" instruction but the list of subjects of the expertise. These words will generate embeddings that have a better chance of activating useful pathways and relationships within the LLM's generation path.

My understanding is the goal is to prime the LLM with context that it will use when generating answers, rather than hoping it will infer connections in the feed forward layers when generating answers based on a sparse prompt.

(comment deleted)
This is something I’ve been arguing for for a while[1]. I called it a “Framework Knowledge Base”. I think it needs to go a bit further and include specific code examples, especially for newer bits that are not in the training set. Ultimately RAG or even fine tuning might be better than a system prompt. [1]: https://devops.com/the-rise-of-coding-assistants-superchargi...
All non language specific rules point to python. why is that?
it’s created by the community, you can add tags for them to be in different sections! No real reason just for python
Something I have been wondering. By giving so much rich instructions which are irrelevant in some cases - aren't we actually creating WORSE results?

For example, I have copied a sample system prompt for React below we instruct the LLM to " - Always use === instead of ==." By making the LLM 'think' of this additional detail, are we not taking away its focus from actually solving the main task? And something like equal signs can easily be auto-fixed by a linter.

  You are an expert in JavaScript, React, Node.js, Next.js App Router, Zustand, Shadcn UI, Radix UI, Tailwind, and Stylus.

  Code Style and Structure
  - Write concise, technical JavaScript code following Standard.js rules.
  - Use functional and declarative programming patterns; avoid classes.
  - Prefer iteration and modularization over code duplication.
  - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
  - Structure files: exported component, subcomponents, helpers, static content.

  Standard.js Rules
  - Use 2 space indentation.
  - Use single quotes for strings except to avoid escaping.
  - No semicolons (unless required to disambiguate statements).
  - No unused variables.
  - Add a space after keywords.
  - Add a space before a function declaration's parentheses.
  - Always use === instead of ==.
  - Infix operators must be spaced.
  - Commas should have a space after them.
  - Keep else statements on the same line as their curly braces.
  - For multi-line if statements, use curly braces.
  - Always handle the err function parameter.
  - Use camelcase for variables and functions.
  - Use PascalCase for constructors and React components.

  Naming Conventions
  - Use lowercase with dashes for directories (e.g., components/auth-wizard).
  - Favor named exports for components.

  React Best Practices
  - Use functional components with prop-types for type checking.
  - Use the "function" keyword for component definitions.
  - Implement hooks correctly (useState, useEffect, useContext, useReducer, useMemo, useCallback).
  - Follow the Rules of Hooks (only call hooks at the top level, only call hooks from React functions).
  - Create custom hooks to extract reusable component logic.
  - Use React.memo() for component memoization when appropriate.
  - Implement useCallback for memoizing functions passed as props.
  - Use useMemo for expensive computations.
  - Avoid inline function definitions in render to prevent unnecessary re-renders.
  - Prefer composition over inheritance.
  - Use children prop and render props pattern for flexible, reusable components.
  - Implement React.lazy() and Suspense for code splitting.
  - Use refs sparingly and mainly for DOM access.
  - Prefer controlled components over uncontrolled components.
  - Implement error boundaries to catch and handle errors gracefully.
  - Use cleanup functions in useEffect to prevent memory leaks.
  - Use short-circuit evaluation and ternary operators for conditional rendering.

  State Management
  - Use Zustand for global state management.
  - Lift state up when needed to share state between components.
  - Use context for intermediate state sharing when prop drilling becomes cumbersome.

  UI and Styling
  - Use Shadcn UI and Radix UI for component foundations.
  - Implement responsive design with Tailwind CSS; use a mobile-first approach.
  - Use Stylus as CSS Modules for component-specific styles:
    - Create a .module.styl file for each component that needs custom styling.
    - Use camelCase for class names in Stylus files.
    - Leverage Stylus features like nesting, variables, and mixins for efficient styling.
  - Implement a consistent naming convention for CSS classes (e.g., BEM) within Stylus modules.
  - Use Tailwind for utility classes and rapid prototyping.
  - Combine Tailwind utility classes with Stylus modules for a hybrid approach:
    - Use Tailwind for common utilities and layout.
    - Use Stylus modules for complex, component-specific styles.
    - Never use the @apply directive

...
This is fantastic, I feel like it can once again improve my development efficiency
Is it possible for .cursorrules to access a directory and say read from the .md files to extend its knowledge?
I don't think so, but imho it would be a no-brainer to have .cursorrules files support the same @Web @...files, @Docs syntax which cursor already has in Cmd+K
how to get official cursor prompt?