<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged rule</title>
<link>https://coderlegion.com/tag/rule</link>
<description>Powered by Question2Answer</description>
<item>
<title>Understanding Chain Rule</title>
<link>https://coderlegion.com/18988/understanding-chain-rule</link>
<description>
&lt;p&gt;Hello, I'm Ganesh. I'm building &lt;em&gt;git-lrc&lt;/em&gt;, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. &lt;a href=&quot;https://github.com/HexmosTech/git-lrc?utm_source=chatgpt.com&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt; to help more developers discover the project. Do give it a try and share your feedback for improving the product.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Chain Rule?
&lt;/h2&gt;

&lt;p&gt;The chain rules nothing but a differntiation of a function with another function.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
Taking displacement, velocity, acceleration as an example&lt;/p&gt;

&lt;p&gt;s(t)&amp;rarr;v(t)&amp;rarr;a(t)&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;displacement depends on time&lt;/li&gt;
&lt;li&gt;velocity depends on displacement changing over time&lt;/li&gt;
&lt;li&gt;acceleration depends on velocity changing over time
### Displacement&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3zckdg1z49cl1f4ioy3.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3zckdg1z49cl1f4ioy3.png&quot; alt=&quot;&quot; width=&quot;179&quot; height=&quot;80&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Velocity
&lt;/h3&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2crtg6kycz956uwbfhxg.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2crtg6kycz956uwbfhxg.png&quot; alt=&quot;&quot; width=&quot;142&quot; height=&quot;68&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Acceleration
&lt;/h2&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjw391x7s4qymlv163wt8.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjw391x7s4qymlv163wt8.png&quot; alt=&quot;&quot; width=&quot;185&quot; height=&quot;74&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each graph is the derivative of the previous one.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqv11i94hrzocavf9gby7.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqv11i94hrzocavf9gby7.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;960&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4ndow9i51dhl90cjv9q.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4ndow9i51dhl90cjv9q.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;727&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why chain rule is used?
&lt;/h2&gt;

&lt;p&gt;The chain rule is used in &lt;strong&gt;Machine Learning&lt;/strong&gt; during &lt;strong&gt;Backpropagation&lt;/strong&gt;, which is the process of training the network by adjusting its weights and biases to minimize errors.&lt;/p&gt;

&lt;p&gt;If you have two functions, &lt;code&gt;f(x)&lt;/code&gt; and &lt;code&gt;g(x)&lt;/code&gt;, and you want to find the derivative of their composition &lt;code&gt;f(g(x))&lt;/code&gt;, the chain rule states:&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3phf6mgdd3mfx734nf7.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3phf6mgdd3mfx734nf7.png&quot; alt=&quot;&quot; width=&quot;253&quot; height=&quot;68&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabn6nl3iehrohehnxgje.png&quot; alt=&quot;git-lrc&quot; width=&quot;800&quot; height=&quot;373&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any feedback or contributors are welcome! It&amp;rsquo;s online, source-available, and ready for anyone to use.&lt;/p&gt;

&lt;p&gt;&amp;#11088; &lt;a href=&quot;https://github.com/HexmosTech/git-lrc?utm_source=chatgpt.com&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt;&lt;/p&gt;


