agentleFS
HaibaraAiAPTXHaibaraAiAPTX/frontend-openapi-skills/skills/generate-barrels/SKILL.md

generate-barrels

Skill1 starsChanged 47 days agoMITView on GitHub

Generate barrel index.ts files for TypeScript projects. Use when user mentions: (1) barrel files, (2) index.ts exports, (3) re-export files, (4) simplify import paths, (5) create index files for directory, or (6) generate export aggregators.

  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask user for target directory path

    line 41
  2. Very specific:

    Only generates index.ts barrel files, no other code

    line 87
  3. Very specific:

    Only processes .ts files, not .tsx, .js, etc.

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Generate Barrel Files

Generate barrel index.ts files for TypeScript directories to simplify imports.

Note: Generation commands (model gen, aptx functions, react-query, vue-query) automatically update barrel files after generation. Use this command only for manual fixes or special cases.

When to Use This Command

ScenarioAction
Normal generationBarrel files are auto-updated - no action needed
Fixing corrupted barrel filesUse this command
Processing non-standard directory structuresUse this command
One-time batch updates across multiple directoriesUse this command

Prerequisites

pnpm add -D @aptx-js/frontend-tk-cli

Usage

pnpm exec aptx-ft barrel gen -i <input-dir>

Alternative (without pnpm):

npx aptx-ft barrel gen -i ./src/functions

Workflow

  1. Ask user for target directory path
  2. Show complete command and confirm with user
  3. Execute and report results

Common Directories

DirectoryPurpose
./src/functionsFunction modules
./src/apiAPI modules
./srcEntire source directory

Examples

# Generate for functions directory
pnpm exec aptx-ft barrel gen -i ./src/functions

# Generate for entire src directory
pnpm exec aptx-ft barrel gen -i ./src

# Generate for specific module
pnpm exec aptx-ft barrel gen -i ./src/api

Output

Recursively scans directory and generates barrel files at all levels:

src/
├── index.ts                    # Exports functions, react-query, spec
├── functions/
│   ├── index.ts                # Exports application, assignment, ...
│   └── application/
│       └── index.ts            # Exports getXXX, setXXX, ...
├── react-query/
│   ├── index.ts                # Exports application, assignment, ...
│   └── application/
│       └── index.ts            # Exports *.query.ts, *.mutation.ts
└── spec/
    └── ...

Boundaries

  • Only generates index.ts barrel files, no other code
  • Subdirectory index.ts files are overwritten
  • Root index.ts is NOT overwritten if it exists with different content (protects manual entry files)
  • Automatically skips node_modules and hidden directories (starting with .)
  • Only processes .ts files, not .tsx, .js, etc.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.