/gloria:mapping-packages-for-coding-agentsfrom gloria
Use when you need to tell a coding agent which package (or workspace, or layer) a change belongs in — "generate package-routing guidance", "add a Package Routing section to CLAUDE.md / AGENTS.md", "when should the agent use each package", "map our monorepo for agents", "which package does this change go in". Reads the codebase, derives the internal dependency graph and each package's role, and emits an imperative, agent-facing routing block (per-package "put here / not here" + a decision table) grounded in the actual code.
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.
Analyze a codebase and produce package-routing guidance for a coding agent: a compact, imperative block — destined for CLAUDE.md / AGENTS.md — that answers one question for every change an agent might make: "which package does this belong in?"
It is a sibling to documenting-service-dependencies, defining-the-documentation-site-map, and identifying-skills-for-a-project: a Markdown skill that runs inside a coding agent, reads the codebase, and emits filesystem Markdown — no D1 dependency for local/agent use.
Core principle: derive the routing from the code — the internal dependency graph and each package's real role — not from a template or from prose alone. The output is routing instructions (where does a change go?), not documentation (what is in each package?). Every line must change a routing decision or be cut.
| Output | Contents |
|---|---|
PACKAGE_ROUTING.md (or a ## Package Routing section pasted into CLAUDE.md / AGENTS.md) | The dependency direction + the one or two hard rules that govern boundaries; a per-package block (one-line "what it is" → "put here when" triggers → "do NOT put here" boundary); a quick decision table; the common cross-package change shape. |
Emit the block by default. Offer to insert it into CLAUDE.md / AGENTS.md, but ask before editing those files — they are load-bearing. Default to writing/printing the standalone block and letting the user place it.
An agent already reads the code; it doesn't need you to re-list what each package contains. It needs to decide where a new change goes. So write every bullet as a trigger or symptom, phrased from the change's point of view:
Test each line: "Does this help an agent pick this package over another for a specific change?" If not, delete it. This single rule is what separates useful routing guidance from a package README.
*-dao.ts, app/api/**/route.ts), never an exhaustive file dump;Detect the packages (the routing targets). Find the workspace boundaries — don't assume /packages/*:
package.json workspaces, pnpm-workspace.yaml, bun/turbo.json, nx.json, lerna.json, tsconfig references.go.work, Gradle/Maven modules, Python pyproject/namespace packages.handlers/ vs domain/ vs db/), and say so explicitly. The rest of this skill applies with "package" read as "module."Build the internal dependency graph. For each package, read its manifest for internal deps (workspace:*, @scope/*, module paths) and confirm with real imports (grep for cross-package import specifiers). Draw the arrows: who depends on whom. The most-depended-on package with no internal deps of its own is the shared/domain leaf; packages that depend on it and are depended on by nothing are entrypoints. This graph, not intuition, decides routing.
Classify each package's role from its deps, its imports, and its scripts/config:
next, wrangler, MCP SDK, a CLI bin, main).Extract the hard rules — reconcile declared vs. actual. Read CLAUDE.md / AGENTS.md / CONTRIBUTING for stated architectural rules ("all D1/R2 access through DAOs," "core never owns a binding"). Verify each against the code (grep that the shared package is the only one importing the db/client) and cite one or two representative files. Where a rule is declared but the code contradicts it, note the drift rather than parroting the doc. Where no rule is declared, derive the boundary from the graph (e.g. only the shared package imports the ORM → that is the rule; state it).
Write the per-package blocks (anatomy above). Prefer globs and 2–4 representative files over exhaustive lists — the guidance must stay short and survive refactors. Every "put here" bullet is a trigger; every "do NOT" bullet redirects.
Write the decision table and the cross-package shape. Map the changes an agent actually makes to packages. Then state the dominant multi-package pattern ("shared schema+access → transport call site") so spanning changes aren't a surprise.
Keep it at agent-instruction altitude. This block loads into every agent turn once it's in CLAUDE.md. Be imperative and scannable; cut anything that reads like a README. If it's longer than a screen or two per package, you're describing, not routing.
Report and offer placement. Summarize the graph you derived, the hard rules (and any declared-vs-code drift), and offer to paste the block into CLAUDE.md / AGENTS.md — asking first.
Author it as a drop-in section so it pastes straight into an agent-instructions file:
## Package Routing
Packages under `<workspace glob>`. Dependency direction is one-way: `A`, `B`, `C`
depend on `core`; `core` depends on none of them. **Decide which package a change
belongs in before writing code.** <the one hard rule that governs boundaries>.
### `core` (`packages/core`)
<one-line role>.
- Put here: <trigger>, <trigger> — representative files/globs.
- <Hard rule that lives here, e.g. the data-access rule>.
- Not here: <concern> (→ `A`), <concern> (→ `B`).
### `A` (`packages/a`)
<one-line role>.
- Put here: <trigger>, <trigger> — `app/api/**/route.ts`, …
- Not here: <concern> (→ `core`).
… (one block per package) …
### Quick routing
| Change is about… | Package |
| ------------------------------ | ------- |
| <domain concept / data access> | `core` |
| <HTTP endpoint / page> | `A` |
| <scheduled/background job> | `B` |
CLAUDE.md unprompted. It's load-bearing. Emit the block and ask before inserting.A well-formed block leads with the dependency direction and the single governing rule, then gives each package a one-line role, a short trigger-based "put here" list (globs, not file dumps), and a redirecting "not here" line, and closes with a decision table. For the shape and voice to match, see the routing block this skill produces for a shared-core-plus-transport-layers monorepo: one leaf domain package that owns schemas + data access, and thin HTTP / MCP / scheduled-worker packages that depend on it — the routing rule ("data and domain logic go in the leaf; the others are doors to it") falls directly out of the dependency graph.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub sandgardenhq/plugins --plugin gloria12 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./deriving-agent-code-styleUse when asked to turn a codebase's linter, formatter, and compiler configuration into agent-facing code style instructions — "write code style rules for agents", "summarize our lint rules as best practices", "add a Code Style section to CLAUDE.md / AGENTS.md", "what conventions should an agent follow in this repo". Reads every config layer per package, detects where linting silently doesn't run, mines observed conventions from the source, and emits an imperative Code Style section with each rule labeled by what enforces it./documenting-service-dependenciesUse to map, document, and register a codebase's service dependencies with gloria.dev so they are monitored. Fires for plain requests to sync a dependency or project with gloria — "register this dependency", "register this project", "register/sync our services with gloria", "start monitoring this service", "add this integration to gloria", "sync my project with gloria" — and to inventory them — "document our integrations/dependencies", "what external services does this connect to", "make a health-check doc". Also fires whenever you add, remove, or swap an external service, SaaS API, SDK, API client, database, queue, or internal endpoint. Produces four dependency Markdown docs (external SaaS inventory + health checks, internal systems inventory + health checks) plus, on a first-time pass, a project explainer and (for monorepos) a package/workspace map, and pushes all of it to gloria.dev via its MCP tools (register_project, put_dependency, put_document)./extracting-coding-standardsUse 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./identifying-skills-for-a-projectUse when asked which agent skills a project already uses and which additional ones would help the people and agents working on it, or to stock your org's gloria.dev skills library from a project's needs. Inventories the skills in play (session list + `.claude/` config + CLAUDE.md), profiles the stack, recommends the gaps, then — only with consent — saves the useful ones to the library by reusing, copying, or authoring a bundle, and offers a local or global install.