Skip to content

fix(install): migrate skills from agents/skills/ to skills/#18

Open
maystudios wants to merge 1 commit intomainfrom
worktree-agent-aee30616
Open

fix(install): migrate skills from agents/skills/ to skills/#18
maystudios wants to merge 1 commit intomainfrom
worktree-agent-aee30616

Conversation

@maystudios
Copy link
Owner

Summary

  • Move MAXSIM skill install destination from .claude/agents/skills/ to .claude/skills/ (Claude Code's native skills directory)
  • Extract shared BUILT_IN_SKILLS constant and removeBuiltInSkills() helper into shared.ts to eliminate 4x duplication across install, uninstall, and hooks modules
  • Add legacy agents/skills/ cleanup during both install (orphan cleanup) and uninstall for seamless upgrades from older versions
  • Update all template references (agents + workflows) from .agents/skills/ to skills/
  • Update manifest to track skills under skills/ instead of agents/skills/

Test plan

  • Unit tests pass (npx vitest run)
  • Build succeeds (npm run build)
  • Manual test: fresh install places skills in ~/.claude/skills/
  • Manual test: upgrade from old version cleans up ~/.claude/agents/skills/
  • Manual test: uninstall removes skills from both skills/ and legacy agents/skills/

🤖 Generated with Claude Code

Move MAXSIM skill install destination from .claude/agents/skills/ to
.claude/skills/ (Claude Code's native skills directory). Extract shared
BUILT_IN_SKILLS constant and removeBuiltInSkills helper to eliminate
4x duplication. Add legacy agents/skills/ cleanup during install and
uninstall for seamless upgrades.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 04:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates MAXSIM’s skill installation and all template references from the legacy agents/skills/ location to Claude Code’s native skills/ directory, while consolidating built-in skill cleanup logic into shared helpers and extending install/uninstall cleanup for backward compatibility.

Changes:

  • Update workflow/agent templates to reference skills/ instead of .agents/skills/.
  • Install/uninstall now manage skills under skills/ and also clean up legacy agents/skills/.
  • Extract BUILT_IN_SKILLS and removeBuiltInSkills() into packages/cli/src/install/shared.ts and update manifest paths accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
templates/workflows/quick.md Update “Project skills” references from .agents/skills/ to skills/.
templates/workflows/plan-phase.md Update “Project skills” references from .agents/skills/ to skills/.
templates/workflows/execute-phase.md Update “Project skills” references from .agents/skills/ to skills/.
templates/agents/maxsim-planner.md Update project-skill lookup paths and skill table links to skills/....
templates/agents/maxsim-plan-checker.md Update project-skill lookup paths and skill table links to skills/....
templates/agents/maxsim-phase-researcher.md Update project-skill lookup paths and skill table links to skills/....
templates/agents/maxsim-executor.md Update project-skill lookup paths and skill table links to skills/....
templates/agents/maxsim-debugger.md Update skill table links to skills/....
packages/cli/src/install/uninstall.ts Add removal of MAXSIM skills from skills/ and legacy agents/skills/.
packages/cli/src/install/shared.ts Introduce shared built-in skill list and helper to remove them.
packages/cli/src/install/manifest.ts Record installed skills under skills/ in the manifest.
packages/cli/src/install/index.ts Install skills into skills/ and use shared cleanup helper.
packages/cli/src/install/hooks.ts Add orphan cleanup for legacy agents/skills/ via shared helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +133 to +135
'batch-execution',
'subagent-driven-development',
'writing-plans',
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILT_IN_SKILLS includes entries that don't exist in the bundled templates (templates/skills/ currently has: code-review, memory-management, simplify, systematic-debugging, tdd, using-maxsim, verification-before-completion). Keeping extra names here can lead to unintended deletion of user-created skills with those names during install/uninstall/cleanup. Update the constant to exactly match the skills MAXSIM actually installs (or derive the list from the templates directory at build/runtime).

Suggested change
'batch-execution',
'subagent-driven-development',
'writing-plans',

Copilot uses AI. Check for mistakes.
for (const skill of BUILT_IN_SKILLS) {
const skillDir = path.join(skillsParentDir, skill);
if (fs.existsSync(skillDir)) {
fs.rmSync(skillDir, { recursive: true });
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeBuiltInSkills() uses fs.rmSync(..., { recursive: true }) even though this module already provides safeRmDir() specifically to handle cross-platform removal issues (e.g., Windows EPERM/read-only files). Consider using the same removal helper here (or fs.rmSync with the options needed for Windows) so uninstall/cleanup doesn't fail on Windows when deleting skill directories.

Suggested change
fs.rmSync(skillDir, { recursive: true });
safeRmDir(skillDir);

Copilot uses AI. Check for mistakes.
Comment on lines +105 to 111
// Include skills in manifest (skills/<skill-name>/*)
const skillsManifestDir = path.join(configDir, 'skills');
if (fs.existsSync(skillsManifestDir)) {
const skillHashes = generateManifest(skillsManifestDir);
for (const [rel, hash] of Object.entries(skillHashes)) {
manifest.files['agents/skills/' + rel] = hash;
manifest.files['skills/' + rel] = hash;
}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeManifest() now hashes everything under configDir/skills and records it as MAXSIM-managed. Since skills/ is a shared, user-editable directory, this will cause saveLocalPatches() to back up (and report) user skills as “modified MAXSIM files” on the next install. Limit manifest entries to MAXSIM-owned skill directories (same set you remove/overwrite during install) rather than the entire skills/ tree.

Copilot uses AI. Check for mistakes.
Comment on lines 295 to +301
const installedSkillDirs = fs.readdirSync(skillsDest, { withFileTypes: true })
.filter(e => e.isDirectory()).length;
if (installedSkillDirs > 0) {
spinner.succeed(chalk.green('\u2713') + ` Installed ${installedSkillDirs} skills to agents/skills/`);
spinner.succeed(chalk.green('\u2713') + ` Installed ${installedSkillDirs} skills to skills/`);
} else {
spinner.fail('Failed to install skills');
failures.push('agents/skills');
failures.push('skills');
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installedSkillDirs counts all subdirectories under the shared skills/ directory, including pre-existing user skills. This makes the “Installed X skills” message inaccurate and can mask an install problem (e.g., if MAXSIM skills failed to copy but user skills already exist, the count is still > 0). Consider validating/counting only the MAXSIM-installed skills (the built-in list) when reporting success/failure.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants