solidworks
Skill0 starsChanged 7 months agoMITView on GitHub
Operate SolidWorks on Windows through Python COM - create or edit parts, build assemblies with real mates, make drawings, export STEP/STL/IGES/PDF/DXF, measure mass properties and interference, and deliver CAD with verified evidence. Use when the user asks an agent to model, modify, inspect, export, review or qualify anything in SolidWorks (.sldprt, .sldasm, .slddrw), or to automate SolidWorks with Python or the SolidWorks API.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Cloud-Cad-Ai/solidworks-mcptheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Cloud-Cad-Ai/solidworks-mcp★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- ai-account-receiptsSkill
- architectSkill
- blast-radiusSkill
- bomSkill
- broSkill
- councilSkill
- create-verification-skillSkill
- datasheetsSkill
- digikeySkill
- element14Skill
- emcSkill
- excalidraw-skillSkill
- grill-meSkill
- handoffSkill
- howSkill
- jlcpcbSkill
- kicad-jlcpcb-rotationsSkill
- kicad-library-managmentSkill
- kicad-library-partSkill
- kicadSkill
- lcscSkill
- maintain-verification-skillSkill
- mermaid-skillSkill
- mouserSkill
- no-commentsSkill
- pcbwaySkill
- code-brainstormingSkill
- code-debuggingSkill
- code-explain-visuallySkill
- code-reviewingSkill
- code-simplifierSkill
- git-commitSkill
- git-worktreesSkill
- spiceSkill
- teachSkill
- technical-writingSkill
- tscircuitSkill
- unslopSkill
- whySkill
- writing-for-agentsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 9 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill when an agent must operate SolidWorks as a tool, not only write a macro.
- Distinctive: line 24
Before claiming that SolidWorks was controlled or that any artifact was created, prove that the current runtime can:
- Distinctive: line 29
import the required COM dependencies.
- Very specific: line 33
Run python <skill-dir>/scripts/sw_preflight.py --no-install and read its output.
- Distinctive: line 40
Never claim that a file was generated, verified, attached, uploaded, or made downloadable unless a tool created it and you inspected its …
- Distinctive: line 52
Never start a second SolidWorks.
- Very specific: line 58
Create, open and import through sw_documents.new_owned/open_owned/import_owned, and close only with DocumentOwnership.close/close_all.
- Distinctive: line 65
Before changing CAD, record:
- Distinctive: line 73
Never overwrite the user's only source model.
- Very specific: line 80
Use the Python helpers in scripts/ rather than generated VBA.
- Very specific: line 83
After each topology change: rebuild, then measure with sw_inspect (feature health, body count, volume, mass properties, envelope).
- Distinctive: line 86
Look at the preview images.
- Very specific: line 157
Use the feature object or ActiveSketch.Name that the API returns.
- Very specific: line 161
Add named driving dimensions for interfaces, then require a fully defined sketch (sw_inspect.fully_define_active_sketch).
- Very specific: line 172
Verify transforms, constrained states, intended free motion (sw_runtime.transform_and_solve), and interference.
- Distinctive: line 204
Read only what the task needs:
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SolidWorks
Use this skill when an agent must operate SolidWorks as a tool, not only write a macro. The result is a reproducible CAD artifact plus evidence that it was rebuilt, measured, saved, exported and reviewed.
<skill-dir> below is the directory that contains this file (in Claude Code:
${CLAUDE_SKILL_DIR}). Helpers live in <skill-dir>/scripts:
import sys
sys.path.insert(0, r"<skill-dir>/scripts")Capability gate
Before claiming that SolidWorks was controlled or that any artifact was created, prove that the current runtime can:
- execute a real local shell and Python process;
- access the requested Windows output directory;
- import the required COM dependencies; and
- connect to
SldWorks.Applicationin the same interactive Windows session as SolidWorks.
Run python <skill-dir>/scripts/sw_preflight.py --no-install and read its output. If
dependencies are missing, ask the user before installing pywin32 and comtypes. If
the runtime cannot run commands, reach the user's files, or reach the SolidWorks COM
session, stop and say that you can only provide instructions or code.
Uploading this repository as chat knowledge does not grant local shell, filesystem,
COM, or desktop access.
Never claim that a file was generated, verified, attached, uploaded, or made downloadable unless a tool created it and you inspected its absolute path, size, and modification time. Do not present plain text as a download link, invent an attachment, or send the user to look for an artifact the runtime did not produce. Keep the requested file name consistent from creation through delivery.
Session safety
The user may have their own work open. Read references/session-safety.md before the
first COM call in a session.
python <skill-dir>/scripts/sw_resource_guard.py --target solidworks --allow-reuse. Never start a second SolidWorks. Never kill a process you did not start.- Attach to the running SolidWorks with
sw_runtime.attach(major). Pin the major version (2024 = 32, 2025 = 33) when more than one release is installed. If none is running, ask the user before launching one. - List open documents with
sw_documents.open_document_report(app). Do not save, close, rebuild or edit documents you did not create or open in this process. - Create, open and import through
sw_documents.new_owned/open_owned/import_owned, and close only withDocumentOwnership.close/close_all. - Change user preferences only inside a restoring context such as
sw_runtime.no_dimension_input_dialog(app).
Operating contract
Before changing CAD, record:
- the source model and whether it may be modified (default: work on a copy);
- units, interfaces, invariants, tolerances and material assumptions;
- the outputs required (
.SLDPRT,.SLDASM,.SLDDRW, STEP, STL, PDF, previews); - acceptance checks (rebuild, body count, dimensions, volumes, mates, interference);
- unknown values as
null. Never guess a dimension; ask or record an explicit assumption.
Never overwrite the user's only source model. Keep source, generated CAD, exports, previews and evidence as separate artifacts.
Agent loop
- Preflight, resource guard, attach (above).
- Turn the request into inputs, constraints, outputs and checks.
- Use the Python helpers in
scripts/rather than generated VBA. - Build one small stage at a time. Check every COM return value:
None,False, a nonzero error code or an unexpected body count is a failure, even if a file was written. - After each topology change: rebuild, then measure with
sw_inspect(feature health, body count, volume, mass properties, envelope). - Save, export, then run
sw_review.run_review()for previews and delivery hygiene. - Look at the preview images. Rule-based review cannot prove geometric intent.
- On failure, classify it first: environment, selection, geometry, rebuild, export, path/encoding, dialog, timeout, or resource conflict. Change one variable and retry from the earliest uncertain stage, with a bounded number of attempts.
- Finish only when the required artifacts and evidence exist. Report each artifact's verified absolute paths, sizes, and modification times.
scripts/sw_evidence.py records atomic JSON evidence with SHA-256 per artifact and
refuses release while checks are missing or a visual review is pending.
scripts/sw_agent_loop.py enforces the workflow states (references/agent-loop.md).
Modules
| Need | Module |
| Environment and dependency checks | sw_preflight.py |
| Single heavyweight CAD/CAE instance | sw_resource_guard.py |
| Attach, version pinning, preferences, transforms | sw_runtime.py |
| Document ownership and safe open/import/close | sw_documents.py |
| Legacy connect/open/save helpers and session facade | sw_connect.py, sw_session.py |
| Sketches and part features | sw_part.py |
| Components, real mates, interference | sw_assembly.py |
| Mass properties, feature health, sketch state, references, BOM/PDF readback | sw_inspect.py |
| Drawings | sw_drawing.py |
| STEP/STL/IGES/PDF/DXF export | sw_export.py |
| Portable packages and reference repointing | sw_package.py |
| Multi-view previews and review report | sw_review.py |
| Structured evidence and workflow states | sw_evidence.py, sw_agent_loop.py |
| Guarded generated VBA (last resort) | sw_macro_guard.py |
| Appearance colors | sw_appearance.py |
Minimal part workflow
import sys
sys.path.insert(0, r"<skill-dir>/scripts")
from sw_connect import mm, save_document
from sw_documents import DocumentOwnership, new_owned
from sw_export import export_to_step
from sw_inspect import snapshot
from sw_part import extrude_boss, sketch, sketch_circle
from sw_review import run_review
from sw_runtime import attach, default_template, no_dimension_input_dialog
app, revision = attach(33)
ownership = DocumentOwnership(app)
with no_dimension_input_dialog(app):
model = new_owned(app, ownership, default_template(app, "part"))
with sketch(model, "Front Plane") as sketch_name:
sketch_circle(model, 0, 0, mm(25))
extrude_boss(model, sketch_name, mm(50)) # raises if no feature is returned
state = snapshot(model) # raises unless the rebuild succeeds
assert state["bodies"] == 1
expected = 3.141592653589793 * mm(25) ** 2 * mm(50)
assert abs(state["mass"]["volume_m3"] - expected) < 1e-9
assert save_document(model, r"C:\cad-output\cylinder.sldprt")
assert export_to_step(model, r"C:\cad-output\cylinder.step")
report, report_path = run_review(model, r"C:\cad-output\review", basename="cylinder",
expected_outputs=[r"C:\cad-output\cylinder.sldprt",
r"C:\cad-output\cylinder.step"])
if report["evaluation"]["status"] == "fail":
raise RuntimeError(f"CAD review failed: {report_path}")
ownership.close_all()SolidWorks API lengths are meters and angles are radians. Convert at the boundary with
mm() and deg().
Parts
- Use the feature object or
ActiveSketch.Namethat the API returns. Do not guess localized names such asSketch7. - Select the exact profile or feature before a dependent feature. Clear selection before and after fragile operations.
- Add named driving dimensions for interfaces, then require a fully defined sketch
(
sw_inspect.fully_define_active_sketch). Seereferences/part-modeling.md. - In inherited feature trees, keep dimension identities (
D2@Sketch2) until their meaning is confirmed; treat pattern counts as topology, not a continuous parameter.
Assemblies
AddComponent4(x, y, z)only sets an initial position. It does not make an assembly.- Fix one datum component. Mate the rest with real mates found by geometry (radius, axis, plane normal and position), not by face names.
- Accept
AddMate5only when the mate is non-null and its error status is 1. - Verify transforms, constrained states, intended free motion
(
sw_runtime.transform_and_solve), and interference. A skipped interference scan is reported as skipped, never as zero. Seereferences/assembly.md.
Drawings and export
- PDF export needs the attached application:
export_to_pdf(drawing, path, ["Sheet1"], sw=app).IModelDoc2has noGetSldWorksObject. Prove the sheet set withsw_inspect.pdf_page_texts(). - BOM tables go on the owning view:
insert_bom_table(..., view=view); read them back withsw_inspect.table_cells(). - See
references/drawing.mdandreferences/export.md.
Completion evidence
A finished run includes:
- source provenance and the confirmed request contract;
- native CAD and the requested neutral exports, with SHA-256, size and mtime;
- rebuild and feature-health results, body/component counts, mass properties;
- mate states and interference results for assemblies;
- isometric plus orthographic previews, and the visual review result you recorded;
- residual uncertainty stated plainly.
Qualify an installation
Unit tests use fake COM objects. To prove a SolidWorks installation behaves as these
helpers expect, run the live suite in qualification/ (read its README first): it
refuses to start with documents open and writes only to its output directory.
References
Read only what the task needs:
references/session-safety.md- attach, ownership, preferences, transforms, packagesreferences/measurement.md- mass, feature health, sketch state, interference, readbackreferences/agent-loop.md- states, request contract, recovery policyreferences/part-modeling.md,references/assembly.md,references/drawing.md,references/export.md,references/appearance.md,references/advanced.mdreferences/review.md-run_review()output and visual checklistreferences/troubleshooting.md,references/com-survival-guide.md- COM failuresreferences/api-lookup.md- how to verify an unwrapped API before using itreferences/agent-runtime.md- dependency-install consent, import template, macro guard
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

