/freecad-cli:freecad-clifrom freecad-cli
Installs, updates, and operates freecad-cli, a CLI tool that controls FreeCAD via XML-RPC for 3D modeling, Python execution, screenshots, and troubleshooting.
Ships in freecad-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
freecad-cli is a shell bridge into a running FreeCAD GUI process.
execute-code is the primary primitive and can reach the full FreeCAD Python API.Follow this playbook in order.
| Requirement | Command | Pass criteria |
|---|---|---|
| Python 3.12+ | python3 --version | Version 3.12 or higher |
| uv | uv --version | Command exists |
| FreeCAD | Ask user | FreeCAD app is running |
If uv is missing (install after user permission):
curl -LsSf https://astral.sh/uv/install.sh | sh
If the user provides a repository path, use it. Otherwise clone:
git clone https://github.com/yoshikouki/freecad-cli.git
cd freecad-cli
uv tool install -e .
Verify: freecad-cli --help runs without error.
freecad-cli install-addon
Expected: JSON with "status": "ok". Already installed is normal.
Check data.path: the installer selects Mod under the newest existing
FreeCAD/vX-Y directory, or the unversioned FreeCAD folder if none exists.
If the running FreeCAD uses an older directory, specify its actual Mod
directory with freecad-cli install-addon --mod-dir /path/to/FreeCAD/v1-1/Mod.
The addon initializes at FreeCAD startup. Ask the user to restart FreeCAD and confirm before proceeding.
freecad-cli ping
Expected: {"status": "ok", "data": true}
If this fails, see troubleshoot.md.
cd <freecad-cli repo directory>
git pull
uv tool install -e . --force
The FreeCAD addon is linked to the repository (symlink on macOS/Linux, directory junction on Windows). File changes from git pull are reflected on disk immediately, but FreeCAD must be restarted to reload the addon into its Python runtime. In practice, addon changes are rare — the design keeps the addon minimal.
Run these checks before modeling and when commands fail unexpectedly:
freecad-cli --help # CLI installed?
freecad-cli ping # RPC connection?
freecad-cli active-document # Document available?
command not found → re-run Setupconnection_refused → FreeCAD not running, or addon not installed / FreeCAD not restartedtimeout → FreeCAD running but unresponsive, try restartingactive-document returns null → create a document first: freecad-cli create-document <name>freecad-cli ping and freecad-cli active-document.execute-code for FreeCAD API work. Keep scripts small enough to diagnose failures.doc.recompute() after every geometry or constraint change.print() output for state checks.export command when producing STL, STEP, or FCStd files.For common modeling snippets, read execute-code-patterns.md. For failures, read troubleshoot.md.
# Inline
freecad-cli execute-code 'print(FreeCAD.ActiveDocument.Name)'
# From file
freecad-cli execute-code --file script.py
# Pipe from stdin
cat script.py | freecad-cli execute-code -
echo 'print(1+1)' | freecad-cli execute-code -
Available modules: FreeCAD, FreeCADGui, Part, PartDesign, Sketcher, Mesh, Draft
Use print() for output. For structured data: import json; print(json.dumps(data)).
freecad-cli create-document MyPart
freecad-cli list-documents
freecad-cli active-document
freecad-cli set-active-document MyPart
freecad-cli export stl -o output.stl
freecad-cli export step -o output.step --object MyBody
freecad-cli export fcstd -o model.FCStd
freecad-cli screenshot # 800px default
freecad-cli screenshot --width 1920 # custom width
Output is a base64-encoded square PNG.
freecad-cli --host localhost --port 9875 --timeout 30 execute-code '...'
Increase --timeout for heavy operations (STL export, complex booleans).
All commands return JSON:
{"status": "ok", "data": <value>}{"status": "error", "error": "<message>", "code": "<error_code>"}Error codes: connection_refused, timeout, rpc_fault, invalid_input, installation_error
See execute-code-patterns.md for common FreeCAD Python snippets.
See troubleshoot.md for setup and runtime error solutions.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub yoshikouki/freecad-cli --plugin freecad-cliOther plugins' skills for the same job