better-skills backup command copies local skill folders to a temporary directory for safe editing and migration.
When to Use Backup
Use backup when:- Migrating existing skills to Better Skills vaults
- Batch editing multiple local skills before upload
- Preserving raw skill snapshots before making changes
- Consolidating skills from multiple agent directories
Backup is designed for local skill folders only. It does not download skills from your vault — use
better-skills clone for that.Backup Command
The basic backup command scans your agent skill directories:Options
--source <dir>: Backup a specific directory instead of auto-detecting agent paths--out <tmp-dir>: Custom output directory (defaults to system temp folder)--agent <agent>: Filter by specific agent (can be repeated)
opencode, claude-code, cursor
Examples
Backup Folder Structure
Backup creates a timestamped folder with two subdirectories:raw/ Directory
Exact snapshots of discovered skill folders. Purpose: Preserve original state for reference Structure:work/ Directory
Editable copies for preparing skills before upload. Purpose: Safe workspace for editing without affecting originals Structure:work/ folders before running create or update.
Discovery Behavior
Backup scans these locations by default:- OpenCode:
~/.config/opencode/skills - Claude Code:
~/.claude/skillsor~/Library/Application Support/Claude/skills(macOS) - Cursor:
~/.cursor/skillsor~/AppData/Roaming/Cursor/skills(Windows) - Workspace:
<cwd>/.agents/skills
Skill Detection
A folder is considered a skill if:- It contains a
SKILL.mdfile - It does not contain
.better-skills-install.json(managed bybetter-skills sync)
Folders with
.better-skills-install.json are skipped because they are already managed by Better Skills.Restore Workflow
Backup prepares skills for upload. Here’s the full workflow:Review and Edit
Navigate to the Edit skills as needed:
work/ directory:- Fix frontmatter (name, description)
- Add resource mentions
- Rewrite local links to mention syntax
Agent Filtering
Filter backup by specific agents:- If
--sourceis provided: ignores--agentfilters - If
--agentis provided: only scans specified agent directories - If neither is provided: scans all supported agent directories + workspace
.agents/skills
Use Cases
Migrating to Better Skills
You have existing skills in your OpenCode config:Bulk Editing Skills
Edit multiple skills before upload:Consolidating Agent Skills
Merge skills from multiple agents:Preserving Originals
Keep raw snapshots before making changes:Output Format
Backup command prints JSON-compatible summary:discoveredCount: Total skill folders foundcopiedCount: Successfully copied to backupskippedCount: Skipped (managed bybetter-skills sync)failedCount: Copy errors
failedCount > 0, the command exits with code 1 and lists failures.
Non-Interactive Usage
Backup works in non-interactive environments (CI, scripts, agents):- No TTY detected
AGENT=1,OPENCODE=1, orCI=trueenvironment variables set
Next Steps
Creating Skills
Learn how to create skills from backed up folders
Markdown Mentions
Understand mention syntax for linking resources