skill.translate

Format translators: SKILL.md <-> agent-specific formats.

Module Attributes

translators

Registry of format translators (Skill -> target format string).

Functions

from_mdc(content)

Import a Cursor .mdc file as a Skill.

to_copilot_instructions(skill)

Translate a Skill to GitHub Copilot instructions format.

to_mdc(skill)

Translate a Skill to Cursor .mdc format.

translate(skill, *, target_format)

Translate a Skill to the specified target format.

skill.translate.from_mdc(content)[source]

Import a Cursor .mdc file as a Skill.

Return type:

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'
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 beyond applyTo, no progressive disclosure, no resources.

Return type:

str

>>> 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
skill.translate.to_mdc(skill)[source]

Translate a Skill to Cursor .mdc format.

Lossy: allowed-tools, license, bundled resources, and progressive disclosure semantics are lost.

Return type:

str

>>> 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
skill.translate.translate(skill, *, target_format)[source]

Translate a Skill to the specified target format.

Return type:

str

>>> from skill.base import SkillMeta
>>> s = Skill(meta=SkillMeta(name='x', description='y'), body='z')
>>> 'alwaysApply' in translate(s, target_format='mdc')
True
skill.translate.translators: Registry[Callable[[Skill], str]] = Registry('translators', keys=['mdc', 'copilot_md'])

Registry of format translators (Skill -> target format string).