---
name: cursor-rules-file-generator
description: "Generates a Cursor rules file with short imperative rules, ranked constraints and clear no-go areas, so suggestions match how the project really works. Use when a team wants a Cursor rules file that makes the editor's AI follow the project's stack, conventions and protected areas. Do not use for rules files for other editors or a one-off task brief. Related topics: AI, Coding, Engineering."
---

# Cursor Rules File Generator

Generates a Cursor rules file with short imperative rules, ranked constraints and clear no-go areas, so suggestions match how the project really works.

## When to use

Use this skill when a team wants a Cursor rules file that makes the editor's AI follow the project's stack, conventions and protected areas. Do not use it for rules files for other editors or a one-off task brief.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. List the stack, structure and conventions from the inputs and drop anything the model would do by default.
3. Rank the constraints by cost of violation and place the highest-cost ones at the top of the file.
4. Write each rule as a short imperative that can be verified in a code diff.
5. Add the boundaries section naming protected paths exactly, plus commit conventions if requested.
6. Check that no rule contradicts another and the file reads cleanly in under two minutes.

## Inputs

- **Project name** (free text, e.g. "Billing service")
- **Main language and framework** (free text, e.g. "TypeScript with Next.js")
- **Folder structure and where things live** (longer free text)
- **Coding conventions to enforce** (longer free text)
- **Working habits** (choose any: Prefer small diffs, Always add tests, No new dependencies without asking, Match existing patterns, Explain non-obvious changes)
- **Files or areas the AI must not touch** (longer free text)
- **Include commit-message conventions** (choose one: Yes, No)

## Output

A single rules file with short headed sections, imperative one-line rules, the strictest constraints first, and no filler prose.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Cursor Rules File

Write a rules file for Cursor that keeps AI suggestions consistent with how this project actually works.

#### Project
- Project name: {{Project name}}
- Main language and framework: {{Main language and framework}}
- Folder structure and where things live: {{Folder structure and where things live}}

#### Conventions
- Coding conventions to enforce: {{Coding conventions to enforce}}
- Working habits: {{Working habits}}

#### Boundaries
- Files or areas the AI must not touch: {{Files or areas the AI must not touch}}
- Include commit-message conventions: {{Include commit-message conventions}}

Output a ready-to-save Cursor rules file. Group short imperative rules under headings: stack, structure, conventions, testing, boundaries, and commits if requested. Put the most important constraints first, since the top of the file carries the most weight. Phrase each rule so it can be checked in a diff, and give a one-line reason only where the rule would otherwise look arbitrary. Leave out anything the model already does by default.

## Pitfalls

- Writing aspirational rules like 'write clean code' that cannot be checked.
- Burying the do-not-touch list at the bottom where it carries least weight.
- Restating defaults, which pads the file and hides the rules that matter.
