Costly mistakes
Some of my tools update user records, revoke access and send emails. I have managed fleets of up to 8,000 accounts: at that scale, one wrong column hits thousands of people.
I build Google Workspace tools in Apps Script: automations, web apps, admin tools, some of which act on real accounts. Here is how I put Claude Code to work on them: with my rules, checks it cannot bypass, and eight agents taking turns under my approval.
An AI that writes code fast also writes its mistakes fast. When a tool changes data, sends emails or touches accounts, a mistake cannot always be undone.
Some of my tools update user records, revoke access and send emails. I have managed fleets of up to 8,000 accounts: at that scale, one wrong column hits thousands of people.
From one session to the next, the AI forgets what I learned the hard way. Apps Script’s 6-minute ceiling, dates that Sheets hands back in another form, a constant declared twice that makes the whole project unreachable: every trap comes back unless it is written down.
I want the AI to propose, check and document, but nothing irreversible leaves without my explicit approval: no email, no deployment, no code release.
Everything lives in a repository I call the workshop, plugged into Claude Code as a plugin.
A rules file loaded at the start of every session. Each rule was paid for at least once: store dates as yyyy-MM-dd, make every long task resumable, run every irreversible operation in two steps (plan, then apply), request the narrowest OAuth scopes and say what each one allows.
A checker screens the project before anything is sent to Google: syntax, duplicate constants, menu targets, types, displayed version, forbidden patterns, plain-text secrets, test bench. It runs from a Claude Code hook, a Git hook and continuous integration: a rejected project does not ship.
Eight specialised agents, started by a single command, /chaine. Each writes its notes in a work folder and the next agent starts from there. Between two steps, nothing moves without my approval.
Between each step there is a gate: I see what was produced and I approve, correct or stop. The orange diamond marks these gates.
Should we build at all? The agent looks at what Google, published tools and my own projects already do, compares the possible forms and names what could sink the idea. It may conclude that nothing should be written.
Who for, what problem, which data and how much, which Google limits. It sets the acceptance criteria the tests will check.
Files, tabs and columns, resuming after 6 minutes, plan then apply, OAuth scopes. It reuses my shared base instead of reinventing it.
It writes the code and its test cases, then fixes what the next steps send back. It releases nothing.
A fresh agent, who did not write the code, tests the tool outside Google on data shaped exactly like the API output. At most three rounds with development.
It looks for what the code allows too much: execution identity, injection into HTML pages, overly broad scopes, secrets.
It discovers the tool as a newcomer would and writes the guide. It checks that every menu and message it quotes exists word for word.
First a plan: commits, changelog, version number, what will leave the machine. Only then, with my approval, does it release.
Testing, review and documentation go to agents that never saw the developer’s reasoning. Whoever wrote the code shares its blind spots: they test what they meant to do, and document what they already know.
One work session on a tool that bulk-updates the Google Workspace directory from a Sheets spreadsheet.
A fix finally exposed advanced columns that had never been exported. The code handling them had therefore never run. Before any real use, Claude replayed it end to end outside Google: reading, computing the differences, building the request sent to the directory.
The project was rejected: no version number, test bench in the wrong place, sixteen type warnings. Each was examined; false positives were frozen and said so, the rest fixed. A fix always comes with the test that would have caught it, and we check that the test fails when the defect is put back.
The project’s licence was not the one used by my other tools, by accident. Claude did not change it on its own: it explained what each licence allows and what the change could not erase, then waited for my choice.
This framework relies on features Claude Code provides out of the box. I had nothing to work around.
Each agent has its role, its allowed tools and its own model: Opus to judge, Sonnet to execute.
A check fires before anything is sent to Google and after every edited file. It blocks; it does not just warn.
The chain, the checks and the release install as one plugin and start with a command.
Claude reads the current Google Workspace documentation instead of quoting a quota from memory.
My workshop stays private: it is cut to my own conventions. Everything it relies on, though, is documented by Anthropic, and a first framework fits in a handful of files. Here is where to start, in the order I built it.
A CLAUDE.md file at the project root, or in ~/.claude for every project. Claude reads it at the start of each session. Only put in what has already cost you once: one rule per mistake paid for.
# Règles de mes projets Apps Script
- Jamais de clasp push direct : d'abord la vérification.
- Toute date lue dans Sheets passe par normaliserDate_().
- Toute correction s'accompagne du test qui l'aurait attrapée.
A Markdown file in .claude/agents/. The header sets its name, when to use it, its model and the tools it may not use; the body describes its job. Here the testing agent cannot edit the code: it can only report.
---
name: essais
description: Éprouve l'outil contre ses critères d'acceptation, sans avoir écrit le code.
model: opus
disallowedTools: Edit
---
Tu n'as pas écrit ce code. Lance le banc d'essai, confronte chaque
critère au résultat, et rends ACCEPTÉ ou REFUSÉ avec les défauts.
A hook runs your script before each command. The script receives the command, and if it exits with code 2, Claude Code refuses it and shows the message to Claude, which has to fix things. That is the difference between an instruction and a guard.
{
"hooks": {
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{ "type": "command", "command": "node .claude/garde.js" }]
}]
}
}
// .claude/garde.js : le code de sortie 2 refuse la commande
const { tool_input } = JSON.parse(require('fs').readFileSync(0, 'utf8'));
if (/clasp (push|deploy)/.test(tool_input.command ?? '')) {
console.error('Envoi bloqué : lancez d’abord la vérification.');
process.exit(2);
}
A skill in .claude/skills/chaine/: Claude runs it when you type /chaine. It chains the agents and holds the gates, since agents cannot talk to you directly.
---
name: chaine
description: Mène un outil de l'idée à la publication, agent par agent.
---
Lance les agents dans l'ordre : idee, cadrage, conception,
developpement, essais, relecture, documentation, publication.
Après chacun, montre-moi son verdict et attends mon accord.
Si les essais refusent, renvoie les défauts au développement.
Once the framework works, a plugin makes it reusable: the same agents, skills and hooks in every new project, or for a whole team, without copying files around.
mon-atelier/
├── .claude-plugin/plugin.json
├── agents/ essais.md, relecture.md…
├── skills/ chaine/SKILL.md
└── hooks/ hooks.json
Start small: rules and a hook are enough to avoid the mistakes you already know. Agents and the chain come when a project calls for them. The exact names and fields are described in the Claude Code documentation.
If you want to try this kind of method, I can offer you a guest pass: one week to discover Claude and Claude Code with the models paying subscribers get. New subscribers only.
Each pass works only once. If it has already been used, ask for a new one through the contact form: I will send it privately.
Disclosure: the “Use my guest pass” button is a referral link. If you subscribe through it, I may receive something in return (usage credit), at no extra cost to you. Terms are set by Anthropic and may change. This page is my own opinion as a user: Anthropic neither commissioned nor reviewed it.
Want to set up a framework like this for your own Google Workspace tools? Let’s talk.
Contact meTo start the chain, no. To approve each gate honestly, you need to be able to read what you approve: a scope document, a list of OAuth scopes, a release plan. The more sensitive the project, the more that reading matters.
Not in this setup: Claude works on the code, on my machine, and tests it with fictitious data shaped like Google’s. The directory, spreadsheets and emails are never sent to it. The tool then runs inside Google, under the identity of the person who starts it.
Claude Code works directly in the project files, runs the checks and tests, and supports hooks and agents. The claude.ai app is great for thinking, writing or reviewing a script; for a tooled framework like this one, you need Claude Code.
No: it is tied to my conventions and tooling, and stays private. The “Build your own” section shows how to set one up; if you would like help for your own Google Workspace projects, contact me.
Claude Code requires a paid plan. Plans and their usage limits change regularly: check Anthropic’s pricing page rather than a figure quoted here.
Développeur freelance spécialisé dans l'optimisation des flux de travail professionnels, le développement d'add-ons sur-mesure (Google Sheets, Docs, Gmail) et l'intégration de modèles IA (Gemini).