| name | sync-claude-resources |
| description | Sync the claudeResources registry in claude-runner.ts with actual files in .claude folder. Use when adding, removing, or renaming skills/agents/commands, or when claudeResources may be out of sync with the .claude directory structure. |
Sync Claude Resources
Synchronizes the claudeResources object in packages/backend/src/claude-runner.ts with the actual files in the .claude folder.
Resource Structure
The .claude folder contains three resource types:
| Type | Location | Path Pattern |
|---|
| Skills | .claude/skills/<name>/SKILL.md | @.claude/skills/<name>/SKILL.md |
| Agents | .claude/agents/<name>.md | @.claude/agents/<name>.md |
| Commands | .claude/commands/<name>.md | @.claude/commands/<name>.md |
Sync Process
-
Scan .claude folder to discover all resources:
find .claude/skills -name "SKILL.md" -type f
ls .claude/agents/*.md .claude/commands/*.md
-
Parse existing claudeResources in packages/backend/src/claude-runner.ts
-
Generate camelCase key from resource name:
complex-task-planner -> complexTaskPlanner
create_plan -> createPlan
web-search-researcher -> webSearchResearcher
-
Determine stopper based on resource purpose:
- Default:
DEFAULT_STOPPER
- Planning commands: Custom stopper mentioning "implementation plan"
- Research commands: Custom stopper mentioning "codebase research"
- Commit/PR commands: Custom stopper mentioning "commit and PR creation"
-
Update claudeResources object in claude-runner.ts:
- Add missing resources
- Remove resources for deleted files
- Preserve custom stoppers for existing entries
Key Conversion Function
function toCamelCase(name: string): string {
return name
.replace(/[-_](.)/g, (_, c) => c.toUpperCase())
.replace(/^(.)/, (c) => c.toLowerCase());
}
Output Format
Each resource entry follows this structure:
resourceKey: {
path: '@.claude/<type>/<name>/SKILL.md',
stopper: DEFAULT_STOPPER,
},
Validation
After syncing, verify:
- All files in
.claude/{skills,agents,commands} have corresponding entries
- No orphan entries exist for deleted files
- TypeScript compiles without errors:
pnpm --filter @haflow/backend build