Added AGENTS.md instructions and SKILLS.md#1921
Conversation
A global general instruction and one per project JAVA-6143
|
Followed general guidelines from: https://wiki.corp.mongodb.com/spaces/MMS/pages/499158370/Making+a+Repo+Agent+Ready AGENTS.md: The ConstitutionAGENTS.md is a markdown file at the root of the repository. Every AI agent — Augment, Claude Code, Cursor — reads it automatically at the start of every session. This means every token in AGENTS.md is loaded into the agent's context window every single time. The context window has a budget. Frontier models reliably follow ~150-200 instructions, and tool system prompts consume a significant share before your AGENTS.md even loads. Overstuffing AGENTS.md degrades the quality of all instructions — not selectively. Brevity is load-bearing. What belongs in AGENTS.mdCore development principles (style, testing, safety rules) What does NOT belong in AGENTS.mdDetailed workflows for specific tasks (use a skill) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 53 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
We had a bit of discussion about this in the AI/ML-sync meeting yesterday. My approach has been to use very minimal agents files (for Junie, Augie, and Claude) because I don't think it is clear what is:
I think we've all seen harmful changes--for example, telling it about tests and then having the agent get caught up attempting to run them all the time. Things that are not harmful but also not very useful (the benign category) can end up being accidentally harmful by taking up context space and thereby forcing something important out. We can discuss these things on a case-by-case basis, but I think that means starting small and understanding the impacts of the changes made. Another approach is for each platform team to do something different and then we all compare notes later. |
katcharov
left a comment
There was a problem hiding this comment.
Partial review. Agree with @ajcvickers points above. There is a fair bit of content here, and I am not sure how we can validate it.
There was a problem hiding this comment.
Could you run Claude to review this PR, asking something like "Confirm that this PR follows best practices for creating CLAUDE.md files. Evaluate it personally, confirming that various items are generally necessary. Also evaluate it based on official and authoritative sources (official Claude documentation, online posts that are corroborated AND experimentally verified, and posts from recognized experts; but not: blog posts, social media speculations, and other uncorroborated sources. Is anything unnecessary, and easily discoverable? Is anything crucial missing?"
Independently, have it doublecheck correctness until it stops finding issues.
Please also include info about how these files were generated, and AI-reviewed, including results of the above. (This is just the typical AI usage, effectiveness comment in the description).
| - **Information hiding:** Bury complexity behind simple interfaces. | ||
| - **Pull complexity downward:** Make the implementer work harder so callers work less. | ||
| - **General-purpose over special-case:** Fewer flexible methods over many specialized ones. | ||
| - **Define errors out of existence:** Design APIs so errors cannot happen rather than detecting and handling them. |
There was a problem hiding this comment.
I am not sure how to interpret this or check if a model has actually applied these principles. For example, the first one, "deep modules", seems to be a matter of intuition. In practice, I'm not sure how we would choose one approach vs another, or what would make a given approach have a "powerful implementation".
| ## API Stability Annotations | ||
|
|
||
| - `@Alpha` — Early development, may be removed. | ||
| Not for production use. | ||
| - `@Beta` — Subject to change or removal. | ||
| Libraries should not depend on these. | ||
| - `@Evolving` — May add abstract methods in future releases. | ||
| Safe to use, but implementing/extending bears upgrade risk. | ||
| - `@Sealed` — Must not be extended or implemented by consumers. | ||
| Safe to use, but not to subclass. | ||
| - `@Deprecated` — Supported until next major release but should be migrated away from. |
There was a problem hiding this comment.
I don't think a model should ever be applying some of these. I also don't know what "Libraries should not depend on these" means? Our users can depend on Beta, but we can change it.
| ## Public API Rules | ||
|
|
||
| - Breaking changes require a major version bump - ALWAYS warn if breaking binary compatibility | ||
| - All `com.mongodb.internal.*` / `org.bson.internal.*` is private API — never expose in public APIs |
There was a problem hiding this comment.
I don't understand how a model would expose these as public APIs?
| @@ -0,0 +1,45 @@ | |||
| --- | |||
| name: api-design | |||
There was a problem hiding this comment.
I ran only this skill through Claude, and I got this:
What's already known to models:
- The design principles section is essentially a summary of Ousterhout's A
Philosophy of Software Design. Any capable model already knows these
concepts and would apply them naturally. This section adds little value.
- "Search before implementing" is generic good practice, not
project-specific guidance.
What's genuinely useful (project-specific):
- The stability annotations (@Alpha, @Beta, @Evolving, @Sealed) — these are
driver-specific and not inferable without reading the source.
- The com.mongodb.internal.* / org.bson.internal.* rule.
- The concrete pattern examples (Filters.eq(),
MongoClientSettings.builder()).
- The package-info.java requirement.
What's missing that would actually help:
- How to choose which annotation for new API — when should something be
@Alpha vs @Beta vs @Evolving? What's the promotion path?
- Sync/async API mirroring — does every sync method need an async
counterpart? How are they kept in sync?
- Nullability conventions — does the driver use @Nullable/@NonNull? What's
the stance on null parameters?
- The module structure — what goes in driver-core vs driver-sync vs
driver-reactive-streams? Where should new API land?
- Default methods on interfaces — the strategy for evolving @Evolving
interfaces without breaking implementors.
- Concrete examples of "wrong" API decisions — models learn more from
"don't do X because Y happened" than from abstract principles.
Bottom line: The skill is ~30% useful as-is. The design principles section
could be dropped entirely without loss. The project-specific rules are
valuable but thin. The biggest improvement would be replacing the generic
principles with concrete, driver-specific guidance on the missing items
above — things a model can't infer from first principles.
I am uncertain that what is marked "useful" above will be in practice (see other comments).
| @@ -0,0 +1 @@ | |||
| @AGENTS.md | |||
There was a problem hiding this comment.
What is this pattern based on?
I tried to look up how it works, and info is scarce. As of 9 months ago, this convention did not imply that the file would be embedded in the other file. See comments in this post, someone experimented and confirmed that Claude sometimes only conditionally reads these files. I believe this means that:
- We don't actually have a guarantee that a referenced file will be read, and the conditions under which it is read are unclear
- Updating the referenced file while a session is in-flight will not cause an immediate context update, which makes tuning difficult
- There will be an additional step (time, tokens) for reading this file
I don't think we should use this pattern if the above is true.
Initial implementation of AGENTS.md and SKILLS.md for the MongoDB Java Driver Repo
JAVA-6143