skill.translate¶
Format translators: SKILL.md <-> agent-specific formats.
Module Attributes
Registry of format translators (Skill -> target format string). |
|
Registry of what each lossy format drops (Skill -> lost field names), by format. |
Functions
|
Import a Cursor |
|
What translating skill to target_format drops; |
|
Translate a Skill to a Cline rule file (Markdown; always active). |
|
Translate a Skill to GitHub Copilot instructions format. |
|
Translate a Skill to a section of Gemini CLI's |
|
Translate a Skill to Cursor |
|
Translate a Skill to a Windsurf rule, applied when the model judges it relevant. |
|
Translate a Skill to the specified target format. |
- skill.translate.from_mdc(content)[source]¶
Import a Cursor
.mdcfile as a Skill.>>> content = "---\ndescription: Do things\nglobs: '*.py'\nalwaysApply: false\n---\n# Rules" >>> s = from_mdc(content) >>> s.meta.description 'Do things' >>> s.meta.metadata.get('cursor.globs') '*.py'Globs as Cursor itself writes them (unquoted, not valid YAML) are kept verbatim:
>>> from_mdc("---\nglobs: **/*.py, **/*.ts\n---\nx").meta.metadata['cursor.globs'] '**/*.py, **/*.ts'- Return type:
- skill.translate.lost_fields(skill, *, target_format)[source]¶
What translating skill to target_format drops;
[]for a lossless format.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='t', description='d', license='MIT'), body='x') >>> lost_fields(s, target_format='mdc') ['license'] >>> lost_fields(s, target_format='skill.md') []
- skill.translate.to_cline_rule(skill)[source]¶
Translate a Skill to a Cline rule file (Markdown; always active).
metadatakeycline.pathsbecomes thepathsfrontmatter that makes the rule conditional. Lossy: no progressive disclosure, andallowed-tools,licenseand bundled resources are dropped.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='lint', description='Lint rules'), body='Use ruff.') >>> to_cline_rule(s).splitlines()[:3] ['# lint', '', '> Lint rules']- Return type:
- skill.translate.to_copilot_instructions(skill)[source]¶
Translate a Skill to GitHub Copilot instructions format.
Produces a Markdown section suitable for appending to
.github/copilot-instructions.md. Lossy: no frontmatter support beyondapplyTo, no progressive disclosure, no resources.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='lint', description='Lint rules'), body='Use ruff.') >>> md = to_copilot_instructions(s) >>> '## lint' in md True >>> 'Use ruff.' in md True- Return type:
- skill.translate.to_gemini_md(skill)[source]¶
Translate a Skill to a section of Gemini CLI’s
GEMINI.md.Lossy: the file is always loaded (no progressive disclosure), and
allowed-tools,licenseand bundled resources are dropped.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='lint', description='Lint rules'), body='Use ruff.') >>> to_gemini_md(s).splitlines()[0] '## lint'- Return type:
- skill.translate.to_mdc(skill)[source]¶
Translate a Skill to Cursor
.mdcformat.Lossy:
allowed-tools,license, bundled resources, and progressive disclosure semantics are lost.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='test', description='Test skill'), body='Do stuff.') >>> mdc = to_mdc(s) >>> 'description: Test skill' in mdc True >>> 'Do stuff.' in mdc True- Return type:
- skill.translate.to_windsurf_rule(skill)[source]¶
Translate a Skill to a Windsurf rule, applied when the model judges it relevant.
metadatakeyswindsurf.trigger(defaultmodel_decision) andwindsurf.globspass through. Lossy:allowed-tools,licenseand bundled resources are dropped.>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='lint', description='Lint rules'), body='Use ruff.') >>> print(to_windsurf_rule(s)) --- trigger: model_decision description: Lint rules --- Use ruff.- Return type:
- skill.translate.translate(skill, *, target_format)[source]¶
Translate a Skill to the specified target format.
>>> from skill.base import SkillMeta >>> s = Skill(meta=SkillMeta(name='x', description='y'), body='z') >>> 'alwaysApply' in translate(s, target_format='mdc') True- Return type:
- skill.translate.translation_losses: Registry[Callable[[Skill], list[str]]] = Registry('translation_losses', keys=['mdc', 'copilot_md', 'gemini_md', 'windsurf_md', 'clinerules_md'])¶
Registry of what each lossy format drops (Skill -> lost field names), by format.
The SSOT for lossy down-casts: translators warn from it, and linters (opsward’s portability check) read it without translating anything.