Skip to main content
AI-assisted coding promises to massively upgrade developer productivity, and with Checkly’s model of Monitoring as Code, you can create monitoring coverage for all your services in minutes instead of days. This guide will show you how to create an AI development environment that lets you create and deploy several types of Checkly monitoring.

Setup

If you haven’t already, start by installing the Checkly CLI, then create a repository that will be the ‘project’ that contains all your Checkly monitors managed as code. If you don’t already have a project, create one with:
Next, install Claude Code globally with
and from the root folder of your project, start Claude Code with the claude command. You’ll be prompted to sign in to or sign up for an Anthropic account.

Add the Playwright MCP

You can give Claude Code access to a browser by adding the Playwright MCP to your local configuration with:
This will let us ask Claude Code to do things like crawling a particular website and interacting with pages.

Give Claude Code Some Context

Everything we write into the CLI interface is part of a ‘prompt,’ and by default, Claude Code will add a bit of information to what we submit as ‘context’ on that prompt. Ideally, our requests written into Claude Code would include context about our specific project: its structure, language, and even its purpose. Because of the npm create command we ran above, our folder already has a boilerplate version of a Checkly project. We can’t feed in all of these files as context, but we can add a summary of our whole project as context by opening Claude Code and running the slash command:
Claude Code will scan the whole project, write a summary, and then store that summary in a local CLAUDE.md file. Claude Code will read that file and add it to our prompt every time it’s run within this project from now on. Let’s add a bit more to this context, we want test files that make sense as a Checkly construct. Let’s add Checkly’s AI rules file to our CLAUDE.md context file:
After this you’ll need to exit and restart Claude Code for it to pick up changes to our context file.

Create new URL Monitors

We’ll start with something easy. A URL monitor that will check an HTTP endpoint and alert if it doesn’t receive the right status code. With the context set from the section above, try a command like:
After a few seconds, Claude Code will produce this:
While we’re writing this simplest of monitors, it’s worth testing the limits of Claude Code’s context for writing valid Checkly configuration. One thing we tested while writing this article was whether picking the wrong prompt would result in invalid Checkly construct code. The Frequency class here doesn’t accept arbitrary values, so we wondered if the context provided in CLAUDE.md was enough for the tool to identify valid values for the check. We tried requesting a check that ran “every 17 seconds” and Claude Code prompted to run a find on the project to identify valid values for frequency. In the end, Claude Code did create valid code with this note in the process feed.
from Claude Code:"}

Create Playwright Synthetics Checks With Claude Code

With our context set up, and a browser available via the Playwright MCP, we can create more complex Playwright scripts for browser monitoring of our site. With specific instructions and clear prompting, you can get consistent performance of Claude Code writing our Browser checks.

1. Start With a single test

First you’ll want to write a single check that does straightforward browsing and checking for page elements. With some context engineering, you can instruct Claude to navigate a page while recording the taken actions to generate a Playwright test. Read more about this approach and extensive prompt guidelines on our blog.
Claude will then open a browser using the Playwright MCP server, perform the actions, and create a short Playwright script that will look something like the following.
Lets make sure our script is valid by running this test:
Without an exact file path, the checkly test command will run any test that matches this pattern. and making sure the test passes.
Like always with the checkly test command, this test isn’t running from our workstation but rather from the Checkly’s monitoring infrastructure. Next we’ll want to create a .check.ts file for this browser check, which sets some check-specific settings and assigns the check’s logical ID.
This should result in a complete .check.ts file generated by Claude, implementing the Checkly construct configuration. For better understanding of the configuration, you can ask for code comments:
The result is a nicely commented version of and a good tour of this construct:
Alternatively, you can deploy a Playwright check without a .check.ts configuration file, and the file name will be used as the logical ID.

2. Add our new Check to Claude’s Context

With this check created, let’s add the following lines to your updated CLAUDE.md file:
Pro tip: from the Claude Code prompt, just hit octothorp ”#” to add to Claude’s memory. Each entry will be a new line in CLAUDE.md.

3. Use Claude Code to create multiple Browser Checks

