Bi-directional converter between Claude Code and Gemini CLI command formats. This library enables seamless sharing of AI commands between different CLI tools, fostering a more connected AI assistant ecosystem.
- 🔄 Bi-directional conversion between Claude Code (.md) and Gemini CLI (.toml) formats
- 🎯 Smart parameter mapping with type conversion and validation
- ⚡ CLI tool for batch conversions
- 📦 Programmatic API for integration into other tools
- 🔍 Compatibility checking with detailed warnings
- 📝 Format preservation maintains metadata and structure where possible
npm install -g ai-command-converterOr use in your project:
npm install ai-command-converterTo automatically sync your Claude Code and Gemini CLI commands:
# One-time bi-directional sync
npx ai-command-sync sync
# Watch for changes and auto-sync
npx ai-command-sync watch
# Sync in one direction only
npx ai-command-sync sync --direction claude-to-geminiConvert a single file:
ai-command-converter convert blog-writer.md --output blog-writer.tomlConvert an entire directory:
ai-command-converter convert ./claude-commands --output ./gemini-commands --format tomlimport { ClaudeCodeCommand, GeminiCommand, Converter } from 'ai-command-converter';
// Parse a Claude Code command
const claudeCmd = await ClaudeCodeCommand.fromFile('./commands/blog-writer.md');
// Convert to Gemini format
const geminiCmd = await Converter.toGemini(claudeCmd);
// Save the converted command
await geminiCmd.saveToFile('~/.gemini/commands/blog-writer.toml');
// Or go the other direction
const geminiCmd = await GeminiCommand.fromFile('./blog.toml');
const claudeCmd = await Converter.toClaudeCode(geminiCmd);Keep your Claude Code and Gemini CLI commands automatically synchronized:
# Sync all commands between ~/.claude/commands and ~/.gemini/commands
npx ai-command-sync sync
# Dry run to see what would change
npx ai-command-sync sync --dry-run
# Verbose output
npx ai-command-sync sync --verboseAutomatically sync changes as they happen:
# Watch for changes every 5 seconds (default)
npx ai-command-sync watch
# Custom check interval
npx ai-command-sync watch --interval 10# Custom directories
npx ai-command-sync sync \
--claude-dir ~/my-claude-commands \
--gemini-dir ~/my-gemini-commands
# One-way sync
npx ai-command-sync sync --direction claude-to-gemini
npx ai-command-sync sync --direction gemini-to-claude
# Conflict resolution strategies
npx ai-command-sync sync --conflict newest # Use newest file (default)
npx ai-command-sync sync --conflict skip # Skip conflicts
npx ai-command-sync sync --conflict prompt # Interactive promptThe sync tool preserves organization structure:
- Claude:
~/.claude/commands/github-import.md - Gemini:
~/.gemini/commands/anthropic/github-import.toml
Commands are matched by name, supporting both flat and organized structures.
- Claude Code: Uses
{{parameter}}placeholders for each parameter - Gemini CLI: Uses
{{args}}for all arguments, which the AI parses based on the prompt instructions
---
title: "Generate Blog Post"
description: "Creates a blog post on any topic"
params:
- name: topic
type: string
required: true
description: "The blog topic"
- name: tone
type: enum
options: [neutral, playful, formal]
default: neutral
---
# Instructions
Write a comprehensive blog post about {{topic}} in a {{tone}} tone...description = "Creates a blog post on any topic"
prompt = """
Parse the provided arguments: {{args}}
Expected parameters:
- topic: The blog topic [required]
- tone: Writing tone (default: neutral) [optional]
Write a comprehensive blog post about the specified topic in the requested tone...
"""static fromFile(path)- Parse a .md filestatic fromString(content)- Parse markdown contenttoObject()- Get command as plain objectvalidate()- Validate command structure
static fromFile(path)- Parse a .toml filestatic fromString(content)- Parse TOML contenttoObject()- Get command as plain objectvalidate()- Validate command structure
static async toGemini(claudeCommand, options)- Convert to Gemini formatstatic async toClaudeCode(geminiCommand, options)- Convert to Claude formatstatic validate(command, targetFormat)- Check compatibility
const options = {
// Preserve organization structure in output path
preserveNamespace: true,
// Include source metadata in converted files
includeSourceMetadata: true,
// Validation strictness
strict: false,
// Custom parameter mapping (advanced use)
parameterMapping: {
'topic': 'subject'
}
};
const geminiCmd = await Converter.toGemini(claudeCmd, options);| Feature | Claude → Gemini | Gemini → Claude |
|---|---|---|
| Basic metadata | ✅ | ✅ |
| String parameters | ✅ | ✅ |
| Enum parameters | ✅ Inferred from usage | |
| Optional params | ✅ | ✅ |
| Default values | ✅ | |
| Multi-line content | ✅ | ✅ |
| MCP requirements | ❌ Not supported |
- Gemini → Claude: Parameter types must be inferred from usage documentation
- Claude → Gemini: Complex parameter types are simplified to strings
- Both directions: Some metadata may be lost in conversion
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
MIT - See LICENSE for details.
Created by Commands.com to foster interoperability in the AI CLI ecosystem.