Cline rules examples work best when they encode repo-specific contracts that land in context for Plan / Act sessions—not one-off chat fluff. This page shows Markdown files under .clinerules/ (or.cline/rules/), common frontmatter fields, and snippets you can copy, then tighten against your own verify commands. Treat every path and key here as illustrative—Cline releases change discovery and the Rules panel, so re-check docs.cline.bot on your installed version before treating any example as permanent.

01

Independence note

02

What Cline rules are for (vs prompts & other files)

In Cline, workspace rules feed durable guidance into agent sessions so the model does not re-guess house style every turn. Put contracts that stay true next month in rules; put this ticket’s goal in the chat brief; keep ephemeral observations out of committed rule files.

  • Rules: package manager, route registry, forbidden deploy paths, test commands, language defaults.
  • Session prompts: this ticket’s objective, acceptance checks, and temporary non-goals.
  • Neither: secrets, production credentials, or one-off customer data.

If you already maintain Cursor-, Windsurf-, Continue-, or Copilot-oriented rules, the engineering intent is similar—different packaging and loaders. Compare side-by-side in cursor rules examples, windsurf rules examples, continue rules examples, and copilot-instructions.md examples, kilo code rules examples, and amazon q developer rules examples. Multi-file choice notes live in AGENTS.md vs CLAUDE.md vs Cursor rules. For reusable root agent docs many hosts also load, see how to write AGENTS.md.

03

File layout, load order & frontmatter

Project rules usually live at the workspace root under.clinerules/. Many setups also accept.cline/rules/—prefer one canonical directory so teammates do not sync two trees. Markdown .md (and sometimes.txt) files are combined into a unified rule set. Numeric prefixes (01-, 02-) help when lexicographic order matters. Global / user-level Cline rules may also exist for personal preferences—keep team contracts in the repo.

.clinerules/
  01-general.md          # always-on house style
  02-frontend.md         # paths → src/pages/**
  03-no-deploy.md        # forbid wrangler/DNS unless asked
  04-security-review.md  # description-gated / toggle when needed

Common frontmatter fields (names and defaults can evolve—confirm in current docs):

  • description — label in the Rules panel; helps humans and models know when the rule matters.
  • paths (or similar path/glob keys) — limit when the rule attaches by path pattern.
  • alwaysApply — when supported, force injection vs optional / toggled rules.

Cline’s Rules panel often lets you toggle individual files without deleting them—useful for prototyping vs strict test mode. Prefer short, concern-scoped files: dense bullets beat essays, and headroom leaves room for the next constraint you will inevitably add.

04

Copy-ready cline rules examples

Adapt these templates. Replace commands, paths, and non-goals with your repo’s truth. Keep them short enough that a human will maintain them.

Always-apply project conventions

---
description: Project conventions (always on)
alwaysApply: true
---

# Project conventions

- Indent with 4 spaces; do not reformat unrelated files.
- Register every indexable page in the site’s route registry (e.g. pages[]).
- Prefer extending an existing page/component pattern over inventing a new layout.
- Run the project’s build command before claiming done.
- Do not deploy, edit hosting config, or change DNS unless the user explicitly asks.

Path-scoped frontend / docs pages

---
description: Frontend and docs page conventions
paths: ["src/pages/", "public/assets/styles.css"]
---

# Frontend page rules

- Mirror ArticleNavigation + article-hero structure from sibling EN how-to pages.
- Unique Title, Description, and a single H1 that contains the target phrase.
- Include Related reading links to sibling guides; keep bidirectional links updated.
- Do not invent new indexed URLs; only add paths listed in the task.

Description-gated database / migrations

---
description: Schema, migrations, and repository query changes
---

# Database work

- Put queries in the existing repository layer; do not invent a second data access style.
- Add a new migration; never rewrite an already-applied migration.
- Include a rollback note for destructive schema changes.
- Do not run production migrations from the agent session.

Safety / no-deploy (always apply)

---
description: Deploy and secrets guardrails
alwaysApply: true
---

# Deploy and secrets

- Do not run wrangler deploy, change DNS, or edit Cloudflare / payment config unless asked.
- Never commit secrets, tokens, or production credentials into rules or chat history.
- Prefer env stores and documented secret managers over pasting keys into the session.

When tools live outside the editor, pair rules with a clear tool policy in the prompt. For MCP host pitfalls, see the MCP server tutorial and MCP server best practices.

05

Writing patterns that stick

  1. Imperative and testable. “Run pnpm run build” beats “ensure quality.”
  2. Name artifacts. Paths, registry names, and sibling files beat vibes.
  3. State non-goals. Agents over-help; forbid deploy, rebrand, or drive-by refactors.
  4. One concern per file. Split style from security so toggles and reviews stay focused.
  5. Write a useful description so the Rules panel (and the model) know when the file matters.
  6. Control load order with prefixes (01-, 02-) when general rules must precede specialized ones.
  7. Point at exemplars. “Match GoodAgentPromptPage.tsx” beats reinventing layout.

Rules degrade when they become a wishlist. If Cline still violates a rule after two sessions, either the rule is vague, path scoping is wrong, the toggle is off, or a stronger nearby example is missing—fix the example and the frontmatter first.

06

Anti-patterns

  • Novel-length always-on rules: crowd context and get sampled inconsistently.
  • Vague descriptions: “be careful” does not help toggle labels or relevance.
  • Contradictions: “always refactor” next to “never touch unrelated files.”
  • Secrets in rules: rules are often committed; use env stores instead.
  • Copying Cursor / Windsurf / Continue rules wholesale without remapping: wrong directory, wrong front matter, wrong done checks.
  • Duplicating the same wall into AGENTS.md and every .md file: sync cost explodes; pick one canonical layer per concern.
  • Product tutorials inside rules: teach workflows in docs; keep rules as contracts.

Related reading: Cursor rules examples · Windsurf rules examples · Continue rules examples · copilot-instructions.md examples · Antigravity rules examples · Kilo code rules examples · Amazon Q rules examples · TRAE AI rules examples · AGENTS.md vs CLAUDE.md vs Cursor rules · How to write AGENTS.md · How to write CLAUDE.md · Cursor skills examples · Good agent prompts · Cursor agent tips · Agent engineering notes

07

FAQ

Where should I put cline rules examples in a repo?

Most teams use a .clinerules/ directory at the workspace root with small, focused Markdown files. Some setups also accept.cline/rules/. Exact discovery depends on your Cline version—confirm in current product docs. This site’s examples are unofficial templates, not a product catalog.

Do I need separate Cline rules if I already have AGENTS.md or Cursor rules?

Only if Cline sessions do not reliably load your other files, or you want Cline-specific toggles / path scoping. Some Cline builds also detect cross-tool files (for example Cursor / Windsurf / AGENTS.md)—treat that as a convenience, not a reason to maintain three novels. Prefer one clear statement of each convention; see AGENTS.md vs CLAUDE.md vs Cursor rules.

How do these relate to Cursor, Windsurf, Continue, or Copilot instructions?

Same job—durable repo contracts—different loaders and file shapes. Cursor: cursor rules examples. Windsurf / Cascade: windsurf rules examples. Continue: continue rules examples. GitHub Copilot: copilot-instructions.md examples. Multi-tool teams often keep a root AGENTS.md and thinner IDE-specific rules. Do not paste the same wall of text into every layer.

Will these templates work unchanged on every Cline release?

No. Treat them as starting points. Re-verify directory names, frontmatter keys (description, paths,alwaysApply), lexicographic load order, and Rules panel toggles after upgrades. Prefer repo-specific commands and paths over marketing phrases that age poorly.