Add AI assistant guidance #21
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey team! I'm trying to see how we can use tools like Claude Code and Cursor to make our Rust projects (pks and codeowners-rs) easier for contributors who are productive in other languages already, but haven't used Rust extensively.
What's Changed
I added an
AGENTS.mdfile to serve as agent-agnostic guidance for writing idiomatic Rust. I'm not an expert here so I want to invite some feedback.Key Areas for Alignment
1. Error Handling Philosophy: "Panic for Programming Bugs, Result for Recoverable Errors"
My back-and-forth with Claude Code and some Googling led to a "principled approach" to error handling that I'd like some feedback on:
When to panic (
.expect()/.unwrap()):debug_assert!for development-time invariant checkingWhen to use
Resultand?:Decision framework:
Alternative:
No-Panic Rust: A Nice Technique for Systems Programming or at least, almost no-panic Rust sounds applicable for projects intended to be used as libraries, like with codeowners-rs which we now embed into a Ruby gem (I can see us shipping libraries for other languages too).
2. Rust Idioms We Emphasize
As I worked on #20, I asked Claude Code to expand on
AGENTS.mdbased on the feedback I gave it as well as feedback from the PR review. I further asked it to expand on Rust idioms and best practices and it distilled this down to:matchinstead of if-else chains when handling all variantsif letfor single pattern matching - Cleaner than verbose match statementsQuestions for the Team
Benefits
Looking forward to your feedback! 💛 ✨