xiaohongshu
xiaohongshu
check-barrel-files
Check for redundant barrel files (index.ts) that only re-export a single item.
Full skill instructions
Check for redundant barrel files (index.ts) that only re-export a single item.
$ARGUMENTS - The library path to check (e.g., libs/mxsecurity/account-page)Redundant barrel files are index.ts files that:
export * from './xxx' statementlibs/scope/domain/features/src/
├── index.ts # exports from './lib/my-dialog'
└── lib/
└── my-dialog/
├── index.ts # Redundant: only exports './my-dialog.component'
└── my-dialog.component.ts
libs/scope/domain/features/src/
├── index.ts # exports from './lib/my-dialog/my-dialog.component'
└── lib/
└── my-dialog/
└── my-dialog.component.ts # No intermediate barrel file
Find all index.ts files in the target path:
find {$ARGUMENTS} -name "index.ts" -type f
For each index.ts file found:
A barrel file is redundant if:
export * from './folder-name'index.ts that also only exports one itemOutput a markdown report:
# Barrel File Check Report
**Path:** {$ARGUMENTS}
**Date:** {current_date}
## Summary
| Total index.ts | Redundant | OK |
|----------------|-----------|-----|
| X | Y | Z |
## Redundant Barrel Files
| File | Exports | Recommendation |
|------|---------|----------------|
| `lib/my-dialog/index.ts` | `./my-dialog.component` | Delete, update parent to export directly |
## Recommended Fixes
### 1. {path/to/redundant/index.ts}
**Current:**
```typescript
// src/index.ts
export * from './lib/my-dialog';
// lib/my-dialog/index.ts
export * from './my-dialog.component';
Recommended:
// src/index.ts
export * from './lib/my-dialog/my-dialog.component';
// Delete: lib/my-dialog/index.ts
| File | Export Count | Reason |
|---|---|---|
domain/src/index.ts | 5 | Multiple exports |
## Auto-Fix Option
After showing the report, ask the user:
> Found {N} redundant barrel files. Would you like me to fix them automatically?
If user confirms, for each redundant barrel:
1. Update the parent `index.ts` to export directly from the component file
2. Delete the redundant `index.ts` file
## Examples
### Example 1: Simple Redundant Barrel
Before: features/src/index.ts → export * from './lib/account-dialog' features/src/lib/account-dialog/index.ts → export * from './account-dialog.component'
After: features/src/index.ts → export * from './lib/account-dialog/account-dialog.component' (deleted: features/src/lib/account-dialog/index.ts)
### Example 2: Valid Multi-Export Barrel (Keep)
domain/src/index.ts: export * from './lib/account-page.api'; export * from './lib/account-page.model'; export * from './lib/account-page.store';
→ This is valid, do not modify
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience