> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Migration steps

Skills from a custom skill blueprint stop loading after January 1, 2027

Until January 1, 2027, Port AI and the load_skill tool of Port MCP load skills from both your skill blueprint and _ai_skill. From that date, they load skills only from _ai_skill, and the port skills commands of the Port CLI stop working. See the migration timeline for details.

This guide is the checklist for moving skills from a custom skill blueprint to the _ai_skill system blueprint. Complete it before January 1, 2027, when Port AI and Port MCP stop loading skills from custom skill blueprints. The _ai_skill blueprint is created automatically in organizations with Port AI enabled. If you don't see it on the data model page, check that Port AI is enabled in your organization.

Before the detailed steps below, review the migration overview so you know how properties and skill groups map to _ai_skill.

Let an AI agent run the migration

Use the Copy page menu at the top right of this page to copy or open these steps in the AI assistant of your choice, then ask it to follow them and migrate your skills for you. This requires connecting your IDE or AI assistant to Port MCP.

Step 1: Update your Git integration mapping​

If you ingest skills from Git, point your mapping at _ai_skill. Use the skill kind with includeSkillFolder: true so every supporting file in the skill folder lands in files. This replaces mappings that used the file or folder kind to fill references and assets.

resources:
- kind: skill
selector:
query: 'true'
includeSkillFolder: true
paths:
- path: 'skills/**/SKILL.md'
organization: my-org
repos:
- name: my-repo
branch: main
port:
entity:
mappings:
identifier: .__repository.full_name + "/" + .skill.skillMdPath
title: .skill.name
blueprint: '"_ai_skill"'
properties:
name: .skill.name
description: .skill.description
instructions: .skill.instructions
files: .skill.files // []
license: .skill.frontmatter.license
compatibility: .skill.frontmatter.compatibility
allowed_tools: .skill.frontmatter["allowed-tools"]
metadata: .skill.frontmatter.metadata
Keep your existing identifiers

If AI agents, automations, or relations reference skills by identifier, adjust the identifier mapping so it produces the same identifiers your skill blueprint uses today. The mapping above uses the same identifiers as the skill kind mapping from earlier versions of the documentation. If you used the file kind, your identifiers likely differ: until you delete the old entities, both versions of a skill exist side by side and agents see each skill twice.

After saving the mapping, trigger a resync and confirm that your skills appear in the _ai_skill catalog.

When you replace the old resources in your mapping rather than keeping them next to the new one, the next resync deletes the skill entities the integration created in your old skill blueprint, because the integration no longer produces them. This only happens when the resync completes without errors and the share of deleted entities stays within the integration's entityDeletionThreshold.

_ai_skill follows the Agent Skills format strictly. A skill whose SKILL.md frontmatter has no description, or a name that is not up to 64 lowercase letters, digits and single hyphens, is rejected and does not appear in the catalog. The integration's logs show which skills were rejected and why, so you can fix their frontmatter.

If you upload skills from CI/CD, update your script to post to /v1/blueprints/_ai_skill/entities. See upload skills from a folder for updated scripts.

Step 2: Copy skills you created manually​

Skills you created in the UI, through the API, or through Terraform are not managed by an integration. Copy them to _ai_skill with the script below. It reads every entity of your skill blueprint, maps it according to the property mapping, and upserts it to _ai_skill with the same identifier.

The script supports the skill blueprints from earlier versions of the documentation. For each skill, it handles the differences between those blueprints and _ai_skill:

  • Moves references, assets, scripts and additional_files into files, keeping the paths agents load today.
  • Removes a frontmatter block from the start of instructions, and uses its name, license, compatibility, allowed-tools and metadata.
  • Sets owning teams from a group relation to teams and from skill_group groups, following the rules in step 4.
  • Copies custom properties, such as fileUrl or publish_status, that exist on _ai_skill with the same identifier.
  • Skips skills whose description is missing or longer than 1024 characters, and warns about skills that end up with the same name.
Review and adapt the script before you run it

