Skip to content

Docs: Add Code Authoring Principles for agents#34835

Merged
valentinpalkovic merged 5 commits into
nextfrom
valentin/add-karpathy-agents-md
May 22, 2026
Merged

Docs: Add Code Authoring Principles for agents#34835
valentinpalkovic merged 5 commits into
nextfrom
valentin/add-karpathy-agents-md

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented May 19, 2026

What

Adds a Code Authoring Principles For Agents section to AGENTS.md, distilled from recurring failure modes observed in agent-authored PRs (concretely, the review of #34833).

Why

These six patterns showed up repeatedly and each cost a review round. Writing them into the canonical agent instruction file makes them preventable instead of caught-after-the-fact:

  1. Comments as an investigation transcript — internal codes (AC-X2, Probe B), how-I-figured-it-out narrative, fragile cross-file line refs that rot.
  2. Encoding environment assumptions without an empirical probe.
  3. Over-engineered defensive tests — asserting "internal API not called" instead of behavior.
  4. Speculative generality — flexibility for consumers/scenarios that don't exist.

Each is a short rule + one-line rationale, placed just before Maintenance Rules For Agents. Docs-only; no code changes. CLAUDE.md already references AGENTS.md, so no duplication.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a "Code Authoring Principles" subsection with practical guidelines for agent-authored changes: where to put explanatory comments, how to empirically validate environment assumptions, using static checks and boundary assertions for invariants, focusing tests and assertions on public contracts and observable side effects, handling security/migration edge cases with version-scoped compatibility, and preferring deletion or simplicity over speculative generality to improve reliability.

Review Change Stack

Distilled from recurring failure modes in agent-authored PRs: comments as
investigation transcript, bending production to the test harness, unproven
environment assumptions, over-engineered defensive tests, convention drift in
generated files, and speculative generality.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Fails
🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.

Generated by 🚫 dangerJS against d24c7e6

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d1a56d05-c5e5-48cb-93b0-cd422fa86580

📥 Commits

Reviewing files that changed from the base of the PR and between d24c7e6 and 4596fa3.

📒 Files selected for processing (1)
  • AGENTS.md

📝 Walkthrough

Walkthrough

This PR adds a "Code Authoring Principles" subsection to AGENTS.md documenting recurring agent failure modes and concrete do/don't guidelines for comments, empirical verification of assumptions, contract-focused tests, and preferring deletion/simplicity over speculative generality.

Changes

Agent Code Authoring Principles Documentation

Layer / File(s) Summary
Code Authoring Principles For Agents
AGENTS.md
New section documenting recurring agent failure modes and concrete guidelines for writing agent-authored changes, including what belongs in comments, empirical verification of environment assumptions, static and runtime assertions for invariants, focusing tests on public contracts/side effects, addressing security/migration edge cases with version-scoped compatibility, and preferring deletion/simplicity over speculative generality.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs


Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@valentinpalkovic valentinpalkovic changed the title docs(agents): add Code Authoring Principles for agents Docs: Add Code Authoring Principles for agents May 19, 2026
@valentinpalkovic valentinpalkovic self-assigned this May 19, 2026
@valentinpalkovic valentinpalkovic added ci:normal documentation ci:docs Run the CI jobs for documentation checks only. and removed ci:normal labels May 19, 2026
@valentinpalkovic valentinpalkovic moved this to In Progress in Core Team Projects May 19, 2026
Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
@valentinpalkovic valentinpalkovic merged commit e4b7f35 into next May 22, 2026
12 of 14 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/add-karpathy-agents-md branch May 22, 2026 08:17
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:docs Run the CI jobs for documentation checks only. documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants