Command Manage

/dr-optimize

Audit and optimize the Datarim framework

Overview

/dr-optimize audits the entire Datarim framework — skills, agents, commands, templates — and identifies problems: unused components, duplicates, oversized files, broken references, and outdated documentation counts. It generates a report with proposals ranked by risk and applies only the changes you approve.

Usage

/dr-optimize
/dr-optimize project
/dr-optimize global
/dr-optimize framework

When to Run

  • After every 5-10 completed tasks
  • After /dr-addskill to check for overlaps with existing skills
  • When skills stop triggering or Claude seems to forget instructions
  • When /dr-archive Step 0.5 (reflection) suggests it

What It Does

  1. Determine Scope — project .claude/, user $HOME/.claude/, or the Datarim source repo, depending on your argument.
  2. Full Inventory — builds a complete table of all skills, agents, commands, and templates with file sizes, descriptions, and cross-references.
  3. Dependency Graph — maps commands to agents, agents to skills, and skills to skills. Identifies orphaned components.
  4. Issue Detection — checks for: unused skills/agents, oversized files (over 500 lines), duplicate coverage (over 70% overlap), stale descriptions, broken references, and doc count mismatches.
  5. Report — presents findings with framework health status (GOOD, NEEDS ATTENTION, BLOATED), issue counts by severity, and proposals ranked from low to high risk.
  6. Approval Gate — asks which proposals to apply (all, none, or specific numbers). Applies only approved changes.
  7. Sync Documentation — updates CLAUDE.md, README.md, and dr-help.md with correct component counts and tables.

Arguments

Optional. project, global/user, or framework/datarim to specify scope. Default: scans both project and user levels.

Output

Full audit report with dependency graph, optimization proposals, applied changes summary, and updated documentation.

Example Session

> /dr-optimize

=== OPTIMIZATION REPORT ===

Framework Health: NEEDS ATTENTION
Components: 16 agents, 20 skills, 18 commands, 11 templates
Total lines: 4,250
Description budget: 5,200 / 8,000 chars (65%)

Issues found: 4
  1. [Low] Unused skill: legacy-deploy.md (no agent references)
  2. [Low] Stale description: security.md (content diverged)
  3. [Medium] Duplicate coverage: testing.md and qa.md (72% overlap)
  4. [Medium] Doc count mismatch: CLAUDE.md says 16 skills, disk has 18

Proposals:
  1. prune-skill: Remove legacy-deploy.md
  2. fix-description: Update security.md description
  3. merge-skills: Combine testing.md into qa.md
  4. sync-docs: Update CLAUDE.md counts

Which proposals should I apply? (all / none / 1,2,4)

Related Commands

  • /dr-addskill — adding new components
  • /dr-archive — Step 0.5 reflection may trigger optimization suggestion
  • /dr-help — verify command list after changes