</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/18988/understanding-chain-rule</guid>
<pubDate>Thu, 28 May 2026 13:45:57 +0000</pubDate>
</item>
<item>
<title>cursor-claude-personas: Give Your AI Coding Assistant a Domain Expert Brain in 30 Seconds</title>
<link>https://coderlegion.com/14653/cursor-claude-personas-give-your-ai-coding-assistant-a-domain-expert-brain-in-30-seconds</link>
<description>
&lt;p&gt;&lt;img src=&quot;https://blog.ratnesh-maurya.com/images/blog/cursor-claude-personas.png&quot; alt=&quot;cursor-claude-personas: Give Your AI Coding Assistant a Domain Expert Brain in 30 Seconds&quot;&gt;&lt;/p&gt;&lt;h1 id=&quot;cursor-claude-personas-give-your-ai-coding-assistant-a-domain-expert-brain-in-30-seconds&quot;&gt;cursor-claude-personas: Give Your AI Coding Assistant a Domain Expert Brain in 30 Seconds&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; &amp;mdash; &lt;code&gt;cursor-claude-personas&lt;/code&gt; is a free, open-source collection of 38 role-based AI persona packs for Claude Code, Cursor, and VS Code. Copy one folder into your project, reopen your editor, and your AI assistant instantly behaves like a seasoned specialist &amp;mdash; whether that's a senior Python developer, a DevOps engineer, a security expert, or a UI/UX designer.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2 id=&quot;the-problem-generic-ai-gives-generic-code&quot;&gt;The Problem: Generic AI Gives Generic Code&lt;/h2&gt;
&lt;p&gt;You have Claude Code or Cursor open. You ask it to add an endpoint. It writes something that works &amp;mdash; but it doesn't know your preferred framework patterns, it doesn't follow your domain conventions, and it certainly doesn't remember that you care deeply about SQL index hygiene or GraphQL schema design.&lt;/p&gt;
&lt;p&gt;The usual fix is a long system prompt you paste in every time. Or a &lt;code&gt;.cursorrules&lt;/code&gt; file you spend hours writing. Or endless back-and-forth corrections.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;cursor-claude-personas solves this with a dead-simple copy-paste.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;what-is-cursor-claude-personas&quot;&gt;What Is cursor-claude-personas?&lt;/h2&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ratnesh-maurya/cursor-claude-personas&quot;&gt;cursor-claude-personas&lt;/a&gt; is a GitHub repository containing &lt;strong&gt;38 ready-made persona packs&lt;/strong&gt; for AI coding tools. Each persona is a folder with two hidden subdirectories:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;hljs language-text&quot;&gt;senior-python-developer/
&amp;#9500;&amp;#9472;&amp;#9472; .claude/
&amp;#9474;   &amp;#9500;&amp;#9472;&amp;#9472; rules/       &amp;larr; always-on instructions Claude Code reads at session start
&amp;#9474;   &amp;#9492;&amp;#9472;&amp;#9472; skills/      &amp;larr; auto-triggered skill docs for specific tasks
&amp;#9492;&amp;#9472;&amp;#9472; .cursor/
    &amp;#9500;&amp;#9472;&amp;#9472; rules/       &amp;larr; always-on instructions Cursor reads at session start
    &amp;#9492;&amp;#9472;&amp;#9472; skills/      &amp;larr; auto-triggered skill docs for specific tasks
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you copy &lt;code&gt;.claude/&lt;/code&gt; or &lt;code&gt;.cursor/&lt;/code&gt; (or both) into the root of your project, your editor loads those configs automatically. No slash commands. No system prompts. The persona is live the moment you start a new chat session.&lt;/p&gt;
&lt;h3 id=&quot;supported-tools&quot;&gt;Supported tools&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What to copy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;.claude/&lt;/code&gt; folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cursor&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;.cursor/&lt;/code&gt; folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;VS Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;.claude/&lt;/code&gt; folder (when using Claude-based extensions)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2 id=&quot;how-to-use-it-step-by-step&quot;&gt;How to Use It &amp;mdash; Step by Step&lt;/h2&gt;
&lt;h3 id=&quot;step-1-clone-the-repo&quot;&gt;Step 1: Clone the repo&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;hljs language-bash&quot;&gt;git &lt;span class=&quot;hljs-built_in&quot;&gt;clone&lt;/span&gt; &lt;a href=&quot;https://github.com/ratnesh-maurya/cursor-claude-personas.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ratnesh-maurya/cursor-claude-personas.git&lt;/a&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You only need to clone it once. Keep it around as your personal AI persona library.&lt;/p&gt;
&lt;h3 id=&quot;step-2-pick-the-persona-that-matches-your-current-work&quot;&gt;Step 2: Pick the persona that matches your current work&lt;/h3&gt;
&lt;p&gt;Browse the table in the next section or visit the &lt;a rel=&quot;nofollow&quot; href=&quot;https://ratnesh-maurya.github.io/cursor-claude-personas/&quot;&gt;GitHub Pages site&lt;/a&gt; to filter by technology or tag.&lt;/p&gt;
&lt;h3 id=&quot;step-3-copy-the-persona-into-your-project&quot;&gt;Step 3: Copy the persona into your project&lt;/h3&gt;
&lt;p&gt;Navigate to your cloned copy and run:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;hljs language-bash&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Claude Code only&lt;/span&gt;
&lt;span class=&quot;hljs-built_in&quot;&gt;cp&lt;/span&gt; -R cursor-claude-personas/senior-python-developer/.claude /path/to/your-project/

