cli_skills.py#

OpenMDAO Agent Skills installer.

Installs OpenMDAO Claude (and, in future, other-platform) agent skills that ship inside the installed package, so the skills always match the installed OpenMDAO version. A re-run of the installer after pip install -U openmdao re-syncs the skills.

Design notes#

  • Skills are bundled in openmdao/skills/ and copied into a tool’s skills directory on install.

  • Skill files may contain {{OPENMDAO_PATH}}, {{OPENMDAO_DOCS}} and {{OPENMDAO_EXAMPLES}} placeholders, which are rewritten to absolute paths on the user’s machine at install time.

  • CLAUDE.md is managed via a marker-bracketed section so user-authored content is preserved across re-installs.

  • Each supported AI tool is described by a Tool object with a detection function and an install strategy, making it easy to add new platforms later.

class openmdao.utils.cli_skills.ClaudeTool(use_global: bool = False)[source]

Bases: Tool

Represents the Claude Code tool and how to install skills into it.

Attributes:
keystr

Short identifier for this tool, used to locate the matching skill directory.

namestr

Human-readable display name for this tool.

main_filenamestr

Name of the main config file managed by the installer (e.g. CLAUDE.md).

install_pathPath

Directory where skill subdirectories are installed.

Methods

detected()

Return True if this tool is detected on the current system.

install(skill_dir)

Install skills into this tool's install path.

install_main_file_md()

Install or update OpenMDAO-managed section in the main file for the tool, e.g. CLAUDE.md.

is_installed()

Return True if OpenMDAO skills have been installed for this tool.

uninstall()

Remove OpenMDAO skills previously installed for this tool.

uninstall_main_file_md()

Remove the OpenMDAO-managed section from the specified main file, if present.

__init__(use_global: bool = False)[source]

Initialize a Tool instance.

Parameters:
use_globalbool

Install skills globally (e.g. ~/.claude) if True, otherwise install locally.

detected() bool[source]

Return True if this tool is detected on the current system.

Returns:
bool

True if the tool is present, False otherwise.

class openmdao.utils.cli_skills.Tool(use_global)[source]

Bases: object

Represents one AI coding tool and how to install skills into it.

Attributes:
use_globalbool

Install skills globally (e.g. ~/.claude) if True, otherwise install locally.

Methods

detected()

Return True if this tool (e.g. Claude) is detected on the current system.

install(skill_dir)

Install skills into this tool's install path.

install_main_file_md()

Install or update OpenMDAO-managed section in the main file for the tool, e.g. CLAUDE.md.

is_installed()

Return True if OpenMDAO skills have been installed for this tool.

uninstall()

Remove OpenMDAO skills previously installed for this tool.

uninstall_main_file_md()

Remove the OpenMDAO-managed section from the specified main file, if present.

__init__(use_global)[source]

Initialize a Tool instance.

Parameters:
use_globalbool

Install skills globally (e.g. ~/.claude) if True, otherwise install locally.

detected() bool[source]

Return True if this tool (e.g. Claude) is detected on the current system.

Returns:
bool

True if the tool is present, False otherwise.

install(skill_dir: Path) None[source]

Install skills into this tool’s install path.

Parameters:
skill_dirPath

Source directory containing the skill subdirectory to install.

Raises:
RuntimeError

If no skill directory or template is found, or if the managed section markers are in an invalid order.

OSError

If any file operation fails.

install_main_file_md() None[source]

Install or update OpenMDAO-managed section in the main file for the tool, e.g. CLAUDE.md.

The OpenMDAO content is wrapped in HTML-comment markers so the section can be replaced in place on re-install without disturbing user content.

Raises:
RuntimeError

If no skill directory or template file is found, or if the managed section markers are in an invalid order.

OSError

If the file cannot be read or written.

is_installed() bool[source]

Return True if OpenMDAO skills have been installed for this tool.

Returns:
bool

True if the install path exists and contains at least one OpenMDAO built-in skill directory.

uninstall() None[source]

Remove OpenMDAO skills previously installed for this tool.

Only subdirectories whose names begin with the OpenMDAO skill prefix are removed, leaving any unrelated skills the user keeps in the same directory untouched.

Raises:
RuntimeError

If the managed section in the main config file is malformed.

OSError

If any file operation fails.

uninstall_main_file_md() None[source]

Remove the OpenMDAO-managed section from the specified main file, if present.

Leaves any user-authored content and the file itself intact.

Raises:
RuntimeError

If the managed section markers are in an invalid order.

OSError

If the file cannot be read or written.

openmdao.utils.cli_skills.cmd_skills_install(args, user_args) int[source]

Execute the install-skills subcommand.

Parameters:
argsargparse.Namespace

Parsed CLI arguments.

Relevant attributes: use_global (bool) and tool (str) for the tool key to install.

user_argslist of str

Extra positional arguments passed through by the OpenMDAO CLI harness (unused; reserved for future extension).

Returns:
int

Exit code: 0 on success, 1 on failure.

openmdao.utils.cli_skills.cmd_skills_list(args, user_args) int[source]

Execute the list-skills subcommand.

Prints a table of all registered tools, their project and global install paths, and whether skills are currently installed at each location.

Parameters:
argsargparse.Namespace

Parsed CLI arguments (currently unused for this subcommand).

user_argslist of str

Extra positional arguments passed through by the OpenMDAO CLI harness (unused; reserved for future extension).

Returns:
int

Exit code: always 0.

openmdao.utils.cli_skills.cmd_skills_uninstall(args, user_args) int[source]

Execute the uninstall-skills subcommand.

Parameters:
argsargparse.Namespace

Parsed CLI arguments.

Relevant attributes: use_global (bool) and tool (str) for the tool key to uninstall.

user_argslist of str

Extra positional arguments passed through by the OpenMDAO CLI harness (unused; reserved for future extension).

Returns:
int

Exit code: 0 on success, 1 if the specified tool is not supported.

openmdao.utils.cli_skills.get_docs_path() Path[source]

Return the path to the bundled documentation (Jupyter Book source).

openmdao.utils.cli_skills.get_examples_path() Path[source]

Return the path to runnable example components.

openmdao.utils.cli_skills.get_package_path() Path[source]

Return the path to the bundled package.

openmdao.utils.cli_skills.get_skills_source_dir() Path[source]

Return the directory containing bundled skill sources.

openmdao.utils.cli_skills.replace_path_placeholders(content: str) str[source]

Replace all path placeholders in content with absolute paths.