Loading...
Loading...
Multi-Harness Portability is the engineering discipline of writing agent skills, prompts, and configurations that work across every major AI coding harness — Claude Code, Cursor, Codex, Gemini CLI, OpenCode, and beyond.
npx skill4agent add itallstartedwithaidea/agent-skills multi-harness-portabilitygraph TD
A[Universal SKILL.md] --> B[Platform Detector]
B --> C{Which Harness?}
C -->|Claude Code| D[Claude Adapter]
C -->|Cursor| E[Cursor Adapter]
C -->|Codex| F[Codex Adapter]
C -->|Gemini| G[Gemini Adapter]
D --> H[CLAUDE.md Rules + Hooks]
E --> I[.cursor/rules/ + Skills]
F --> J[codex instructions]
G --> K[System Prompt Config]
H --> L[Unified Execution]
I --> L
J --> L
K --> L.cursor/rules/#!/bin/bash
detect_platform() {
if [ -n "$CLAUDE_CODE" ] || [ -f "CLAUDE.md" ]; then
echo "claude-code"
elif [ -d ".cursor" ] || [ -n "$CURSOR_SESSION" ]; then
echo "cursor"
elif [ -n "$CODEX_SESSION" ] || [ -f ".codex/instructions.md" ]; then
echo "codex"
elif [ -n "$GEMINI_CLI" ]; then
echo "gemini"
else
echo "generic"
fi
}import os
import shutil
from pathlib import Path
class SkillInstaller:
PLATFORM_CONFIGS = {
"claude-code": {
"skill_dir": ".",
"rules_file": "CLAUDE.md",
"hooks_dir": ".claude/hooks",
"format": "markdown_rules",
},
"cursor": {
"skill_dir": ".cursor/skills",
"rules_file": ".cursor/rules/{name}.md",
"hooks_dir": None,
"format": "skill_md",
},
"codex": {
"skill_dir": ".codex",
"rules_file": ".codex/instructions.md",
"hooks_dir": None,
"format": "instructions",
},
"gemini": {
"skill_dir": ".gemini",
"rules_file": ".gemini/system_prompt.md",
"hooks_dir": None,
"format": "system_prompt",
},
}
def install(self, skill_path: str, platform: str, project_root: str):
config = self.PLATFORM_CONFIGS[platform]
skill = self.parse_skill(skill_path)
if config["format"] == "markdown_rules":
self.install_claude_code(skill, config, project_root)
elif config["format"] == "skill_md":
self.install_cursor(skill, config, project_root)
elif config["format"] == "instructions":
self.install_codex(skill, config, project_root)
elif config["format"] == "system_prompt":
self.install_gemini(skill, config, project_root)
def install_cursor(self, skill, config, root):
skill_dir = Path(root) / config["skill_dir"] / skill["name"]
skill_dir.mkdir(parents=True, exist_ok=True)
(skill_dir / "SKILL.md").write_text(skill["content"])
def install_claude_code(self, skill, config, root):
claude_md = Path(root) / config["rules_file"]
existing = claude_md.read_text() if claude_md.exists() else ""
section = f"\n\n## Skill: {skill['name']}\n\n{skill['instructions']}\n"
if skill["name"] not in existing:
claude_md.write_text(existing + section)
def parse_skill(self, path: str) -> dict:
content = Path(path).read_text()
name = content.split("\n")[0].replace("# ", "").strip()
return {"name": name, "content": content, "instructions": self.extract_instructions(content)}
def extract_instructions(self, content: str) -> str:
sections = content.split("\n## ")
for section in sections:
if section.startswith("Use When") or section.startswith("Best Practices"):
return section
return content[:2000]# .github/workflows/skill-test.yml
name: Skill Portability Test
on: [push, pull_request]
jobs:
test-skills:
strategy:
matrix:
platform: [claude-code, cursor, codex, gemini]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install skill for ${{ matrix.platform }}
run: |
python scripts/install_skill.py \
--skill skills/claude-mythos/context-engineering/SKILL.md \
--platform ${{ matrix.platform }} \
--root ./test-project
- name: Validate installation
run: |
python scripts/validate_installation.py \
--platform ${{ matrix.platform }} \
--root ./test-project
- name: Run platform-specific checks
run: |
python scripts/platform_checks.py \
--platform ${{ matrix.platform }} \
--root ./test-project# {Skill Name}
Part of [Agent Skills™](https://github.com/itallstartedwithaidea/agent-skills)
<!-- PORTABLE: This skill is designed for cross-platform compatibility -->
<!-- PLATFORMS: claude-code, cursor, codex, gemini -->
## Description
{Platform-agnostic description using no platform-specific terminology}
## Use When
{Conditions that apply regardless of platform}
## Implementation
{Code examples using standard libraries, no platform-specific APIs}
## Platform Notes
| Platform | Loading | Notes |
|---|---|---|
| Claude Code | CLAUDE.md / hooks | {specific guidance} |
| Cursor | .cursor/skills/ | {specific guidance} |
| Codex | instructions.md | {specific guidance} |
| Gemini | system_prompt | {specific guidance} || Feature | Claude Code | Cursor | Codex | Gemini CLI |
|---|---|---|---|---|
| SKILL.md loading | ✅ Via CLAUDE.md | ✅ Native | ⚠️ Via instructions | ⚠️ Via system prompt |
| Automated installation | ✅ Hooks | ✅ Skills | ✅ CLI | ✅ Config |
| Cross-platform CI | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| Adapter layer | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| Hot-reload | ✅ File watch | ✅ Native | ❌ Restart needed | ❌ Restart needed |