Skip to content

Commit c095ce0

Browse files
committed
fixup! doc: create ai-guidelines and include to CONTRIBUTING
1 parent 2c97efd commit c095ce0

1 file changed

Lines changed: 37 additions & 43 deletions

File tree

doc/contributing/ai-guidelines.md

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# AI use policy and guidelines
22

33
* [Core principle](#core-principle)
4-
* [Using AI for code contributions](#using-ai-for-code-contributions)
5-
* [Using AI for communication](#using-ai-for-communication)
4+
* [When AI is used in contributions](#when-ai-is-used-in-contributions)
5+
* [When AI is used in communications](#when-ai-is-used-in-communications)
66

77
This document aligns with the [OpenJS Foundation AI Coding Assistants Policy][].
88

99
## Core principle
1010

11-
Node.js expects contributions to come from _people_. Contributors are free
12-
to use whatever tools they choose, including AI assistants, but such tools
13-
never replace the contributor's own understanding and responsibility.
11+
Tools should never replace human judgment, regardless of whether they are powered by AI.
1412

1513
Node.js requires contributors to understand and take full responsibility for
1614
every change they propose. The answer to "Why is X an improvement?" can
@@ -20,13 +18,15 @@ If AI tools assisted in generating a contribution, acknowledge that honestly.
2018
Regardless of how much code is generated by AI, disclosure does not serve
2119
as a disclaimer of responsibility.
2220

23-
The contributor remains the sole author and bears full responsibility for every line.
24-
If the disclosure involves trademarks or commercial brands, it's recommended to
25-
anonymize it in the commit message or only mention the brand/trademark in the
26-
PR description, but not in the commit message, unless the context would not
27-
have made sense without mentioning the specific brand/trademark. The goal
28-
is to prevent the commit messages, which are part of the codebase, from being
29-
abused for profit-driven marketing.
21+
Be aware that the mention of for-profit trademarks or commercial brands in commit
22+
messages, which are part of the code base, can be abused for profit-driven marketing.
23+
If the disclosure involves for-profit trademarks or commercial brands, it's
24+
recommended to either anonymize the branding (e.g. say `a frontier reasoning model`,
25+
`a closed-source coding agent` instead of `<brand>`), or only mention the
26+
for-profit brand/trademark in the PR description, but not in the commit message,
27+
unless the message would not have made sense without mentioning the specific
28+
brand/trademark. These recommendations only apply to for-profit tools/models, not
29+
any non-profit ones.
3030

3131
Pull requests that contain AI-generated code the contributor has not
3232
personally understood, tested, and verified waste collaborator time and
@@ -41,36 +41,30 @@ approved in advance by the project. To request approval, either open an issue in
4141
be done in the form of a GitHub workflow, submit a pull request to add the workflow
4242
and use the usual pull request review process to seek consensus.
4343

44-
## Using AI for code contributions
44+
## When AI is used in contributions
4545

4646
Contributors may use AI tools to assist with contributions, but such tools
4747
never replace human judgment.
4848

4949
When using AI as a coding assistant:
5050

5151
* **Understand the codebase first.** Do not skip familiarizing yourself with
52-
the relevant subsystem. LLMs frequently produce inaccurate descriptions of
53-
Node.js internals — always verify against the actual source. When using an AI
54-
tool, ask it to cite the exact source it’s relying on, and then
55-
match the claim against that resource to verify if it holds up in the current
56-
code.
52+
the relevant subsystem. Always verify analysis generated by tools against
53+
the actual source code with human judgement.
5754

5855
* **Own every line you submit.** You are responsible for all code in your
59-
pull request, regardless of how it was generated. This includes ensuring
60-
that AI-generated or AI-assisted contributions satisfy the project's
61-
[Developer's Certificate of Origin][] and licensing requirements. Be
62-
prepared to explain any change in detail during review.
63-
64-
* **Keep logical commits.** Structure commits coherently even when an LLM
65-
generates multiple changes at once. Follow the existing
66-
[commit message guidelines][].
67-
68-
* **Test thoroughly.** AI-generated code must pass the full test suite and
69-
any manually written tests relevant to the change. Existing tests should not
70-
be removed or modified without human verification. Do not rely on the LLM
71-
to assess correctness. It is crucial to manually verify the correctness of
72-
tests against the expected behavior of the feature being tested,
73-
independently of the feature's implementation.
56+
pull request, regardless of how it was created. The submitted changes
57+
must satisfy the project's [Developer's Certificate of Origin][] and licensing
58+
requirements. Be prepared to explain any change in detail during review.
59+
60+
* **Keep the commits logical.** The [commit message guidelines][]
61+
and [commit squashing guidelines](./pull-requests.md#commit-squashing)
62+
must be followed regardless of what tool is used in the pull request.
63+
64+
* **Test thoroughly.** Existing tests should not be removed or modified
65+
without human verification. It is crucial to verify, with human judgement,
66+
the correctness of new tests against the expected behavior of the feature being
67+
tested, independently of the feature's implementation.
7468

7569
* **Do not disappear.** If you open a PR, follow it through. Respond to
7670
feedback and iterate until the work lands or is explicitly closed. If you
@@ -79,20 +73,20 @@ When using AI as a coding assistant:
7973
* **Do not use AI to claim "good first issue" tasks.** These issues exist to
8074
help new contributors learn the codebase and processes hands-on.
8175

82-
* **Edit generated comments critically.** LLM-generated comments are often
83-
verbose or inaccurate. Remove comments that simply restate what the code
84-
does; add comments only where the logic is non-obvious.
76+
* **Keep the comments useful.** Verify with human judgement that the
77+
comments are necessary and accurate. Remove comments that simply
78+
restate what the code does. Add comments only where the logic is non-obvious.
8579

86-
## Using AI for communication
80+
## When AI is used in communications
8781

8882
Node.js values concise, precise communication that respects collaborator and contributor time.
8983

90-
* **Do not post messages generated entirely by AI** in pull requests, issues, or the
91-
project's communication channels.
92-
* **Verify accuracy** of any LLM-generated content before including it in a
93-
PR description or comment.
94-
* **Link to primary sources**code, documentation, specifications — rather
95-
than quoting LLM answers or linking to LLM chats.
84+
* **Do not paste messages generated entirely by AI** in pull requests, issues, or the
85+
project's communication channels. Such communication may be removed in accordance
86+
to [the Node.js moderation policy](https://github.com/nodejs/admin/blob/main/Moderation-Policy.md).
87+
* **Verify claims about the code with human judgement before using them in communications**. Results
88+
from AI tools should only be treated as hypothesis. Link to actual code, documentation and
89+
specifications as source of truth.
9690
* Grammar and spell-check tools are acceptable when they improve clarity and
9791
conciseness.
9892

0 commit comments

Comments
 (0)