/gloria:extracting-coding-standardsfrom gloria
Use to set up or register gloria Coding Standards for a project. Fires for plain requests to register or sync standards with gloria — "register our coding standards with gloria", "sync our conventions with gloria", "save our rules to gloria", "register our coding conventions" — and to derive them — "extract our coding standards", "derive rules and snippets from this repo", "set up the standards library". Orchestrates deriving-agent-code-style and mapping-packages-for-coding-agents, structures their findings into stable rules (slug ids, authority labels, scope, evidence), mines one canonical placeholder-ized snippet per rule-implied pattern, registers everything via the gloria MCP tools (register_standard, put_rule, put_snippet) with per-item approval, and renders a version-stamped Coding Standards section into CLAUDE.md/AGENTS.md.
Ships in gloria. 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.
None: SKILL.md is the whole skill.
When the user says "register", "registering", or "sync" our coding
standards, rules, conventions, or snippets with gloria (e.g. "register our
coding standards", "sync our conventions with gloria", "save our rules to
gloria"), that means calling the gloria MCP tools — register_standard to
ensure the standard exists, then put_rule per rule and put_snippet per
snippet (with per-item approval) — not just writing them into CLAUDE.md or
a doc. The registered library is the source of truth checking-coding-standards
flags violations against; getting the rules and snippets into gloria via those
tools is the point of this skill.
Turn a repo's coding intent — configs, written conventions, and the consistent-but-unwritten
patterns in its source — into gloria's checkable form: rules (imperative instructions with
stable identities) and snippets (canonical exemplars of the patterns the rules imply),
registered in the project's standards library and rendered ambiently into CLAUDE.md/AGENTS.md.
Core principle: every rule traces to evidence, and nothing is registered without the user seeing it first. A rule you cannot point at a config, a doc, or a set of source files is a guess, not a standard. The registered library is the source of truth checkers will flag violations against — polluting it with invented rules turns every future check run into noise.
Don't use for: checking code against already-registered standards (use
checking-coding-standards); consulting snippets while writing (use using-coding-standards);
deriving style rules without registering them (use deriving-agent-code-style alone).
Requires: the gloria MCP server connected, and the project registered
(register_project / list_projects to confirm the slug).
Run the two analysis skills (or reuse their prior output if it exists and is current — check that the configs it cites haven't changed since):
deriving-agent-code-style — configs → imperative style rules, each already labeled
enforced / stated / observed with per-package scope.mapping-packages-for-coding-agents — package map: what each package owns, its layering,
and the architectural patterns in use.Also read CLAUDE.md / AGENTS.md / CONTRIBUTING.md directly: stated rules that never made
it into configs (data-access discipline, commit conventions, domain-model placement) are prime
rule material the style derivation may have skimmed.
Convert each finding into a rule object:
| Field | What it must be |
|---|---|
ruleId | Stable kebab-case slug naming the behavior, not the tool: all-d1-access-via-daos, not eslint-rule-37. This is the identity per-finding history hangs off — pick it as if it will live for years. |
instruction | Imperative, second person, self-contained: an agent reading only this line knows what to do. |
authority | enforced — a tool blocks violations (lint error, compile error, CI gate). stated — written in CLAUDE.md/docs but nothing blocks it. observed — consistent in the source, written nowhere. |
scope | Globs and/or package paths where the rule applies. Omit only for genuinely repo-wide rules. |
evidence | The files the rule was derived from: the config that enforces it, the doc that states it, or the source files that exhibit it. |
Worked examples from gloria.dev itself:
{
"ruleId": "all-d1-access-via-daos",
"instruction": "Route every D1/R2 query through a @gloria/core DAO; never write raw SQL, db.prepare(), or bucket.get/put in packages/web or packages/mcp.",
"authority": "stated",
"scope": { "packages": ["packages/web", "packages/mcp", "packages/jobs"] },
"evidence": { "sources": ["CLAUDE.md"] }
}
{
"ruleId": "sql-only-in-statement-builders",
"instruction": "Keep SQL strings exclusively inside pure *Statement(...) builder functions that return { sql, params }; DAOs execute builders and map rows, never embed SQL.",
"authority": "observed",
"scope": { "packages": ["packages/core"] },
"evidence": {
"sources": ["packages/core/src/skill-statements.ts", "packages/core/src/skill-dao.ts"]
}
}
{
"ruleId": "unix-timestamps-for-dates",
"instruction": "Store all dates as Unix-second integers, never strings; name columns *_at and domain fields *At.",
"authority": "stated",
"scope": {},
"evidence": {
"sources": ["CLAUDE.md", "packages/web/migrations/0003_projects_dependencies_documents.sql"]
}
}
Where a stated rule and observed practice disagree, create the rule from the stated intent and note the discrepancy in the instruction's evidence — do not silently pick the code's side.
For each architectural pattern the rules imply — "a DAO", "a statement builder + row transformer", "an API route with Zod validation", "a D1 migration", "a Workers vitest test" — find the best real instance in the repo and distill it:
TODO: markers naming what goes there. Everything structural stays verbatim.ruleIds the snippet embodies — a DAO snippet embodies
all-d1-access-via-daos and sql-only-in-statement-builders.snippetId is a stable kebab-case slug for the pattern (d1-dao, api-route-zod), and
language the file's language (typescript, sql).One canonical snippet per pattern. Two competing exemplars for the same pattern means the repo
has drift — pick the intended one and let checking-coding-standards flag the other.
Present the full rule and snippet list to the user grouped by authority, each with its evidence, and ask for a batch approval ("register all", or exclude items by id). Never register anything the user has not seen — a blanket "I trust you, skip the review" given before the list existed does not count; the user must see what "everything" is. Then, via the gloria MCP tools:
register_standard { projectSlug } — ensures the standard exists.put_rule { projectSlug, ruleId, instruction, authority, scope, evidence } per approved rule.put_snippet { projectSlug, snippetId, language, name, description, code, placeholders, ruleIds }
per approved snippet.get_standards { projectSlug } — read back the final version number N for Step 5.Ask before editing CLAUDE.md / AGENTS.md. Then write (or replace) a ## Coding Standards
section:
<!-- gloria:standards v<N> -->enforced first), sub-grouped per
package where scopes differ.Before writing pattern-shaped code (a DAO, an API route, a migration…), call gloria
find_snippets(language, query)and adapt the canonical snippet. Mark adopted code with// gloria:snippet <project>/<snippet-id> (verbatim|adapted).
Finally record the render: register_standard { projectSlug, renderedStamp: N }.
| Mistake | Fix |
|---|---|
| Inventing rules with no evidence pointer | Every rule cites the config/doc/source it came from; no citation → no rule |
Tool-shaped rule ids (eslint-no-explicit-any) | Name the behavior (no-any-narrow-unknown); ids outlive the toolchain |
| Registering before the user approved | Present the full list first; register only approved items |
| Snippets with instance details left in | Placeholder-ize every customization point with a named TODO: |
| Snippet linked to no rule | If no rule implies the pattern, either add the (evidenced) rule or drop the snippet |
| Editing CLAUDE.md/AGENTS.md unasked | Ask first; some repos generate those files |
| Forgetting the rendered stamp | Without <!-- gloria:standards vN --> + register_standard { renderedStamp }, render_stale drift is undetectable |
put_rule / put_snippet## Coding Standards section rendered with the version stamp and snippet nudge (with permission)register_standard called with the rendered stampWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
12 skills in this plugin
/checking-coding-standardsUse to check code against a project's registered gloria Coding Standards. Fires for plain requests to compare code with the rules — "check this against our standards", "does this drift from our rules/conventions", "are we following our own standards", "review this for standards compliance", "check this PR against our standards", "run a standards check", "audit the repo for drift", "has our code drifted from the rules" — including before or after implementing a change in a project that has registered standards. Runs diff-scoped checks (the per-PR workhorse), cheap metadata checks (render stamp + rule-evidence staleness), or a full audit (snippet staleness included), and reports findings to the gloria drift ledger via report_check_run. Read-only: findings, never edits./debugging-production-errorsUse to investigate production problems through gloria's log debugging tools. Fires for plain requests about live behavior — "why is X failing in production", "what happened at 2pm", "debug these 500s", "is anything erroring right now", "check the logs", "what broke after the last deploy", "why are checkouts timing out" — for any project with a gloria log connection configured. Queries the org's own log provider live via the gloria MCP tools (get_log_provider_status, get_log_stats, list_error_groups, query_logs): find the spike, group the errors, correlate with the deploy, pull the stack trace, map it to source. Read-only over logs; never asks for credentials in chat.npx claudepluginhub sandgardenhq/plugins --plugin gloria