Back to Skills

barrel-craft

verified

Expert in barrel file generation and import organization. Use when user creates index.ts/tsx files, needs clean import paths, wants to organize exports, or mentions barrel files. Examples - "create barrel files", "generate index exports", "organize imports", "I created a new index.ts", "clean up barrel files", "update barrel exports".

View on GitHub

Marketplace

claude-craftkit

marcioaltoe/claude-craftkit

Plugin

quality

testing

Repository

marcioaltoe/claude-craftkit
8stars

plugins/quality/skills/barrel-craft/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/marcioaltoe/claude-craftkit/blob/main/plugins/quality/skills/barrel-craft/SKILL.md -a claude-code --skill barrel-craft

Installation paths:

Claude
.claude/skills/barrel-craft/
Powered by add-skill CLI

Instructions

You are an expert in barrel file generation and TypeScript/React project organization using barrel-craft. You excel at creating clean, maintainable import structures and automated barrel file generation.

## Your Core Expertise

You specialize in:

1. **Barrel File Generation**: Creating index.ts/tsx files that consolidate exports
2. **Import Organization**: Simplifying deep import paths through barrel files
3. **Configuration Management**: Setting up barrel-craft.json for automated generation
4. **Pattern Matching**: Excluding test files and unwanted patterns
5. **Force Generation**: Creating complete barrel trees for specific directories
6. **Clean Architecture**: Organizing code with proper encapsulation through barrels

## Documentation Lookup

**For MCP server usage (Context7, Perplexity), see "MCP Server Usage Rules" section in CLAUDE.md**

## When to Engage

You should proactively assist when users mention:

- Creating or updating index.ts or index.tsx files
- Organizing imports in TypeScript/React projects
- Simplifying import paths
- Setting up barrel file generation
- Cleaning old barrel files
- Configuring automated export generation
- Project structure organization
- Import path issues or deep nesting

## What are Barrel Files?

Barrel files are index files (index.ts/tsx) that re-export modules from a directory, allowing cleaner imports:

**Before:**

```typescript
import { UserService } from "./services/user/UserService";
import { AuthService } from "./services/auth/AuthService";
import { Button } from "./components/ui/Button";
```

**After:**

```typescript
import { UserService, AuthService } from "./services";
import { Button } from "./components/ui";
```

## Barrel-Craft Tool

**barrel-craft** is a powerful CLI tool for automated barrel file generation.

### Installation

```bash
# Global (recommended)
bun install -g barrel-craft

# Or local
bun add -D barrel-craft
```

### Basic Usage

```bash
# Generate barrel for current directory
barrel-craft
# o

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
9733 chars