K6 Docs
Grafana LabsOfficialPublished by Grafana Labs
- Skill
- Content generator
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The k6-docs skill provides a structured approach to managing documentation across the k6 ecosystem. It ensures that user-facing documentation, TypeScript type definitions, and release notes remain accurate and synchronized with the k6 codebase. The skill enforces strict quality standards, including mandatory validation of all code examples against the current k6 master branch and visual verification of rendered documentation using browser-based tools.
What it does
- Drafts and reviews user documentation for k6 features
- Generates and maintains TypeScript type definitions
- Drafts release notes and changelogs for new versions
- Validates code examples by executing them against k6@master
- Verifies documentation rendering and link integrity
- Applies consistent style conventions across all documentation
When to use it
- When updating or creating k6 API reference documentation
- When drafting release notes for a new k6 version
- When modifying TypeScript type definitions for k6
- When reviewing documentation changes for accuracy and style
- When verifying that code examples in documentation are functional
Advantages
- Ensures all documentation code examples are tested and functional
- Maintains consistency across multiple repositories
- Prevents broken links and rendering issues through automated checks
- Automates the validation of TypeScript types
- Provides a clear, repeatable workflow for documentation maintenance
Usage examples
- “Review the new documentation for the k6 browser module.”
- The agent will check the documentation against the style guide, verify all links, and run the included code examples against k6@master.
- “Generate the release notes for the latest k6 update.”
- The agent will draft the release notes, ensuring all mentioned features are documented and examples are validated.
- “Update the TypeScript types for the k6 HTTP module.”
- The agent will update the type definitions and run tests to ensure they are compatible with the current k6 implementation.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/grafana/k6-docs/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip k6-docs.zip -d .agents/skills
Documentation by Grafana Labs
k6 Documentation
Document or review k6 features across three repositories: k6-DefinitelyTyped (TypeScript types), k6-docs (user documentation), and k6 (release notes).
Workflow
Pick the workflow that matches the user's intent:
Write documentation: follow references/workflows/write.md
Review documentation: follow references/workflows/review.md
Quick References
Critical Rules
Never push automatically - always ask first
Never chain commands with
&∨- run each command separately (prevents failures)Only document user-facing features - not internal implementation
Use
1.for every numbered list item (not1.,2.,3.)Test every code example against k6@master before committing
No
Co-Authored-By: Claudeor AI attribution in commits
Validating examples (always run before committing)
Every code example in k6 documentation and release notes must execute cleanly against k6@master. The minimum loop:
# 1. cd into the k6 repo (not k6-docs or k6-DefinitelyTyped)
cd ~/path/to/k6
# 2. Make sure you're on master at the latest commit (the contract is k6@master)
# First check for local work: if this prints anything, stop and ask the user before switching branches
git status --porcelain
git checkout master
git pull
# 3. Run each example as a separate command (no &&)
go run . run /path/to/script.jsIf the run fails: read the error, fix the example in the source (doc or release note), re-run. Do not commit a change whose example doesn't run clean against current master. For the full multi-example workflow with parallel subagents, see references/testing-workflow.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer832 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md2.8 KiB
- references/agent-browser-reference.md3.0 KiB
- references/checklists/documentation.md4.1 KiB
- references/checklists/release-notes.md783 B
- references/checklists/typescript.md752 B
- references/repository-structure.md3.9 KiB
- references/subagent-prompts.md3.4 KiB
- references/templates/documentation.md3.1 KiB
- references/templates/release-notes.md854 B
- references/testing-workflow.md2.3 KiB
- references/troubleshooting.md4.7 KiB
- references/typescript-patterns.md4.2 KiB
- references/workflows/review.md2.7 KiB
- references/workflows/write.md5.4 KiB
- scripts/check_agent_browser.shScript524 B
- scripts/fetch_pr.shScript195 B
- scripts/find_branch.shScript968 B
- scripts/format_typescript.shScript236 B
- scripts/test_typescript.shScript303 B
- scripts/update_team_members.shScript1.4 KiB
- scripts/validate_links.shScript1.1 KiB
references/troubleshooting.md
Troubleshooting Guide
Common issues and solutions when documenting k6 features.
TypeScript Module Resolution
Error: Cannot find module 'k6/browser'
Cause: You likely used npm install instead of pnpm install. The k6-DefinitelyTyped workspace requires pnpm to create proper symlinks for module resolution.
Fix:
cd k6-DefinitelyTyped
pnpm install -w --filter "{./types/k6}..."The first command creates a symlink for @types/k6 in node_modules, which is required for TypeScript module resolution during tests.
Error: dtslint is not found
Cause: Missing workspace dependencies.
Fix:
cd k6-DefinitelyTyped
pnpm install -w --filter "{./types/k6}..."Ensure you're using the --filter flag to install workspace dependencies correctly.
Pre-existing Test Failures
Issue: The test suite shows errors unrelated to your changes.
Context: The k6-DefinitelyTyped test suite may have pre-existing failures. This is normal.
Action: Focus on ensuring your NEW types don't introduce ADDITIONAL errors. Compare test output before and after your changes.
Locating Documentation Files
When testing documentation, files may not be on the current branch.
Step 1: Check Local Branches
# Search for branches matching the feature name
git branch | grep -i <feature-name>
# Example:
git branch | grep -i waitforeventStep 2: Check Remote Branches
If not found locally:
# Fetch all remote branch info
git fetch --all
# Search remote branches
git branch -r | grep -i <feature-name>
# Example:
git branch -r | grep -i waitforeventStep 3: Checkout the Branch
Once found:
# For remote branches, fetch and create local branch in one command
git fetch origin <branch-name>:<branch-name>
git checkout <branch-name>
# Example:
git fetch origin add/page-waitForEvent:add/page-waitForEvent
git checkout add/page-waitForEvent⚠️ Common Mistake: Don't run git checkout origin/branch-name directly. It creates a detached HEAD state. Always use the fetch command above to create a local tracking branch.
Step 4: Checkout from PR Number
If given a PR number, use GitHub CLI:
gh pr checkout <PR_NUMBER>This automatically creates the local branch and checks it out.
Step 5: Verify Files
After checkout, confirm the documentation files exist:
# List all changed files in this branch vs main
git diff main --name-onlyLink Validation Issues
Link Returns 404
Common causes:
Wrong casing:
consolemessagevsconsole-messageMissing hyphens:
browsercontextvsbrowser-contextWrong path structure: Check actual file/folder names in docs directory
Fix:
# Check the actual file name in the docs
ls -la docs/sources/k6/next/javascript-api/k6-browser/
# Compare with your link pathCan't Extract Links from Diff
Issue: The git diff + grep pipeline isn't finding links.
Debug:
# Step-by-step debugging
cd k6-docs
# 1. Check diff has content
git diff main -- docs/sources/k6/next/ | head -20
# 2. Check for added lines
git diff main -- docs/sources/k6/next/ | grep '^\+' | head -20
# 3. Check for URLs
git diff main -- docs/sources/k6/next/ | grep '^\+' | grep 'grafana.com'agent-browser Issues
Installation Fails
If npm install -g [email protected] fails, check Node.js version:
node --version # Should be 18.x or higherUpdate Node.js if needed, then retry installation.
Browser Not Installed
After installing agent-browser, install the browser:
agent-browser installThis downloads Chromium for agent-browser to use.
Command Not Found After Install
Check PATH includes npm global bin directory:
npm config get prefix
# Should show a directory in your PATHAdd to PATH if needed (add to ~/.bashrc or ~/.zshrc):
export PATH="$(npm config get prefix)/bin:$PATH"k6 Testing Issues
Error: k6: command not found when running go run . run
Issue: You're not in the k6 repository directory.
Fix:
# Navigate to k6 repo first
cd /path/to/k6
# Then run the command
go run . run /tmp/test-script.jsExamples Work Locally But Not in Docs
Issue: Example has environment-specific code (hardcoded paths, local servers).
Fix: Ensure examples use:
Generic URLs (use
https://quickpizza.grafana.com/for HTTP examples)No hardcoded file paths
No dependencies on local services unless documented
k6 Branch Issues
Issue: Testing with wrong k6 version.
Verify:
cd /path/to/k6
git branch # Should show * master
git status # Should be clean or only local uncommitted changesIMPORTANT: k6 must be on master branch for testing examples with new features.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Grafana Labs
- Publisher
- Grafana Labs (Official)
- Source
- grafana/skills · skills/grafana-k6/k6-docs · commit 8fb72a5
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Grafana Labs or Grafana Labs.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download k6-docs.zip