Each organization defines its own skill blueprint differently, so yours may differ from the ones this script expects, for example in property names, property types, or custom properties and relations. Use the script with caution: read it, adjust the to_ai_skill function to match your blueprint, and run it with --dry-run before copying any entities.

copy_skills_to_ai_skill.py script (click to expand)
#!/usr/bin/env python3
"""
Copy skill entities from a custom skill blueprint to the _ai_skill blueprint.

Supports the skill blueprints from earlier versions of the Port documentation:
- The skills overview blueprint (references, assets, location).
- The skills registry blueprint (owning teams, a `group` relation to teams,
fileUrl, version, publish_status).
- Skill groups in a separate blueprint (commonly `skill_group`), related to
skills in either direction.

Environment variables:
PORT_CLIENT_ID - Port client ID
PORT_CLIENT_SECRET - Port client secret
PORT_BASE_URL - Port API base URL (default: https://api.port.io)
SOURCE_BLUEPRINT - Identifier of your skill blueprint (default: skill)
GROUP_BLUEPRINT - Identifier of your skill group blueprint, if you have one (default: skill_group)

Usage:
python copy_skills_to_ai_skill.py # Copy all skills
python copy_skills_to_ai_skill.py --dry-run # Print what would be copied
"""

import os
import re
import sys
from collections import defaultdict

import requests
import yaml

PORT_BASE_URL = os.environ.get('PORT_BASE_URL', 'https://api.port.io')
SOURCE_BLUEPRINT = os.environ.get('SOURCE_BLUEPRINT', 'skill')
GROUP_BLUEPRINT = os.environ.get('GROUP_BLUEPRINT', 'skill_group')
TARGET_BLUEPRINT = '_ai_skill'
TEAM_BLUEPRINT = '_team'

NAME_PATTERN = re.compile(r'^[a-z0-9]+(-[a-z0-9]+)*$')
FRONTMATTER_PATTERN = re.compile(r'^\s*---\r?\n(.*?)\r?\n---[ \t]*(?:\r?\n|$)', re.DOTALL)

# Folder prefix of each file property. Port loads these files under the prefix today,
# so adding it keeps the paths agents and instructions refer to unchanged.
FILE_PROPERTIES = {
'references': 'references',
'assets': 'assets',
'scripts': 'scripts',
'additional_files': None,
}

# SKILL.md frontmatter keys and the _ai_skill property each one is stored in
FRONTMATTER_PROPERTIES = {
'license': 'license',
'compatibility': 'compatibility',
'allowed-tools': 'allowed_tools',
}

# Source properties mapped explicitly, or not used by _ai_skill
HANDLED_PROPERTIES = {'name', 'description', 'instructions', 'location', 'files', *FILE_PROPERTIES}


def get_access_token():
client_id = os.environ.get('PORT_CLIENT_ID')
client_secret = os.environ.get('PORT_CLIENT_SECRET')

if not client_id or not client_secret:
raise Exception('PORT_CLIENT_ID and PORT_CLIENT_SECRET environment variables are required')

response = requests.post(
f'{PORT_BASE_URL}/v1/auth/access_token',
json={'clientId': client_id, 'clientSecret': client_secret},
)
response.raise_for_status()
return response.json()['accessToken']


def get_blueprint(headers, identifier):
response = requests.get(f'{PORT_BASE_URL}/v1/blueprints/{identifier}', headers=headers)
if response.status_code == 404:
return None
response.raise_for_status()
return response.json()['blueprint']


def get_entities(headers, blueprint):
response = requests.get(f'{PORT_BASE_URL}/v1/blueprints/{blueprint}/entities', headers=headers)
response.raise_for_status()
return response.json().get('entities', [])


def as_list(value):
if value is None:
return []
return value if isinstance(value, list) else [value]


