feat: refactor rules generation to ai-context with skill output#1199
Merged
feat: refactor rules generation to ai-context with skill output#1199
Conversation
Rename src/rules to src/ai-context and enhance the context generation: - Extract example configs to separate context.ts module with doc references - Generate both checkly.rules.md and skills/monitoring/SKILL.md - Add YAML frontmatter for skill metadata (stripped from rules output) - Support inline exampleConfig in addition to exampleConfigPath
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors how Checkly AI context (“rules.md”) content is generated so it can also produce a Vercel-compatible SKILL.md under a root-level skills/ directory.
Changes:
- Move rules/context sources to
src/ai-context/and update therulescommand to read fromdist/ai-context/checkly.rules.md. - Replace the old
compile-rules.tspipeline withcompile-ai-context.ts, generating bothdist/ai-context/checkly.rules.md(without frontmatter) andskills/monitoring/SKILL.md(with frontmatter). - Add a centralized
EXAMPLE_CONFIGSconfiguration and new fixtures for the generation flow.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/commands/rules.ts | Updates base rules path to new dist/ai-context output location. |
| packages/cli/src/ai-context/context.ts | Adds centralized example/placeholder config (including inline code samples + doc references). |
| packages/cli/src/ai-context/context.fixtures.json | Adds fixtures used to generate example code via import plan. |
| packages/cli/src/ai-context/checkly.context.template.md | Introduces skill-style frontmatter and adjusts template to rely on injected examples. |
| packages/cli/scripts/compile-rules.ts | Removes the old rules compiler script. |
| packages/cli/scripts/compile-ai-context.ts | Adds new compiler that outputs both SKILL.md and stripped checkly.rules.md. |
| packages/cli/package.json | Renames generation script and wires it into prepare. |
Comments suppressed due to low confidence (3)
packages/cli/src/ai-context/checkly.context.template.md:108
- There’s still a hard-coded “Reference [the docs…]” link here, while other sections moved references into the generated example blocks. For consistency (and to avoid duplicated/competing references), consider removing this link and relying on the per-example
referenceinjected by the compiler.
packages/cli/src/ai-context/checkly.context.template.md:132 - Grammar: “All alert are described…” should be “All alerts are described…”. Since this template content is distributed to users/AI tooling, it’s worth fixing the wording.
packages/cli/src/ai-context/checkly.context.template.md:79 - This line reads awkwardly/incorrectly (“if your tasked”). Please fix the grammar (e.g., “Use
pwProjectsif you’re tasked with reusing a Playwright project.”) since this text is shipped in generated AI context.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add prepare:ai-context script that copies compiled skills from packages/cli/dist to repo root for skills.sh compatibility.
Adds a GitHub Actions workflow that runs on PRs when packages/cli changes. It regenerates the skills/ directory and fails if there are uncommitted changes, posting a comment to guide the PR author.
Adds the generated skills directory that contains Checkly monitoring documentation for AI assistants.
|
sorccu
approved these changes
Feb 4, 2026
Member
|
I forgot that we also needed to change the workflows: #1217 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Affected Components
Notes for the Reviewer
This PR changes how Checkly AI context files (aka
rules.md) are generated to align with upcoming skill conventions in the AI ecosystem. The primary concern is to provide aSKILL.mdfor MaC and be compatible with Vercel's new skills tooling:For that to work, the repo needs to include a
skillsdirectory in the root, which contains all the provided markdown skills (skills/monitoring/SKILL.md). For that, I repurposed the script of thecheckly.rules.mdand now create two different context files./package/cli/dist/ui-context/skillsis then copied over to the root directory viaprepare:ai-contextto avoid that theclipackage rights files outside its scope. The new file needs to be reviewed and commited (otherwise a new GH action fails).Generally, I changed the naming convention from
rulestoai-contextbecause the script now generates our "rules" (rules.md) and a Checkly "monitoring" skill (skills/monitoring/SKILL.md). The content is more or less the same, though. I've chosen themonitoringskill name to be flexible in creating more skills (e.g. aplaywright-best-practicesskill) in the future. We'll see how this plays out.Additionally, I extracted the configuration code from the actual script into its own file so that there's a single config file.
Content-wise, I expect multiple iterations on the new "context" files, but I still made some adjustments on the way:
checkly.configcode is now part of the generated context files. To do so, the code config now supports inline code samples bccheckly.configandpwCheckSuitesaren't part of the exported files used for the existing code generation.@sorccu
And I discussed the best approach and landed on a GH workflow that generates the skills files and checks if there are uncommitted changes. This way the team needs to review and commit changes manually and we also have a sanity check in each PR.
To check later
We need to make sure that the configuration in the marketing site still works and provides the generated file from GitHub.