Prompt Utilities

Bundled prompt guide files for AI coding assistants are stored in asset/prompt/*.md. These utilities let you list, read, and copy them into your project. Use them together with the MCP Server for the richest AI integration, or stand-alone for manual context injection.

Example

import dartwork_mpl as dm

# List available guides
available = dm.list_prompts()           # ['general-guide', 'layout-guide']

# Read guide content
content = dm.get_prompt('layout-guide')

# Copy to IDE folder
dm.copy_prompt('layout-guide', '.cursor/rules/')

# Get the file path directly
print(dm.prompt_path('general-guide'))

API

dartwork_mpl.prompt_path(name: str) Path[source]

Get the absolute path to a prompt guide file.

Parameters:

name (str) – Name of the prompt guide to retrieve (e.g., 'layout-guide', 'general-guide').

Returns:

Path to the prompt guide Markdown file.

Return type:

Path

Raises:

ValueError – If the specified guide cannot be found in the library.

dartwork_mpl.get_prompt(name: str) str[source]

Read a prompt guide file and return its full content as a string.

Parameters:

name (str) – Name of the prompt guide to read.

Returns:

The Markdown content of the prompt guide.

Return type:

str

dartwork_mpl.list_prompts() list[str][source]

List all available prompt guide files.

Returns:

Sorted list of available prompt guide names.

Return type:

list[str]

dartwork_mpl.copy_prompt(name: str, destination: str | Path) Path[source]

Copy a bundled prompt guide file to the specified destination.

Parameters:
  • name (str) – Name of the prompt guide to copy.

  • destination (str | Path) – Destination path. If a directory, the file is copied with its original name (name.md). If a file path, that name is used.

Returns:

Absolute path of the newly copied file.

Return type:

Path

Raises:

ValueError – If the source prompt guide cannot be found.

LLM Integration

Install or remove static guide files for IDE-based AI assistants that do not support MCP.

dartwork_mpl.install_llm_txt(project_dir: str | Path | None = None) None[source]

Install the dartwork-mpl usage guide into project IDE integration folders.

Copies the usage guide to the following paths so that various AI coding assistants can discover library context: - .claude/commands/ (for Claude Code) - .cursor/ (for Cursor IDE)

Parameters:

project_dir (str | Path | None, optional) – Target project directory. If None, the current working directory is used. Default is None.

Raises:

FileNotFoundError – If the USAGE_GUIDE.md file cannot be found in the package assets.

dartwork_mpl.uninstall_llm_txt(project_dir: str | Path | None = None) None[source]

Remove the dartwork-mpl usage guide from project IDE integration folders.

Parameters:

project_dir (str | Path | None, optional) – Target project directory. If None, the current working directory is used. Default is None.