/green-claude:green-claudefrom green-claude
Applies digital sobriety rules when writing, modifying, or reviewing code. Covers performance topics like N+1 queries, pagination, caching, bundle size, payloads, and framework choice. Also runs eco-design audits via RGESN/GR491 checklists.
Ships in green-claude. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
What this skill is for. Deliver code that consumes as little as possible: the fewest tokens during the session, the least CPU time and memory at runtime, the fewest bytes over the network, the least storage, and therefore the least energy. That is what digital sobriety means in practice, and it is the reason every rule below exists. A rule that does not eventually reduce a resource someone pays for is not worth the context it takes.
The consumption comes in two waves, and the second is the larger one. During the session, the context you transmit and the output you produce are processed by a model, which costs computation and the energy behind it. After the session, the code you leave behind runs on every user's machine, on every request, for years. Both matter; only one of them stops when the conversation does.
Four rule sets: rules/ecoconception.json (131 rules, RGESN 2024 / GR491 /
Green Software Foundation / W3C WSG) while you write or modify code,
rules/langages/*.json (137 rules across 24 languages and frameworks) for the language you're
working in, and, during the conversation itself, rules/usage.json (13
responsible-use practices) and rules/tokens.json (30 token sobriety rules). Using Claude Code efficiently is also using it soberly.
Do not read these JSON files whole. They carry the regexes, examples and notes
the audit script needs, which is several times the context of the rules
themselves. eco-audit.sh --rules prints what you need, one line per rule (see
Language-specific rules).
| Mode | Trigger | Action |
|---|---|---|
| Proactive (default) | Always, as soon as you write or modify code | Apply the relevant families from ecoconception.json, unprompted; load them with eco-audit.sh --rules <family> |
| Audit | "eco-design audit", "check the sobriety", --eco-check | bash "$SKILL_DIR/scripts/eco-audit.sh" --compact file1 file2 ... (see Finding the scripts) |
| Browse | /green-claude (/green-claude:green-claude when installed as a plugin) | Full checklist of the 9 RGESN families plus Hosting for AI, 13 responsible-use practices and 30 token sobriety rules: eco-audit.sh --rules all |
Three rules decide what gets written at all, which makes them worth more than every optimisation that follows. A function tuned to perfection still costs everything it cost if it had no reason to exist.
Ask when the answer changes the work (USAGE-BRIEF-03). Name the assumption
that would reshape the task if it were wrong. If it is genuinely ambiguous, ask
that one question and wait. If it is not, state the assumption in a line and
build. One blocking question beats four that the repository could have answered.
Write the least code that solves the problem (ECO-ARCH-07). Volume is the
easiest thing to mistake for progress, and an assistant produces it faster than
anyone can read it. Every line is compiled, shipped, loaded, executed, reviewed
and carried through every future migration. When you are about to generalise,
ask which second caller justifies it; with no answer, write the specific
version.
Challenge the request and the model behind it (ECO-ALGO-08). When a
request names a model or an AI approach, check whether the task needs a model at
all, whether this is the smallest one that clears the quality bar, and whether
the approach is the fitting one or merely the first one to mind. Say what you
would do differently in a sentence or two, give the reason, then build what the
user decides. Someone who has heard the argument and still wants the large model
is making a decision, not a mistake.
That last one is the rule most likely to collide with a direct instruction, so the order matters: raise it once, take the answer, deliver.
Keep the 10 categories of ecoconception.json in mind (the 9 RGESN families:
strategy, specifications, architecture, UX, content, frontend, backend, hosting,
algorithms; plus hosting for AI), and load the
rules for the language you are about to write (see Language-specific
rules). Concretely, without being asked:
SELECT *).When you write or change a page or a feature, apply three principles from the RGESN 2024:
ECO-SPEC-05). Editorial: every screen does a job, so remove a screen
that only links to the next one and redirect its address (ECO-UX-09);
every link leads somewhere the screen does not already offer (ECO-UX-10);
a page nobody visits answers 410 or merges into another with a 301
(ECO-CONT-04).
Technical: the least code that does the job, no dead code, no unused
dependency (ECO-ARCH-07, ECO-FRONT-05, ECO-FRONT-04). No autoplay, no
infinite scroll (ECO-UX-01, ECO-UX-02).ECO-SPEC-02) and on a slow connection (ECO-SPEC-03). Walk the journey
with the keyboard alone: skip link, tab order that follows the reading
order, visible focus, aria-current="page" on the current entry, focus in
the first field of a single-form page (ECO-UX-08).ECO-STRAT-02). No
pre-ticked consent, no shaming refusal, no fake urgency, cancelling as short
as signing up (ECO-UX-11). Load third-party services on demand, after
assessing them (ECO-UX-04, ECO-SPEC-04).Each of the 78 RGESN 2024 criteria maps to at least one rule.
references/rgesn-2024.md holds the criteria and the criterion-to-rule table.
When a decision falls in a family (hosting, AI training, content formats…),
read that family's section of the file, not the whole file: grep -n "^## 8\."
gives its line.
When a rule conflicts with an explicit user request (performance, deadline, readability), state the trade-off in one sentence, propose the lighter option, and deliver what was asked. A user who requested two-second polling with their eyes open is making a decision, not a mistake.
While writing code, stay quiet: apply the rules and mention only what the user would otherwise be surprised by. One line at the end, naming the rule id, beats a running commentary on every rule you honoured.
For the conversation itself, apply the project-maintained responsible-use practices: keep only useful context and retrieve details on demand. Present them as Green Claude recommendations, not as quotations or personal advice. Verify client-specific commands against the official documentation for the version in use.
On the link between tokens and energy: state the direction, refuse the ratio. Fewer tokens processed means less computation, and less computation means less energy. That much holds and is worth acting on. Turning a token count into watts, joules or grams of CO2 does not hold, because prompt caching, model size, batching, hardware and the grid mix each move the result more than the token count does. Reduce because the computation is real; measure before you put a number on it.
Every command below starts from this skill's own directory, the one whose path was given to you when the skill loaded ("Base directory for this skill: ..."). Set it once and reuse it, so no command ever contains a guessed path:
SKILL_DIR="<the base directory given when this skill loaded>"
If that path was not given to you, resolve it before running anything, in this order, and stop at the first hit:
SKILL_DIR="$( { ls -d "$HOME"/.claude/skills/green-claude 2>/dev/null
ls -d "$HOME"/.claude/plugins/cache/*/green-claude/*/skills/green-claude 2>/dev/null | sort -V | tail -1
ls -d "$HOME"/.claude/plugins/marketplaces/*/skills/green-claude ./skills/green-claude 2>/dev/null
} | head -1)"
[ -f "$SKILL_DIR/scripts/eco-audit.sh" ] || echo "Green Claude: scripts not found"
A path that does not resolve is worth saying out loud. Inventing one produces a "command not found" that reads like the audit found nothing, which is the one outcome the user must never be handed.
bash "$SKILL_DIR/scripts/eco-audit.sh" --compact file1 file2 ... is a
deterministic script (grep/awk) with no reasoning cost for detection. It prints
one line per candidate: impact, rule id, title, file:line and the fix. Rerun
without --compact on the files you keep: the full block adds the corrected
example and the rule's Note, which you need before giving a verdict. Run it rather than
grepping by hand: it carries 311 rules, their thresholds, their per-language
scoping and their known false positives, none of which a hand-written grep
reproduces. Interpret and prioritize its output (High impact first), and read each
candidate's Note before relaying it (see Reporting what you find).
Rules with no detectable pattern ("measure before optimizing", "environmental
criteria in user stories"...) are process rules, listed via
bash "$SKILL_DIR/scripts/eco-audit.sh" --list-rules rather than searched by grep.
rules/langages/ holds one file per language: the idioms cross-cutting rules
cannot name, such as ORM N+1 queries, cursor-based pagination,
parallelStream() or a convenience clone(). A generic "avoid redundant
queries" never tells you to use select_related; the Python file does.
Load the rules for the language you are about to write, before writing it. Give the script the file you are working on, and it resolves the language from the extension, with the same table the audit uses:
bash "$SKILL_DIR/scripts/eco-audit.sh" --rules src/App.tsx # or by name: --rules python
Load them once per session, for the language actually in play. Loading all 24
costs context for the ones you are not writing, and a Python pattern says
nothing useful about Java. Some extensions map to more than one set, because a
.tsx is TypeScript and React at once. A file with no language rules is
reported as such: the cross-cutting rules still apply. A Dockerfile has no
extension at all and is routed by its name.
The same command loads a cross-cutting family before a structural decision
(--rules backend hosting), and --rules alone lists the families and
languages. If the script cannot run (jq missing), read the one file you need
in rules/langages/ rather than all of them.
eco-audit.sh --list-langs lists the covered languages and their globs.
An audit result is a list of candidates, not a verdict. Deciding which ones hold is your job, and the user needs to see that decision rather than the raw list. Give every finding you report one of three verdicts:
| Verdict | Meaning |
|---|---|
FAIL | Confirmed in context. You read the code around it and the defect is real. |
REVIEW | The pattern matched but the context does not settle it. Say what would settle it. |
PASS | Checked and correct. Only worth stating for a rule the user asked about. |
FAIL ECO-BACK-01 views.py:12 N+1: c.client.nom inside the loop over Commande.objects.all()
Fix: select_related("client"). Verify: assertNumQueries.
REVIEW ECO-CONT-01 index.html:116 logo.jpg is 1024x529 for a 192x99 display slot
Settles it: whether a 2x screen needs the extra resolution.
Two things make this worth the keystrokes. A REVIEW you cannot resolve is
useful information, whereas a candidate relayed as a defect costs the user time
and costs the audit its credibility. And naming what would settle a REVIEW
turns it into a task someone can pick up.
A Note line under a result gives the limit of that rule's pattern or
detector: known false positive, threshold, scope. Read it before you give a
verdict. It lives in the rule itself, so it stays current with every new rule.
When a rule carries an example, the audit prints the corrected form under
Write. Use it: it says what the fix looks like rather than describing it, and
it saves rebuilding that shape from the recommendation every time.
Keep replies simple and direct, in whatever language you write: a sober reply
costs fewer tokens and less reading time. Before a long reply or a report, read
references/style.md for the patterns to cut (em dashes, announced lists,
pseudo-clefts, binary antitheses).
rules/tokens.json holds the 30 NR-TOK rules of the Institut du Numérique
Responsable. Print them with eco-audit.sh --rules tokens when a session
starts on real work.
--rules tokens. Skip it for a plain question, and when
--rules tokens says the report is off (lean mode). Never invent a metric:
write "unavailable".NR-TOK-023 to 026 and NR-TOK-028 apply when the environment allows them (model choice, cache, metrics). The others apply by default.
A candidate you dismiss once will come back on the next run, and the run after that. Dismissed six times, it teaches everyone to skim past the audit, which costs more than the rule ever saved.
.green-claude/decisions.md at the repository root closes the question:
ECO-CONT-01 docs/index.html ACCEPTED logo.jpg kept as the og:image fallback
ECO-SH-05 install.sh TODO two mktemp with no trap
ACCEPTED silences that rule for that file, and only there. TODO stays
visible, because a debt taken on deliberately is not an exemption. The audit
says how many findings it hid and where the file lives, so nothing disappears
without a trace.
Propose an entry when you and the user settle a trade-off, and read the file before relaying a finding the team has already answered. Suggest it, and let the user write it: a decision recorded on their behalf is a decision they never made.
/green-claude)Installed as a plugin, the command is /green-claude:green-claude.
Checklist of the 9 RGESN families plus Hosting for AI, the 13 responsible-use practices and the 30 token sobriety rules, with each rule's title and recommendation. Useful for a design review before any code is written.
Print it with bash "$SKILL_DIR/scripts/eco-audit.sh" --rules all rather than
reading the JSON files.
Loading this skill remains the model's decision: it happens often, not every
time. For a check that depends on no one, the repository ships
hooks/green-claude-audit.sh, a PostToolUse hook on Write|Edit|MultiEdit.
Installing the plugin does not wire it: install.sh offers to, or the user adds
it to settings.json. Once wired, Claude Code runs it after every code file
written and hands you back the patterns it found. It only audits what the write added, and stays silent when it finds
nothing.
The "zero token" response cache cannot be handled by a skill: it has to be wired
through UserPromptSubmit/Stop hooks, which intercept the request before it
reaches the model (see hooks/ at the repository root). Caching is explicitly
opt-in per request with [cache] , for self-contained factual questions only.
Ordinary prompts always reach Claude. Cached replies are displayed to the user
but are not added to Claude's conversation context. The model choice
(Haiku/Sonnet/Opus) can be changed mid-session with /model: this skill won't do
it for you, but nothing stops you from suggesting a lighter model when a task is
plainly out of proportion with it.
LICENSE (opens in a new tab)LICENSES/Apache-2.0.txt (opens in a new tab)LICENSES/CC-BY-4.0.txt (opens in a new tab)LICENSES/MIT-legacy.txt (opens in a new tab)NOTICE (opens in a new tab)references/rgesn-2024.md (opens in a new tab)references/style.md (opens in a new tab)rules/ecoconception.json (opens in a new tab)rules/langages/angular.json (opens in a new tab)rules/langages/astro.json (opens in a new tab)rules/langages/c.json (opens in a new tab)rules/langages/cpp.json (opens in a new tab)rules/langages/csharp.json (opens in a new tab)rules/langages/go.json (opens in a new tab)rules/langages/java.json (opens in a new tab)rules/langages/javascript.json (opens in a new tab)rules/langages/julia.json (opens in a new tab)rules/langages/kotlin.json (opens in a new tab)rules/langages/nim.json (opens in a new tab)rules/langages/php.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
green-it, eco-design, digital-sobriety, performance-audit, eco-check
npx claudepluginhub institut-du-numerique-responsable/green-claude --plugin green-claudeOther plugins' skills for the same job