serviceradar-bazel-guardrails
Skill934 starsChanged 2 days agoApache-2.0View on GitHub
Use before creating a worktree, script, or ad hoc orchestration, handling generated Bazel artifacts, changing native add-ons, or adding serviceradar_core tests.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- openspec/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- daisyuiSkill
- demo-cnpg-local-web-ngSkill
- demo-local-rolloutSkill
- demo-web-ng-fastpathSkill
- fieldsurvey-local-web-ngSkill
- playwright-cliSkill
- release-cut-and-demo-rollSkill
- serviceradar-build-testSkill
- serviceradar-dependenciesSkill
- serviceradar-elixirSkill
- serviceradar-openspecSkill
- serviceradar-operationsSkill
- srql-fixtures-db-testsSkill
- web-ng-docker-loopSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
No shell scripts. Everything is a Bazel target: Do not add a script under scripts/, and do not extend an existing one.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill 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
ServiceRadar Bazel Guardrails
After
git worktree add(or any extra checkout), symlink the gitignored Bazel rc files before anybazelcommand..bazelrctry-imports%workspace%/.bazelrc.remoteand.bazelrc.local. Both are gitignored: they hold the BuildBuddy API key and the remote cache/executor overrides.git worktree addonly checks out tracked files, so a new worktree has neither. Without them--config=remote/--config=cicannot authenticate: Bazel printsPERMISSION_DENIED: Missing API keyand never reaches RBE (local crawl or abort).bb viewstill works from the primary clone — that is not proof the worktree is wired for remote execution. From the checkout that already has the files:ln -sfn "$PRIMARY/.bazelrc.remote" "$WT/.bazelrc.remote" test -e "$PRIMARY/.bazelrc.local" && ln -sfn "$PRIMARY/.bazelrc.local" "$WT/.bazelrc.local" test -f "$WT/.bazelrc.remote"Same rule for
/tmp/...trees,jj workspace add, and extra clones. Never commit those files.Never read generated Bazel output. No
cpout ofbazel-out, nobazel info bazel-binplus a path, nobazel cquery --output=filesfollowed by reading the file. The output tree is a cache, not an interface: it can be wiped at any time, and its path encodes the configuration that produced it, so an artifact found underbazel-out/rbe_platform-opt/is whatever happened to be built with that platform and compilation mode — the same command with a different-cor--configsilently reads something else, or nothing.This tree hides the path deliberately:
//.bazelrcsets--experimental_convenience_symlinks=clean, so there is nobazel-outsymlink at the workspace root. A copy that appears to do nothing there is that guard working. Do not route around it by resolving an absolute path by hand.Express the need as a target instead: a
filegroupconsumed as a declared input, orwrite_source_filesfromaspect_bazel_libto copy an artifact back into the tree. When a generated file must be committed — protoc output embedded withinclude_bytes!socargoworks without Bazel, generated bindings — the pattern is a committed copy, adiff_testthat says when it is stale, and a write-back target that makes it current. See//config/manager_config/rust:update_embedded_instances, which copies from runfiles. If a write-back target is missing, add one rather than doing the copy by hand.No shell scripts. Everything is a Bazel target. Do not add a script under
scripts/, and do not extend an existing one. Build, test, provisioning, teardown, packaging and publishing are Bazel targets invoked withbazel build/bazel test/bazel run. A script is a build system with no dependency graph, no cache, no sandbox and no remote execution — every one of them is a hole in the graph that has to be re-run, re-debugged and re-documented by hand.The only permitted exception is a hard corner case that genuinely cannot be a Bazel action, and it must be justified in a comment at the top of the file. Today that means credential handling that must not become an action input: Docker/registry authentication and cosign/OpenBao signing setup, plus materializing rotating SRQL fixture credentials in the Bazel client's environment before database test actions start. "It was easier" is not a corner case.
Corollaries:
- Work an existing script does belongs in a target.
//rust/integration-dbalready replacedscripts/{reset,drop,sweep-stale-core}-test-db.sh— those files are dead and should be deleted, not maintained. - A test needing a file gets it as a declared input (
data/srcs), never from a script writing it to a runner temp dir and exporting a path. That pattern is what forcesno-remote-execand breaks RBE. - Ordering between targets is the caller's sequence of
bazelinvocations, not a script that wraps them.
- Work an existing script does belongs in a target.
Two registration gates fail only under make test/BazelCI — never under mix test,
go test, cargo test or a PR check — so a missing entry looks green all the way to
trunk unless the no-mistakes pipeline catches it first:
- Adding or changing a native add-on (
addons/<name>/+ a Go/Rust binary) must be registered in four places, and any change to its source, config orBUILD.bazelrequires bumpingaddons/<name>/addon.yamlversion. - Adding an
elixir/serviceradar_coretest file requires a row inelixir/serviceradar_core/test/INTEGRATION_SOURCE_DISPOSITIONS.tsv. The no-mistakestest-registrationgate (.no-mistakes.yaml) now runs this contract before push, so a missing row is caught there instead of only in BazelCI.
Both procedures, with their local verification commands, are in docs/agent-runbooks.md.
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.