def parse_frontmatter(text):
try:
frontmatter = yaml.safe_load(text)
return frontmatter if isinstance(frontmatter, dict) else None
except yaml.YAMLError:
pass
# Agents accept frontmatter that is not valid YAML, like an unquoted colon in the description
frontmatter, key = {}, None
for line in text.splitlines():
match = re.match(r'^([A-Za-z][\w-]*):\s*(.*)$', line)
if match:
key, value = match.groups()
frontmatter[key] = value.strip().strip('\'"')
elif key and line.strip() and line[0].isspace() and isinstance(frontmatter[key], str):
frontmatter[key] = f'{frontmatter[key]} {line.strip()}'.strip()
elif line.strip():
return None
return frontmatter


def split_frontmatter(instructions):
"""Split leading SKILL.md frontmatter blocks from the instructions, if there are any."""
frontmatter = {}
while match := FRONTMATTER_PATTERN.match(instructions):
block = parse_frontmatter(match.group(1))
if block is None:
break
frontmatter = {**block, **frontmatter}
instructions = instructions[match.end():].lstrip('\n')
return frontmatter, instructions


def to_files(properties):
files = {}
for key, prefix in FILE_PROPERTIES.items():
for item in properties.get(key) or []:
path = item.get('path')
if not path or item.get('content') is None:
continue
if prefix and not path.startswith(f'{prefix}/'):
path = f'{prefix}/{path}'
files[path] = {'path': path, 'content': item['content']}
return list(files.values())


def to_skill_name(frontmatter_name, identifier):
if isinstance(frontmatter_name, str) and NAME_PATTERN.match(frontmatter_name) and len(frontmatter_name) <= 64:
return frontmatter_name
# _ai_skill names are up to 64 lowercase letters, digits and single hyphens
return re.sub(r'[^a-z0-9]+', '-', identifier.lower()).strip('-')[:64].rstrip('-')


def is_required_group(group):
properties = group.get('properties') or {}
return 'required' in (properties.get('enforcement'), properties.get('enforcement_level'))


def group_teams_by_skill(headers, source_blueprint, entities):
"""Owning teams each skill gets from the groups it belongs to."""
teams_by_skill = defaultdict(set)

# A relation from the skill blueprint to teams, like `group` in the skills registry guide
team_relations = [
key for key, relation in source_blueprint.get('relations', {}).items() if relation['target'] == TEAM_BLUEPRINT
]

group_blueprint = get_blueprint(headers, GROUP_BLUEPRINT)
if not group_blueprint:
return team_relations, teams_by_skill

# Group membership can be a relation on the skill, on the group, or both
skill_to_group = [
key for key, relation in source_blueprint.get('relations', {}).items() if relation['target'] == GROUP_BLUEPRINT
]
group_to_skill = [
key for key, relation in group_blueprint.get('relations', {}).items() if relation['target'] == SOURCE_BLUEPRINT
]

groups = {group['identifier']: group for group in get_entities(headers, GROUP_BLUEPRINT)}
groups_by_skill = defaultdict(set)
for group in groups.values():
for key in group_to_skill:
for skill_identifier in as_list((group.get('relations') or {}).get(key)):
groups_by_skill[skill_identifier].add(group['identifier'])
for skill in entities:
for key in skill_to_group:
for group_identifier in as_list((skill.get('relations') or {}).get(key)):
groups_by_skill[skill['identifier']].add(group_identifier)

for skill_identifier, group_identifiers in groups_by_skill.items():
skill_groups = [groups[identifier] for identifier in group_identifiers if identifier in groups]
# Skills in a required group were synced to everyone, so they stay visible to everyone
if any(is_required_group(group) for group in skill_groups):
continue
for group in skill_groups:
teams_by_skill[skill_identifier].update(group.get('team') or [])

return team_relations, teams_by_skill


def to_ai_skill(entity, target_properties, team_relations, teams_by_skill):
properties = entity.get('properties') or {}
frontmatter, instructions = split_frontmatter(properties.get('instructions') or '')

skill_properties = {
'name': to_skill_name(frontmatter.get('name'), entity['identifier']),
'description': properties.get('description') or frontmatter.get('description'),
'instructions': instructions,
'files': to_files(properties),
}
for key, property_name in FRONTMATTER_PROPERTIES.items():
if isinstance(frontmatter.get(key), str):
skill_properties[property_name] = frontmatter[key]
if isinstance(frontmatter.get('metadata'), dict):
skill_properties['metadata'] = frontmatter['metadata']

