Skip to content

A new project with Cursor’s agent takes seven steps: turn the brief into a PRD in Plan Mode, write project rules before any code, scaffold the framework, add tooling with one verify command, prove each gate can fail and require it in CI, then build the first feature test-first. The gates, not your reading, then prove the agent’s work.

This page is for the developer who owns a new codebase from an empty directory, and for the tech lead who wants every new repository on the team to start from the same checkable baseline. The situation: your product manager writes “we need something like Trello but simpler, for daily standups, prototype by Thursday”. There is no spec and no wireframe. If you let the agent build features straight away, you get a demo on Thursday and a codebase on Friday that nobody can change safely.

  • A PRD in docs/prd.md whose acceptance criteria are written as Given/When/Then statements that map to tests
  • Two project rules in .cursor/rules/, written before the agent writes any code, that tell every later chat the stack and the command that defines “done”
  • A tooling-only scaffold with one npm run verify command that runs lint, type check, unit tests and end-to-end tests
  • A table that shows each gate going red on a deliberate break, which is the evidence that later green runs mean something
  • Five copy-paste prompts, one per step that needs the agent, and recovery steps for the ways a bootstrap usually fails

Prerequisite: Cursor installed and signed in, Node.js and Git on your PATH. If Cursor is new to you, start with the Cursor quick start. For a feature inside an existing codebase instead of a new one, use the PRD workflow in Cursor.

Bootstrap a new project in Cursor, step by step

Section titled “Bootstrap a new project in Cursor, step by step”

