← All guides

Spec-driven development with Cursor

Vibe coding ships fast and regresses faster when “done” lives only in chat. Pair short acceptance criteria with Cursor’s persistent rules so Agent gets the same definition every session.

Why chat-only instructions fail

Cursor’s own docs put it plainly: “Large language models don’t retain memory between completions. Rules provide persistent, reusable context at the prompt level.” Correcting the agent in one chat does nothing for the next one.

Source: cursor.com/docs/rules

Step 1 — Lock “done” in Given/When/Then

Before the first Agent prompt for a feature, write 3–5 testable lines:

---
Feature: Password reset
AC-1: Given a valid account email, When user requests reset, Then a one-time link is issued and expires within 1 hour.
AC-2: Given an unused reset link, When user sets a new password, Then the old password no longer authenticates.
AC-3: Given an expired link, When user opens it, Then they see an error and can request a new link.
Out of scope: Do not change OAuth providers, billing, or DB migrations.
---

Step 2 — Put durable constraints in project rules

Cursor project rules live in .cursor/rules as .mdc files with frontmatter (alwaysApply, globs, description). Per Cursor’s docs, a plain .md file in that folder is ignored. If you prefer plain markdown, use an AGENTS.md file in the project root instead.

---
description: Password reset feature constraints
alwaysApply: false
globs: src/auth/**/*
---

- Implement only AC-1…AC-3 from specs/password-reset.md
- Do not modify OAuth, billing, or migrations
- Prefer minimal diffs; ask before new dependencies

Rule types: Always Apply · Apply Intelligently (via description) · Apply to Specific Files (globs) · Apply Manually (@mention). Official details: Cursor Rules.

Step 3 — Prompt against the checklist

  1. “Implement AC-1 only. Stop and summarize. Do not mark others done.”
  2. Manually verify the Then clause.
  3. Repeat per criterion. Keep the finished criteria in a running checklist (for example in the PR description or specs/) so it accumulates across features and you can recheck old ones.

How this relates to Spec Kit / Kiro / Traycer

GitHub Spec Kit, Kiro, and Traycer already offer strong spec-first workflows inside your repo or IDE. Use them if they fit. The habit above is free inside Cursor today, with no new product required.

Want the habit in a browser?

SpecLock is in development (waitlist): plain English → locked criteria → one-click packs for Cursor / Claude Code / Codex + a growing regression checklist. Planned Solo $15 / Pro $29 — not charging yet. Not affiliated with Cursor.

Join the SpecLock waitlist

Related: Acceptance criteria before Claude Code