website icon indicating copy to clipboard operation
website copied to clipboard

[FEATURE] Introduce AI-facing documentation

Open sammy200-ui opened this issue 9 months ago • 15 comments

As many of you know with the rapid rise of AI coding assistants like Cursor , Github Copilot , Claude , many new contributors are relying on LLMs to generate PRs. This is great for getting people involved and trying to contribute, but there’s a catch: these AIs don't know our specific project rules.

Right now, when someone points an AI at the repo and says "fix this bug" or "add this feature", the AI will just generate a PR, but it has no idea that:

You need to open an issue first before submitting a PR PR titles must follow conventional commits (feat:, fix:, docs:, etc.) One PR should do one thing, not five things at once There are specific patterns we use in this Next.js/TypeScript/Tailwind codebase

Its basically a waste of time on both side , the PR is technically working but miss all the process stuff that maintainers have to point out in the review.

The idea is simple, these files are read automatically by AI coding tools and tell them the project specific rules upfront, before they start writing code. Instead of the maintainer catching it in review, the AI catches it before it even writes the PR.

What I'm proposing -

Add one or more of the following files to the root of the AsyncAPI website repo

AGENTS.md that read by OpenAI Codex-based tools and several others, becoming something of an informal standard .cursorrules that read by the Cursor IDE, which a lot of contributors use CLAUDE.md that picked up by Claude when working in a directory

Please dont consider these as a replacement to CONTRIBUTING.md, they're more like a cheat sheet written specifically for AI tools.

sammy200-ui avatar Feb 27 '26 16:02 sammy200-ui

i will be adding more context for the discussion in some time

I would love to hear thoughts from Maintainers and my fellow Contributors . Do add your opinions in this discussion !!

sammy200-ui avatar Feb 27 '26 16:02 sammy200-ui

What could go in these files - Open an issue and get it approved before opening a PR unless it's a typo or a really obvious fix PR title should be following conventional commits liek feat:, fix:, docs:, chore:, test:, refactor: Title should be written in imperative mood and be descriptive in itsef Keep PRs small, making sure to follow like a one feature or fix per PR, not a bundle of things. Run npm run lint and npm run test locally and make sure they pass before submitting

sammy200-ui avatar Feb 27 '26 19:02 sammy200-ui

CI checks problems after a PR is opened, but AI docs can help tools follow the rules from the start adding some automatically checked rules like PR title format could reduce mistakes and make easier

Amythystx avatar Feb 28 '26 04:02 Amythystx

A big plus on the problem description. Although such rules wouldn't block such PRs but might definitely reduce such spam.

anshgoyalevil avatar Mar 14 '26 14:03 anshgoyalevil

i too agree on the problem statement For this, can you check if we could add any rule in .coderabbit.yaml so that coderabbit can help us with this? Also, I believe we need to explore how we can improve that file by adding more rules to get more help from coderabbit

princerajpoot20 avatar Mar 22 '26 06:03 princerajpoot20

@anshgoyalevil Totally agree

@princerajpoot20 tbh i had not consider leveraging coderabbit for this, but seems like a good idea but as far as i know coderabbit mostly acts on the pr side where as files like AGENTS.md would act on editor side i.e before the pr is even open , combining them would be good idea , let me get back after going through the coderabbit setup then i will also figure out custom rules and instructions and also ping them here

sammy200-ui avatar Mar 22 '26 07:03 sammy200-ui

@sammy200-ui Simply adding agent.md or file like claude.md will not make much difference, as their rules are only applied when using the respective editor. The problem you mentioned in the issue description is related to the flow of PR creation, so it will only apply if the PR is created through those editors via the MCP server, which is not currently used by everyone. Most people create PRs by going to github.com, so I’m not sure the rules you’re proposing for this PR creation workflow will be effective.

princerajpoot20 avatar Mar 22 '26 08:03 princerajpoot20

@princerajpoot20 Fair point tbh, took some time to figure out how coderabbit works and turns out it can auto-detect files like AGENTS.md, .cursorrules, CLAUDE.md ref , and uses them as review criteria during PR reviews with no no extra config needed.

