
Chapter 2: Cline Rules
Learn how System Prompt Rules guide coding style, security, and workflow ensuring consistency, safety, and alignment in every task.

In most development environments, your codebase doesn't exist in isolation. It connects to databases, integrates with external APIs, follows specific security protocols, and adheres to coding standards that have evolved with your team. These connections and conventions form an invisible framework that experienced team members navigate instinctively.
Cline Rules provide a way to make this invisible framework explicit. They're a designated section where you can document the principles, practices, and constraints that should guide Cline's work on your codebase.
Think of Cline Rules as your team's institutional knowledge, codified in a way that an autonomous agent can understand and follow.
Rules vs Requirements
One important distinction to keep in mind is the difference between rules and requirements. Cline Rules focus on how code should be written and how systems should be modified – the technical standards and practices that govern implementation.

Business requirements, feature specifications, and project goals belong in a separate area called Cline Docs. This separation helps maintain clarity about what Cline should do (requirements) versus how it should do it (rules).
Onboard Cline as a New Team Member
The best way to determine what belongs in your Cline Rules is to think about what you would tell a new developer during their first week. What would they need to know to be productive and avoid common pitfalls?
Common categories include coding principles that reflect your team's philosophy about software design. If you prioritize readability over cleverness, or favor composition over inheritance, these principles should be documented.
Security practices often contain critical but non-obvious requirements. Perhaps all database queries must use parameterized statements, or API keys must be stored in specific environment variables. These aren't always evident from reading the code.
Documentation guidelines help maintain consistency across your codebase. Some teams prefer extensive inline comments, while others favor comprehensive README files and minimal code comments.
Coding style encompasses everything from naming conventions to file organization. While linters catch some of these issues, many stylistic choices are more nuanced and context-dependent.
Database schema rules become crucial when Cline needs to modify data structures. Understanding which tables can be altered, which require migration scripts, and how relationships should be maintained prevents costly mistakes.
External system integrations require special attention. If your application connects to third-party APIs, payment processors, or internal microservices, Cline needs to understand the proper protocols, error handling patterns, and rate limiting considerations.

The Quality Problem
Just as poorly written prompts lead to sub-optimal results, vague or conflicting Cline Rules create inconsistent experiences. The most common issue is ambiguous language that leaves too much room for interpretation.
Consider the rule:
"Optimize code where possible."
While well-intentioned, this guideline provides no concrete criteria for when optimization should occur. "where possible" could mean anything from "whenever you see an opportunity" to "only when performance is critically important." The result is unpredictable behavior – sometimes Cline will spend significant effort optimizing code that doesn't need it, other times it will miss genuine performance bottlenecks.
A more effective version might be:
"Optimize code when unit tests take longer than 100ms to execute."
This provides a clear, measurable threshold that removes ambiguity.
Similarly,
"use proper coding techniques"
sounds reasonable but offers no guidance about what "proper" means in your context. Does it refer to design patterns, error handling, or something else entirely?
A better approach would be
"Use SOLID principles when designing classes" or "Implement graceful error handling for all external API calls."
The Conflict Problem
Another frequent issue occurs when different rules contradict each other.
Imagine two Cline rules:
"use CamelCase for class names" - Coding principles document
"use snake_case for class names." - Coding style guide
These conflicting directives create an impossible situation where following one rule means violating another.
The solution involves creating a hierarchy of rules that complement rather than compete with each other. You might establish a general principle like "use CamelCase for class names" while adding language-specific exceptions: "For Python code, use snake_case for class names."
This approach allows you to maintain consistency within each language while acknowledging that different technologies have different conventions. The key is making the hierarchy explicit so Cline knows which rule takes precedence in specific situations.
Living Documentation
As your use of Cline expands and your systems evolve, your Cline Rules should evolve too. Requirements change, new technologies get adopted, and team preferences shift over time. Treating Cline Rules as static documentation leads to drift between your actual practices and the rules Cline follows.
Regular review and updates ensure that Cline's behavior stays aligned with your team's current standards. When you adopt a new framework, update your security practices, or change your deployment process, the corresponding Cline Rules should be updated as well.
This maintenance effort pays dividends in consistency and reliability. Well-maintained rules help Cline make decisions that align with your team's current thinking, reducing the need for corrections and revisions.
Practical Implementation
Effective Cline Rules share several characteristics. They're specific enough to provide clear guidance but flexible enough to accommodate different situations. They're organized logically, making it easy to find relevant information. Most importantly, they reflect your team's actual practices rather than aspirational ideals.
Start by documenting the most critical rules – those that prevent security vulnerabilities, maintain system stability, or ensure code quality. As you gain experience with Cline, you can add more nuanced guidelines that capture your team's preferred approaches to common problems.
The goal isn't to create an exhaustive manual that covers every possible scenario. Instead, focus on the rules that have the biggest impact on code quality, system reliability, and team productivity.
When properly configured, Cline Rules transform Cline from a capable but generic coding assistant into a team member who understands your context, follows your standards, and makes decisions that align with your practices. The investment in creating and maintaining these rules pays off through more consistent, predictable, and valuable assistance with your coding tasks.
Ready to create your own Cline Rules? Start by identifying the most important standards and practices your team follows, then document them with specific, actionable language.
For more advanced techniques and examples, explore the documentation, or share your experiences and learn from others in the community on Reddit and Discord.