library — скилл для Claude Code: что делает и как установить
Скилл library объясняет структуру библиотеки компонентов Faebryk в atopile, генерацию фасада _F.py и правила создания новых модулей и трейтов.
MIT 1 установок ★ 4 090 обновлён 2026-10-14
npx skills add atopile/atopile --skill library -a claude-codeЧто делает library
Скилл описывает устройство стандартной библиотеки Faebryk в каталоге src/faebryk/library/. Он задаёт чёткое разделение понятий: физические детали (компоненты вроде Resistor или Capacitor) описывают объект и наследуются от Node, а трейты (can_bridge, is_power) определяют поведение.
Файл src/faebryk/library/_F.py служит входным фасадом для импорта компонентов через F.<Name>. Редактировать его вручную бесполезно: скрипт tools/library/gen_F.py сканирует каталог, выполняет топологическую сортировку ссылок для защиты от циклических зависимостей и полностью перезаписывает фасад.
Для проверки новых узлов запускается дымовой тест командой ato dev test --llm test/library/test_instance_library_modules.py -q.
Какие задачи решает
- добавить новый компонент платы с наследованием от
Node - создать трейт для описания поведения электронного узла
- перегенерировать фасад
_F.pyбез циклических импортов - прогнать тесты инстанцирования модулей в Faebryk
Примеры запросов агенту
- Помоги создать новый компонент конденсатора в
src/faebryk/library/по правилам Faebryk - Как правильно перегенерировать файл
_F.pyпосле добавления класса? - Добавь трейт
can_bridgeк новому узлу и покажи команду для проверки
Как установить library
1Через Skills CLI (Vercel)
npx skills add atopile/atopile --skill library -a claude-code2Вручную: положить файлы
~/.claude/skills/library/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/library/
1Через Skills CLI (Vercel)
npx skills add atopile/atopile --skill library -a codex2Вручную: положить файлы
.agents/skills/library/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add atopile/atopile --skill library -a cursor2Вручную: положить файлы
.cursor/skills/library/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install atopile/atopile .claude/skills/library2Вручную: положить файлы
.github/skills/library/SKILL.md1Через Skills CLI (Vercel)
npx skills add atopile/atopile --skill library -a gemini-cli2Командой платформы
gemini skills install https://github.com/atopile/atopile --path .claude/skills/libraryВручную: положить файлы
.devin/skills/library/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add atopile/atopile --skill library -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о library
Как установить library в Claude Code?
Выполните в терминале команду npx skills add atopile/atopile --skill library -a claude-code.
Зачем нужен файл _F.py?
Он собирает экспорт всех модулей и типов библиотеки в один фасад для импорта через псевдоним F. Файл создаётся генератором tools/library/gen_F.py, поэтому менять его вручную нельзя.
В чём разница между компонентами и трейтами в Faebryk?
Компоненты представляют физические элементы оборудования и наследуются от Node, а трейты задают поведение и возможности узлов.
Исходный текст
SKILL.md · MIT
--- name: library description: "How the Faebryk component library is structured, how `_F.py` is generated, and the conventions/invariants for adding new library modules. Use when adding or modifying library components, traits, or module definitions." --- # Library Module The `library` module (located in `src/faebryk/library/`) contains the collection of reusable components, traits, and interfaces that form the "standard library" of the hardware design language. ## Quick Start ```python import faebryk.core.faebrykpy as fbrk import faebryk.core.graph as graph import faebryk.library._F as F g = graph.GraphView.create() tg = fbrk.TypeGraph.create(g=g) resistor = F.Resistor.bind_typegraph(tg=tg).create_instance(g=g) ``` ## Relevant Files - **Facade (auto-generated)**: `src/faebryk/library/_F.py` - Eagerly imports and re-exports library modules/types for the `import faebryk.library._F as F` pattern. - This file is generated; do not hand-edit it. - **Generator**: `tools/library/gen_F.py` - Scans `src/faebryk/library/*.py`, detects whether the file contains a same-named class, and writes `_F.py`. - Orders exports via a topological sort of `F.<Name>` references to avoid import-order cycles. - **Components**: `src/faebryk/library/` contains specific component definitions (e.g. `Resistor.py`, `Capacitor.py`, `LED.py`). - **Traits/Interfaces**: Also contains trait definitions (e.g. `can_bridge.py`, `is_power.py`). ## Dependants (Call Sites) - **User Code**: atopile projects heavily import from `faebryk.library._F` (aliased as `F`). - **Compiler**: The compiler maps `ato` built-ins to these classes. ## How to Work With / Develop / Test ### Core Concepts - **Traits vs Components**: Use Traits for behavior (what it *can do* like `can_bridge`) and Components for physical things (what it *is* like `Resistor`). - **Export model**: `_F.py` is a generated “barrel” module; importing it is intentionally convenient but can be heavyweight. ### Development Workflow 1. **New Component**: Create a new file `MyComponent.py` in `src/faebryk/library/`. Inherit from `Node` (or a more specific base). 2. **Naming Convention**: Class names should match the file basename (usually). 3. **Regenerate `_F.py`**: run `python tools/library/gen_F.py` and commit the updated `src/faebryk/library/_F.py`. ### Testing - Library tests live under `test/library/` (including `test/library/nodes/`). - A good smoke test for new modules is: - `ato dev test --llm test/library/test_instance_library_modules.py -q` ## Best Practices - **Atomic Parts**: Mark leaf components (specifically verified part numbers) with the `is_atomic_part` trait. - **Parameters**: Use `F.Parameters` to define physical properties like `resistance`, `capacitance`, etc. - **Documentation**: Add docstrings to components explaining their ports and parameters.
© atopile · MIT · atopile/atopile