&lt;span class=&quot;hljs-comment&quot;&gt;# Cursor only&lt;/span&gt;
&lt;span class=&quot;hljs-built_in&quot;&gt;cp&lt;/span&gt; -R cursor-claude-personas/senior-python-developer/.cursor /path/to/your-project/

&lt;span class=&quot;hljs-comment&quot;&gt;# Both tools&lt;/span&gt;
&lt;span class=&quot;hljs-built_in&quot;&gt;cp&lt;/span&gt; -R cursor-claude-personas/senior-python-developer/.claude /path/to/your-project/
&lt;span class=&quot;hljs-built_in&quot;&gt;cp&lt;/span&gt; -R cursor-claude-personas/senior-python-developer/.cursor /path/to/your-project/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace &lt;code&gt;senior-python-developer&lt;/code&gt; with any persona slug from the list below.&lt;/p&gt;
&lt;h3 id=&quot;step-4-reopen-your-editor-or-start-a-new-session&quot;&gt;Step 4: Reopen your editor or start a new session&lt;/h3&gt;
&lt;p&gt;Claude Code and Cursor reload configuration at session start. From that point on, the AI follows the persona's rules, applies its skills automatically, and behaves as a domain expert &amp;mdash; without you typing a single extra word.&lt;/p&gt;
&lt;h3 id=&quot;bonus-enable-the-auto-skill-router&quot;&gt;Bonus: Enable the auto-skill router&lt;/h3&gt;
&lt;p&gt;Each persona includes a special rule file called &lt;code&gt;rules--auto-skill-router.mdc&lt;/code&gt; (&lt;code&gt;.mdc&lt;/code&gt; is the Cursor/Claude rule file format &amp;mdash; it is just Markdown with optional YAML frontmatter). This rule tells the AI to automatically select the right skill doc based on what you're working on &amp;mdash; so you never need to type &lt;code&gt;/skill&lt;/code&gt; commands manually.&lt;/p&gt;
&lt;p&gt;It is already included when you copy the persona folders. No extra steps required.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;all-38-personas&quot;&gt;All 38 Personas&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Persona&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;3d-frontend-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Three.js, WebGL, 3D UI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ai-agent-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;LLM agents, tool use, orchestration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ai-ml-engineer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Model training, pipelines, MLOps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;azure-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Azure services, ARM/Bicep, AKS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;blockchain-web3-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Smart contracts, DeFi, Web3 tooling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;blog-website-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Content sites, CMS, static generators&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;data-engineer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pipelines, dbt, Spark, warehouses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;devops-cloud-engineer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CI/CD, Kubernetes, IaC, observability&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ecommerce-specialist&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shopify, WooCommerce, checkout flows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fullstack-saas-mvp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rapid SaaS prototyping, full-stack&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;functional-programming&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Haskell, Clojure, FP patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;game-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unity, Godot, game loops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;health-tech-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;FHIR, HL7, medical data systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;legal-finance-analyst&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Contracts, compliance, financial models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;marketing-automation&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Email, CRM integrations, analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mobile-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;React Native, Flutter, iOS/Android&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;n8n-automation-specialist&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;n8n workflows, low-code automation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;odoo-erp-specialist&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Odoo modules, ERP customization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;open-source-maintainer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OSS governance, reviews, releases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;platform-integrations&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;APIs, webhooks, third-party services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;product-manager&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Roadmaps, specs, user stories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;qa-testing-engineer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Test strategy, automation, coverage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;saas-startup-founder&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;GTM, metrics, early-stage decisions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;security-engineer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Threat modeling, hardening, audits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-dotnet-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;C#, ASP.NET Core, Azure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-elixir-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Elixir, Phoenix, OTP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-frontend-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;React, TypeScript, frontend architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-golang-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Go, microservices, concurrency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-java-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Java, Spring Boot, enterprise patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-python-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Python, APIs, automation, data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;senior-rust-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rust, systems programming, WASM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;seo-specialist&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Technical SEO, Core Web Vitals, schema&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;system-architect&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Service boundaries, scalability, design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;system-designer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Low-level system design, algorithms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;technical-writer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Docs, onboarding, API clarity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ui-ux-designer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Design systems, accessibility, UX&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;voice-ai-developer&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Voice interfaces, TTS, STT, ASR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wordpress-specialist&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;WordPress, WooCommerce, theme dev&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Not sure where to start? Try &lt;code&gt;senior-python-developer&lt;/code&gt; or &lt;code&gt;senior-frontend-developer&lt;/code&gt; &amp;mdash; both are polished starting points that work for a wide range of projects.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;What Makes This Different From a &lt;code&gt;.cursorrules&lt;/code&gt; File?&lt;/h2&gt;
&lt;p&gt;A &lt;code&gt;.cursorrules&lt;/code&gt; file (a single plain-text file at the project root) you write yourself usually contains two or three paragraphs of general instructions. Cursor also supports a &lt;code&gt;.cursor/rules/&lt;/code&gt; directory of individual rule files for more granular control. Both are fine for broad guidance, but neither gives your AI assistant real domain depth out of the box.&lt;/p&gt;
&lt;p&gt;cursor-claude-personas packs in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Multiple focused rule files&lt;/strong&gt; &amp;mdash; each covering a specific concern (schema design, security, pagination, query patterns, etc.) rather than one sprawling blob of text.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Skill documents&lt;/strong&gt; &amp;mdash; structured reference files that are automatically surfaced when the AI detects it needs them, without you prompting it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Both tool formats simultaneously&lt;/strong&gt; &amp;mdash; the same expertise loads whether you are using Claude Code, Cursor, or VS Code Copilot.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Zero prompt engineering on your part&lt;/strong&gt; &amp;mdash; you copy two folders and you are done.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The key design principle is &lt;strong&gt;depth over breadth&lt;/strong&gt;: one sharp specialist beats five vague generalists.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;real-world-example&quot;&gt;Real-World Example&lt;/h2&gt;
&lt;p&gt;Imagine you are building a Python REST API with PostgreSQL. You copy in the &lt;code&gt;senior-python-developer&lt;/code&gt; persona. From that point on, when you write a query, the AI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Warns you against &lt;code&gt;WHERE id IN (SELECT ...)&lt;/code&gt; and rewrites it as &lt;code&gt;WHERE id = ANY(ARRAY[...])&lt;/code&gt; with a note about the 10&amp;times; speedup.&lt;/li&gt;
&lt;li&gt;Adds &lt;code&gt;WHERE deleted_at IS NULL&lt;/code&gt; partial indexes automatically when it sees soft-delete columns.&lt;/li&gt;
&lt;li&gt;Flags missing foreign key indexes before you even run &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Enforces proper connection pool limits and prepared statement patterns.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of that required you to type a single instruction. It was all encoded in the rules and skills you copied in.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;how-the-folder-structure-works-under-the-hood&quot;&gt;How the Folder Structure Works Under the Hood&lt;/h2&gt;
&lt;p&gt;Each persona ships with two kinds of config files:&lt;/p&gt;
&lt;h3&gt;Rules (&lt;code&gt;rules/&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;Rules are always-on markdown files the editor reads at the start of every session. They define the persona's defaults, code style, anti-patterns to avoid, and domain-specific best practices. They are named with a &lt;code&gt;rules--&lt;/code&gt; prefix so they sort together and are easy to identify.&lt;/p&gt;
&lt;h3&gt;Skills (&lt;code&gt;skills/&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;Skill documents are structured markdown files with YAML frontmatter. The auto-skill router rule tells the AI to load the relevant skill when it detects you are working on a related task. For example, if you start writing an index migration, the SQL indexing skill is surfaced automatically. If you start wiring up an authentication flow, the auth skill fires.&lt;/p&gt;
&lt;p&gt;This means the AI pulls in deep, specific guidance exactly when it is relevant &amp;mdash; not all at once, cluttering its context.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;switching-personas-mid-project&quot;&gt;Switching Personas Mid-Project&lt;/h2&gt;
&lt;p&gt;You can swap personas at any time. Just delete the existing &lt;code&gt;.claude/&lt;/code&gt; and &lt;code&gt;.cursor/&lt;/code&gt; folders in your project and copy in a different persona. Reopen your session and the new persona is live.&lt;/p&gt;
&lt;p&gt;You can even mix rules from multiple personas manually if you know what you are doing, but most of the time a single focused persona is all you need.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;contributing-a-new-persona&quot;&gt;Contributing a New Persona&lt;/h2&gt;
&lt;p&gt;The project is open source under the MIT license and welcomes contributions. If you want to add a new persona:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fork the repository.&lt;/li&gt;
&lt;li&gt;Create a new folder named after the role (e.g., &lt;code&gt;data-science-researcher&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Add matching &lt;code&gt;.claude/&lt;/code&gt; and &lt;code&gt;.cursor/&lt;/code&gt; subdirectories with rules and skills.&lt;/li&gt;
&lt;li&gt;Make sure the two directories are in sync &amp;mdash; the parity check in &lt;code&gt;CONTRIBUTING.md&lt;/code&gt; validates this.&lt;/li&gt;
&lt;li&gt;Open a pull request.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;See &lt;a rel=&quot;nofollow&quot; href=&quot;CONTRIBUTING.md&quot;&gt;CONTRIBUTING.md&lt;/a&gt; for branch naming conventions, commit message format, and the full persona checklist.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;where-to-get-it&quot;&gt;Where to Get It&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub repository&lt;/strong&gt;: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ratnesh-maurya/cursor-claude-personas&quot;&gt;https://github.com/ratnesh-maurya/cursor-claude-personas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GitHub Pages site&lt;/strong&gt; (browse and filter personas): &lt;a rel=&quot;nofollow&quot; href=&quot;https://ratnesh-maurya.github.io/cursor-claude-personas/&quot;&gt;https://ratnesh-maurya.github.io/cursor-claude-personas/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;License&lt;/strong&gt;: MIT &amp;mdash; free for personal and commercial use.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If it saves you time, star the repo. It helps other developers discover it.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it is&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;38 role-based AI persona packs for Claude Code, Cursor, and VS Code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it does&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Shapes your AI coding assistant into a domain specialist &amp;mdash; instantly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How to install&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Clone the repo, copy one persona folder, reopen your editor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Time to set up&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Under 30 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Free and open source (MIT)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Requires&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Claude Code, Cursor, or VS Code with Copilot&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Clone it, copy a persona, and ship better code.&lt;/p&gt;
</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/14653/cursor-claude-personas-give-your-ai-coding-assistant-a-domain-expert-brain-in-30-seconds</guid>
<pubDate>Fri, 17 Apr 2026 22:44:50 +0000</pubDate>
</item>
<item>
<title># The Rule Pattern in C#, and Why It Works So Well with the Result Pattern</title>
<link>https://coderlegion.com/14143/the-rule-pattern-in-c-and-why-it-works-so-well-with-the-result-pattern</link>
<description>&lt;h2 id=&quot;the-rule-pattern-in-c-and-why-it-works-so-well-with-the-result-pattern&quot;&gt;The Rule Pattern in C#, and Why It Works So Well with the Result Pattern&lt;/h2&gt;
&lt;p&gt;Business rules rarely stay in one place.&lt;/p&gt;
&lt;p&gt;A small validation starts in a command handler. Another check appears in a service. A third gets added somewhere in the domain. A few weeks later, the real business policy is scattered across the application, and nobody can see it clearly anymore.&lt;/p&gt;
&lt;p&gt;That is exactly where the Rule pattern becomes useful.&lt;/p&gt;
&lt;p&gt;At its core, the idea is simple. Instead of expressing business decisions as anonymous conditionals spread throughout the system, you give each rule a name and wrap it in its own object. Martin Fowler describes this style through the Specification pattern, where the statement of what satisfies a candidate is separated from the candidate itself, and those specifications can be combined into richer logic. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://martinfowler.com/apsupp/spec.pdf?utm_source=chatgpt.com&quot; title=&quot;Specifications&quot;&gt;martinfowler.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;In practical C# applications, especially the ones using CQRS or domain-driven design, that gives you something powerful: business rules that are explicit, reusable, and easy to reason about. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://martinfowler.com/apsupp/spec.pdf?utm_source=chatgpt.com&quot; title=&quot;Specifications&quot;&gt;martinfowler.com&lt;/a&gt;)&lt;/p&gt;
&lt;h3 id=&quot;what-the-rule-pattern-really-solves&quot;&gt;What the Rule pattern really solves&lt;/h3&gt;
&lt;p&gt;The biggest problem is not that business checks exist. The problem is that they often exist in the wrong shape.&lt;/p&gt;
&lt;p&gt;When rules are buried inside handlers, services, or controller actions, they are hard to spot, hard to test in isolation, and very easy to duplicate. The code still works, but the business language disappears.&lt;/p&gt;
&lt;p&gt;The Rule pattern fixes that by turning each business condition into a named concept. Instead of asking developers to interpret a chain of low-level checks, the code starts speaking in terms the business would actually recognize. That is very much in line with DDD’s emphasis on modeling around the real language of the domain. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/ddd-oriented-microservice?utm_source=chatgpt.com&quot; title=&quot;Designing a DDD-oriented microservice - .NET&quot;&gt;Microsoft Learn&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;In other words, the pattern is not just about validation. It is about clarity.&lt;/p&gt;
&lt;h3 id=&quot;why-it-is-often-called-the-specification-pattern&quot;&gt;Why it is often called the Specification pattern&lt;/h3&gt;
&lt;p&gt;If the shape feels familiar, that is because it usually is. What many teams call a Rule pattern is very close to what Fowler documented as Specification. The core idea is to represent business criteria as composable objects rather than raw conditionals, and then combine them with logical operations like AND, OR, and NOT. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://martinfowler.com/apsupp/spec.pdf?utm_source=chatgpt.com&quot; title=&quot;Specifications&quot;&gt;martinfowler.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;That is why this pattern tends to feel so natural in real systems. Business rules are rarely isolated. More often, they are layered:&lt;/p&gt;
&lt;p&gt;A customer must be verified.&lt;br&gt;
An order must reach a minimum amount.&lt;br&gt;
A credit limit must not be exceeded.&lt;/p&gt;
&lt;p&gt;On their own, each rule is simple. The real value appears when they can be combined into a meaningful policy.&lt;/p&gt;
&lt;h3 id=&quot;why-this-pattern-becomes-more-valuable-as-the-system-grows&quot;&gt;Why this pattern becomes more valuable as the system grows&lt;/h3&gt;
&lt;p&gt;At first, a few inline checks seem harmless. But as the application grows, the cost of hidden business logic grows with it.&lt;/p&gt;
&lt;p&gt;Rules get copied into multiple workflows.&lt;br&gt;
One endpoint enforces them, another forgets.&lt;br&gt;
A handler applies three checks, a background job applies only two.&lt;br&gt;
Tests start focusing on branches instead of policies.&lt;/p&gt;
&lt;p&gt;When rules become standalone concepts, those problems start to shrink. You can test a rule directly. You can reuse it in multiple flows. You can combine it with other rules. Most importantly, you can read the application flow and understand what it is trying to protect.&lt;/p&gt;
&lt;p&gt;That is one of the reasons this pattern fits so well in systems that care about maintainability.&lt;/p&gt;
&lt;h3 id=&quot;where-the-result-pattern-fits&quot;&gt;Where the Result pattern fits&lt;/h3&gt;
&lt;p&gt;The Rule pattern answers one question:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Is this action allowed according to the business?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Result pattern answers another:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What happened when we tried to perform it?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That separation is the reason the two patterns fit together so well.&lt;/p&gt;
&lt;p&gt;The rule evaluates business truth.&lt;br&gt;
The result communicates application outcome.&lt;/p&gt;
&lt;p&gt;Vladimir Khorikov’s writing on Result-based error handling makes this distinction especially useful for expected failures. Instead of throwing exceptions for normal business rejections, you can return an explicit failure outcome and keep the flow predictable. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://enterprisecraftsmanship.com/posts/error-handling-exception-or-result/?utm_source=chatgpt.com&quot; title=&quot;Error handling: Exception or Result?&quot;&gt;Enterprise Craftsmanship&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;That gives you a very clean mental model:&lt;/p&gt;
&lt;p&gt;The domain decides.&lt;br&gt;
The application reports.&lt;/p&gt;
&lt;h3 id=&quot;why-this-pairing-feels-so-clean-in-practice&quot;&gt;Why this pairing feels so clean in practice&lt;/h3&gt;
&lt;p&gt;A good rule object should not care about HTTP, API responses, logging, UI wording, or transport concerns. Its responsibility is much smaller. It answers whether a business condition holds.&lt;/p&gt;
&lt;p&gt;The application layer then takes that answer and decides what to do next. If the rule fails, the application can return a failure result. If it passes, the use case continues.&lt;/p&gt;
&lt;p&gt;This separation lines up well with Microsoft’s DDD guidance, which treats validations as invariants and emphasizes that aggregates are responsible for enforcing consistency across state changes. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-model-layer-validations?utm_source=chatgpt.com&quot; title=&quot;Designing validations in the domain model layer - .NET&quot;&gt;Microsoft Learn&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;That is why the combination works so well. The rule keeps business logic clean. The result keeps flow control clean.&lt;/p&gt;
&lt;h3 id=&quot;a-simple-order-example-without-the-code&quot;&gt;A simple order example, without the code&lt;/h3&gt;
&lt;p&gt;Imagine an order placement use case with three policies:&lt;/p&gt;
&lt;p&gt;The order must meet a minimum amount.&lt;br&gt;
The customer must be verified.&lt;br&gt;
The order must stay within the customer’s credit limit.&lt;/p&gt;
&lt;p&gt;Without a rule-based approach, those checks often end up inline inside the command handler. That works, but the handler slowly becomes the place where business policy lives.&lt;/p&gt;
&lt;p&gt;With a rule-based approach, those policies become named rules. The handler simply coordinates the workflow: load data, build the order, evaluate the rule set, return a success or failure result, and persist when everything is valid.&lt;/p&gt;
&lt;p&gt;That is a much healthier separation of concerns.&lt;/p&gt;
&lt;p&gt;The handler stops being the place where business logic is invented, and becomes the place where business logic is orchestrated.&lt;/p&gt;
&lt;h3 id=&quot;the-biggest-benefit-is-not-flexibility-it-is-readability&quot;&gt;The biggest benefit is not flexibility, it is readability&lt;/h3&gt;
&lt;p&gt;People often talk about this pattern in terms of reuse or composability, and those are real benefits.&lt;/p&gt;
&lt;p&gt;But the biggest benefit is readability.&lt;/p&gt;
&lt;p&gt;When rules are named well, the code starts reading like a business conversation instead of a technical negotiation. That matters more than people think. Clear code reduces mistakes, speeds up maintenance, and makes onboarding easier for everyone who touches the system later.&lt;/p&gt;
&lt;p&gt;A long chain of conditionals tells you how the system behaves.&lt;/p&gt;
&lt;p&gt;A well-named rule tells you why.&lt;/p&gt;
&lt;h3 id=&quot;one-important-design-note&quot;&gt;One important design note&lt;/h3&gt;
&lt;p&gt;There is one trap worth mentioning.&lt;/p&gt;
&lt;p&gt;Just because a rule is expressed cleanly does not automatically mean it belongs in the application layer.&lt;/p&gt;
&lt;p&gt;Some rules are just use-case checks. Those can live comfortably near the workflow.&lt;/p&gt;
&lt;p&gt;But some rules are true invariants of the domain. Those should usually be protected by the aggregate itself. Microsoft’s guidance is very clear on this point: aggregates are responsible for enforcing invariants across state changes. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-model-layer-validations?utm_source=chatgpt.com&quot; title=&quot;Designing validations in the domain model layer - .NET&quot;&gt;Microsoft Learn&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;So the right question is not only, “Can I model this as a rule?”&lt;/p&gt;
&lt;p&gt;The better question is, “Who is responsible for protecting this rule?”&lt;/p&gt;
&lt;p&gt;If the answer is “the domain itself,” then the aggregate should not rely on the handler to remember it.&lt;/p&gt;
&lt;h3 id=&quot;where-this-pattern-can-go-wrong&quot;&gt;Where this pattern can go wrong&lt;/h3&gt;
&lt;p&gt;Like most good patterns, this one becomes dangerous when overused.&lt;/p&gt;
&lt;p&gt;Not every &lt;code&gt;if&lt;/code&gt; statement needs to become a rule object.&lt;br&gt;
Not every workflow needs an entire rules engine.&lt;br&gt;
Not every tiny validation deserves its own abstraction.&lt;/p&gt;
&lt;p&gt;If the business logic is trivial and local, introducing rule classes may create more ceremony than value.&lt;/p&gt;
&lt;p&gt;The pattern shines when the rules are meaningful, reusable, and important enough to deserve a name. If the condition is just a one-off technical check, a plain conditional may still be the better choice.&lt;/p&gt;
&lt;p&gt;The goal is not abstraction for its own sake. The goal is to make business intent easier to see.&lt;/p&gt;
&lt;h3 id=&quot;why-the-result-pattern-keeps-the-design-honest&quot;&gt;Why the Result pattern keeps the design honest&lt;/h3&gt;
&lt;p&gt;The Result pattern adds a second layer of clarity.&lt;/p&gt;
&lt;p&gt;A failure is no longer hidden behind a thrown exception for something the system fully expected. Instead, the caller gets an explicit outcome. That makes business rejections feel normal rather than exceptional, which is often the right model for application workflows. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://enterprisecraftsmanship.com/posts/error-handling-exception-or-result/?utm_source=chatgpt.com&quot; title=&quot;Error handling: Exception or Result?&quot;&gt;Enterprise Craftsmanship&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;When paired with rules, the flow becomes very natural:&lt;/p&gt;
&lt;p&gt;Evaluate the business policy.&lt;br&gt;
If it fails, return a failure result.&lt;br&gt;
If it passes, continue the operation.&lt;/p&gt;
&lt;p&gt;That is simple, predictable, and easy to test.&lt;/p&gt;
&lt;h3 id=&quot;final-thought&quot;&gt;Final thought&lt;/h3&gt;
&lt;p&gt;The Rule pattern is one of those ideas that looks modest at first, but pays off more and more as the codebase grows.&lt;/p&gt;
&lt;p&gt;It helps you name business policies.&lt;br&gt;
It helps you reuse them.&lt;br&gt;
It helps you combine them.&lt;br&gt;
And when paired with the Result pattern, it gives your application a very clean way to both enforce rules and communicate outcomes. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://martinfowler.com/apsupp/spec.pdf?utm_source=chatgpt.com&quot; title=&quot;Specifications&quot;&gt;martinfowler.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;If your handlers are starting to fill up with business conditionals, this pattern is often a strong sign that the code wants a better language.&lt;/p&gt;
&lt;p&gt;And that, more than anything else, is what good domain design is really about.&lt;/p&gt;
&lt;p&gt;Source code :&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/stevsharp/RulePatternApplication&quot;&gt;https://github.com/stevsharp/RulePatternApplication&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
&lt;p&gt;Martin Fowler, &lt;em&gt;Specifications&lt;/em&gt;. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://martinfowler.com/apsupp/spec.pdf?utm_source=chatgpt.com&quot; title=&quot;Specifications&quot;&gt;martinfowler.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Microsoft Learn, &lt;em&gt;Designing validations in the domain model layer&lt;/em&gt;. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-model-layer-validations?utm_source=chatgpt.com&quot; title=&quot;Designing validations in the domain model layer - .NET&quot;&gt;Microsoft Learn&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Microsoft Learn, &lt;em&gt;Designing a DDD-oriented microservice&lt;/em&gt;. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/ddd-oriented-microservice?utm_source=chatgpt.com&quot; title=&quot;Designing a DDD-oriented microservice - .NET&quot;&gt;Microsoft Learn&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Vladimir Khorikov, &lt;em&gt;Error handling: Exception or Result?&lt;/em&gt; (&lt;a rel=&quot;nofollow&quot; href=&quot;https://enterprisecraftsmanship.com/posts/error-handling-exception-or-result/?utm_source=chatgpt.com&quot; title=&quot;Error handling: Exception or Result?&quot;&gt;Enterprise Craftsmanship&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Vladimir Khorikov, &lt;em&gt;Advanced error handling techniques&lt;/em&gt;. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://enterprisecraftsmanship.com/posts/advanced-error-handling-techniques/?utm_source=chatgpt.com&quot; title=&quot;Advanced error handling techniques&quot;&gt;Enterprise Craftsmanship&lt;/a&gt;)&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/14143/the-rule-pattern-in-c-and-why-it-works-so-well-with-the-result-pattern</guid>
<pubDate>Tue, 07 Apr 2026 10:01:22 +0000</pubDate>
</item>
</channel>
</rss>