AD

Guide for implementing and testing new resource converters in acplugin.

Install

mkdir -p .claude/skills/add-converter && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9700" && unzip -o skill.zip -d .claude/skills/add-converter && rm skill.zip

Installs to .claude/skills/add-converter

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Add a new resource type converter to acplugin (e.g., adding support for converting a new Claude Code resource type)
115 charsno explicit “when” trigger
Advanced

Key capabilities

  • Define resource interfaces
  • Implement scanner functions
  • Create conversion logic
  • Integrate with writers
  • Add unit tests

How it works

It follows a multi-step process to define types, implement scanning, create converters, and integrate with writers and CLI outputs.

Inputs & outputs

You give it
New resource type definition
You get back
Integrated converter and scanner

When to use add-converter

  • Add resource converter
  • Extend acplugin functionality
  • Test converter logic

About this skill

添加新资源类型转换器

当需要支持转换新的 Claude Code 资源类型时,按以下步骤操作。

步骤

1. 定义类型 (src/types.ts)

添加新资源的接口定义和 frontmatter 类型(如果有),以及在 ScanResult 中添加字段。在 ConvertedFile.type 联合类型中添加新值。

2. 添加扫描函数 (src/scanner/claude.ts)

创建并导出可复用的扫描函数(如 scanXxxDir()),这样 plugin.ts 也能使用。

scanClaudeProject() 中调用新函数。

3. 集成 Plugin Scanner (src/scanner/plugin.ts)

scanPlugin() 中调用新扫描函数,注意 plugin 目录结构与 .claude/ 不同:

  • 项目: .claude/xxx/
  • Plugin: xxx/(直接在 plugin 根目录下)

更新 countResources() 包含新资源。

4. 创建 Converter (src/converter/xxx.ts)

实现 convertXxx(item, platform) 函数,处理三个平台:

export function convertXxx(item: Xxx, platform: Platform): ConvertedFile {
  switch (platform) {
    case 'codex': return convertToCodex(item);
    case 'opencode': return convertToOpenCode(item);
    case 'cursor': return convertToCursor(item);
  }
}

关键原则

  • Converter 无副作用,只返回 ConvertedFile
  • 不支持的功能用降级策略(合并到 AGENTS.md 或 rules)
  • 返回 warnings 告知用户不兼容项

5. 集成 Writer (src/writer/*.ts)

在三个 writer 文件中调用新 converter,处理合并逻辑。

6. 更新 CLI 输出 (src/index.ts)

更新 printScanResult()convertSingleScan() 中的资源计数。

7. 添加测试 (src/__tests__/xxx.test.ts)

为新 converter 创建测试,覆盖三个平台的转换逻辑。

8. 更新 test-fixture/

test-fixture/ 中添加新资源类型的示例文件,确保 scanner.test.ts 覆盖。

Frontmatter 解析容错

社区插件的 YAML 可能格式不规范。扫描函数中必须 try-catch parseFrontmatter(),解析失败时用空 frontmatter + 原始内容兜底。

When not to use it

  • Modifying existing core logic without adding new resource types

Prerequisites

acplugin codebase

Limitations

  • Frontmatter parsing requires error handling

How it compares

This provides a structured, repeatable framework for extending plugin functionality rather than ad-hoc code changes.

Compared to similar skills

add-converter side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
add-converter (this skill)04moNo flagsAdvanced
codex-skill125moReviewAdvanced
run-nx-generator53moReviewIntermediate
cli-builder57moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry