SolidworksMCP-python: Skill for Claude Code

.github/skills/extract-and-test/SKILL.md

extract-and-test is a skill for Claude Code, Codex from andrewbartels1/SolidworksMCP-python. It costs 112 tokens per session (1,607 once invoked), scanned A, original, MIT.

A refactoring and testing guide for methods in a Windows-to-SolidWorks adapter, especially methods that combine COM calls, error handling, and nested functions. It explains how to split them into smaller helpers.

In plain words
What is it for?
Use it when restructuring a method in pywin32_adapter.py, such as extracting COM operations, fallback logic, error handling, or pure data transformations into separate helpers.
Why use it?
It makes code that is difficult to test in isolation easier to check and maintain. It also helps cover different success and failure paths with tests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

This is andrewbartels1/SolidworksMCP-python's own configuration. It tells Claude Code and Codex how to work on SolidworksMCP-python itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything SolidworksMCP-python configures →

Reuse

Borrowing it

Nothing to install: this file belongs to andrewbartels1/SolidworksMCP-python. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/andrewbartels1/SolidworksMCP-python/main/.github/skills/extract-and-test/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/andrewbartels1/SolidworksMCP-python

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for extract-and-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/andrewbartels1/solidworksmcp-python/extract-and-test/github.svg)](https://agentmods.dev/skills/andrewbartels1/solidworksmcp-python/extract-and-test)
Your own site
<a href="https://agentmods.dev/skills/andrewbartels1/solidworksmcp-python/extract-and-test"><img src="https://agentmods.dev/badge/skills/andrewbartels1/solidworksmcp-python/extract-and-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for extract-and-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/andrewbartels1/solidworksmcp-python/extract-and-test"><img src="https://agentmods.dev/badge/skills/andrewbartels1/solidworksmcp-python/extract-and-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 112 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00112 $0.01607
Opus 5.5 $0.00045 $0.00643
Sonnet 5.5 $0.00022 $0.00321
Haiku 4.5 $0.00011 $0.00161

Measured 1mo ago against content hash c9ee5989cfcc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

extract-and-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/extract-and-test/SKILL.md · 177 lines

How it starts

The opening of the file, as written. The whole thing — 177 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Extract & Test — pywin32_adapter.py

Apply this skill whenever a method in src/solidworks_mcp/adapters/pywin32_adapter.py contains:

  • Deeply nested try/except blocks or inner closures that can't be tested in isolation
  • Mixed concerns (COM selection strategy + fallback + error handling all in one body)
  • A closure that calls self._attempt(...) with an inner _run/_operation lambda

Step 1 — Read and Analyse

Read the target line range. For each logical block, fill in this table:

Concern COM calls involved Failure mode Return contract
(fill in) (fill in) (fill in) (fill in)

Apply these heuristics to determine the right helper shape:

Shape When to use
-> None (log, never raise) Setup/orientation side-effects — failure is acceptable
-> bool COM operation that writes a file; True = file exists
-> dict | None COM selection/query strategy; None = this strategy failed, try next
-> dict (raises on failure) Last-chance fallback or invoker — surface error to caller
@staticmethod Pure string/data transformation with no self state

Step 2 — Extract Helpers

Write one helper per concern. Insert helpers immediately before the async def they support.

def _<verb>_<noun>(self, <args>) -> <return type>:
    """<One-line description>.

    Args:
        <arg>: <description>

    Returns:
        <type>: <description>

    Raises:
        <ExceptionType>: <when>
    """
    ...

Examples by return contract:

# Graceful-failure helper — log, never raise
def _set_view_orientation(self, target_doc, orientation, view_const) -> None:
    try:
        target_doc.ShowNamedView2("", view_const)
    except Exception:
        logger.warning("Could not set view orientation to %s", orientation)

# Boolean helper — True = file written
def _save_screenshot_with_modelview(self, model_view, path, width, height) -> bool:
    try:
        model_view.SaveBitmapWithVariableSize(path, width, height)
        return os.path.exists(path)
    except Exception:
        return False

# Optional-dict helper — None = strategy failed, try next
def _try_select_by_extension(self, target_doc, candidates, feature_name) -> dict | None:
    for candidate in candidates:
        for entity_type in ENTITY_TYPES:
            try:
                if target_doc.Extension.SelectByID2(candidate, entity_type, 0, 0, 0, False, 0, None, 0):
                    return {"selected": True, "feature_name": feature_name, ...}
            except Exception:
                continue
    return None

# Raising helper — last-chance invoker
def _invoke_run_macro2(self, macro_path, module_name, proc_name) -> dict:
    result = self.swApp.RunMacro2(macro_path, module_name, proc_name, 0, 0)
    success = result[0] if isinstance(result, (list, tuple)) else bool(result)
    if not success:
        raise SolidWorksMCPError(f"RunMacro2 failed for {macro_path}")
    return {"macro_path": macro_path, "module_name": module_name}

Read the full file on GitHub · 177 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 177 lines · 112 tokens per session scan A c9ee5989cfcc

Subscribe to this mod's changes

extract-and-test is a skill published in the GitHub repository andrewbartels1/SolidworksMCP-python (82 stars, last pushed 4d ago), licensed MIT. It adds 112 tokens to every session and 1,607 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.