-
-
Notifications
You must be signed in to change notification settings - Fork 268
Add initial instructions for AI agents #7765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As more and more people use AI tools at the company, we need to make sure that generated code follows the standards that we want engineers to follow as well. `AGENTS.md` is a standard that is used by many AI agents (Cursor, Claude Code, etc.). This commit introduces a basic version that describes how the monorepo is structured, how to perform various tasks, and what kind of guidelines to follow.
2108113 to
cfb4857
Compare
cryptodev-2s
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I left a few minor suggestions. We can follow up by adding a “skills” section to each of the existing pattern docs (Data Service, Selectors, etc.).
| ### Configuration files | ||
|
|
||
| The monorepo uses a hierarchical configuration approach for different tools: | ||
|
|
||
| ### Contributing teams and codeowners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Configuration files | |
| The monorepo uses a hierarchical configuration approach for different tools: | |
| ### Contributing teams and codeowners | |
| ### Configuration files | |
| The monorepo uses a hierarchical configuration approach for different tools. Root-level config files define shared settings, while package-level files extend or customize them. | |
| #### Contributing teams and codeowners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: 75a2174
AGENTS.md
Outdated
|
|
||
| - Run `yarn workspace <package-name> run <script>` to run a package script within a package. | ||
| - Run `yarn workspace <package-name> exec <command>` to run a command within a package. | ||
| - Run `yarn workspace foreach --all run <script>` to run a package script across all repos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Run `yarn workspace foreach --all run <script>` to run a package script across all repos. | |
| - Run `yarn workspace foreach --all run <script>` to run a package script across all packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: 75a2174
AGENTS.md
Outdated
| - Run `yarn workspace <package-name> run <script>` to run a package script within a package. | ||
| - Run `yarn workspace <package-name> exec <command>` to run a command within a package. | ||
| - Run `yarn workspace foreach --all run <script>` to run a package script across all repos. | ||
| - Run `yarn workspace foreach --all exec <command>` to run a command across all repos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Run `yarn workspace foreach --all exec <command>` to run a command across all repos. | |
| - Run `yarn workspace foreach --all exec <command>` to run a command across all packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: 75a2174
AGENTS.md
Outdated
| - Run `yarn workspace foreach --all run <script>` to run a package script across all repos. | ||
| - Run `yarn workspace foreach --all exec <command>` to run a command across all repos. | ||
| - Run `yarn run <script>` to run a package script defined in the root `package.json`. | ||
| - Run `yarn exec <command>` to run a command available at the root of the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: might be worth adding a note on how to add a dependency too.
| - Run `yarn exec <command>` to run a command available at the root of the project. | |
| - Run `yarn exec <command>` to run a command available at the root of the project. | |
| - Run `yarn workspace <package-name> add <dependency>` to add a dependency to a specific package. | |
| - Run `yarn workspace <package-name> add -D <dependency>` to add a dev dependency to a specific package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Updated here: 75a2174
| - Run `yarn workspace <package-name> run jest --no-coverage <file>` to run a specific test file. | ||
| - Prefer the above two commands, but if you must, run `yarn test` to run tests for all packages in the monorepo. | ||
|
|
||
| ### Linting and formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should we add a short section here about CI?
| ### Linting and formatting | |
| ### Continuous integration | |
| Pull requests trigger automated checks including: | |
| - **Lint** — Runs ESLint and Prettier to check code quality and formatting. | |
| - **Tests** — Runs Jest tests across affected packages. | |
| - **Type checking** — Ensures TypeScript compiles without errors. | |
| - **Changelog validation** — Verifies changelog entries are properly formatted. | |
| Ensure all checks pass locally before pushing changes. | |
| ### Linting and formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Cursor tends to handle linting and typechecking automatically without my having to tell it what to do. (Claude Code I'm not sure about.)
That said, you're right that there are some missing instructions in the "General development workflow" section. I've added some more words there: 75a2174
AGENTS.md
Outdated
|
|
||
| ### Controllers | ||
|
|
||
| When adding or updating controllers in packages, make sure to abide by the guidelines in `docs/controller-guidelines.md`. Use `SampleGasPricesController` and `SamplePetnamesController` in the `sample-controllers` package as examples for implementation and tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe worth expanding this a bit more, then we can add “skills” for each of these later.
| When adding or updating controllers in packages, make sure to abide by the guidelines in `docs/controller-guidelines.md`. Use `SampleGasPricesController` and `SamplePetnamesController` in the `sample-controllers` package as examples for implementation and tests. | |
| When adding or updating controllers in packages, make sure to abide by the guidelines in `docs/controller-guidelines.md`. Key patterns include: | |
| - Controllers extend `BaseController` and use a messenger for inter-controller communication. | |
| - Actions and events should be explicitly typed on the controller's messenger. | |
| Use `SampleGasPricesController` and `SamplePetnamesController` in the `sample-controllers` package as examples for implementation and tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that Cursor was basically able to read sample-controllers and figure out what to do. That said, it couldn't hurt. I added some controller guidelines here: 75a2174
AGENTS.md
Outdated
|
|
||
| ### Services | ||
|
|
||
| When adding or updating services in packages, use the `sample-gas-prices-service/` directory in the `sample-controllers` package as examples for implementation and tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe worth expanding this a bit, feel free to update it.
| When adding or updating services in packages, use the `sample-gas-prices-service/` directory in the `sample-controllers` package as examples for implementation and tests. | |
| When adding or updating services in packages, follow these patterns: | |
| - Services encapsulate external API calls and data fetching logic. | |
| - They should be stateless and injectable into controllers. | |
| - Use dependency injection to allow mocking in tests. | |
| Use the `sample-gas-prices-service/` directory in the `sample-controllers` package as examples for implementation and tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that Cursor was basically able to read sample-controllers and figure out what to do. That said, it couldn't hurt. I added some (data) service guidelines here: 75a2174
cryptodev-2s
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Agreed! |
Add AGENTS.md file with instructions for AI agents that operate on the repository. The goal is to outline our requirements for feature development and any quirks in using the repo. Mostly written by Claude as an experiment, but with edits and guidance from myself. Also with inspiration from MetaMask/core#7765 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: documentation-only addition plus a small `lint-staged` pattern tweak that only affects formatting behavior for `CLAUDE.md`. No runtime or package code changes. > > **Overview** > Adds `AGENTS.md`, a repository guide for AI coding agents covering stack/tooling, monorepo conventions, build/test/lint commands, changelog requirements, and high-level Snaps platform architecture/naming guidelines. > > Adds `CLAUDE.md` pointing to `AGENTS.md`, and updates `lint-staged` in `package.json` to exclude `CLAUDE.md` (alongside `CHANGELOG.md`) from Prettier formatting. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4ade350. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Pull request was closed
|
Oops, I thought I merged this 😂 |
cryptodev-2s
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Explanation
As more and more people use AI tools at the company, we need to make sure that generated code follows the standards that we want engineers to follow as well.
AGENTS.mdis a standard that is used by many AI agents (Cursor, Claude Code, etc.). This commit introduces a basic version that describes how the monorepo is structured, how to perform various tasks, and what kind of guidelines to follow.References
https://consensyssoftware.atlassian.net/browse/WPC-79
Testing
To test these agent rules, I had AI create a controller package. You can see the results here: 88bde44. The only tweaks I made after the initial generation was to fix lint errors, everything else is coming straight from AI.
Checklist
Note
Low Risk
Low risk: this PR only adds documentation and does not change runtime code, build output, or dependencies.
Overview
Adds a new
AGENTS.mddocument with repo-specific guidance for AI agents, covering monorepo structure, common Yarn commands (testing/linting/building), changelog expectations, and coding standards for packages/controllers/data services.Written by Cursor Bugbot for commit 9dc59fc. This will update automatically on new commits. Configure here.