domain-layer

Instructions for electronics-specific logic and build processes: netlists, PCBs, build steps, and exporters. Use when implementing or modifying build steps, exporters, PCB generation, or BOM/netlist output.

3,147 stars

Best use case

domain-layer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Instructions for electronics-specific logic and build processes: netlists, PCBs, build steps, and exporters. Use when implementing or modifying build steps, exporters, PCB generation, or BOM/netlist output.

Teams using domain-layer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/domain-layer/SKILL.md --create-dirs "https://raw.githubusercontent.com/atopile/atopile/main/.claude/skills/domain-layer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/domain-layer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How domain-layer Compares

Feature / Agentdomain-layerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Instructions for electronics-specific logic and build processes: netlists, PCBs, build steps, and exporters. Use when implementing or modifying build steps, exporters, PCB generation, or BOM/netlist output.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Domain Layer Module

The `domain layer` (primarily `src/atopile/build_steps.py` and `src/faebryk/exporters/`) encompasses the logic and processes specific to electronic hardware engineering. This includes the build pipeline that transforms a compiled graph into manufacturing artifacts (Gerbers, BOMs, Pick & Place).

## Quick Start

Run the standard build pipeline from a project directory (where `ato.yaml` lives):

```bash
ato build
```

## Relevant Files

- **Build Orchestration**: `src/atopile/build_steps.py`
    - Defines the `Muster` class (a DAG-based task runner).
    - Registers standard build targets: `generate_bom`, `generate_manufacturing_data`, `update_pcb`, etc.
- **Build entry / app init**: `src/atopile/build.py` (constructs app graph from `.ato` or `.py`, runs unit inference)
- **Exporters**: `src/faebryk/exporters/`
    - **pcb/**: KiCad PCB generation and layout sync (`layout_sync.py`).
    - **bom/**: Bill of Materials generation (`jlcpcb.py`, etc.).
    - **netlist/**: Netlist formatting.
    - **documentation/**: Datasheets, diagrams.
- **Layout sync inputs**:
  - `src/atopile/layout.py` (generates `.layouts.json` module→layout mapping)
  - `src/atopile/kicad_plugin/README.md` (plugin workflow overview)

## Dependants (Call Sites)

- **CLI (`src/atopile/cli/build.py`)**: The `ato build` command directly invokes `build_steps.muster` to execute the pipeline.
- **IDE/Extension**: May invoke specific build steps for previews (e.g., `generate_3d_render`).

## How to Work With / Develop / Test

### Core Concepts
- **Muster**: The task runner. Targets declare dependencies (e.g. `generate_bom` depends on `build_design`).
- **Layout Sync**: The process of preserving manual PCB layout changes while updating the netlist/components from the code (`update_pcb`).
- **Artifacts**: Files produced by the build process, stored in the build directory.

### Development Workflow
1.  **Adding a Config Option**: If a new build step needs configuration, add it to `atopile.config` (not covered here, but relevant).
2.  **New Exporters**: Create a new module in `src/faebryk/exporters/` and register a wrapper function in `build_steps.py` using `@muster.register`.

### Testing
- **Integration Tests**: Since this layer orchestrates the whole flow, it is best tested via end-to-end tests or integration tests in `test/end_to_end/` or `test/integration/`.
- **Manual Verification**: Run `ato build` on a sample project and inspect the generated artifacts (Gerbers, BOM csv).
- **Muster unit tests**: `ato dev test --llm test/test_muster.py -q`

## Best Practices
- **Idempotency**: Build steps should generally be idempotent.
- **Virtual Targets**: Use `virtual=True` for targets that just group other targets (e.g. `all` or `default`).
- **Layout Preservation**: Be extremely careful when modifying `update_pcb` or `layout_sync` logic to avoid dataloss of user's manual PCB routing.

Related Skills

lsp

3147
from atopile/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.

solver

3147
from atopile/atopile

How the Faebryk parameter solver works (Sets/Literals, Parameters, Expressions), the core invariants enforced during mutation, and practical workflows for debugging and extending the solver. Use when implementing or modifying constraint solving, parameter bounds, or debugging expression simplification.

SEXP Benchmark Strategy

3147
from atopile/atopile

## Goal

sexp

3147
from atopile/atopile

How the Zig S-expression engine and typed KiCad models work, how they are exposed to Python (pyzig_sexp), and the invariants around parsing, formatting, and freeing. Use when working with KiCad file parsing, S-expression generation, or layout sync.

pyzig

3147
from atopile/atopile

How the Zig↔Python binding layer works (pyzig), including build-on-import, wrapper generation patterns, ownership rules, and where to add new exported APIs. Use when adding Zig-Python bindings, modifying native extensions, or debugging C-API interactions.

planning

3147
from atopile/atopile

Spec-driven planning for complex design tasks: when to plan, how to write specs as .ato files, and how to verify against requirements.

Package Agent

3147
from atopile/atopile

You are a package specialist.

library

3147
from atopile/atopile

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.

graph

3147
from atopile/atopile

How the Zig-backed instance graph works (GraphView/NodeReference/EdgeReference), the real Python API surface, and the invariants around allocation, attributes, and cleanup. Use when working with low-level graph APIs, memory management, or building systems that traverse the instance graph.

frontend

3147
from atopile/atopile

Frontend standards for atopile extension webviews: architecture, contracts, design system, and testing workflow.

faebryk

3147
from atopile/atopile

How Faebryk's TypeGraph works (GraphView + Zig edges), how to traverse/resolve references, and how FabLL types/traits map onto edge types. Use when working with TypeGraph traversal, edge types, or building type-aware queries.

fabll

3147
from atopile/atopile

How FabLL (faebryk.core.node) maps Python node/trait declarations into the TypeGraph + instance graph, including field/trait invariants and instantiation patterns. Use when defining new components or traits, working with the Node API, or understanding type registration.