the shed // cursor tutorial

Cursor is an AI code editor that will happily rewrite half your repo before lunch. Here is how to point that speed at DevOps and security work without losing control of it.

See the workflow in action, tap through the tabs below:




cursor-devops.mdc
01/04

$ setup

mkdir -p .cursor/rules
touch AGENTS.md
# open the repo in Cursor, then press Ctrl+I (Cmd+I on Mac) for Agent

$ cat .cursor/rules/infra.mdc

---
description: Infra and security conventions for this repo
globs: ["**/*.tf", "**/*.yaml", "**/Dockerfile"]
alwaysApply: false
---
- Never hardcode secrets. Use the secrets manager.
- No 0.0.0.0/0 ingress unless a comment explains why.
- Pin image tags and provider versions.
- Show a plan or dry run before any apply.

$ agent prompt

Review the Terraform in /infra for security problems.
Do not edit anything. Output a table: file, line,
risk, severity, suggested fix. Flag open security
groups, public buckets, and unencrypted volumes.

Read-only first. Ask for a review or a plan before you let Agent edit files. Approve terminal commands by hand until you trust a workflow. Use checkpoints, but remember they only restore files, not the outside world.

+CURSOR7 DevOps + SecurityWorkflows That ShipTHA-SHED.COM
Cursor tutorial cover illustration

What Cursor Actually Is

Cursor is an AI-first code editor built around an Agent that can search your repo, read and edit files, run terminal commands, browse the web, and ask you questions while it works. It is not autocomplete with a chat box bolted on. It is closer to a fast, tireless junior engineer who never asks what the deploy process is. That is exactly why it needs rules. Read the official Agent docs once, then come back here for the practical version.

Quick Setup

Install Cursor, open your repo, and press Ctrl+I (Cmd+I on Mac) to open Agent. Then do the two things most people skip: create a .cursor/rules folder and drop an AGENTS.md file in the project root. Rules are markdown files that get included at the start of the model context, so the AI starts every chat already knowing your conventions. Plans include Hobby (free), Pro, Pro+, Ultra, and Teams. Check the pricing page for current numbers, because they change.

The Mindset: Fast Hands, Slow Trust

The winning principle is simple. Let the AI move fast on reading and drafting, and stay slow on anything that touches the real world. Read-only first, edits second, terminal commands only after you have looked at them. Cursor takes a checkpoint before significant changes, and you can restore from the chat timeline, but a checkpoint reverts files only. It cannot un-run a command that already hit your cloud account.

Treat every prompt like a ticket you would hand a contractor: scope, constraints, and what "done" looks like. Vague prompts get confident nonsense. If you want more on the wider approach, see our earlier guide on agentic coding workflows for DevOps and security.

+The safe Cursor loop01Write rules02Ask read-only03Review the plan04Approve edits05Test and commitEvery edit passes a human gate. Speed comes from the loop, not from skipping it.THA-SHED.COM
Workflow diagram: the safe Cursor loop (Illustration with example data)

7 Workflows Worth Stealing

1. Write your rules file first

Rules come in four flavors: Always Apply, Apply Intelligently (the agent reads your description and decides), Apply to Specific Files via globs, and Apply Manually when you @-mention them. Keep each rule file short and actionable. The docs recommend staying under 500 lines and referencing files instead of pasting them in.

Prompt: "Draft an infra.mdc rule for our Terraform: no hardcoded secrets, pinned provider versions, and a dry run before any apply. Scope it to .tf files."

+.cursor/rules/infra.mdcdescription: Infra conventionsglobs: **/*.tf- No secrets in code- Pin every version- Dry run before applyRule applied3 of 3 checks passedTHA-SHED.COM
Mockup of a Cursor rules file (Illustration with example data)

2. Read-only security review

Before anything gets edited, have Agent audit. This is the highest-value, lowest-risk use of the tool.

Prompt: "Review /infra for security problems. Do not edit anything. Give me a table of file, line, risk, severity, and a suggested fix."

+agent: review /infra (read-only)FILE LINE RISK SEVnetwork.tf 42 ingress open to world HIGHstorage.tf 17 bucket not encrypted HIGHcompute.tf 88 unpinned image tag MEDiam.tf 9 wildcard action HIGH4 findings. No files changed.THA-SHED.COM
Mockup of an agent security review table (Illustration with example data)

3. Explain the legacy pipeline

Inherited a 900-line CI config nobody understands? Ask for a plain-English walkthrough.

Prompt: "Walk me through this pipeline stage by stage. List every secret it reads, every environment it deploys to, and anything that looks unsafe."

4. Dockerfile hardening

Prompt: "Harden this Dockerfile: non-root user, pinned base image, multi-stage build, no build tools in the final image. Show a diff, do not apply it yet."

5. Draft tests before fixing bugs

Prompt: "Write a failing test that reproduces this bug. Stop once the test fails for the right reason. Do not fix the bug."

6. Incident runbook from a postmortem

Prompt: "Turn this postmortem into a runbook: detection signals, first five checks, rollback steps, and who to page. Use only facts from the document."

7. Plan mode for risky refactors

For big changes, ask for a plan and edit nothing until you have read it. The navigation in Cursor's docs lists Plan Mode alongside Agent. Ask for the steps, the files touched, and the rollback path, then approve one step at a time.

Prompt: "Plan a migration of our deploy scripts from bash to Python. List files touched, risks, and a rollback path. No edits yet."

Safety and Gotchas

Agent can run unlimited tool calls, which is great until it is wrong at scale. Keep these habits: approve terminal commands manually until a workflow has earned trust, never paste real secrets into a prompt, and keep production credentials out of the environment your editor runs in. Review diffs like you would a stranger's pull request. If a rule says "never do X," verify it, because rules guide the model but do not enforce anything. Real enforcement still lives in your CI, your IAM policies, and your branch protection.

Also watch for scope creep. Agents love to "helpfully" refactor neighboring files. Say "only touch these files" in the prompt, and check the diff list before accepting.

Usage and Cost Tips

Every plan includes a set amount of model usage, and on-demand usage bills in arrears once you burn through it. Start a fresh chat per task so old context does not inflate every request. Use the cheaper model for boilerplate and save the heavy one for planning. Reviews and explanations are cheap wins; giant open-ended "fix everything" prompts are where budgets go to die.

FAQ

Is Cursor good for DevOps work?

Yes, for reading, reviewing, and drafting Terraform, YAML, and Dockerfiles. Keep it read-only until you trust the workflow, and let CI do the enforcing.

Do Cursor rules replace AGENTS.md?

No. AGENTS.md is a simpler plain-markdown option, and nested files in subfolders apply to that directory. The .cursor/rules folder adds metadata like globs and descriptions for finer control.

Can Cursor leak my secrets?

Anything you put in a prompt or open in context can be sent to a model provider. Keep secrets out of the repo and out of chat, and check your plan's privacy settings.

Your Next Step

Pick one repo today, write a five-line rules file, and run the read-only security review. That single loop pays for itself. Want to go deeper on AI-assisted DevOps and security careers? Check out our courses.

Tha-Shed

Type a brief, get a finished film. Characters, voices and music included.

Start creating