code-health-guard

Detects circular dependencies, oversized files, and layer violations in TypeScript and JavaScript projects.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Simon-YHKim/eject-button --skill code-health-guard-simon-yhkim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-health-guard
Source: https://github.com/Simon-YHKim/eject-button/tree/main/.claude/skills/code-health-guard
Command: npx skills add https://github.com/Simon-YHKim/eject-button --skill code-health-guard-simon-yhkim

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires madge, ts-unused-exports, and includes scripts (resource) and references (resource) components.

What problem does it solve? Codebases gradually degrade into spaghetti code: circular dependencies creep in, files grow past hundreds of lines, and shared modules start importing from feature layers. This Skill enforces structural discipline both before code is written (proactive checklists) and after (reactive scans), so architecture stays clean as the project grows. ## Core Features & Use Cases - Proactive checks before coding: A file placement decision tree, naming convention tables, import direction rules, function size limits, and duplicate detection guidance applied before writing new code. - Reactive scans on existing code: Detects circular dependencies via madge, unused exports via ts-unused-exports, and flags files over 300/500 lines using the included check-circular-deps.sh script. - Layered architecture enforcement: Unidirectional dependency rules (page → feature → shared → util), shared-module export-only rule, and a detailed anti-pattern gallery in references/architecture-patterns.md. - Use Case: Before adding a new payment module, ask where the files should go—the Skill walks the decision tree and recommends src/features/billing/ with components, services, and types subdirectories, while warning against putting domain logic in shared/. ## Quick Start Ask the agent to check the project structure for spaghetti code and circular dependencies, and it will run the health scan and produce a refactoring checklist.

Frequently Asked Questions about code-health-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect circular dependencies in a TypeScript project?

Run npx madge --circular src/ to detect circular imports in TypeScript and JavaScript files. The included check-circular-deps.sh script automates this scan and also flags oversized files in the same pass.

How to find unused exports in TypeScript code?

Use npx ts-unused-exports tsconfig.json to list exported symbols that nothing imports. For plain JavaScript projects, npx unimported provides equivalent dead-export detection.

What folder structure should I use for a layered frontend project?

Organize code into features/ (domain logic per domain), shared/ (reusable UI, hooks, lib), types/, config/, and adapters/ for external integrations like Stripe or Supabase. Dependencies must flow downward only: page → feature → shared → util.

When should a file or function be split for readability?

Split functions over 40 lines or with nesting deeper than 3 levels, and files over 300 lines are split candidates while 500 lines forces separation. Functions taking more than 5 arguments should accept an options object instead.

Does this code health check work for Python or Go projects?

The shell script scans .py files for size, and the references document covers pydeps and import-linter for Python layer contracts. Go needs no circular check because its compiler rejects import cycles at build time.