Skip to content

feat(config): Reorganize agent rules and instructions#683

Merged
yamadashy merged 1 commit intomainfrom
feat/agent-rules-organization
Jun 22, 2025
Merged

feat(config): Reorganize agent rules and instructions#683
yamadashy merged 1 commit intomainfrom
feat/agent-rules-organization

Conversation

@yamadashy
Copy link
Owner

Summary

  • Reorganized AI agent instructions for better maintainability and context-specific application
  • Created dedicated rule files in .agents/rules/ directory with clear descriptions
  • Improved cross-referencing between different rule sets

Changes

  • Move project guidelines from CLAUDE.md to .agents/rules/base.md
  • Create browser-extension.md rule file for browser development guidelines
  • Consolidate GitHub release note guidelines into base.md
  • Add cross-references between rule files for better navigation
  • Update instructions to reference new rule structure

This improves organization by separating core project rules from extension-specific and website-specific guidelines, making it easier for AI agents to apply the appropriate rules based on context.

Checklist

  • Run npm run test
  • Run npm run lint

🤖 Generated with Claude Code

- Move project guidelines from CLAUDE.md to .agents/rules/base.md
- Create browser-extension.md rule file for browser development
- Consolidate GitHub release note guidelines into base.md
- Add cross-references between rule files for better navigation
- Update instructions to reference new rule structure

This improves organization by separating core project rules from
extension-specific and website-specific guidelines, making it easier
for AI agents to apply the appropriate rules based on context.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 22, 2025 14:12
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 22, 2025

Walkthrough

This update centralizes and restructures project guidelines by introducing a new comprehensive rules document at .agents/rules/base.md. Several previous documentation files are removed or replaced with pointers to the new rules file. Additional, specialized guidelines for the browser extension and website are added or updated, clarifying development and documentation standards across the project.

Changes

Files / Paths Change Summary
.agents/rules/base.md Added a comprehensive project-wide guidelines document covering structure, standards, commits, PRs, and reviews.
.agents/rules/browser-extension.md Added detailed browser extension development and internationalization guidelines.
.agents/rules/website.md Updated front matter: replaced applyTo with a descriptive description field.
.cursorrules, .github/instructions/base.instructions.md, CLAUDE.md Replaced detailed content with a single-line pointer to .agents/rules/base.md.
.github/instructions/github-release-note.instructions.md, website/CLAUDE.md Deleted detailed release note and website documentation guideline files.

Sequence Diagram(s)

sequenceDiagram
    participant Contributor
    participant Repo
    participant Guidelines

    Contributor->>Repo: Seeks project guidelines
    Repo->>Guidelines: Points to .agents/rules/base.md
    Contributor->>Guidelines: Reads unified rules
    Guidelines-->>Contributor: Provides standards for code, PRs, commits, and reviews
Loading

Possibly related PRs

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch feat/agent-rules-organization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@claude
Copy link
Contributor

claude bot commented Jun 22, 2025

Claude finished @yamadashy's task —— View job


PR Review: Agent Rules Reorganization

Reviewing the reorganization of AI agent instructions and rule structure.

Todo List

  • Read and analyze new .agents/rules/ directory structure
  • Review content migration from CLAUDE.md to base.md
  • Check browser-extension.md and website.md rule files
  • Analyze modified files (.cursorrules, base.instructions.md, CLAUDE.md)
  • Evaluate cross-referencing and maintainability improvements
  • Provide comprehensive review feedback

Review Feedback

This PR successfully reorganizes AI agent instructions into a much more maintainable and scalable structure. Overall, this is a well-executed refactoring that significantly improves the codebase organization.

Strengths & Best Practices

1. Excellent Modular Architecture

  • Clear separation of concerns: base rules, browser extension, and website-specific guidelines
  • Logical directory structure in .agents/rules/ provides intuitive navigation
  • Each rule file has a clear, focused responsibility

2. Smart Content Consolidation

  • Eliminated duplication by consolidating GitHub release note guidelines into base.md:119-130
  • Removed redundant files (website/CLAUDE.md, github-release-note.instructions.md)
  • Net reduction of 282 lines while maintaining all essential content

3. Strong Cross-Referencing System

  • Base rules properly reference specialized rules (lines 134-136 in base.md)
  • All entry points (CLAUDE.md, .cursorrules, .github/instructions) correctly redirect to main rules
  • Consistent referencing pattern across all files

4. Proper Metadata Usage

  • YAML frontmatter with clear descriptions helps AI agents understand context
  • applyTo: '**' directive in base.instructions.md is appropriate for universal rules

🔍 Architecture Analysis

Directory Structure - The new .agents/rules/ structure is well-designed:

  • base.md - Core project guidelines (appropriate as the foundation)
  • browser-extension.md - Specialized rules for browser development
  • website.md - Documentation-specific guidelines

