Skip to content
vibespell

.cursor/rules/security.mdc

Cursor security rule for Vue

A focused Cursor `.mdc` rule for auth, secrets, and untrusted input. It attaches when those files change, instead of repeating security policy in every chat. This copy is written for a Vue project. This repository is a Vue 3 app. New components use the Composition API and `<script setup>`. Single-file components stay the unit of UI.

The example uses a balanced, readable style, pragmatic tests, and comments only where the intent is not obvious. Open the generator to make the agent stricter, switch to test-first, quiet the comments, or pick a different file.

The example assumes Vue 3 with the Composition API. It does not assume Nuxt, Pinia, or Vue Router unless those are already installed. Do not mix in the Options API for new code.

Example file

Balanced strictness, readable style, pragmatic tests. Download name: security.mdc

---
description: "Security rules for a Vue repository"
globs: "**/*{auth,Auth,secret,config,Config}*"
alwaysApply: false
---

# Security rules

Attach these rules when editing auth, config, or secret-handling code in this Vue repository.
This repository is a Vue 3 app. New components use the Composition API and `<script setup>`. Single-file components stay the unit of UI.

## Secrets and trust

- Do not use v-html on untrusted strings.
- Keep tokens out of the bundle. Read them on the server.
- Validate form payloads before they reach an API.

## Errors

- Fail at the boundary. Do not swallow errors.
- Fail in the composable or the submit handler with a message the component can render. Do not swallow rejected promises.

## Done when

- Untrusted input is validated before a side effect.
- No secret was added to source, logs, or a client bundle.
- `npm run build` still succeeds, and you ran the repo's lint or test script when one exists.

Add it to the project

  1. 01

    Copy a starting file

    Copy the example Cursor security rule on this page, or open the generator if you want different testing, strictness, or comment rules.

  2. 02

    Save it at .cursor/rules/security.mdc

    Save it at `.cursor/rules/security.mdc` in the Vue repo. Narrow the globs if your auth and config files live in a known folder.

  3. 03

    Start a fresh agent session

    Rules files are read when a session starts. A chat that is already open may still be using the old instructions.

  4. 04

    Give it one small task

    Ask for one change a Vue agent often gets wrong, such as a component that types its props and emits instead of reaching into a parent. If it ignores the file, confirm the path and start a new session.

Questions about this file

Where do I put Cursor security rule in a Vue repo?

Save it at `.cursor/rules/security.mdc` in the Vue repo. Narrow the globs if your auth and config files live in a known folder.

Which tools read this Cursor security rule?

Cursor loads `.cursor/rules/security.mdc` for files that match its globs. Pair it with the always-on project rule. It is not a substitute for code review.

What does the Vue example assume?

The example assumes Vue 3 with the Composition API. It does not assume Nuxt, Pinia, or Vue Router unless those are already installed. Do not mix in the Options API for new code.

Does VibeSpell upload my repository?

No. Recipe pages are static, and the generator builds the file in your browser from the options you pick. Your source code never leaves the machine.

Other files for Vue

Cursor security rule for other stacks