Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

feature-folders

БесплатноБез исполняемых скриптовНе проверен

Break a giant source file into feature folders, each with a named owner from the team. Prove nothing changed without running the app. Move code with a tool…

atrislabsот atrislabs★ 71 звезда на GitHub

Об этом скилле

Feature folders

A file with tens of thousands of lines has no owner. Every agent edits it, nobody can read it whole and every change risks a neighbour. Splitting it by feature gives each part a home and a person who answers for it.

The split must change nothing. The proof is a text rebuild, not a feeling.

The real run

On 2026-11-16 the desktop app's main.js went from 37,560 lines to 8,529. About 29,000 lines moved into 17 folders under src/features/ (browser, engines, voice, payments, team, core, smoke and others). Each folder got a README naming its owner. It landed as one pull request after a script did every move and a rebuild showed the old file came back exactly, apart from blank lines.

What made it work: one tool did all the moving, the rules for what may move were strict and the proof was mechanical.

The short version

  1. One script parses the file and does every move.
  2. Move only functions and inline request handlers that do not run at load time.
  3. Give each piece a feature folder and each folder an owner.
  4. Rebuild the old file from the new ones and diff. Only blank lines may differ.
  5. Run the related checks on your branch and on the published code. Only new failures count.

Before you start

  • Work in a short-lived copy (atris worktree start), never the main checkout.
  • Freeze the original file. Copy it somewhere read-only. Every proof compares against this copy.
  • Read atris/team/ so you know who can own what.

1. Move with a tool

Never move code by hand. Never let several agents edit the big file at once. Hand moves drop a line. Parallel edits collide.

Write one script that parses the file. The TypeScript compiler API parses plain JS fine. For every top-level statement, record:

  • the names it declares
  • the top-level names it reads
  • the top-level names it assigns

This table drives every later step.

For a plain CommonJS file, that script already exists: atris ships it as lib/split-file.js (in a global install, $(npm root -g)/atris/lib/split-file.js). The next file needs only a plan, not new code. It needs the TypeScript parser once, kept outside the repo: npm i --prefix ~/.cache/atris-split typescript.

node lib/split-file.js analyze --plan <dir>/split-plan.json --verbose   # what moves where, writes nothing
node lib/split-file.js split   --plan <dir>/split-plan.json             # every move, READMEs, order file, MEMBER.md pointers
node lib/split-file.js rebuild --plan <dir>/split-plan.json --out /tmp/original.js
node lib/split-file.js verify  --plan <dir>/split-plan.json             # rebuild diff, node --check, loads, wiring, unresolved names

The plan names each feature, its owner and its functions, by exact name, by a span from one function through another, or by pattern. commands/task/split-plan.json is a worked example: it split commands/task.js from 12,519 lines to 829 on 2026-11-16. The tool moves function declarations only, not inline request handlers.

2. Decide what may move

Safe to move:

  • function declarations
  • request handler registrations whose callback is written inline, like ipcMain.handle('app:save', async () => {...})

Keep in place:

  • anything reachable from code that runs while the file is still loading
  • anything that reads a top-level variable reassigned later (a moved copy would hold a stale value)
  • anything that assigns a top-level name

Callbacks handed to an event, ready or timer host run later, not during load. They do not pin code in place.

3. Assign each piece to a feature

In this order:

  • Handlers go by their request name (app:browser-navigate goes to browser).
  • Functions go to the feature whose handlers reach them.
  • Still unplaced, go by name.
  • Pieces many features share go to core.
  • The app's own self-tests go to smoke.

Look at the result before writing anything. A folder of 40 unrelated functions means the rules need another pass.

4. Write each piece byte for byte

Copy the statement text exactly. Then wire it:

  • Borrowed names. Each new file declares the names it borrows and receives them through one function, bindMain(deps). The main file calls every bindMain as its very last startup step.
  • Handlers. Each new file exports registerIpc(ipcMain). The main file calls it where the first moved handler used to sit. Registration order stays the same.
  • Direct requires. A folder requires another folder directly only when the two do not depend on each other in a loop. Loops go through bindMain.
  • Path globals. __dirname means a different folder now. Replace it with a named value the main file sets, like MAIN_DIR.
  • Relative requires. Rewrite require('./src/lib/x.cjs') so it still points at the same file from the new folder.

A tiny example of the top of a moved file:

let apiJson, isTrustedSender;
function bindMain(deps) { ({ apiJson, isTrustedSender } = deps); }
function registerIpc(ipcMain) {
  // moved handlers, unchanged
}
module.exports =
Полный SKILL.md на GitHub

Установить feature-folders в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл feature-folders?

Break a giant source file into feature folders, each with a named owner from the team. Prove nothing changed without running the app. Move code with a tool that parses the file, never by hand. Use when one file has grown too big for agents to read or edit safely. Triggers on split a big file, decompose, file too big, modularize, monolith, feature folders, main.js too big, organize code by feature.

Как установить скилл feature-folders?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл feature-folders запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить feature-folders с