Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/adapters/claude-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import yaml from 'js-yaml';
import { loadAgentManifest, loadFileIfExists } from '../utils/loader.js';
import { loadAllSkills, getAllowedTools } from '../utils/skill-loader.js';
import { loadAllSkillMetadata } from '../utils/skill-loader.js';

export function exportToClaudeCode(dir: string): string {
const agentDir = resolve(dir);
Expand Down Expand Up @@ -32,20 +32,19 @@ export function exportToClaudeCode(dir: string): string {
parts.push(duty);
}

// Skills — loaded via skill-loader
// Skills — loaded via skill-loader (metadata only for progressive disclosure)
const skillsDir = join(agentDir, 'skills');
const skills = loadAllSkills(skillsDir);
const skills = loadAllSkillMetadata(skillsDir);
if (skills.length > 0) {
const skillParts: string[] = ['## Skills\n'];
for (const skill of skills) {
skillParts.push(`### ${skill.frontmatter.name}`);
skillParts.push(skill.frontmatter.description);
const tools = getAllowedTools(skill.frontmatter);
if (tools.length > 0) {
skillParts.push(`Allowed tools: ${tools.join(', ')}`);
const skillDirName = skill.directory.split('/').pop()!;
skillParts.push(`### ${skill.name}`);
skillParts.push(skill.description);
if (skill.allowedTools && skill.allowedTools.length > 0) {
skillParts.push(`Allowed tools: ${skill.allowedTools.join(', ')}`);
}
skillParts.push('');
skillParts.push(skill.instructions);
skillParts.push(`Full instructions: \`skills/${skillDirName}/SKILL.md\``);
skillParts.push('');
}
parts.push(skillParts.join('\n'));
Expand Down
3 changes: 3 additions & 0 deletions src/utils/skill-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface SkillMetadata {
name: string;
description: string;
license?: string;
allowedTools?: string[];
directory: string;
}

Expand Down Expand Up @@ -79,11 +80,13 @@ export function loadSkillMetadata(filePath: string): SkillMetadata {
}

const fm = yaml.load(frontmatterMatch[1]) as SkillFrontmatter;
const tools = getAllowedTools(fm);

return {
name: fm.name,
description: fm.description,
license: fm.license,
allowedTools: tools.length > 0 ? tools : undefined,
directory: join(filePath, '..'),
};
}
Expand Down
Loading