# Custom properties you added to _ai_skill with the same identifier, like fileUrl or publish_status
for key, value in properties.items():
if key not in HANDLED_PROPERTIES and key in target_properties and value is not None:
skill_properties[key] = value

teams = set(entity.get('team') or []) | teams_by_skill.get(entity['identifier'], set())
for key in team_relations:
teams.update(as_list((entity.get('relations') or {}).get(key)))

skill = {
'identifier': entity['identifier'],
'title': entity.get('title') or entity['identifier'],
'properties': skill_properties,
}
if teams:
skill['team'] = sorted(teams)
return skill


def main():
dry_run = '--dry-run' in sys.argv
token = get_access_token()
headers = {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}

source_blueprint = get_blueprint(headers, SOURCE_BLUEPRINT)
target_blueprint = get_blueprint(headers, TARGET_BLUEPRINT)
if not source_blueprint or not target_blueprint:
raise Exception(f'Both the "{SOURCE_BLUEPRINT}" and "{TARGET_BLUEPRINT}" blueprints must exist')
target_properties = set(target_blueprint['schema']['properties'])

entities = get_entities(headers, SOURCE_BLUEPRINT)
print(f'Found {len(entities)} skills in the "{SOURCE_BLUEPRINT}" blueprint')
team_relations, teams_by_skill = group_teams_by_skill(headers, source_blueprint, entities)

skills = [to_ai_skill(entity, target_properties, team_relations, teams_by_skill) for entity in entities]
identifiers_by_name = defaultdict(list)
for skill in skills:
identifiers_by_name[skill['properties']['name']].append(skill['identifier'])

copied, skipped, failed = 0, 0, 0
for skill in skills:
identifier = skill['identifier']
description = skill['properties']['description']
if not description or len(description) > 1024:
length = len(description or '')
print(f' Skipped {identifier}: description has {length} characters, {TARGET_BLUEPRINT} requires 1 to 1024')
skipped += 1
continue
if not skill['properties']['name']:
print(f' Skipped {identifier}: cannot derive a valid name from the identifier')
skipped += 1
continue

if dry_run:
teams = ', '.join(skill.get('team', [])) or 'none'
print(
f' Would copy {identifier} as "{skill["properties"]["name"]}" '
f'({len(skill["properties"]["files"])} files, owning teams: {teams})'
)
continue

result = requests.post(
f'{PORT_BASE_URL}/v1/blueprints/{TARGET_BLUEPRINT}/entities?upsert=true&merge=true',
headers=headers,
json=skill,
)
if result.ok:
print(f' Copied {identifier}')
copied += 1
else:
print(f' Failed {identifier}: {result.status_code} {result.text}')
failed += 1

for name, identifiers in identifiers_by_name.items():
if len(identifiers) > 1:
print(f'Warning: {", ".join(identifiers)} share the name "{name}". Loading "{name}" returns only one of them.')

if not dry_run:
print(f'Done: {copied} copied, {skipped} skipped, {failed} failed')


if __name__ == '__main__':
main()

Run the script with --dry-run first to review what will be copied, including each skill's name and owning teams:

pip install requests pyyaml

export PORT_CLIENT_ID="your-client-id"
export PORT_CLIENT_SECRET="your-client-secret"
# For the US region:
# export PORT_BASE_URL="https://api.us.port.io"
# If your skill group blueprint has a different identifier:
# export GROUP_BLUEPRINT="my_skill_group"

python copy_skills_to_ai_skill.py --dry-run
python copy_skills_to_ai_skill.py

Before you run it without --dry-run:

  • Shorten the description of every skill the dry run skips, then run it again.
  • Resolve skills that share a name, for example duplicates such as api_readiness and api-readiness. Delete one of them, or give them different names.
  • Add custom properties and relations you want to keep, such as fileUrl or publish_status, to _ai_skill on the data model page, so the script copies their values. The script copies properties only. To copy relations too, extend the to_ai_skill function.

