Skip to content

Commit 94454d7

Browse files
committed
docs: agent setup instructions
1 parent 45cc32d commit 94454d7

8 files changed

Lines changed: 38 additions & 40 deletions

File tree

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
These markdown files are bundled with the npm package for coding agents. They describe the installed package version.
44

5-
Start with [LLM Guidelines](./guides/llm-guidelines.md) for the agent setup snippet and quick rules, or use the included page list below to load specific references.
5+
Start with [LLM Guidelines](./guides/llm-guidelines.md) for rules overview, or use the included page list below to load specific references.
66

77
## Included pages
88

docs/guides/llm-guidelines.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@
22

33
Actionable guidelines for writing tests with React Native Testing Library (RNTL) v14.
44

5-
## Agent docs in the package
6-
7-
RNTL ships package-specific documentation for coding agents in `node_modules/@testing-library/react-native/docs/`.
8-
Add this snippet to your project's `AGENTS.md` or `CLAUDE.md` file so agents use the docs for the installed package version:
9-
10-
```md
11-
<!-- BEGIN:react-native-testing-library-agent-rules -->
12-
13-
# React Native Testing Library in this project
14-
15-
This project uses `@testing-library/react-native`. Its APIs and testing conventions can differ from your training data.
16-
Before writing or changing RNTL tests, read the relevant guide in
17-
`node_modules/@testing-library/react-native/docs/`, starting with
18-
`node_modules/@testing-library/react-native/docs/guides/llm-guidelines.md`.
19-
Prefer those package docs over stale assumptions, and follow deprecation notices.
20-
21-
<!-- END:react-native-testing-library-agent-rules -->
22-
```
23-
245
## Core APIs
256

267
### render

docs/guides/migration-v14.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ command={{
4646

4747
After running the codemods, review the changes and run your tests.
4848

49+
If your project uses coding agents, add the RNTL package-docs instruction snippet from the [Quick Start](./quick-start.md#agent-docs-in-the-package) so agents read the docs that match your installed package version.
50+
4951
## Breaking Changes
5052

5153
### Supported React, React Native, and Node.js versions

docs/guides/quick-start.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ command={{
2828

2929
Test Renderer has better compatibility with React 19 and improved type safety compared to the deprecated [React Test Renderer](https://reactjs.org/docs/test-renderer.html).
3030

31+
## Agent docs in the package
32+
33+
RNTL ships package-specific documentation for coding agents in `node_modules/@testing-library/react-native/docs/`.
34+
Add this snippet to your project's `AGENTS.md` or `CLAUDE.md` file so agents use the docs for the installed package version:
35+
36+
```md
37+
# React Native Testing Library in this project
38+
39+
This project uses `@testing-library/react-native`. Its APIs and testing conventions can differ from your training data.
40+
Before writing or changing RNTL tests, read the relevant guide in
41+
`node_modules/@testing-library/react-native/docs/`, starting with
42+
`node_modules/@testing-library/react-native/docs/guides/llm-guidelines.md`.
43+
Prefer those package docs over stale assumptions, and follow deprecation notices.
44+
```
45+
3146
### Jest matchers
3247

3348
RNTL automatically extends Jest with React Native-specific matchers. The only thing you need to do is to import anything from `@testing-library/react-native` which you already need to do to access the `render` function.

scripts/generate-package-docs.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ function rewriteInternalLinks(markdown, output) {
258258
['docs/guides/common-mistakes', 'guides/common-mistakes.md'],
259259
['docs/guides/troubleshooting', 'guides/troubleshooting.md'],
260260
['docs/guides/llm-guidelines', 'guides/llm-guidelines.md'],
261+
['docs/start/quick-start', 'guides/quick-start.md'],
262+
['docs/start/migration-v14', 'guides/migration-v14.md'],
261263
['docs/advanced/testing-env', 'guides/testing-environment.md'],
262264
['docs/advanced/understanding-act', 'guides/understanding-act.md'],
263265
['cookbook/basics/custom-render', 'cookbook/custom-render.md'],
@@ -285,7 +287,7 @@ function buildReadme(pages) {
285287
286288
These markdown files are bundled with the npm package for coding agents. They describe the installed package version.
287289
288-
Start with [LLM Guidelines](./guides/llm-guidelines.md) for the agent setup snippet and quick rules, or use the included page list below to load specific references.
290+
Start with [LLM Guidelines](./guides/llm-guidelines.md) for rules overview, or use the included page list below to load specific references.
289291
290292
## Included pages
291293

website/docs/14.x/docs/guides/llm-guidelines.mdx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@
22

33
Actionable guidelines for writing tests with React Native Testing Library (RNTL) v14.
44

5-
## Agent docs in the package
6-
7-
RNTL ships package-specific documentation for coding agents in `node_modules/@testing-library/react-native/docs/`.
8-
Add this snippet to your project's `AGENTS.md` or `CLAUDE.md` file so agents use the docs for the installed package version:
9-
10-
```md
11-
<!-- BEGIN:react-native-testing-library-agent-rules -->
12-
13-
# React Native Testing Library in this project
14-
15-
This project uses `@testing-library/react-native`. Its APIs and testing conventions can differ from your training data.
16-
Before writing or changing RNTL tests, read the relevant guide in
17-
`node_modules/@testing-library/react-native/docs/`, starting with
18-
`node_modules/@testing-library/react-native/docs/guides/llm-guidelines.md`.
19-
Prefer those package docs over stale assumptions, and follow deprecation notices.
20-
21-
<!-- END:react-native-testing-library-agent-rules -->
22-
```
23-
245
## Core APIs
256

267
### render

website/docs/14.x/docs/start/migration-v14.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ We provide codemods to automate most of the migration:
4949

5050
After running the codemods, review the changes and run your tests.
5151

52+
If your project uses coding agents, add the RNTL package-docs instruction snippet from the [Quick Start](/docs/start/quick-start#agent-docs-in-the-package) so agents read the docs that match your installed package version.
53+
5254
## Breaking Changes
5355

5456
### Supported React, React Native, and Node.js versions

website/docs/14.x/docs/start/quick-start.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ This library has a peer dependency on [Test Renderer](https://github.com/mdjastr
2828

2929
Test Renderer has better compatibility with React 19 and improved type safety compared to the deprecated [React Test Renderer](https://reactjs.org/docs/test-renderer.html).
3030

31+
## Agent docs in the package
32+
33+
RNTL ships package-specific documentation for coding agents in `node_modules/@testing-library/react-native/docs/`.
34+
Add this snippet to your project's `AGENTS.md` or `CLAUDE.md` file so agents use the docs for the installed package version:
35+
36+
```md
37+
# React Native Testing Library in this project
38+
39+
This project uses `@testing-library/react-native`. Its APIs and testing conventions can differ from your training data.
40+
Before writing or changing RNTL tests, read the relevant guide in
41+
`node_modules/@testing-library/react-native/docs/`, starting with
42+
`node_modules/@testing-library/react-native/docs/guides/llm-guidelines.md`.
43+
Prefer those package docs over stale assumptions, and follow deprecation notices.
44+
```
45+
3146
### Jest matchers
3247

3348
RNTL automatically extends Jest with React Native-specific matchers. The only thing you need to do is to import anything from `@testing-library/react-native` which you already need to do to access the `render` function.

0 commit comments

Comments
 (0)