Skip to content

Instantly share code, notes, and snippets.

@t851029v2
Created March 18, 2025 19:41
Show Gist options
  • Save t851029v2/e1d078fff6baf15f6dfdd7454c8dfd06 to your computer and use it in GitHub Desktop.
Save t851029v2/e1d078fff6baf15f6dfdd7454c8dfd06 to your computer and use it in GitHub Desktop.

AI Rules Configuration and Guidelines

This document details the naming conventions, folder structure, and formatting rules for our internal AI rules. The guidelines follow a Modular Component Organization approach, ensuring consistency, clarity, and ease of reuse across projects.


Table of Contents


Introduction

This guide defines our standards for organizing AI rules. Following these practices will help us maintain a clean, scalable, and understandable rule set that all teams can easily update and reference.


File Naming Conventions

To create clarity and consistency across our rule files, please follow these guidelines:

  • Case & Style: Use snake_case (lowercase with underscores) for file names.
  • Descriptive Names: Include descriptive names with content type indicators.
  • Ordering: Use numerical prefixes when ordering is important.
  • Versioning: Append version numbers or dates where applicable.

Examples and Guidelines

Category Naming Convention Example Description
Core Rules 01_core_rules.md Foundational guidelines applied across all projects.
Tech Stack Rules tech_stack_react.md Rules specific to React or similar technologies.
Workflow Guidelines workflow_guidelines.md Standards for AI interactions and coding workflows.
Versioning core/base_rules_v1.md Indicates version 1 of the base rules for core standards.

Additional Tips:

  • Avoid spaces and special characters.
  • Use clear identifiers (e.g., coding_conventions, naming_guidelines) to indicate purpose.
  • If ordering is necessary, use a prefix such as 01_, 02_, etc.

Modular Component Organization

We organize rules into modular components to allow for reusability and easier maintenance. The primary categories include:

Core Rules

These files contain universal guidelines applicable to every project.

  • Examples:
    • core/base_rules.md: Essential coding standards and documentation requirements.
    • core/coding_conventions.md: General formatting and naming rules.

Details:

  • Act as the foundation for other rule modules.
  • Cover security practices, code quality, and basic conventions.

Tech Stack Rules

These files tailor the guidelines for specific technologies used within our projects.

  • Examples:
    • tech_stack/react.md: Best practices for React projects.
    • tech_stack/node.md: Guidelines for Node.js coding and project structure.

Details:

  • Specific to the technologies and libraries in use.
  • Ensure uniformity in handling technology-specific nuances.

Framework Rules

Targeted rules for specific frameworks or application domains.

  • Examples:
    • frameworks/nextjs.md: Conventions and folder structuring for Next.js applications.
    • frameworks/express.md: Middleware and routing rules for Express.

Details:

  • Provide tailored guidance for framework-specific implementations.
  • Maintain consistency in complex frameworks.

Suggested Formatting Rules

Consistent formatting enhances readability for both humans and AI tools. Use the following rules across documentation and code examples:

  • Indentation: Use 2 spaces per indent.
  • Line Length: Limit lines to 80 characters.
  • Headers: Use clear markdown headers (#, ##, etc.) to outline sections.
  • Bullet Lists: Use dashes (-) for unordered lists.
  • Code Blocks: Wrap code examples in triple backticks for clarity.
  • Comments: When necessary, include inline comments to explain non-obvious details.

Sample Code Block:

# Example Header

- Ensure code is modular.
- Maintain clear documentation.
- Follow security guidelines.

Folder Structure Overview

Below is the recommended folder structure following the Modular Component Organization approach:

.ai-rules/
├── core/
│   ├── base_rules.md
│   └── coding_conventions.md
├── tech_stack/
│   ├── react.md
│   └── node.md
├── frameworks/
│   ├── nextjs.md
│   └── express.md
└── shared/
    ├── workflow_guidelines.md
    └── naming_conventions.md

Key Points:

  • Organize rules under clear directories (core, tech_stack, frameworks, shared).
  • Use the shared folder for rules applicable across multiple modules.
  • Maintain consistency by updating related files when changes are made.

Version Control Guidelines

  • Versioning Files: Append version numbers (e.g., _v1, _v2) or dates to filenames when changes occur.
  • Changelog: Keep a CHANGELOG.md to document version updates.
  • Collaboration: Use Git for pull requests and code reviews on rule updates.

Document Maintenance

  • Regular Reviews: Schedule periodic reviews of rule documents to adapt to evolving practices.
  • Feedback Loop: Encourage team feedback and incorporate suggestions into updates.
  • Central Repository: Host this document and all rule files in a central repository to ensure everyone works with the latest version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment