djobbo/alambic/add-autogate
Claude Code and agent skill by djobbo/alambic
- community
Checking that the SKILL.md file is still in the repository.
Step-by-step guide for adding a new autogate to workerd for gradual rollout of risky changes, including enum registration, string mapping, usage pattern, and testing.
Install
npx vskill@latest install djobbo/alambic/add-autogateSKILL.md
The same SKILL.md was published earlier as djobbo/alambic/add-autogate.
Adding an Autogate
Autogates enable gradual rollout of risky code changes independent of binary releases. Unlike compatibility flags (which are permanent, date-based behavioral changes), autogates are temporary gates that can be toggled on/off via internal tooling during rollout, then removed once the change is stable.
When to use an autogate vs a compat flag
| Use an autogate when... | Use a compat flag when... | |
|---|---|---|
| Rolling out a risky internal change gradually | Changing user-visible behavior permanently | |
| You need a kill switch during rollout | The change is tied to a compatibility date | |
| The gate will be removed once stable | Users need to opt in or out explicitly |
Autogates and compat flags are separate mechanisms — an autogate does not become a compat flag.
Step 1: Add the enum value
Edit src/workerd/util/autogate.h. Add a new entry to the AutogateKey enum before `NumOfKeys`:
Naming convention: SCREAMING_SNAKE_CASE for the enum value.
Step 2: Add the string mapping
Edit src/workerd/util/autogate.c++. Add a case to the KJ_STRINGIFY switch before the `NumOfKeys` case:
Naming convention: kebab-case for the string name. This string is what appears in runtime configuration (prefixed with workerd-autogate-). The enum name and string name should match to avoid confusion.
Step 3: Guard your code
Use Autogate::isEnabled() to conditionally execute the new code path:
Step 4: Test
Three ways to test autogated code:
A. The `@all-autogates` test variant (automatic):
Every wd_test() and kj_test() generates a @all-autogates variant that enables all gates. If your feature is tested by existing tests, they'll automatically run with the gate enabled:
B. Targeted C++ test setup:
In a C++ test file, enable specific gates:
C. Environment variable:
Set WORKERD_ALL_AUTOGATES=1 to enable all gates when no explicit config is provided.
Step 5: Build and verify
Step 6: Remove the gate (after rollout)
Once the human user explicitly confirms that the feature is stable and fully rolled out:
- Remove the
AutogateKeyenum value fromautogate.h - Remove the
casefromKJ_STRINGIFYinautogate.c++ - Remove all
Autogate::isEnabled()checks, keeping only the new code path
Checklist
- [ ] Enum value added to
AutogateKeyinautogate.h(beforeNumOfKeys) - [ ] Comment describes what the gate controls
- [ ] String mapping added to
KJ_STRINGIFYinautogate.c++ - [ ] Code guarded with
Autogate::isEnabled() - [ ] Old code path preserved (for rollback)
- [ ]
@all-autogatestest variant passes - [ ] Tests cover both gated and ungated paths
Files touched
| File | What to do | |
|---|---|---|
src/workerd/util/autogate.h | Add enum value with comment | |
src/workerd/util/autogate.c++ | Add case to KJ_STRINGIFY | |
| Your feature file(s) | Guard code with Autogate::isEnabled() |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.repos/workerd/.opencode/skills/add-autogate/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/djobbo/alambic/add-autogate)