barrel-import-boundary-guard

Audits barrel import boundaries across App Router entrypoints to verify page-level independence.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/masakinihirota/2026src-ni --skill barrel-import-boundary-guard-masakinihirota
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: barrel-import-boundary-guard
Source: https://github.com/masakinihirota/2026src-ni/tree/main/.agents/skills/barrel-import-boundary-guard
Command: npx skills add https://github.com/masakinihirota/2026src-ni --skill barrel-import-boundary-guard-masakinihirota

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? In a Next.js App Router codebase, pages can silently become coupled through deep imports into shared components, hooks, and internal logic, eroding the architecture where each page should act as an independent mini-app. This Skill audits all entrypoints and classifies every @/components/* import so coupling is detected before it spreads. ## Core Features & Use Cases - Import Classification: Scans 125+ page/layout/loading/error/not-found entrypoints and classifies each import as Compliant (top-level or page-unit barrel), Warning (deep import), or Violation (lib/hooks/_internal dependency). - Independence Scoring: Computes a Compliant/Warning/Violation ratio to quantify how independent each page really is and track progress over time. - Staged Remediation: Produces a prioritized fix list and a phased roadmap for converting deep imports into sub-barrels, with a strict mode that promotes Warnings to Errors in CI. - Use Case: Before a release, run the report to confirm no page depends on another group's internal hooks, then plan Phase 1/2/3 sub-barrel refactors for the remaining deep imports. ## Quick Start Run the barrel isolation audit on this repository and report which pages violate the import boundary rules with a prioritized fix plan.

Frequently Asked Questions about barrel-import-boundary-guard

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

FAQPage Schema
How do I audit barrel import boundaries in a Next.js App Router project?▼

Run pnpm ci:barrel-isolation to scan all page, layout, loading, error, and not-found entrypoints. Use pnpm ci:barrel-isolation:report for a detailed report including Warnings, or the strict variant to treat Warnings as Errors.

What import patterns violate page independence in App Router?▼

Imports into internal implementation paths like @/components/<group>/lib, /hooks, or /_internal are Violations because they create shared logic across pages. Deep imports three or more levels down are Warnings, while top-level and page-unit barrels are Compliant.

How can I enforce barrel import rules in CI?▼

Use the strict mode command pnpm ci:barrel-isolation:strict, which promotes Warnings to Errors so the check fails in CI. The base command already fails on Violations, letting teams adopt the rules in phases.

Which files does the barrel isolation check scan?▼

It scans App Router entrypoints matching src/app/**/{page,layout,loading,error,not-found}.{ts,tsx}, covering over 125 entrypoints automatically. Only @/components/* imports are analyzed for boundary compliance.

How do I fix deep import warnings without breaking pages?▼

Convert deep imports into page-unit sub-barrels that expose a public API for each page's components. The skill recommends a phased roadmap, reducing Warnings gradually while eliminating Violations immediately.