Skip to content
Framework

AI

skills_copy()

Copy skills from one assistant's skills folder to the others.

A project can keep the same skill in several assistant folders: .claude/skills for Claude Code and .agents/skills for Codex and Copilot. pull_skills() writes identical copies, but editing one makes them diverge. skills_sync() then stops, and push_skills() reports the skill as failed and goes on with the others. skills_copy() makes the copies agree: each skill's SKILL.md and its syncable companion files, with their executable modes, are copied from the source over each target.

A skill is a folder holding a regular SKILL.md file. Other folders are ignored, and so are dot-folders, where the installer stages copies. Excluded files (such as .env, keys, and .git) are not copied, and stay in the target. Other files only the target had are removed from the active copy and kept in its backup: each replaced copy is backed up to .framework/skills-backups/ first. Identical copies are left alone. Skills only a target has are left alone and not read: they are listed, never deleted. When a copied skill is tracked in .framework/skills.lock.json, each target path joins its entry, so pull and push treat the copies as one skill; nothing else in the lock changes, so push_skills() afterwards sees an edited skill and pushes it as usual. A dry run leaves the lock alone, and so does a copy of a skill the lock doesn't track.

Usage

skills_copy(
    from_: str | None = None,
    to: str | None = None,
    *,
    from_dir: str | None = None,
    to_dir: str | None = None,
    skills: list[str] | None = None,
    dry_run: bool = False,
    project_path: str | Path = '.',
) -> dict[str, Any]

Arguments

Name Type Default Description
from_ str | None None

The source assistant folder: "claude" (.claude/skills) or "agents" (.agents/skills; "codex" and "copilot" are aliases).

to str | None None

The target assistant folder, named the same way. Default: every other assistant skills folder in the project.

from_dir str | None None

The source folder, relative to the project, in place of from_.

to_dir str | None None

The target folder, relative to the project, in place of to.

skills list[str] | None None

The skills to copy. Default: every skill in the source.

dry_run bool False

Report what would be copied and write nothing.

project_path str | Path '.'

The project's root directory. Default: the current directory.

Value

A dict: dry_run, from (the source folder), to (the target folders), skills (one per skill and target, each with name, status, from, to, and backup; status is copied, current, or missing, which means not in the source, and then from is None; backup is the replaced copy's backup folder), counts by status, and message (the summary line).

Details

A real run holds the project's skill sync lock, then checks everything before anything is written. If a copy fails partway, the copies made before it are undone; if one can't be put back, the error names it and the backup holding its old copy. The target can't be in, or contain, .framework/.

Name folders by assistant (from_, to) or by project-relative path (from_dir, to_dir), not both. from_ has a trailing underscore because from is a Python keyword.

Raises

  • FrameworkError: When the arguments mix names and folders, name an unknown assistant or skill, or name folders that overlap each other or .framework/; when the source folder is missing or a target isn't a folder; when there is no folder to copy to; when a skill folder is a symlink or a skills folder holds a broken one; or when a failed copy can't be undone (the message names each copy not put back and its backup).
  • OSError: When a folder can't be read or looked up, such as a permission error.
  • ProjectNotFoundError: When the folder is not a Framework project.
  • ValueError: When another skill sync holds the project's skill lock.

Examples

fw.skills_copy(from_="claude", skills=["ggplot2-figures"], dry_run=True)
fw.skills_copy(from_="claude", to="agents")
fw.skills_copy(from_dir=".claude/skills", to_dir="some/other/skills")

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.