---
title: "@n8n/code-health"
description: "Static analysis for monorepo dependency hygiene. Built on `@n8n/rules-engine`."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/readme-559
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:36:42.116Z
license: CC-BY-4.0
attribution: "@n8n/code-health — Claudary (https://claudary.paisolsolutions.com/skills/readme-559)"
---

# @n8n/code-health
Static analysis for monorepo dependency hygiene. Built on `@n8n/rules-engine`.

## Overview

# @n8n/code-health

Static analysis for monorepo dependency hygiene. Built on `@n8n/rules-engine`.

## What it does

Scans all `package.json` files across the monorepo and flags:

- **Hardcoded catalog deps** — dependencies using a pinned version when `pnpm-workspace.yaml` already defines a catalog entry
- **Cross-package version drift** — the same dependency appearing in multiple packages with different versions

## Usage

```bash
# Build first
pnpm --filter=@n8n/code-health build

# Run analysis (uses baseline if present)
node packages/testing/code-health/dist/cli.js

# Show all violations (ignore baseline)
node packages/testing/code-health/dist/cli.js --ignore-baseline

# Run a specific rule
node packages/testing/code-health/dist/cli.js --rule=catalog-violations

# List available rules
node packages/testing/code-health/dist/cli.js rules
```

## Baseline

The baseline (`.code-health-baseline.json` at repo root) snapshots current violations so only **new** violations fail the check.

```bash
# Generate/update baseline
node packages/testing/code-health/dist/cli.js baseline

# Commit it
git add .code-health-baseline.json
git commit -m "chore: update code-health baseline"
```

## Output

All output is JSON. Exit code 1 if new violations are found, 0 if clean.

```json
{
  "summary": {
    "totalViolations": 3,
    "byRule": { "catalog-violations": 3 },
    "bySeverity": { "error": 3, "warning": 0, "info": 0 }
  }
}
```

## Adding rules

Rules extend `BaseRule<CodeHealthContext>` from `@n8n/rules-engine`. See `src/rules/catalog-violations.rule.ts` for the pattern. Register new rules in `src/index.ts`.

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/readme-559) · https://claudary.paisolsolutions.com