so if we add an AGENTS.md to the repo, it would serve double duty:

  • AI editors (cursor, copilot, claude) can pick it up locally while writing code
  • coderabbit picks it up automatically during PR review

that already addresses your concern about people who don't use these editors, coderabbit would still enforce the same rules during review regardless of how the PR was created.

Also worth exploring is path_instructions in CodeRabbit , it basically lets you set file-specific review rules per directory. Would make sense to add some for this codebase once we agree on what the common review pain points are ref

cc : @anshgoyalevil @animeshk923

sammy200-ui avatar Mar 24 '26 16:03 sammy200-ui

My two cents:

Definitely an interesting problem statement to solve. We use coderabbit heavily on the website repo to review so configuring it should be our primary focus. As @sammy200-ui stated in this comment, we can add an AGENTS.md file with a more verbose version of the instructions mentioned here and any new instructions as well. We need to give the agent context on how the contribution flow looks like.

We have to do a trial run and actively see how coderabbit is performing on new active PRs. And yes, it would solve the local IDE scope as well.

We definitely should create an AI-faced CONTRIBUTING.md and apply them in AGENTS.md. Most low-quality PRs (and regular PRs) are opened with GitHub's ui. If someone doesn't read the CONTRIBUTING.md file, we can apply the fixes in the PR by utilizing AGENTS.md, configure coderabbit to give a custom message (via coderabbit comment itself?) about our "please read CONTRIBUTING.md before opening a PR/issue".

PS: great insights @sammy200-ui !

animeshk923 avatar Mar 24 '26 17:03 animeshk923

Hey maintainers,

I put together a PR #5306 based on what's been discussed here so far. It adds AGENTS.md, CLAUDE.md, .cursorrules, and updates .coderabbit.yaml with path_instructions for directory-specific reviews basically covering all the suggestions from @sammy200-ui, @princerajpoot20, and @animeshk923.

The PR is up, so if the direction looks good I can tweak it based on whatever you all decide. Open to feedback.

Anexus5919 avatar Apr 02 '26 14:04 Anexus5919

we can go ahead. it will more like experiment so just make sure to keep track on the effectiveness of it. @sammy200-ui can you come up with rough draft on the points you have in mind that you want to add as part of this.

princerajpoot20 avatar Apr 03 '26 17:04 princerajpoot20

@princerajpoot20 sure

so the way i see it, the main file would be AGENTS.md at root. reason being - most AI tools (cursor, claude, copilot) pick it up automatically. and like i said in my previous message the good thing is that coderabbit auto-detects AGENTS.md and uses it as review criteria ref. so one file covers both the editor side and the review side without needing separate config.

for the content itself, here's what i think makes sense based on common review pain points and actual codebase patterns:

  1. contribution workflow - open issue first, get approval, then PR. one fix/feature per PR. now i know this is already inCONTRIBUTING.md but AI tools don't always read that, so worth restating in a concise way here.

  2. PR title format - conventional commits (feat:, fix:, docs: etc), imperative mood, keep it descriptive. again stuff thats in CONTRIBUTING.md but needs to be explicitly spelled out for AI tools.

  3. local checks before submitting - run npm run lint and npm run dev before pushing. also import type is enforced by eslint so AI tools should use it when importing types only.

  4. codebase conventions — this is where project-specific stuff goes: use Heading, Paragraph from components/typography/ instead of raw html tags use project tailwind tokens from tailwind.config.ts (we have custom primary, secondary, gray color scales and custom font sizes like text-heading-xl, text-body-sm) data-testid attributes for anything that needs test hooks import ordering is enforced by simple-import-sort (this is something AI messes up a lot)

  5. project structure overview — a quick map of what goes where (components/, pages/, scripts/, types/, config/ etc) so the AI tool knows where to place new files

For the coderabbit side - apart from the auto-detection of AGENTS.md, we can also add path_instructions (for more context ref ) in .coderabbit.yaml for directory-specific review rules. the current config only has linting tools enabled, no custom review instructions yet. Very interesting enhancment i would say