Content Migration - The migration from CLAUDE.md to base.md is thorough:

  • All essential project information preserved
  • Improved organization with clear sections
  • Maintained all critical development guidelines

💡 Minor Suggestions for Improvement

1. Consider Adding Table of Contents
At base.md:5, consider adding a TOC for the lengthy guidelines:

## Table of Contents
- [Project Overview](#project-overview)
- [Coding Guidelines](#coding-guidelines)
- [Commit Messages](#commit-messages)
- [Dependencies and Testing](#dependencies-and-testing)

2. Validate Cross-References
The links in base.md:135-136 use relative paths. Consider testing that these resolve correctly from different contexts where the base rules might be referenced.

3. Documentation Consistency
In browser-extension.md:31-38, the command examples could benefit from consistent formatting with the rest of the project's documentation style.

🎯 Impact Assessment

Maintainability: ⭐⭐⭐⭐⭐

  • Significantly easier to maintain and update rules
  • Clear ownership and scope for each rule file
  • Reduced cognitive load when working with specific contexts

Scalability: ⭐⭐⭐⭐⭐

  • Easy to add new specialized rule files
  • Existing architecture supports future growth
  • Clean separation allows independent updates

Developer Experience: ⭐⭐⭐⭐⭐

  • AI agents can now apply context-appropriate rules
  • Clearer guidance for different development scenarios
  • Reduced confusion from scattered instructions

🔒 Security & Quality

  • No security concerns identified
  • All content appears to be properly migrated
  • No sensitive information exposed
  • Clean removal of deprecated files

Verdict

This is a high-quality refactoring that transforms a maintenance burden into a well-organized, scalable system. The reorganization follows software engineering best practices for modular design and separation of concerns.

Recommendation: ✅ Approve - This PR significantly improves the codebase organization with no identified issues.

The net reduction of 282 lines while maintaining functionality demonstrates excellent consolidation work. The new structure will make it much easier for AI agents to apply appropriate rules based on context, which was the primary goal of this reorganization.


Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @yamadashy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors how AI agent instructions and project guidelines are organized within the repository. The primary goal is to enhance maintainability and ensure AI agents can more effectively apply context-specific rules by centralizing core guidelines and separating specialized instructions into dedicated files.

Highlights

  • Reorganized AI Agent Instructions: I've introduced a new .agents/rules/ directory to house structured guidelines for AI agents, improving overall maintainability and clarity of instructions.
  • Centralized Core Guidelines: Core project guidelines, including coding standards, commit message conventions, and PR procedures, have been consolidated into a new base.md file within the .agents/rules/ directory.
  • Dedicated Context-Specific Rules: New, specialized rule files (browser-extension.md and website.md) have been created to provide targeted guidelines for specific areas of the codebase, such as browser extension development and website documentation.
  • Updated Instruction References: Existing AI instruction files (.cursorrules, .github/instructions/base.instructions.md, CLAUDE.md) have been updated to point to the new, reorganized rule structure, ensuring all agents reference the correct and up-to-date guidelines.
  • Improved Cross-Referencing: The new rule files include cross-references to related guidelines, facilitating easier navigation and a more comprehensive understanding of the project's standards.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.36%. Comparing base (b9e36ca) to head (7ae7aac).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #683   +/-   ##
=======================================
  Coverage   90.36%   90.36%           
=======================================
  Files          99       99           
  Lines        5541     5541           
  Branches     1183     1183           
=======================================
  Hits         5007     5007           
  Misses        534      534           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cloudflare-workers-and-pages
Copy link

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7ae7aac
Status: ✅  Deploy successful!
Preview URL: https://4e4d3d55.repomix.pages.dev
Branch Preview URL: https://feat-agent-rules-organizatio.repomix.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Reorganize and centralize AI agent instructions by moving legacy guidelines into dedicated .agents/rules/ files and replacing outdated markdown with pointers to the new structure.

  • Remove old instruction files (CLAUDE.md, GitHub release note guidelines, base instructions).
  • Introduce new rule files under .agents/rules/ and update references.
  • Simplify pointer files (.cursorrules, root CLAUDE.md) to reference the new rule directory.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/CLAUDE.md Deleted obsolete website documentation; replaced with centralized rule references.
CLAUDE.md Stripped detailed AI instructions; added pointer to .agents/rules/base.md.
.github/instructions/github-release-note.instructions.md Removed legacy GitHub release note guidelines; consolidated in base rules.
.github/instructions/base.instructions.md Removed detailed instructions; left only pointer to new base rule file.
.cursorrules Replaced previous context with pointer to .agents/rules/base.md.
.agents/rules/website.md Added description field but missing applyTo in frontmatter.
.agents/rules/browser-extension.md New browser extension guidelines file; frontmatter lacks applyTo property.
.agents/rules/base.md Added core project guidelines; frontmatter missing applyTo directive.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request reorganizes AI agent instructions, improving maintainability and context-specific application by creating dedicated rule files. The changes involve moving project guidelines and consolidating information into new .agents/rules/ files, with updates to reference the new structure. I've provided feedback on ensuring accuracy of file paths and verifying the impact of abstracting detailed instructions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
.agents/rules/base.md (2)

75-75: Add missing period.
A period is needed at the end of this sentence to maintain consistency in the commit message guideline examples.


116-116: Fix grammar in output directive.
Consider rephrasing for clarity, e.g.:
“Include all content without being abbreviated, unless specified otherwise.”

.github/instructions/base.instructions.md (1)

1-6: Optional: Align front matter with new rule file conventions.
To maintain consistency across documentation, you may replace the applyTo field with a description entry in the YAML front matter:

- ---
- applyTo: '**'
- ---
+ ---
+ description: Legacy instructions streamlined; please refer to the centralized rules in .agents/rules/base.md.
+ ---
CLAUDE.md (1)

5-5: Use a clickable Markdown link for the file path

Converting the file path into a Markdown link improves navigation in rendered documentation.

- Please make sure to check the rules written in `.agents/rules/base.md` as they contain important project-specific guidelines and instructions.
+ Please make sure to check the rules written in [.agents/rules/base.md](.agents/rules/base.md) as they contain important project-specific guidelines and instructions.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b9e36ca and 7ae7aac.

📒 Files selected for processing (8)
  • .agents/rules/base.md (1 hunks)
  • .agents/rules/browser-extension.md (1 hunks)
  • .agents/rules/website.md (1 hunks)
  • .cursorrules (1 hunks)
  • .github/instructions/base.instructions.md (1 hunks)
  • .github/instructions/github-release-note.instructions.md (0 hunks)
  • CLAUDE.md (1 hunks)
  • website/CLAUDE.md (0 hunks)
💤 Files with no reviewable changes (2)
  • website/CLAUDE.md
  • .github/instructions/github-release-note.instructions.md
🧰 Additional context used
🪛 LanguageTool
.agents/rules/browser-extension.md

[uncategorized] ~46-~46: The preposition ‘to’ seems more likely in this position.
Context: ...dding New Languages 1. Create directory in app/_locales/[language_code]/ 2. Add ...

(AI_HYDRA_LEO_REPLACE_IN_TO)

.agents/rules/base.md

[uncategorized] ~75-~75: A period might be missing here.
Context: ...- Description must start with a capital letter ## Pull Request Guidelines - All pull ...

(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)


[uncategorized] ~116-~116: Possible missing preposition found.
Context: ...ble ## Generate Comprehensive Output - Include all content without abbreviation, unles...

(AI_HYDRA_LEO_MISSING_TO)

⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: Test (macos-latest, 22.x)
  • GitHub Check: Test (windows-latest, 21.x)
  • GitHub Check: Test (windows-latest, 23.x)
  • GitHub Check: Test (windows-latest, 20.x)
  • GitHub Check: Test (windows-latest, 18.0.0)
  • GitHub Check: Test (ubuntu-latest, 18.x)
  • GitHub Check: Test (ubuntu-latest, 21.x)
  • GitHub Check: Test (ubuntu-latest, 20.x)
  • GitHub Check: Build and run (macos-latest, 20.x)
  • GitHub Check: Build and run (macos-latest, 21.x)
  • GitHub Check: Build and run (macos-latest, 22.x)
  • GitHub Check: Build and run (windows-latest, 21.x)
  • GitHub Check: Build and run (ubuntu-latest, 23.x)
  • GitHub Check: Build and run (ubuntu-latest, 19.x)
  • GitHub Check: Build and run (ubuntu-latest, 24.x)
  • GitHub Check: Build and run (ubuntu-latest, 21.x)
  • GitHub Check: auto-review
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
.agents/rules/base.md (1)

1-137: Consolidated project guidelines are clear and well-structured.
The new base.md effectively centralizes coding standards, commit conventions, PR workflows, testing guidance, and release note instructions into a single source of truth.

.agents/rules/website.md (1)

1-44: Specialized website guidelines are concise and comprehensive.
The updated description front matter clearly scopes these rules to the documentation site, and the steps for navigation and language support are well laid out.

.agents/rules/browser-extension.md (1)

1-50: Browser extension rules are well-documented and complete.
The manifest, directory structure, development commands, and i18n steps are clearly defined, providing all needed context for extension work.

.cursorrules (1)

1-2: Pointer to centralized rules is accurate.
The single-line pointer correctly directs contributors to the new .agents/rules/base.md for full guidelines.

CLAUDE.md (1)

5-5: Approved redirect to centralized rules

This succinctly directs readers to the new .agents/rules/base.md and aligns with the project-wide consolidation of guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants