AI-powered PCB design assistant for Circuitron. Helps generate, plan, and layout circuits from natural language using SKiDL, KiCad, and multi-agent orchestration.
Expert assistant for Circuitron, an AI-powered PCB design accelerator that converts natural language requirements into SKiDL scripts, KiCad schematics, and PCB layouts using a multi-agent orchestration pipeline.
Circuitron follows a sophisticated, multi-stage agent workflow defined in `circuitron/pipeline.py` with nested correction loops:
1. **Planner** → **Plan Editor** (optional user feedback loop)
2. **Part Finder** → **Part Selector**
3. **Documentation Agent** (gathers context via RAG)
4. **Code Generator**
5. **Validation & Correction Loop** (Validator → Corrector until valid or retry limit)
6. **Runtime Check & Correction Loop** (Docker container check → Runtime Corrector until success)
7. **ERC & Handling Loop** (ERC Handler checks and fixes until pass or warnings accepted)
8. **Final Execution** (produces KiCad files)
Agents are created in `circuitron/agents.py` as pure functions:
```python
def create_planning_agent() -> Agent:
"""Create and configure the Planning Agent."""
model_settings = ModelSettings(tool_choice="required")
tools: list[Tool] = [execute_calculation]
return Agent(
name="Circuitron-Planner",
instructions=PLAN_PROMPT,
model=settings.planning_model,
output_type=PlanOutput,
tools=tools,
input_guardrails=[pcb_query_guardrail],
model_settings=model_settings,
)
```
**Key Points:**
Define tools in `circuitron/tools.py` using `@function_tool` decorator:
```python
@function_tool
async def search_kicad_libraries(query: str, max_results: int = 50) -> str:
"""Search KiCad libraries using skidl.search."""
# Implementation using DockerSession
```
Can also wrap existing functions:
```python
run_runtime_check_tool = function_tool(run_runtime_check)
```
All external tool execution occurs in isolated Docker containers:
Attach shared MCP server for documentation/RAG and validation:
```python
def _tool_choice_for_mcp(model: str) -> str:
return "auto" if model == "o4-mini" else "required"
def create_documentation_agent() -> Agent:
model_settings = ModelSettings(tool_choice=_tool_choice_for_mcp(settings.documentation_model))
return Agent(
name="Circuitron-DocSeeker",
instructions=DOC_AGENT_PROMPT,
model=settings.documentation_model,
output_type=DocumentationOutput,
mcp_servers=[mcp_manager.get_server()],
model_settings=model_settings,
)
```
**CRITICAL: Always reference official documentation before implementing changes.**
1. **context7 MCP server** (if available locally): Provides documentation for any library/framework
2. **Official online docs** (if in cloud environment without context7 access)
**Workflow for any API/tool usage:**
1. Look up relevant section in official documentation
2. Verify syntax, arguments, return types, intended behavior
3. Follow recommended usage patterns
4. If uncertain, re-check docs or ask for clarification — never guess or hallucinate API usage
- Functions/variables: `snake_case`
- Classes: `PascalCase`
All public functions/classes require complete docstrings:
**Test-Driven Development (TDD) is mandatory:**
1. Write failing test before production code
2. Write minimal code to pass test
3. Refactor for clarity after passing
**Testing Requirements:**
**Running Tests:**
```bash
pytest -q # Run all tests quietly after every logical change
```
**Never commit if:**
Activate virtual environment before running commands:
```powershell
& C:/Users/shaur/circuitron/circuitron_venv/Scripts/Activate.ps1
```
**Notes:**
Review recent progress notes in `collab_progress/` folder to understand:
Follow instructions in `collab_progress/PROTOCOL.md` to document your work.
**This protocol is mandatory for all AI coding assistants.**
**You are the sole implementation agent for this repository.**
1. **Always verify against official documentation** before implementing or changing behavior
2. **Never guess or hallucinate API usage** — look it up or ask for clarification
3. **All tests must pass** before any commit
4. **Maintain ≥90% branch coverage** at all times
5. **Use Docker isolation** for all external tool execution
6. **Document all work** in `collab_progress/` following the protocol
7. **Follow TDD**: Test first, minimal implementation, then refactor
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/circuitron-pcb-design-assistant/raw