If you manage skills with Terraform, update the blueprint of your port_entity resources to _ai_skill and map the properties according to the property mapping instead of running the script.

Skills ingested from Git

Skip skills that your Git integration already writes to _ai_skill after step 1. Copying them is harmless, but the next resync overwrites them with the content from Git.

Step 3: Recreate custom properties and automations​

Review what you built on top of your skill blueprint and move it to _ai_skill:

  • Custom properties and relations - add any you want to keep to _ai_skill before running the copy script in step 2, so their values are copied in the first run. If you add them afterward, you can re-run the script as a fallback to fill in the values, but that upserts each skill by identifier and overwrites any changes you made to them in _ai_skill since.
  • Relations from other blueprints - update relations that target your skill blueprint, for example from a plugin, an AI agent, or a skill_group blueprint you keep, to target _ai_skill.
  • Automations and self-service actions - update triggers and payloads that reference your skill blueprint identifier.
  • Scorecards - recreate scorecards on _ai_skill.
  • Catalog pages and dashboards - point pages and widgets at _ai_skill.
  • Permissions - reapply any entity permissions you configured, so each team keeps seeing the same skills. To scope skills to owning teams, see step 4.

Step 4: Scope skills to owning teams​

If you grouped skills in your custom skill blueprint, move the groups to owning teams:

  • group relation to teams - add the teams in the relation to the skill's $team, and replace the read policy on group_identifiers with the policy below.
  • skill_group groups owned by teams - add the group's owning teams to the $team of every skill in the group. A skill in several groups gets the owning teams of all of them.
  • required groups - leave the skills in them without an owning team, so they stay visible to everyone, even if the group has an owning team.
  • Broader audiences - a Port team of type group, such as a department or guild, can own a skill, which makes it visible to everyone in it.

The copy script in step 2 applies these rules for you.

Owning teams alone do not limit who can read a skill. To scope read access, set the following read policy on the _ai_skill blueprint:

  1. Go to the data model page, expand the AI Skill blueprint, click the ... button, and select Permissions.

  2. Switch to the Entities tab and click Edit JSON.

  3. Add the following to the blueprint's permissions JSON:

    {
    "entities": {
    "read": {
    "roles": ["Admin"],
    "policy": {
    "combinator": "or",
    "rules": [
    { "property": "$team", "operator": "isEmpty" },
    {
    "property": "$team",
    "operator": "containsAny",
    "value": { "context": "userTeams", "property": "$identifier" }
    }
    ]
    }
    }
    }
    }
  4. Click Save.

Admins can read every skill. Everyone else can read skills with no owning team, and skills owned by one of their teams.

The policy in Scope read access to owning teams also filters on publish_status, a property the skills registry guide adds to _ai_skill. Use that version only if your skills have publish_status, otherwise it hides every skill.

Step 5: Verify​

  1. Open the _ai_skill catalog and check that every skill has a name, a description, its instructions, and its supporting files, and that Expose through Port AI and Expose through Port MCP are set the way you want.
  2. Open the Skills page and check that it now lists your _ai_skill entities.
  3. Ask Port AI, or a coding agent connected to Port MCP, to load one of your skills, and confirm it uses the instructions and files you expect. If several skills share the same name, for example the same skill in two repositories, loading by name returns the most recently updated one. Load it by its identifier to get a specific one.

Until January 1, 2027, a skill that exists only in your skill blueprint still loads, so make sure each skill you want to keep exists in _ai_skill before moving on.

Step 6: Remove your skill blueprint​

After you verify that all your skills live in _ai_skill:

  1. Remove the integration mappings, scripts, and automations that still write to your skill blueprint.
  2. If you have a skill_group blueprint, delete it, or point its relation at _ai_skill first if you keep it (see Skill groups). Deleting your skill blueprint also removes every relation that targets it, along with the mirror and aggregation properties built on those relations.
  3. Delete the skill blueprint and its entities from the data model page.
Deleting a blueprint is irreversible

Deleting the blueprint deletes all of its entities. Make sure every skill you need exists in _ai_skill first.