Cline rules are markdown files Cline reads as standing instructions, kept in a .clinerules folder at the project root for the team or in a global Rules folder for one person. A rule without frontmatter loads on every task; one with a paths list loads only when a matching file is in play, such as auth or payment code.

What are Cline rules? The .clinerules folder and the files Cline reads

Cline rules are plain markdown files, best kept to one concern each, that Cline adds to its instructions. Workspace rules live in a .clinerules or .cline/rules folder at the project root and travel with git; Cline also reads .cursorrules, .windsurfrules and AGENTS.md files it finds.

Cline reads rules as context, so a rule can ask for something but has no way to refuse a change. That is why the guardrails that make agent instructions binding sit in hooks and CI, outside the markdown.

Here is every source Cline recognizes, as the Cline rules documentation listed them on October 5, 2026:

Rule sourceLocationWhat Cline does with it
Cline workspace rules.clinerules/ or .cline/rules/ at the project rootSearches both when present; the VS Code Rules panel creates new files in .clinerules/
Cline global rulesYour system’s Cline Rules directory (locations below)Combines them with workspace rules; the workspace rule takes precedence in a conflict
Cursor rules.cursorrulesDetects the file automatically
Windsurf rules.windsurfrulesDetects the file automatically
AGENTS.mdAGENTS.md, plus the cross-tool global ~/.agents/AGENTS.mdReads it as the standard format for cross-tool compatibility

Every detected rule shows up in the Rules panel with a toggle of its own. Each Cline rules file is plain markdown, with optional YAML frontmatter at the top for the paths condition described further down. That is the whole file format Cline expects in .clinerules; numeric prefixes such as 01-coding.md keep the folder in order but are optional. Inside a file, a heading, short bullets and the reason behind any rule that looks arbitrary are enough, since Cline’s docs ask you to include the why.

One .clinerules file or a folder, and rules written for other agents

Cline’s current Rules page describes only the .clinerules/ and .cline/rules/ directories, and its deprecations page does not mention a single .clinerules file at the root (both read October 5, 2026). If your repository still has one, move to the folder in this order: rename the old file first, since one path cannot be a file and a folder at once; create the .clinerules/ folder; split the old contents into one file per concern; check that the Rules panel lists each new file; then delete the renamed original.

A repository that already has a .cursorrules, .windsurfrules or AGENTS.md file is not starting from nothing, because Cline reads all three. Roo Code originated from Cline but kept its own layout: Roo Code’s rules folder is .roo/rules/, with a single .roorules file as the fallback, and its repository now says the extension was shut down. For the wider picture there is a separate map of which rules file each coding tool reads, and a page on what an AGENTS.md file is for if you want one file that several agents share.

Why the paths a rule guards matter more than its wording

Rules that guard behavior beat rules that set style. In our audits, 10 of the 21 third-party apps trusted the client: the server accepted whatever the browser asserted. A rule scoped to the code that writes roles, prices or permissions is the one worth its context.

Those 21 were third-party apps from our June and July 2026 audits, chosen rather than drawn at random, so treat the 10 as a pattern to check for and not as a rate.

A style rule (keep functions small, prefer early returns) costs context on every task and changes little. The rules that earn their place name a path and a command that passes or fails. Cline’s own docs warn that rules consume context tokens and advise against pasting entire style guides, so keep the always-on rules to a few lines and put the rest behind paths. Guarding named paths is one of the engineering standards for teams that code with AI, and it decides which rules are worth their tokens. The paths we would guard first in a working app are auth and permissions, payments and webhooks, database migrations, and secrets.

The role column a signup could set for itself

In a food-delivery app we audited, the account type (customer, seller, driver, admin) sat in a role column the owner could edit. Put plainly, a customer account and a seller or admin account differed by one value the customer could set.

The rule that guards it is short: a paths-scoped rule over the profile and permissions code asking for a test that a non-admin account cannot change its own role. File 02 in the starter folder below is that rule. The rule is only the reminder: the test is what catches the defect, and only CI makes the test run on every change.

Our view: a rule that names the one column a signup must never write is worth more than a page of style rules. Who may grant a role, and how to model roles in the first place, is a design question of its own, with role-based access control examples for the common patterns.

How Cline loads a rule: workspace, global, paths and toggles

Four things decide whether a rule reaches the prompt: where the file lives, whether its toggle is on, whether its paths match the task, and whether its YAML parsed. Every behavior in this section comes from Cline’s documentation as read on October 5, 2026; we did not run Cline for this page.

Workspace rules and Cline global rules: where each file lives

Global rules live in a Rules folder under Documents (Documents\Cline\Rules on Windows, ~/Documents/Cline/Rules on macOS and Linux) and apply to every project. Workspace rules travel with the repository. Cline combines both sets, and the workspace rule wins a conflict.

Operating systemDefault global locationOther places Cline searches
WindowsDocuments\Cline\Rules~/.cline/rules, ~/Cline/Rules, and Documents\Cline\Rules under the OneDrive, OneDriveConsumer and OneDriveCommercial folders
macOS~/Documents/Cline/Rules~/.cline/rules and ~/Cline/Rules
Linux/WSL~/Documents/Cline/Rules~/.cline/rules and ~/Cline/Rules

