Skip to main content

AI rules for Flutter and Dart

Learn how to add AI rules to tools that accelerate your development workflow.

This guide covers how you can leverage AI rules to streamline your Flutter and Dart development.

Overview

#

AI-powered editors use rules files to provide context and instructions to an underlying LLM. These files help you:

  • Customize AI behavior to your team's needs.
  • Enforce project best practices for code style and design.
  • Provide critical project context to the AI.

The Flutter project provides several versions of the rules file to accommodate different tool limits:

  • rules.md: The comprehensive master rule set.
  • rules_10k.md: A condensed version (<10k chars) for tools with stricter context limits.
  • rules_4k.md: A highly concise version (<4k chars) for limited contexts.
  • rules_1k.md: An ultra-compact version (<1k chars) for very strict limits.
Download the Flutter and Dart rules template

Device & editor specific limits

#

Different AI coding assistants and tools have varying limits for their "rules" or "custom instructions" files. Last updated: 2026-01-05.

Tool / Product Rules file / Feature Limit (soft / hard) Documentation
Antigravity (Google) .agent/rules/<rule-name>.md 12,000 chars (Hard) Configure rules
Claude Code CLAUDE.md No Hard Limit Claude Code Docs
Cursor AGENTS.md No Hard Limit Cursor Docs
Gemini CLI GEMINI.md 1M+ Tokens (Context) Gemini CLI Docs
GitHub Copilot .github/copilot-instructions.md ~4k chars GitHub Copilot Docs
JetBrains AI (Junie) .junie/guidelines.md No Hard Limit JetBrains AI Docs
VS Code .instructions.md Unknown Configure instructions

Create rules for your editor

#

You can adapt our Flutter and Dart rules template for your specific environment. To do so, follow these steps:

  1. Download the Flutter and Dart rules template: rules.md

  2. In an LLM like Gemini, attach the rules.md file that you downloaded in the last step.

  3. Provide a prompt to reformat the file for your desired editor.

    Example prompt:

    Convert the attached rules.md file
    into a guidelines.md file for Gemini CLI. Make sure
    to use the styles required for a guidelines.md file.
    
  4. Review the LLM's output and make any necessary adjustments.

  5. Follow your environment's instructions to add the new rules file. This may involve adding to an existing file or creating a new one.

  6. Verify that your AI assistant is using the new rules to guide its responses.