browser-sdk / scripts
AGENTS.md400 starsChanged 9 months agoApache-2.0View on GitHub
The scripts/ directory contains TypeScript scripts for CI automation and developer tools. Pattern: Each subdirectory has a lib/ folder for domain-specific utilities. Scripts run on the latest Node.js version (see volta.node in package.json): All scripts follow this pattern: Key conventions: Scripts can have spec files using Node.js built-in test runner: Run script tests: Core utilities available to all scripts:
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Use modern TypeScript and latest Node.js APIs
- Very specific: line 26
Prefer built-in Node.js modules over dependencies
- Very specific: line 27
Always use node: prefix for Node.js imports
- Distinctive: line 42
All scripts follow this pattern:
- Very specific: line 60
Use runMain() wrapper for proper async handling and error reporting
- Very specific: line 61
Use printLog() for console output
- Very specific: line 62
Use command template literal for shell commands
- Very specific: line 63
Import with .ts extension (required for Node.js ESM)
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scripts and Automation
The scripts/ directory contains TypeScript scripts for CI automation and developer tools.
Directory Structure
scripts/
├── build/ # Build automation
├── deploy/ # Deployment (CI only)
├── performance/ # Performance benchmarking (CI only)
├── release/ # Release automation (CI only)
├── test/ # Test infrastructure (CI only)
└── lib/ # Shared utilitiesPattern: Each subdirectory has a lib/ folder for domain-specific utilities.
Writing Scripts
TypeScript & Node.js Version
Scripts run on the latest Node.js version (see volta.node in package.json):
- Use modern TypeScript and latest Node.js APIs
- Prefer built-in Node.js modules over dependencies
- Always use
node:prefix for Node.js imports
// ✅ Good - built-in Node.js APIs
import { globSync } from 'node:fs'
import { parseArgs } from 'node:util'
import * as path from 'node:path'
// ❌ Bad - unnecessary dependencies
import glob from 'glob'
import minimist from 'minimist'Basic Structure
All scripts follow this pattern:
import { printLog, runMain } from './lib/executionUtils.ts'
import { command } from './lib/command.ts'
runMain(async () => {
printLog('Starting task...')
// Script logic here
command`yarn build`.run()
printLog('Task completed.')
})Key conventions:
- Use
runMain()wrapper for proper async handling and error reporting - Use
printLog()for console output - Use
commandtemplate literal for shell commands - Import with
.tsextension (required for Node.js ESM)
Testing Scripts
Scripts can have spec files using Node.js built-in test runner:
// deploy.spec.ts
import { test } from 'node:test'
import assert from 'node:assert'
test('should deploy to staging', () => {
// Test logic
assert.strictEqual(actual, expected)
})scripts/deploy/
├── deploy.ts
└── deploy.spec.ts # Tests using node:testRun script tests:
yarn test:scriptShared Utilities (scripts/lib/)
Core utilities available to all scripts:
executionUtils.ts-runMain(),printLog(), error handlingcommand.ts- Shell command builder with fluent APIfilesUtils.ts- File operations (read, write, modify, iterate)gitUtils.ts- Git operations (branches, tags, commits, PRs)buildEnv.ts- Detect environment (CI, local, staging, production)datacenter.ts- Datadog datacenter configurationpackagesDirectoryNames.ts- Package directory listing
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- scripts/CLAUDE.mdCLAUDE.md
- .cursor/rules/test-driven-development.mdcCursor rule
- .cursor/rules/unit-test-best-practices.mdcCursor rule
- manual-testingSkill
- running-testsSkill
- writing-commits-and-prsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