On a Mac, the default is the Cline folder under Documents, with a Rules folder inside it. Team rules belong in the workspace, where git carries them to everyone who clones the repository. Personal habits, such as how you like commit messages written, belong in global rules, so they never land in a shared repository.

Conditional rules: the paths frontmatter and its glob patterns

A conditional rule is a rule file whose YAML frontmatter holds a paths list of glob patterns. Cline loads it only when a file in the current task matches one pattern: a path you mention, an open or visible file, a file it edited, or one it is about to edit.

This one is our example, not the docs’. It wakes up for migration files only:

---
paths:
  - "supabase/migrations/**"
---

# Row level security policies

Any new or edited policy needs a test that signs in as a
second account and reads the first account's rows.
That test passes only when the read returns no rows.

The paths list accepts five glob operators:

PatternMatchesExample
*Any characters except /*.md: markdown files in the root only
**Any characters including / (recursive)src/**/*.ts: all TypeScript files under src/
?A single characterv?.md: matches v1.md and v2.md (our example)
[abc]Any character in the brackets0[12]-*.md: files starting 01- or 02- (our example)
{a,b}Either patternpackages/{web,api}/**: files in the web or api packages

Cline’s docs list what counts as context in this order: file paths mentioned in your message, open tabs, visible files, files Cline has created, modified or deleted during the task, and files it is about to edit. A rule can switch on with your first message, when a matching file is open, or mid-task when Cline starts working on one. Naming the path beats naming the feature; the docs’ own tip is that “Update src/services/user.ts” reliably triggers path-based rules while “update the user service” may not. Two edge cases: paths: [] means the rule never activates, and invalid YAML fails open, so the rule loads with its raw frontmatter visible.

Creating a rule with /newrule, and the toggle in the Rules panel

A new Cline rule takes three steps in VS Code:

  1. 01 Run /newrule and let Cline write the file, or click the scale icon at the bottom of the Cline panel, choose "New rule file…" and enter a filename.
  2. 02 Check that the new rule appears in the Rules panel with its toggle on.
  3. 03 Open or name a file its paths cover, and look for Cline's Conditional rules applied notice with the rule's filename in it.

Either route saves a workspace rule in your .clinerules directory. Switching the toggle off disables a conditional rule even when its paths match, which parks a rule without deleting it. The community library on GitHub, cline/clinerules, is a source of starting points; read any rule you take from it before you commit it.

The Cline ignore file, and why it is not a security boundary

The .clineignore file stops Cline loading matching files into context on its own, but it is not an access control: an explicit @ mention or a shell command can still read them, and Cline has marked the feature for deprecation.

Cline’s .clineignore page now carries the label “deprecate soon”, and the deprecations page lists it as “Deprecating soon”. For a real stop, the same page shows a PreToolUse hook that cancels any file read, edit or shell command aimed at a path listed in .clineignore; in the VS Code extension the hook lives in .clinerules/hooks/, named exactly after its event with a shebang and the executable bit, and Enable Hooks must be checked in Cline’s feature settings. Even with the hook in place, secrets belong outside the repository and outside the agent’s reach, which starts with how to keep secrets out of the repository.

Examples: a starter rules folder for the paths that break

These Cline examples guard behavior, not style. Each .clinerules example below covers one risky area, and the three scoped ones name their paths and a command that passes or fails, since a Cline rules example that only asks for care changes nothing. Swap <your test command> for the command your project runs, and point the paths lists at your own folders.

.clinerules/01-secrets.md has no frontmatter, so it is always on:

# Secrets

- Never print an API key, a webhook signing secret or a
  service-role token into chat, a log line or a commit.
- Read secrets from environment variables only.
- If a task needs a real secret value, stop and ask.

.clinerules/02-auth-and-roles.md loads for the auth and profile code:

---
paths:
  - "src/auth/**"
  - "src/profile/**"
---

# Auth and roles

- Do not change how a session is created or how a role is
  written unless the auth tests pass: <your test command>
- Keep a test proving a non-admin account cannot set its
  own role.

.clinerules/03-payments.md loads for the payment and webhook folders:

---
paths:
  - "src/payments/**"
  - "src/webhooks/**"
---

# Payments

- Verify the webhook signature on the raw body before parsing.
- Never trust an amount, price or plan sent by the browser.
- The payments tests must pass, including one that sends a
  webhook with a bad signature: <your test command>

.clinerules/04-migrations.md loads for the migrations folder:

---
paths:
  - "supabase/migrations/**"
---

# Migrations

- Never edit a migration that has already run; add a new one.
- A new or changed access policy needs the second-account
  test: signed in as account B, reading account A's row
  returns nothing. Run <your test command> before finishing.

File 01 sits in the prompt on every task; files 02 to 04 stay out of it until a matching path enters the task, so the context-token cost Cline’s docs warn about applies to them only when that code is in play. The payments file only reminds; the full method for signature checks, raw body included, is in how to verify a webhook signature. For more clinerules examples, the cline/clinerules library collects community rules and workflows, and the Cline extension lets you browse them from its Prompts Library.

Rules, workflows, hooks and CI: which one stops a bad change

A Cline rule is context, so it can ask but never refuse. A skill or workflow loads its instructions when invoked, a PreToolUse hook can cancel a tool call, and only a CI check set as required on the pull request can refuse to merge a forbidden change, whoever wrote it.

MechanismWhat it is forWhat it can refuse
Rule in .clinerulesStanding context, always on or scoped by pathsNothing; the model can ignore or misapply it
Skill or workflow, run by slash commandInstructions loaded on demand for one kind of taskNothing by itself
Hook (PreToolUse)A script that runs before a tool callThe tool call: it can cancel the read, edit or command
CI check on the pull requestTests and pattern checks on every pushThe merge, once the check is required: it fails when the forbidden change appears

Cline workflows no longer have a page of their own: the workflows address in Cline’s docs now opens the Rules page, and the commands page lists skills under its slash commands instead (read October 5, 2026). The community library still keeps a workflows folder.

Plan and Act modes add one more layer. In Plan mode Cline can read the codebase and discuss strategy but cannot modify files or execute commands, so a path rule can shape the plan, and the tests it calls for, before Act mode edits anything. Of the four, build the CI check first; a CI check that blocks forbidden code is the one that still holds when a human, not Cline, makes the change.

How to check a rule fires, and what to do when it does not

A rule is proven in 5 checks: the Rules panel shows it on, a matching file triggers Cline’s notice, a non-matching file does not, a deliberate forbidden request is refused or flagged, and CI fails when that change is pushed. Only the fifth shows the build, not the model, stopping the change.

  1. 01 Open the Rules panel and confirm the file is listed with its toggle on. Keep a screenshot or a dated note.
  2. 02 Open a file inside the rule's paths and confirm the Conditional rules applied notice names the rule.
  3. 03 Open a file outside the rule's paths and confirm no notice appears, which shows the rule is scoped rather than always on.
  4. 04 On a throwaway branch, ask Cline for the forbidden change on purpose, for the payments rule removing the signature check, and record whether it refuses, warns or complies.
  5. 05 Push that branch and confirm the CI check fails on the forbidden change. Keep the link to the failing run.

Checks 1 to 4 show only that the rule loaded and what the model did with it; check 5, run by GitHub Actions or whatever runs your pull requests, is the evidence that the change fails CI. In the Production Hardening Sprint, deliverable 10.8, AI repository guardrails, is verified this way: we review the guidance and demonstrate CI catching a representative forbidden regression.

When a rule does not behave, work through the causes in this order:

  • The toggle is off. A conditional rule needs the toggle on and a path match.
  • Nothing in the task’s context matches paths. A rule over supabase/migrations/** stays quiet while you work on a component.
  • The YAML did not parse. Cline fails open, so the rule loads with its raw frontmatter visible; paths: showing in Cline’s output is the sign; check for a missing --- line, bad indentation or an unquoted special character.
  • A global rule and a workspace rule disagree, and the workspace rule wins.
  • The rule loaded and the model did not act on it. No rewording fixes that; move the requirement into a hook or a CI check.

The opposite problem, a rule that fires when you did not expect it, can come from a ** that reaches deeper than you meant, or from a file path you mentioned in passing.

Where the sprint does this

When the app is about to take paying users or go to a client and nobody has written down which paths are fragile, bring that question to a free audit: a video call where we weigh up with you which paths to guard first and whether to set the rules up yourself. In the Production Hardening Sprint we provide CLAUDE.md, AGENTS.md, Cursor rules or equivalents (for a team on Cline, a .clinerules folder) describing conventions and protected patterns, and add CI checks for the rules that can be enforced. The handover includes guidance and automated checks for future AI-assisted changes, and your app’s current framework and hosting setup are our starting point.

Common questions about using Cline

How do you use Cline?

Install Cline where you work (the VS Code extension, the JetBrains plugin, the CLI or the desktop app), connect a model through Cline’s own billing or your own provider key, then describe the task in plain words and approve the file edits and commands it proposes. Rules hold the instructions you would otherwise repeat in every task.

What does Cline do?

Cline is an AI coding agent that works in your editor and your terminal: it reads and writes files, runs terminal commands and can use a browser, and by default every action waits for your approval. Its Auto Approve setting lets you pick which kinds of action it may take without asking.

What are the best practices for using Cline?

Start in Plan mode for changes that touch several files, name file paths in your prompts, keep rules short and specific with the reason included, one concern per file, review every diff before you approve it, and put a CI check behind anything a rule asks for. Cline’s docs also describe a Memory Bank: structured markdown files, set up through a rule, through which Cline can remember project details across sessions.

What does Cline mean?

In software, Cline is the name of an AI coding agent that runs in editors such as VS Code and in the terminal. The ordinary English word cline has a different meaning: Cambridge Dictionary defines it as a scale on which things can be arranged in order according to a particular feature or quality.