agentleFS
DataDogDataDog/browser-sdk/scripts/AGENTS.md

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
  1. Very specific:

    Use modern TypeScript and latest Node.js APIs

    line 25
  2. Very specific:

    Prefer built-in Node.js modules over dependencies

    line 26
  3. Very specific:

    Always use node: prefix for Node.js imports

    line 27
  4. Distinctive:

    All scripts follow this pattern:

    line 42
  5. Very specific:

    Use runMain() wrapper for proper async handling and error reporting

    line 60
  6. Very specific:

    Use printLog() for console output

    line 61
  7. Very specific:

    Use command template literal for shell commands

    line 62
  8. Very specific:

    Import with .ts extension (required for Node.js ESM)

    line 63

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 utilities

Pattern: 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 command template literal for shell commands
  • Import with .ts extension (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:test

Run script tests:

yarn test:script

Shared Utilities (scripts/lib/)

Core utilities available to all scripts:

  • executionUtils.ts - runMain(), printLog(), error handling
  • command.ts - Shell command builder with fluent API
  • filesUtils.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 configuration
  • packagesDirectoryNames.ts - Package directory listing

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.