These are all my final points i would say and yeah as you said, will keep track of the effectiveness, we can compare review turnaround and common feedback patterns on PRs before and after to see if its actually helping.

cc : @anshgoyalevil @animeshk923

If there are any questions or any points that you guys think should be dropped or refine , do ask !!

sammy200-ui avatar Apr 04 '26 12:04 sammy200-ui

contribution workflow - open issue first, get approval, then PR. one fix/feature per PR. now i know this is already inCONTRIBUTING.md but AI tools don't always read that, so worth restating in a concise way here.

PR title format - conventional commits (feat:, fix:, docs: etc), imperative mood, keep it descriptive. again stuff thats in CONTRIBUTING.md but needs to be explicitly spelled out for AI tools.

local checks before submitting - run npm run lint and npm run dev before pushing. also import type is enforced by eslint so AI tools should use it when importing types only.

codebase conventions — this is where project-specific stuff goes: use Heading, Paragraph from components/typography/ instead of raw html tags use project tailwind tokens from tailwind.config.ts (we have custom primary, secondary, gray color scales and custom font sizes like text-heading-xl, text-body-sm) data-testid attributes for anything that needs test hooks import ordering is enforced by simple-import-sort (this is something AI messes up a lot)

Just as a heads up: make sure to refine the prompts to be descriptive from an llm

For the coderabbit side - apart from the auto-detection of AGENTS.md, we can also add path_instructions (for more context ref ) in .coderabbit.yaml for directory-specific review rules. the current config only has linting tools enabled, no custom review instructions yet. Very interesting enhancment i would say

Indeed. Utilizing glob patterns to make the reviews more nuanced. Great!


@sammy200-ui you can take the inspiration from this PR and introduce the changes when this is finalized.

animeshk923 avatar Apr 04 '26 15:04 animeshk923

@animeshk923 Thanks for the help, will surely look into the pr !!

sammy200-ui avatar Apr 04 '26 15:04 sammy200-ui

@princerajpoot20 sure

so the way i see it, the main file would be AGENTS.md at root. reason being - most AI tools (cursor, claude, copilot) pick it up automatically. and like i said in my previous message the good thing is that coderabbit auto-detects AGENTS.md and uses it as review criteria ref. so one file covers both the editor side and the review side without needing separate config.

for the content itself, here's what i think makes sense based on common review pain points and actual codebase patterns:

  1. contribution workflow - open issue first, get approval, then PR. one fix/feature per PR. now i know this is already inCONTRIBUTING.md but AI tools don't always read that, so worth restating in a concise way here.
  2. PR title format - conventional commits (feat:, fix:, docs: etc), imperative mood, keep it descriptive. again stuff thats in CONTRIBUTING.md but needs to be explicitly spelled out for AI tools.
  3. local checks before submitting - run npm run lint and npm run dev before pushing. also import type is enforced by eslint so AI tools should use it when importing types only.
  4. codebase conventions — this is where project-specific stuff goes: use Heading, Paragraph from components/typography/ instead of raw html tags use project tailwind tokens from tailwind.config.ts (we have custom primary, secondary, gray color scales and custom font sizes like text-heading-xl, text-body-sm) data-testid attributes for anything that needs test hooks import ordering is enforced by simple-import-sort (this is something AI messes up a lot)
  5. project structure overview — a quick map of what goes where (components/, pages/, scripts/, types/, config/ etc) so the AI tool knows where to place new files

For the coderabbit side - apart from the auto-detection of AGENTS.md, we can also add path_instructions (for more context ref ) in .coderabbit.yaml for directory-specific review rules. the current config only has linting tools enabled, no custom review instructions yet. Very interesting enhancment i would say

These are all my final points i would say and yeah as you said, will keep track of the effectiveness, we can compare review turnaround and common feedback patterns on PRs before and after to see if its actually helping.

cc : @anshgoyalevil @animeshk923

If there are any questions or any points that you guys think should be dropped or refine , do ask !!

@princerajpoot20 we going ahead with this? or any changes to be expected

sammy200-ui avatar Apr 06 '26 14:04 sammy200-ui