A comprehensive collection of rules, patterns, and standards designed to guide AI assistants in developing high-quality Ruby on Rails applications effectively.
This repository provides structured guidelines, best practices, and standard procedures to ensure consistent, maintainable, and robust code production when leveraging AI tools like Cursor and Cline for Rails development. It serves as a template and reference for teams aiming to standardize their AI-assisted workflows.
This project distinguishes between different types of rules and documentation:
-
Generic System Prompt (
generic.md):- This file contains fundamental behavioral instructions and operational modes (e.g.,
KEY_REQUIREMENTS,PLANNING_MODE,ARCHITECHTURE_MODE,DEBUG_MODE) for the AI assistant. - It sets the baseline for interaction style, code quality expectations, and specific workflows.
- This can often be used as a base system prompt for the AI tool.
- This file contains fundamental behavioral instructions and operational modes (e.g.,
-
Generic Documentation (
docs/):- Contains foundational project knowledge, architectural decisions, patterns, specifications, and workflows applicable regardless of the specific AI tool being used.
- Files like
docs/architecture.md,docs/patterns/,docs/specs/,docs/tdd.md, anddocs/erd.mmdprovide essential context for both human developers and AI assistants. - AI tools should be configured to reference these documents for background information and project standards, often directed by tool-specific rules.
-
Cursor-Specific Rules (
.cursorrules,.cursor/rules/*.mdc):- These files are formatted specifically for use with the Cursor IDE.
- They might contain rules leveraging Cursor's specific features or syntax (like
.mdcfiles) and can reference bothgeneric.mdand files withindocs/. - Refer to Cursor's documentation for how to integrate these rules effectively. The
.cursorrulesfile is generally deprecated in favor of the.cursor/rules/directory structure.
-
Cline-Specific Rules (
.clinerules):- This file contains rules formatted for use with the Cline tool.
- It defines project-specific instructions, preferences, and constraints directly consumable by Cline, potentially incorporating or referencing instructions from
generic.mdand context fromdocs/.
- System Prompt: Use the content of
generic.mdas a base system prompt if your AI tool supports it. - Cursor: Place
.mdcrule files within the.cursor/rules/directory. These rules can instruct Cursor to adhere togeneric.mdprinciples and consultdocs/. - Cline: Ensure the
.clinerulesfile is present. This file should incorporate the desired behaviors fromgeneric.mdand referencedocs/as needed. - Generic Docs: Tool-specific rules (
.clinerules,.mdc) should guide the AI on when and how to use the information within thedocs/directory.
README.md: This file - provides an overview and explains rule organization.generic.md: Base system prompt and behavioral instructions for the AI..clinerules: Rules specifically for the Cline AI tool..cursorrules/.cursor/rules/: Rules specifically for the Cursor IDE (prefer.cursor/rules/*.mdc).docs/: Generic project documentation (architecture, patterns, specs, TDD, ERD, decisions). Essential context for any AI or developer.LICENSE: Project license information.CONTRIBUTING.md: (Optional) Guidelines for contributing to this ruleset.
This ruleset assumes a modern Rails development stack. Key technologies and concepts are detailed within docs/architecture.md and relevant pattern/spec files. Examples include:
- Ruby on Rails (Version specified in
docs/architecture.md) - Hotwire (Turbo & Stimulus)
- ViewComponents
- TailwindCSS
- RSpec
- Service Objects
- Background Job Framework (Specified in
docs/architecture.md)
- Clone/Fork: Start with this repository as your base.
- Customize
generic.md: Adapt the base AI instructions to your team's preferences. - Customize
docs/: Update generic documentation (architecture.md,erd.mmd, patterns, specs) to match your project. - Configure AI Rules:
- Populate/modify
.cursor/rules/with.mdcfiles for Cursor, referencinggeneric.mdanddocs/. - Populate/modify
.clinerulesfor Cline, incorporatinggeneric.mdprinciples and referencingdocs/.
- Populate/modify
- Integrate: Set up your AI tools to use the configured system prompts and rules.
- Communicate: Ensure your team understands the structure and how to use/maintain the rules and documentation.
This project template is available as open source under the terms of the MIT License.