The order is the point. Each step leaves a file on disk that the next chat reads, so no step depends on a long conversation surviving. Start each step in a new chat.

  1. Turn the brief into a PRD in Plan Mode. Plan Mode “creates detailed implementation plans before writing any code” (Cursor docs, verified 28 August 2026), so the agent can question the brief without touching files. Create an empty folder, open it in Cursor, open a new chat, switch it to Plan Mode, and paste the prompt below with your PM’s message in place of the quoted brief.

    Answer the questions, then leave Plan Mode and ask the agent to write the PRD to docs/prd.md. Read this file properly: it is the one document you review line by line, because everything after it is checked against it.

  2. Write the project rules before any code exists. Write rules as .mdc files in .cursor/rules/; that is the pattern Cursor’s SDK agent (@cursor/sdk 1.0.32) loads, and it reads the frontmatter keys alwaysApply, globs and description: alwaysApply: true applies a rule to every request, globs applies it when matching files are in play, and description lets the agent decide. Cursor’s docs agree: “Project rules live in .cursor/rules as .mdc files”, with the frontmatter keys description, globs and alwaysApply (checked 2026-10-12). Paste this prompt in a new chat:

    The verify command does not exist yet; the rule names it now so that step 4 has a fixed target. For the full rule syntax and more templates, see project rules in Cursor.

  3. Scaffold the framework yourself, in the terminal. Run the generator with every choice supplied, so it never stops to ask:

    Terminal window
    # In the project folder, in Cursor's terminal or your own
    npx create-next-app@16.3.6 . --ts --tailwind --eslint --app --src-dir --use-npm --yes

    The generator accepts a folder that already holds docs/ and .cursor/. By default it also writes an AGENTS.md with Next.js guidance and initialises a Git repository (pass --no-agents-md or --disable-git to skip either). Cursor supports AGENTS.md in the project root and subdirectories, so the agent reads that file too (Cursor docs, checked 2026-10-12). Running the generator yourself rather than through the agent keeps the one step that downloads a template out of the chat, and its output is a known template rather than generated code.

  4. Add the tooling and one verify command, and no features. The agent now installs the rest of the stack and wires the gates. Keep features out of this step: a scaffold that already contains half a board is harder to check.

    Approve each terminal command the agent proposes unless your run mode lets it run commands without asking. Cursor’s run modes are Auto-review (the recommended default since Cursor 3.6: allowlisted calls run immediately, and other shell commands run in the sandbox when possible), Allowlist (actions on your allowlist run without approval) and Run Everything (every tool call runs automatically). You choose one in Settings > Agents > Approvals & Execution, and Cursor’s docs describe them on the Run modes page, under Agent security (checked 2026-10-12).

    When verify passes, commit everything so far. Step 5 reverts its probes against this commit, and git restore only works on files Git already tracks:

    Terminal window
    git add -A
    git commit -m "Baseline: PRD, project rules, tooling and verify gate"
  5. Prove every gate can fail. A green verify on day zero proves nothing until you have seen each gate go red. This step is what lets you trust later agent work without reading all of it.

    A “no” in that table is the most valuable output of the whole bootstrap. Fix that gate, then run the prompt again.

  6. Make the baseline a required check. If step 5 made you fix a gate, commit that fix now, so the baseline is the version whose gates you have seen fail. Then add a CI job that runs npm ci, npx playwright install --with-deps chromium and npm run verify on every pull request. It installs only Chromium, the same browser as your local setup, so CI and your machine test the same thing:

    .github/workflows/verify.yml
    name: verify
    on: [pull_request]
    permissions:
    contents: read
    jobs:
    verify:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7
    with:
    persist-credentials: false
    - uses: actions/setup-node@v7
    with:
    node-version: lts/*
    cache: npm
    - run: npm ci
    - run: npx playwright install --with-deps chromium
    - run: npm run verify

    Push it, then make the verify job a required status check in the branch protection rules for main. The agent’s local run is a preview; CI is the gate. That holds only while the agent’s pull request cannot rewrite the gate: on pull_request, GitHub runs verify.yml from the pull request itself, and npm run verify comes from its package.json. Put /.github/ and package.json under CODEOWNERS with a required code-owner review, and treat any diff to them in a feature pull request as a finding. Cursor in CI/CD covers running Cursor’s agent inside such a workflow. Git commits are the restore points you control; for how they combine with Cursor’s own checkpoints, see checkpoints and branching.

  7. Build the first feature test-first from the PRD. Create a branch first: git switch -c feat/move-card. The feature lands on main through a pull request that the required check gates. Open a new chat in Plan Mode and pick one MVP feature. The plan names its tests before the agent writes code, and each milestone ends with a verify run.

    Review the plan against the PRD, not against your taste: every acceptance criterion needs a named test. Then build it. Write the tests first and confirm they fail, then implement. Push the branch and open the pull request. Each later feature, including sign-in, goes through this same step.

How do you check the scaffold without reading every generated file?

Section titled “How do you check the scaffold without reading every generated file?”

You read two things line by line, the PRD and the two rules, because they are short and everything else is checked against them. Everything else is checked by evidence:

What you need to knowEvidenceWhere it comes from
The gates can catch a mistakeThe gate table from step 5 with “yes” in every rowThe prove-the-gates prompt
The agent follows the rulesIn a new chat, ask “Which command proves a change is done here, and which files may you not edit?” The answer quotes npm run verify and the test rule.cursor/rules/project.mdc
The feature does what the PRD saysEach acceptance criterion maps to a test name that failed before and passes afterThe step 7 plan and the test run
The change stayed in scopegit diff --stat main...HEAD lists only files named in the planGit
Nothing regressedThe required CI check is green on the pull requestCI running npm run verify

Sign-off follows the same split. The developer who owns the project approves the PRD and the rules, and a tech lead approves them when the repository is a team template. After that, reviewers read the plan, the test names and the CI result, and open the diff only where that evidence bundle is thin. How to write criteria that a test can check is in executable acceptance criteria, and the reasoning behind reviewing evidence rather than diffs is in evidence, not diffs.

What breaks when you start a new project with Cursor?

Section titled “What breaks when you start a new project with Cursor?”

The agent reaches for outdated APIs. Models learn from years of older code, so they suggest Pages Router patterns or an auth library’s older API. For example, the latest tag of next-auth is 4.24.15 while version 5 is on the beta tag (checked 26 September 2026), so an agent that writes version 5 code against a latest install produces type errors. Recovery: pin major versions in project.mdc, and when you add a library, tell the agent which version npm view <package> version reports.

Rules do not seem to apply. The file sits outside .cursor/rules/, has a different extension, or its frontmatter is malformed. The SDK’s loader (@cursor/sdk 1.0.32) reads .cursor/rules/**/*.mdc, so use .mdc and both the IDE and the SDK pick the rule up. Cursor’s docs add that a plain .md file in .cursor/rules is ignored by the rules system (checked 2026-10-12). Recovery: check the file is .mdc with a frontmatter block at the top, then ask the rule-check question from the table above in a new chat. If the answer does not quote npm run verify, the rule is not loaded.

The generator stops with “contains files that could conflict”. create-next-app 16.3.6 tolerates docs/, .cursor/, .git and a few other files, but not, for example, a package.json or a README.md you wrote first. Recovery: move the extra file out, run the generator, then move the file back.

verify is green but tests nothing. A test runner with no matching test files, or a Playwright config that points at the wrong port, can pass or skip silently, and ESLint warnings do not change its exit code, which is why the lint script uses --max-warnings=0. Recovery: this is what step 5 catches. Do not start step 7 until every row in the gate table says “yes”.

The agent edits a test to make it pass. This is the cheapest way for the agent to reach green. Recovery: the “never edit an existing test” line in project.mdc, plus a scope check: if git diff --stat shows a changed test file that the plan did not name, reject the change.

The architecture grows past the brief. Asked to plan a board, the agent proposes WebSockets, a queue and a cache for 12 users. Recovery: put the scale in the prompt (“12 users, two days, one SQLite file”) and reject any plan item that no acceptance criterion requires. For decisions that do matter long term, use architecture design with Cursor.

Later chats contradict earlier decisions. Decisions made in one conversation are gone in the next. Recovery: write every decision into the PRD or a rule, not into chat, and start each step in a new chat that references those files.

The same bootstrap in other tools: start a new project with Codex and project initialisation with Claude Code.