Skip to content

Commit 4cd806d

Browse files
aluedeketnolet
andauthored
feat: enhance AI IDE documentation with indexing instructions and custom rules (#1299)
- Added a section on indexing Checkly documentation in various IDEs for improved code generation. - Introduced custom rules for AI IDEs to guide code generation specific to Checkly. - Included detailed setup instructions for GitHub Copilot, Cursor, and Windsurf on Windows and Mac/Linux. - Created a new file for Checkly rules to standardize code generation practices. Co-authored-by: Tim Nolet <[email protected]>
1 parent 8b3fabb commit 4cd806d

File tree

2 files changed

+107
-3
lines changed

2 files changed

+107
-3
lines changed

site/content/docs/ai/use-checkly-with-ai-ide.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,75 @@ title: Using Checkly with AI IDEs and Copilots - Checkly Docs
33
displayTitle: Use Checkly with AI IDEs & Copilots
44
navTitle: Use Checkly with AI IDEs & Copilots
55
weight: 3
6-
draft: true
76
beta: true
87
menu:
98
platform:
109
parent: "AI"
1110
---
1211

13-
## GitHub Copilot
12+
## Docs
1413

15-
## Cursor
14+
You can index our docs pages in your IDE to leverage better code generation results. Todo so follow the guides for your IDE of choice:
1615

16+
Make sure to index the following url:
1717

18+
```txt
19+
https://checklyhq.com/docs/
20+
```
21+
22+
- [Cursor](https://docs.cursor.com/context/@-symbols/@-docs)
23+
24+
At the time of writing this unfortunately no other IDE supports this kind of context enrichment.
25+
26+
## Custom Rules
27+
28+
We prepared a first set of ai rules which you can use to teach your AI IDE of choice on how to generate code for Checkly.
29+
30+
Go into the root of your IDEs workspace and download the rules according to your IDEs config parameters.
31+
32+
When asking questions about Checkly manually add the download rules files to your prompt.
33+
34+
### GitHub Copilot
35+
36+
Windows
37+
38+
```powershell
39+
New-Item -ItemType Directory -Path ".github\instructions" -Force
40+
Invoke-WebRequest -Uri "https://www.checklyhq.com/docs/ai/docs/ai/checkly.rules.md" -OutFile ".github\instructions\checkly-api-check.md"
41+
```
42+
43+
Mac and Linux
44+
45+
```bash
46+
mkdir -p .github/instructions && curl -o .github/instructions/checkly-api-check.md "https://www.checklyhq.com/docs/ai/checkly.rules.md"
47+
```
48+
49+
### Cursor
50+
51+
Windows
52+
53+
```powershell
54+
New-Item -ItemType Directory -Path ".cursor\rules" -Force
55+
Invoke-WebRequest -Uri "https://www.checklyhq.com/docs/ai/checkly.rules.md" -OutFile ".cursor\rules\checkly-api-check.mdc"
56+
```
57+
58+
Mac and Linux
59+
60+
```bash
61+
mkdir -p .cursor/rules && curl -o .cursor/rules/checkly-api-check.md "https://www.checklyhq.com/docs/ai/checkly.rules.md"
62+
```
63+
64+
## Windsurf
65+
66+
Windows
67+
68+
```powershell
69+
New-Item -ItemType Directory -Path ".windsurf\rules" -Force
70+
Invoke-WebRequest -Uri "https://www.checklyhq.com/docs/ai/checkly-api-check.md" -OutFile ".windsurf\rules\checkly-api-check.md"
71+
```
72+
73+
Mac and Linux
74+
75+
```bash
76+
mkdir -p .windsurf/rules && curl -o .windsurf/rules/checkly-api-check.md "https://www.checklyhq.com/docs/ai/checkly.rules.md"
77+
```

site/static/docs/ai/checkly.rules.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Checkly
2+
3+
- refer to docs for checkly cli v5
4+
- to generate the initial setup for checkly use the command `npm create checkly@latest`
5+
- check the checkly cli output to figure out into which folder the setup was generated
6+
- use the [checkly cli reference](https://www.checklyhq.com/docs/cli/command-line-reference)
7+
- use the [checkly test api](https://www.checklyhq.com/docs/cli/constructs-reference)
8+
- always ground generated code and cli commands against the official documentation
9+
- when referencing environment variables always use the handlebar syntax `{{MY_ENV_VAR}}`
10+
- when referencing secrets always use the handlebar syntax `{{MY_SECRET}}`
11+
- after the initial setup is done ask the user for which endpoints to generate api checks
12+
- check in the code if api endpoints require authentication
13+
- if endpoints require authentication ask the user which authentication method to use and then generate a setupScript to authenticate the given requests
14+
- referenced setupScript for ApiChecks must be plain ts files and not export anything
15+
16+
## Project Structure
17+
18+
checkly.config.ts - Mandatory global project and CLI configuration. We recommend using TypeScript.
19+
src/__checks__/* - TS/JS files defining your checks and other resources.
20+
package.json - Standard NPM project manifest.
21+
Here is an example directory tree of what that would look like:
22+
23+
.
24+
|-- checkly.config.ts
25+
|-- package.json
26+
`-- src
27+
`-- __checks__
28+
|-- alert-channels.ts
29+
|-- api-check.check.ts
30+
`-- homepage.spec.ts
31+
32+
The checkly.config.ts at the root of your project defines a range of defaults for all your checks.
33+
## `ApiCheck`
34+
35+
- Checkout the api docs for [API Checks](https://www.checklyhq.com/docs/cli/constructs-reference/#apicheck) before generating any code.
36+
- Only use assertions for Api Checks which are [documented](https://www.checklyhq.com/docs/cli/constructs-reference/#assertionbuilder)
37+
- test api checks using `npx checkly test` command pass env variables using `-e` parama, use `--record` to persist results and `--verbose` to be able to see all errors
38+
39+
### Authentication Setup Scripts
40+
41+
- setupScripts should be flat scripts, no functions, no exports, they will be executed straight by Checkly
42+
- use axios for making http requests
43+
- read the input credentials from env variables using process.env
44+
- pass auth tokens to the request object using `request.headers['key'] = AUTH_TOKEN_VALUE`

0 commit comments

Comments
 (0)