@library / rules

Cursor library: reusable rules and prompts that just work

Good output depends on good instructions. This Cursor library collects rule sets, prompt templates and context packs organised by language and framework, ready to drop into any repository.

Inside the library

Three kinds of building blocks

Each entry in the Cursor library is plain text, versioned and easy to adapt. Use them as they are or as a starting point for your own team standards.

.mdc

Rule sets

Project rules that describe architecture, naming, error handling and testing style. Scoped by file glob so the right rule loads at the right moment.

prompt

Prompt templates

Proven instructions for recurring jobs: writing unit tests, reviewing a diff, documenting an endpoint, migrating between library versions.

@docs

Context packs

Lists of documentation sources and reference files to index, so the agent answers with current API details instead of guesses.

By stack

Popular collections in the Cursor library

React & Next.js

Server vs client components, hooks rules, accessible markup, Tailwind class order.

Open →

Python

Type hints everywhere, pytest fixtures, FastAPI routers, clean dependency layout.

Open →

Go

Idiomatic errors, small interfaces, table-driven tests, context propagation.

Open →

Node backend

Layered services, input validation, structured logging, safe database queries.

Open →

Swift & iOS

SwiftUI view composition, async/await, previews and snapshot testing.

Open →

Rust

Ownership-friendly APIs, thiserror patterns, clippy-clean code, doc tests.

Open →

DevOps

Dockerfiles, CI pipelines, Terraform modules with sane defaults.

Open →

Code review

Checklists for security, performance and readability on every diff.

Open →
Example

What a library rule looks like

A rule is a short Markdown file with a header that says when it applies. Keep it specific: concrete do’s and don’ts beat general advice like “write clean code”.

Short rules are cheaper too. Every applied rule uses part of the context window, so split large guidelines into focused files instead of one long document.

---
description: API route conventions
globs: src/api/**/*.ts
---
- Validate input with zod at the top
- Return { data } or { error }, never both
- Log with requestId, no console.log
- Each route gets an integration test
How to use

Add a Cursor library entry to your project

Pick a collection

Choose the set that matches your language and framework.

Copy into the rules folder

Place files in the repository’s rules directory and commit them.

Adjust the details

Replace example paths and library names with the ones your codebase uses.

Test with a prompt

Ask the agent for a small change and confirm the output follows each rule.

FAQ

About the Cursor library

Yes. Every rule and template here is plain text you can copy, modify and share inside your team.
Start with three to five focused rules. Add more only when you notice the AI repeating the same mistake.
Yes. Rules marked always-apply load in every request, while glob-scoped rules attach automatically when matching files are involved.
Absolutely — send a short description of the stack and the conventions you rely on, and it can be added to the library.

Don’t have the editor yet?

Install it on Windows, macOS or Linux and apply your first rule set in minutes.

Go to download