library
Provides guidance on the Faebryk library structure, component definitions, and the auto-generation of _F.py exports.
Install
mkdir -p .claude/skills/library && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3010" && unzip -o skill.zip -d .claude/skills/library && rm skill.zipInstalls to .claude/skills/library
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Structure Faebryk component library modules
- →Manage auto-generation of _F.py facade files
- →Define conventions for components, traits, and interfaces
- →Support topological sorting for library exports
How it works
The skill uses a generator script to scan library files, detect class definitions, and write a barrel module that re-exports types via topological sort.
Inputs & outputs
When to use library
- →Creating new hardware components
- →Adding behavior traits to modules
- →Modifying existing library definitions
About this skill
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
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 Fpattern. - This file is generated; do not hand-edit it.
- Eagerly imports and re-exports library modules/types for the
- 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.
- Scans
- 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 asF). - Compiler: The compiler maps
atobuilt-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 likeResistor). - Export model:
_F.pyis a generated “barrel” module; importing it is intentionally convenient but can be heavyweight.
Development Workflow
- New Component: Create a new file
MyComponent.pyinsrc/faebryk/library/. Inherit fromNode(or a more specific base). - Naming Convention: Class names should match the file basename (usually).
- Regenerate
_F.py: runpython tools/library/gen_F.pyand commit the updatedsrc/faebryk/library/_F.py.
Testing
- Library tests live under
test/library/(includingtest/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_parttrait. - Parameters: Use
F.Parametersto define physical properties likeresistance,capacitance, etc. - Documentation: Add docstrings to components explaining their ports and parameters.
When not to use it
- →When manually editing the auto-generated _F.py file
Prerequisites
Limitations
- →Requires manual regeneration of _F.py after adding new components
- →Requires adherence to specific class naming conventions
How it compares
It automates the maintenance of the facade module, preventing manual import errors and circular dependencies.
Compared to similar skills
library side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| library (this skill) | 1 | 5mo | No flags | Intermediate |
| python-project-structure | 8 | 6mo | No flags | Beginner |
| graph | 6 | 6mo | No flags | Advanced |
| generate-subsystem-skills | 1 | 7mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by atopile
View all by atopile →You might also like
python-project-structure
wshobson
Python project organization, module architecture, and public API design. Use when setting up new projects, organizing modules, defining public interfaces with __all__, or planning directory layouts.
graph
atopile
How the Zig-backed instance graph works (GraphView/NodeReference/EdgeReference), the real Python API surface, and the invariants around allocation, attributes, and cleanup.
generate-subsystem-skills
llama-farm
Generate specialized skills for each subsystem in the monorepo. Creates shared language skills and subsystem-specific checklists for high-quality AI code generation.
faebryk
atopile
How Faebryk’s TypeGraph works (GraphView + Zig edges), how to traverse/resolve references, and how FabLL types/traits map onto edge types.
tool-renderer
daaain
Implement specialized rendering for Claude Code tools. Use when adding a new tool type (WebSearch, WebFetch, etc.) to the transcript viewer, or when asked to implement tool rendering.
lsp
atopile
How the atopile Language Server works (pygls), how it builds per-document graphs for completion/hover/defs, and the invariants for keeping it fast and crash-proof.