improve-code-quality

A structured code-quality audit for any path in a monorepo, which is a repository containing multiple related projects or packages. It uses automated checks and manual review, then reports findings before applying approved fixes.

In plain words
What is it for?
Use it to audit or improve a directory, file, or package, including refactoring, linting, security checks, dependency audits, and performance reviews.
Why use it?
It gathers security, performance, robustness, readability, and maintenance issues in one review instead of relying only on a linter.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/moonrepo/moon/improve-code-quality
Any agent
npx skills add moonrepo/moon --skill improve-code-quality
Clone the repo
git clone --depth 1 https://github.com/moonrepo/moon

Made for: Claude Code, Codex.

Per session 116 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,748 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00116 $0.01748
Opus 5 $0.00058 $0.00874
Sonnet 5 $0.00023 $0.00350
Haiku 4.5 $0.00012 $0.00175

Measured 3d ago against content hash e546e3232b1d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

improve-code-quality scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/improve-code-quality/SKILL.md · 235 lines

How it starts

The opening of the file, as written. The whole thing — 235 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Improve Code Quality

Perform a structured code quality audit on a target path in the monorepo. The workflow is: run automated tools, do deeper manual analysis, present a report, then apply fixes only after the user approves.

Usage

/improve-code-quality <path>

The path can be a directory (e.g., crates/task-runner), a single file (e.g., crates/task-runner/src/lib.rs), or the name of a package (e.g., moon_task_runner).

Step 1: Validate and detect language

First, verify the target path exists. If it doesn't, tell the user and stop.

Then detect what languages are present:

  • Rust: path is under crates/, wasm/, or legacy/, or contains .rs files or a Cargo.toml

Tell the user what you detected before continuing.

If the target is a single file, skip the automated tool phase and go straight to manual analysis.

Step 2: Manual analysis

Read the source files in the target path and look for issues that automated tools miss. Organize findings by category:

Security

  • unsafe blocks without justification comments
  • .unwrap() on user-facing code paths (not tests — unwrap is fine in tests)
  • Path traversal or injection risks
  • Hardcoded secrets or credentials
  • Use of std::collections::HashMap or std::collections::HashSet (refer to conventions below)

Performance

  • Unnecessary .clone() where borrowing would work
  • Unnecessary .collect() in iterator chains
  • O(n^2) or worse algorithms with better alternatives
  • Blocking calls inside async functions
  • Large types on the stack that should be Boxed
  • Avoid cloning in loops; use .iter() instead of .into_iter() for Copy types
  • Prefer iterators over manual loops (when applicable); avoid intermediate .collect() calls
  • Detect memory leaks or dangling pointers

Readability & structure

  • Functions longer than ~80 lines that should be split
  • Deeply nested or complex match/if-else chains
  • Dead code or unused imports
  • Inconsistent naming
  • Magic numbers that should be named constants

Read the full file on GitHub · 235 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 235 lines · 116 tokens per session scan A e546e3232b1d

Subscribe to this mod's changes

improve-code-quality is a skill published in the GitHub repository moonrepo/moon (4,084 stars, last pushed 4d ago), licensed MIT. It adds 116 tokens to every session and 1,748 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

turborepo

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines…

vercel/turborepo · 111 tokens

migrate-internal-package

Move a package from another TryGhost repository into Ghost as an internal-only workspace package while preserving its Git history. Use for package migrations from repositories such as TryGhost/SDK or TryGhost/framework, including the history import PR, exceptional merge-commit handoff, source-repository removal PR…

TryGhost/Ghost · 77 tokens

Shade tokens, not hex

Use Shade semantic tokens (bg-background, text-foreground, border-border-default, bg-surface-elevated) — never hex, hsl(), or bg-gray-200-style raw palette utilities for UI chrome. Trigger when editing TSX/CSS in Shade-consuming apps.

TryGhost/Ghost · 61 tokens

Shade dropdown surface contract

DropdownMenu, Select, and Popover share one visual recipe (bg-surface-elevated-2 + border-border/60 dark:border-border/30 + shadow-md). Change them together. Trigger when editing any of those three Shade files.

TryGhost/Ghost · 54 tokens

Shade inputSurface recipe

Use the inputSurface() recipe for form-control chrome (border, background, radius, focus ring, invalid state) — don't roll your own. Trigger when editing form-control-shaped files in Shade.

TryGhost/Ghost · 44 tokens

Shade new component

Acceptance checklist for adding or editing a Shade component or pattern file — naming, sibling story, className forwarding, cva variants, required states, recipe usage. Trigger when editing files in apps/shade/src/components.

TryGhost/Ghost · 47 tokens