Now that we’ve got a working test and, let’s let Claude Code create another check for us:
As the prompt didn’t specify which button to click, Claude Code will select one. In this case it picked a the signup button. The result is a nice clean test written to the spec, even the title is specific to the button that Claude Code decided to click:
Claude Code will confirm before creating the script file. If you’ve followed these tutorial steps in a single conversation with Claude Code, the tool will likely offer to create signup-form-elements.check.ts to configure the check. You can prompt for multiple checks at the same time. As you can imagine, this unlocks the creation of a large number of synthetic monitors relatively quickly.
If you haven’t watched the responses from Claude Code already, it can be helpful to see how the tool breaks down our request:
from Claude Code:"}
Every file output from this command isn’t included here for brevity, but Claude Code did create five new check scripts based on the five heading links at danube-web.shop. To test all these new checks quickly, run
With no file name argument, this will try to run everything in the __checks__ folder
If you’ve followed every step in this tutorial, you may have different numbers for the number of tests run here. When running a number of generated tests, the only issue we ran into was a failure with the message: Error: expect.toBeVisible: Error: strict mode violation: getByText('Crime & Thrillers') resolved to 2 elements:. As the error message implies, the issue is that this locator:
Found multiple results on the page. There are a number of ways to fix this with Claude Code. We could prompt Claude Code with:
This would change every locator in the check, which may or may not be what you want! You could also paste in the error message to Claude and ask it to fix the script, or specify which locator you want to add first() to. Whatever route you take the result will be an edit to:
Once Claude Code added a single .first() to the checks written above, everything was passing. If you’re having trouble reading the generated tests, take a look at Checkly’s Playwright documentation.

4. Going Further: Edit Multiple Checks and Configurations

Updating checks is another use case that may be useful for larger projects. Try prompting Claude Code with something like:
Not only do requests to update monitoring configuration work, sometimes they even produce sensible feedback and information about the checks that currently had no frequency setting:
from Claude Code:"}
Once we’re done creating new checks, we can test them with npx checkly test like we did above. Then it’s time to run them all.

Deploy With the Checkly CLI

In our example, we want to deploy a couple of checks at once, so it’s worth checking whether the project is properly set up before deployment. Many problems would have been revealed while running test, but if, for example, some checks were unintentionally removed from our project, we’ll need to use deploy to detect that. Run the deploy command with the -p preview flag:
This command won’t deploy anything, just parse our project and show us what will be changed when we run the command without the preview flag. When you first run deploy -p you should just see a long list of created checks in the deployment command. For this tutorial, here’s the preview of a more complex project state:
Let’s discuss the output of this preview command in detail, as it’s critical to understand how Checkly handles deployments from your project:
  • Checks that have no .check.ts config file are listed by their filename and will be named for their file name in the Checkly web UI. In general, it’s better to include a config file for every check since it gives you explicit control of the check’s logical ID. We’ve left out the config for five checks for demonstration purposes.
  • Checks with a config file are shown by their logical ID.
  • Checks previously deployed from this project that are not present in this deployment will be deleted.
  • Checks with a matching logical ID from a previous deployment will be listed as “Update and Unchanged”.
If you’re getting strange results from a preview of deploy and you’re not sure why, it might be time to get in touch with the Checkly team. Join our Slack for deployment advice! Once we’re happy with what will be deployed, it’s time to run npx checkly deploy and create our checks!

Conclusion

AI-assisted coding tools like Claude Code can significantly accelerate the creation and deployment of monitoring checks with Checkly’s Monitoring as Code approach. By integrating AI into your development workflow, you can generate valid Checkly constructs—including URL monitors and Playwright-based browser checks—with minimal effort. One of the superpowers that an AI workflow can unlock is the mass updating of many files in your project. Updating a large number of test files can go much faster with the help of Claude Code. While AI can handle much of the boilerplate work, human oversight remains essential for ensuring best practices, refining assertions, and maintaining high-quality monitoring scripts. By combining AI efficiency with developer expertise, teams can achieve comprehensive monitoring coverage in minutes rather than days.

Further Reading

Throughout this tutorial, we added a few lines to the CLAUDE.md context file. In all, those additions were (rewritten for clarity):
To learn more about Checkly’s capabilities, explore these resources: For more tutorials and advanced use cases, visit the Checkly YouTube channel, where you can see great tutorials like this guide to the Playwright MCP server: