barrel-export-validation-testing

Validates TypeScript barrel re-export contracts with parser residue assertions and compile-time type binding.

1|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/VilnaCRM-Org/claude-plugins --skill barrel-export-validation-testing-vilnacrm-org
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: barrel-export-validation-testing
Source: https://github.com/VilnaCRM-Org/claude-plugins/tree/main/plugins/react-frontend-sdlc/skills/barrel-export-validation-testing
Command: npx skills add https://github.com/VilnaCRM-Org/claude-plugins --skill barrel-export-validation-testing-vilnacrm-org

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Barrel guard tests that parse only some re-export forms pass vacuously: a type written in an unrecognised form is invisible to the parser, and runtime key inspection cannot see type-only exports, so a type can leak onto or vanish from a package's public surface without any test failing. ## Core Features & Use Cases - Parser residue assertion: Strip every recognised re-export form from the barrel and assert no export line remains, so unrecognised forms fail loudly instead of slipping past. - Compile-time surface binding: Reference every public type in a tuple type so dropping an export type breaks the type check, which runtime key sweeps can never catch. - Derived name validation: Compute the expected props type from the directory slug (e.g. ui-card-list → UiCardListProps) instead of relying on a loose "ends with Props" filter, with a documented exemption map for legitimate exceptions. - Negative assertions: Assert that internal-only helper types never appear in the barrel's type re-exports, covering the drift direction that presence-only checks miss. - Use Case: A component library publishes a components barrel guarded by a regex-based test. A contributor adds export type * from './tokens', which the regex does not match; the residue assertion fails immediately instead of letting the new export form bypass the contract. ## Quick Start Ask the AI to write or repair a barrel export contract test for the components index using the residue assertion, compile-time type binding, and derived-name validation patterns.

Frequently Asked Questions about barrel-export-validation-testing

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

FAQPage Schema
How do I test that a TypeScript barrel exports the correct types?▼

Barrel export testing combines a regex residue assertion with compile-time type binding. Strip every recognised re-export form and assert no export line remains, then reference each public type in a tuple type so dropping an export type breaks the type check.

Why does Object.keys not detect missing type exports in a barrel?▼

Object.keys performs runtime key inspection, and type-only exports are erased at compile time, so they never appear at runtime. Bind the type surface at compile time by referencing each public type in a tuple type instead.

How do I validate component prop types against a barrel export contract?▼

Derive the expected props type name from the directory slug, such as ui-card-list mapping to UiCardListProps, and require it in both the register row and the barrel's type re-exports. A loose ends-with-Props filter passes on typos.

Can this barrel guard pattern work in a Next.js or React SPA project?▼

Applicability is partial for React SPA and Next.js shapes, where module and shared component barrels exist but no export-contract test is present. The patterns fully apply to component-library shapes with a published package barrel.

When should I not use a barrel export guard test?▼

Do not use it to enforce which module may import which; that is a dependency-cruiser boundary rule run through the lint-deps target. The guard covers the export contract, not import direction between modules.