Skills
This feature is currently in open beta and available to all organizations. Should you encounter any bugs or functionality issues, please let us know so we can rectify them as soon as possible. Your feedback is greatly appreciated! ⭐
We are actively iterating to improve the experience. Breaking changes in the data model and functionality may occur. We will communicate changes on an ongoing basis. General availability is expected by Q4 2026.
Skills are domain-specific guidance packages that help Port AI handle specialized tasks more effectively. When the AI encounters a task that matches a skill's description, it loads the skill's step-by-step instructions to ensure consistent, thorough handling.
What are skills
Skills provide structured workflows for common but complex tasks. Instead of relying on general AI capabilities, skills encode expert knowledge into reusable instruction sets that guide the AI through specific processes.
Each skill contains:
- Name: A unique name for the skill.
- Description: When the AI should use this skill.
- Instructions: Step-by-step guidance in markdown format.
- Files (optional): Supporting files such as references, scripts, or assets.
Skills follow the open Agent Skills specification.
Example skills you can create
- Deployment guidelines
- Engineering metrics
- Analyze incident root cause
Deployment guidelines
A skill that helps decide on a deployment strategy, which workflows to run, how to check deployment status, and get approval. This skill can guide developers through your organization's deployment process by providing step-by-step instructions on choosing the right deployment strategy for different environments, running the appropriate CI/CD workflows, monitoring deployment progress, and obtaining necessary approvals from stakeholders before deploying to production.
Engineering metrics
A skill that structures how you want to get engineering metrics and what to look for. This skill helps analyze key performance indicators like lead time for changes, deployment frequency, change failure rate, and AI usage and cost metrics. It can provide guidance on how to collect, aggregate, and interpret these metrics to gain insights into your team's performance and identify areas for improvement.
Analyze incident root cause
A skill that provides a walkthrough on steps to run when analyzing an incident root cause. This skill guides you through a systematic process for investigating incidents, including gathering relevant logs and metrics, identifying the timeline of events, examining related services and dependencies, analyzing error patterns, and documenting findings to prevent similar incidents in the future.
How skills work
Skills are loaded via the load_skill tool available in the Port MCP Server. When Port AI detects a task that matches a skill's description, it automatically loads the relevant skill before proceeding.
Loading a skill:
load_skill({ name: "troubleshoot-integration" })
Loading a specific file from a skill:
load_skill({ name: "troubleshoot-integration", resource: "references/common-errors.md" })
Built-in skills
Port includes built-in skills for common workflows. These skills are available to all users without any configuration, unless marked as admins only.
action-permissions-helper (click to expand)
Helps you configure permissions for legacy self-service actions, with a focus on dynamic permission policies.
Use it to write or debug JQ expressions for execute and approve policies, or to understand why an existing permission policy isn't behaving as expected.
catalog-page-helper (click to expand)
Guides the creation and update of catalog pages that list a blueprint's entities in a single table.
Use it to create a catalog page, add it to the sidebar, or set up filters, grouping, sorting, and columns on the table.
create-custom-oauth-app (admins only) (click to expand)
Registers an OAuth app for a custom UI that you build outside of Port, and wires the authorization code flow with PKCE into that UI so it can call the Port API.
Use it when you want to build or connect an external app to Port. For widgets inside Port, use the plugin skills instead.
dashboard-page-helper (click to expand)
Guides the creation of dashboard pages with widgets, including a fallback approach for large pages with five or more widgets. It also checks your existing sidebar structure before placing a new page, keeping your navigation organized.
ei-ai-copilot-adoption (click to expand)
Sets up GitHub Copilot adoption metrics and the GitHub Copilot AI Adoption dashboard as part of Engineering Intelligence.
Use it to measure or visualize license utilization, acceptance rate, lines-of-code efficiency, low-engagement users, or per-team Copilot rollups.
ei-delivery-performance (click to expand)
Sets up pull request and merge request delivery performance metrics and dashboards for GitHub, GitLab, or Azure DevOps as part of Engineering Intelligence.
Use it to measure cycle time, throughput, stale pull requests, or reviewer coverage.
ei-foundation (click to expand)
Validates whether your organization has the data model required for Engineering Intelligence use cases, before you run the Delivery Performance or AI Copilot Adoption skills.
Use it whenever Engineering Intelligence widgets, scorecards, or dashboards appear empty, to check readiness and identify what's missing.
entity-page-helper (click to expand)
Guides updates to entity pages, the pages that show a single entity with tabs.
Use it to create, rename, or reorder tabs, or to update the widgets on an entity page.
fix-pages-api-validation (click to expand)
Validates the JSON of a dashboard, home, entity, or catalog page and repairs it until the page passes validation.
Use it when creating or updating a page fails because the page configuration is invalid.
install-library-plugin (admins only) (click to expand)
Browses the Port Plugins Library and installs curated plugins and widgets into your organization.
Use it to see which plugins are available, or to add a widget from the library.
mapping-assistant (click to expand)
Helps you create, modify, or troubleshoot integration mapping configurations.
Use it to write JQ expressions for data transformation, understand test results and errors, or debug mapping issues.
skill-creator (click to expand)
Guides you through creating and registering custom AI skills in Port, from clarifying the skill's purpose to writing effective instructions and registering it as a Port entity.
troubleshoot-integration (click to expand)
Diagnoses and resolves integration sync issues, mapping errors, and data problems.
Use it when data isn't syncing or appearing in Port, entities are missing or incorrect, or you're seeing sync errors and mapping configuration problems.
troubleshoot-scim (click to expand)
Diagnoses and resolves SCIM provisioning issues, including group provisioning errors, missing users, compatibility issues, and login problems. Works with Azure Entra ID, Okta, JumpCloud, Google Workspace, or any SCIM 2.0-compatible identity provider.
workflows (click to expand)
Creates or updates Port workflows, including triggers, action nodes, conditions, and data flow.
Use it to add, update, or remove individual nodes, connections, or user inputs in a workflow.
Port skills for coding agents
Port also publishes open-source skills for coding agents such as Claude Code, Cursor, and GitHub Copilot in the port-labs/port-skills repository. They teach your coding agent how to build with Port, and they are the best place to find the public skills Port offers:
| Skill | What it does |
|---|---|
port-getting-started | Sign up for Port and connect its MCP server to your coding agent. |
port-blueprints | Model your context lake with blueprints, properties, and relations. |
port-context-lake | Design a context lake with connected blueprints and semantic relations. |
port-dashboards | Build dashboard pages with widgets, layout, and permissions. |
port-integrations | Configure and troubleshoot integration mapping. |
port-permissions | Configure RBAC across the context lake and pages. |
port-terraform | Manage Port resources as code with the Terraform provider. |
port-workflows | Build workflows with triggers, action nodes, and conditions. |
Install a skill with the skills CLI, or install all of them, together with the Port MCP server, as a Claude Code plugin:
# Install a single skill
npx skills add port-labs/port-skills --skill port-workflows
# Or, in Claude Code, install the plugin
/plugin marketplace add port-labs/port-skills
/plugin install port-skills
See the repository README for the full and up-to-date list.
Creating custom skills
You can create custom skills tailored to your organization's specific workflows. Custom skills are stored as entities of the _ai_skill blueprint and can override built-in skills with the same identifier.
If your organization stores skills in a blueprint you created yourself, see Migrate to the _ai_skill blueprint.
The _ai_skill blueprint
_ai_skill is a system blueprint for skills. You can find it in your data model, browse its entities on the dedicated Skills page under AI Agents, and extend it with your own properties and relations. Skills support team ownership, so you can assign owning teams to each skill.
_ai_skill blueprint (click to expand)
{
"identifier": "_ai_skill",
"title": "AI Skill",
"icon": "Book",
"description": "Agent skills available to AI agents and coding assistants",
"schema": {
"properties": {
"name": {
"icon": "DefaultProperty",
"type": "string",
"title": "Name",
"description": "The skill name, as declared in the SKILL.md frontmatter. Lowercase letters, digits and single hyphens, up to 64 characters",
"minLength": 1,
"maxLength": 64,
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
"description": {
"icon": "DefaultProperty",
"type": "string",
"title": "Description",
"description": "What the skill does and when to use it, as declared in the SKILL.md frontmatter",
"minLength": 1,
"maxLength": 1024
},
"instructions": {
"icon": "Markdown",
"type": "string",
"title": "Instructions",
"format": "markdown",
"description": "The SKILL.md body, without the frontmatter"
},
"license": {
"icon": "DefaultProperty",
"type": "string",
"title": "License",
"description": "License name or reference to a bundled license file, as declared in the SKILL.md frontmatter"
},
"compatibility": {
"icon": "DefaultProperty",
"type": "string",
"title": "Compatibility",
"description": "Environment requirements (intended product, system packages, network access), as declared in the SKILL.md frontmatter",
"maxLength": 500
},
"allowed_tools": {
"icon": "DefaultProperty",
"type": "string",
"title": "Allowed Tools",
"description": "Space-delimited list of pre-approved tools, as declared in the `allowed-tools` field of the SKILL.md frontmatter"
},
"metadata": {
"icon": "DefaultProperty",
"type": "object",
"title": "Metadata",
"description": "Additional key-value pairs, as declared in the `metadata` field of the SKILL.md frontmatter"
},
"files": {
"icon": "DefaultProperty",
"type": "array",
"title": "Files",
"description": "Supporting files of the skill folder (e.g. references, scripts, assets)",
"items": {
"type": "object",
"properties": {
"path": { "type": "string", "title": "Path" },
"content": { "type": "string", "title": "Content" }
},
"required": ["path", "content"]
}
},
"expose_through_port_ai": {
"icon": "DefaultProperty",
"type": "boolean",
"title": "Expose through Port AI",
"description": "If true, this skill is available to Port AI",
"default": true
},
"expose_through_port_mcp": {
"icon": "DefaultProperty",
"type": "boolean",
"title": "Expose through Port MCP",
"description": "If true, this skill is loadable via Port MCP",
"default": true
}
},
"required": ["name", "description"]
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {},
"ownership": {
"type": "Direct",
"title": "Owning Teams"
}
}
The name, description, license, compatibility, allowed_tools and metadata properties follow the frontmatter fields of the Agent Skills specification. Port enforces the specification's limits on name (lowercase letters, digits and single hyphens, up to 64 characters), description (up to 1024 characters) and compatibility (up to 500 characters), and rejects entities that break them. When Port AI or Port MCP loads a skill, it builds the SKILL.md frontmatter from these properties and the body from instructions.
Control where a skill is available
Two boolean properties decide which Port surface can load a skill:
| Property | Effect when false |
|---|---|
expose_through_port_ai | Port AI, including your AI agents, does not list or load the skill. |
expose_through_port_mcp | Coding agents connected to Port MCP do not list or load the skill. |
Both default to true for new skill entities, so a skill is available everywhere unless you turn one of them off. A skill that is hidden from a surface stays in the catalog, and you can still view, edit and score it in Port.
Use them to:
- Keep a skill that is still under review away from agents until it is approved.
- Offer a skill only to coding agents, for example one that edits local files, or only to Port AI, for example one that relies on Port actions.
- Retire a skill without deleting it and its history.
The flags complement permissions. Port AI and Port MCP load skills with the requesting user's permissions, so a user can only load a skill they can read, and only through a surface the skill is exposed on.
The integration mappings on this page use enableMergeEntity: true and don't set the expose flags, so a flag you change in Port stays as you set it on the next sync. If you want Git to control them, map them from the SKILL.md frontmatter, for example expose_through_port_mcp: .skill.frontmatter.metadata["port-mcp"] != "false".
Create skill entities
Each _ai_skill entity represents one skill.
- Manual creation
- Using GitOps
Required properties:
| Property | Description |
|---|---|
identifier | Unique skill identifier, for example deploy-to-production. Agents load the skill by this identifier. |
name | The skill name from the SKILL.md frontmatter. Up to 64 lowercase letters, digits, and single hyphens, without a leading or trailing hyphen. Use the same value as the identifier when you can. |
description | A clear description of what the skill does and when Port AI should use it, up to 1024 characters. This helps the AI decide when to load the skill. |
Optional properties:
| Property | Description |
|---|---|
instructions | Step-by-step instructions in markdown format. |
files | Array of supporting files. Each item needs a path relative to the skill folder (for example references/runbook.md) and the file content. |
license | The license that applies to the skill, for example Apache-2.0, or the name of a bundled license file. |
compatibility | Environment requirements, such as the intended product, system packages, or network access, up to 500 characters. |
allowed_tools | Space-delimited list of tools the skill is pre-approved to use, for example Bash(git:*) Read. Served as allowed-tools in the frontmatter. |
metadata | Additional key-value pairs, for example {"author": "platform-team", "version": "1.2.0"}. |
expose_through_port_ai | Whether Port AI can load the skill. Defaults to true. See Control where a skill is available. |
expose_through_port_mcp | Whether coding agents connected to Port MCP can load the skill. Defaults to true. |
Example: Custom deployment skill
Here's an example of a custom skill for deploying services in your organization:
{
"identifier": "deploy-to-production",
"title": "Deploy to Production",
"properties": {
"name": "deploy-to-production",
"description": "Guide for deploying services to production. Use when users ask to deploy, release, or promote a service to production.",
"instructions": "# Deploy to Production\n\nFollow these steps to deploy a service to production:\n\n## Step 1: Verify prerequisites\n\n- Check that all tests pass.\n- Verify the service has a production-readiness scorecard score above 80%.\n- Confirm the service owner has approved the deployment.\n\n## Step 2: Run the deployment\n\nExecute the deployment action for the target service and environment.\n\n**Example input:**\n- Service: `payment-service`\n- Environment: `production`\n\n**Expected output:**\n- Deployment initiated successfully.\n- Action run ID returned for tracking.\n\n## Step 3: Verify deployment\n\n- Check the action run status.\n- Verify the service is healthy in production.\n- Monitor for any alerts in the first 15 minutes.\n\n## Common edge cases\n\n- If tests are failing, do not proceed with deployment.\n- If scorecard score is below threshold, recommend remediation steps first.\n- If deployment fails, check logs and suggest rollback if needed.",
"files": [
{
"path": "references/deployment-runbook.md",
"content": "# Deployment Runbook\n\n## Pre-deployment checklist\n\n- [ ] All CI checks pass\n- [ ] Code review approved\n- [ ] QA sign-off received\n\n## Rollback procedure\n\nIf deployment fails:\n1. Revert to previous version\n2. Notify on-call team\n3. Create incident ticket"
},
{
"path": "references/common-errors.md",
"content": "# Common Deployment Errors\n\n## ImagePullBackOff\nCause: Container registry authentication failed.\nFix: Verify registry credentials.\n\n## CrashLoopBackOff\nCause: Application fails to start.\nFix: Check application logs and configuration."
},
{
"path": "assets/deployment-config.yaml",
"content": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: {{ service_name }}\nspec:\n replicas: 3\n strategy:\n type: RollingUpdate"
}
]
}
}
You can ingest skills from your Git repositories using the skill kind of the GitHub or GitLab v2 integration. This enables a GitOps workflow where Git is the source of truth and Port stays in sync automatically.
Prerequisites:
The GitHub or GitLab v2 integration is installed in your account.
Recommended file structure:
Store each skill in its own folder. Put the instructions in SKILL.md, and put any other files the skill needs next to it, for example under references/ or assets/:
skills/
├── deploy-to-production/
│ ├── SKILL.md
│ ├── references/
│ │ └── deployment-runbook.md
│ └── assets/
│ └── deployment-config.yaml
└── troubleshoot-integration/
└── SKILL.md
Configure the integration:
-
Go to the connectors page in Port.
-
Find your GitHub or GitLab integration and click Manage.
-
Go to the Mapping tab.
-
Add the
skillkind mapping:The
skillkind discoversSKILL.mdfiles, parses the frontmatter and instructions, and emits one entity per skill. WithincludeSkillFolder: true, it also bundles the text files in each skill folder into.skill.files.- GitHub
- GitLab v2
GitHub skill kind mapping (click to expand)
deleteDependentEntities: falsecreateMissingRelatedEntities: trueenableMergeEntity: trueresources:- kind: skillselector:query: 'true'includeSkillFolder: truepaths:- path: 'skills/**/SKILL.md'organization: my-org # Optional if githubOrganization is set (required if not set)repos:- name: my-skills-repobranch: mainport:entity:mappings:identifier: .__repository.full_name + "/" + .skill.skillMdPathtitle: .skill.nameblueprint: '"_ai_skill"'properties:name: .skill.namedescription: .skill.descriptioninstructions: .skill.instructionsfiles: .skill.files // []license: .skill.frontmatter.licensecompatibility: .skill.frontmatter.compatibilityallowed_tools: .skill.frontmatter["allowed-tools"]metadata: .skill.frontmatter.metadataGitLab v2 skill kind mapping (click to expand)
deleteDependentEntities: falsecreateMissingRelatedEntities: trueenableMergeEntity: trueresources:- kind: skillselector:query: 'true'includeSkillFolder: truepaths:- path: 'skills/**/SKILL.md'repos:- group/my-skills-repoport:entity:mappings:identifier: .repo.path_with_namespace + "/" + .skill.skillMdPathtitle: .skill.nameblueprint: '"_ai_skill"'properties:name: .skill.namedescription: .skill.descriptioninstructions: .skill.instructionsfiles: .skill.files // []license: .skill.frontmatter.licensecompatibility: .skill.frontmatter.compatibilityallowed_tools: .skill.frontmatter["allowed-tools"]metadata: .skill.frontmatter.metadata -
Click Save & Resync to update the integration configuration.
After configuration, skills from your repositories will automatically sync to Port. Changes in Git will appear in your Port catalog after the integration syncs.
Common practices
- Namespace the
identifierwith the repository, so skills with the same folder name in different repositories don't collide. - Keep
deleteDependentEntities: falseon this connector. Setting it totruemeans a temporary sync issue, like a rate limit, a revoked permission, or a renamed repo, deletes skill entities on the next resync instead of leaving them stale. includeSkillFolderbundles text files only, and skips skills whoseSKILL.mdand folder files exceed 1MB in total. Keep large or binary assets out of skill folders.- Keep each
SKILL.mdwithin the specification limits. When the frontmatter has noname, the integration uses the folder name, so a folder likeDeploy_Servicefails to sync until you add a validnamesuch asdeploy-service.
To sync prompt files alongside skills, see the Ingest prompts and skills from GitHub using GitOps guide.
Upload skills from a folder
You can manage skills as folders in your repository and upload them to Port using a script. This is useful when you want to publish skills from a CI/CD pipeline instead of an integration.
Skill folder structure
Organize each skill as a folder with the following structure:
my-skill/
├── SKILL.md # Skill definition (required)
├── references/ # Reference documents (optional)
│ ├── runbook.md
│ └── common-errors.md
└── assets/ # Assets used by the skill (optional)
└── config-template.yaml
The SKILL.md file contains YAML frontmatter with the skill metadata, followed by the instructions in markdown:
---
name: deploy-to-production
description: Guide for deploying services to production. Use when users ask to deploy, release, or promote a service to production.
metadata:
title: Deploy to Production
---
# Deploy to Production
Follow these steps to deploy a service to production:
## Step 1: Verify prerequisites
- Check that all tests pass.
- Verify the service has a production-readiness scorecard score above 80%.
## Step 2: Run the deployment
Execute the deployment action for the target service.
## Common edge cases
- If tests are failing, do not proceed with deployment.
- If deployment fails, check logs and suggest rollback.
Upload script
Use the following script to read a skill folder and upload it to Port as an _ai_skill entity. Every text file in the folder, other than SKILL.md, is uploaded to the files property with its path relative to the skill folder.
Upload script (click to expand)
Prerequisites:
# Python: install dependencies
pip install requests pyyaml
# JavaScript: install dependencies
npm install js-yaml
# Bash: install jq and yq, make script executable
# macOS: brew install jq yq
# Ubuntu: sudo apt-get install jq && pip install yq
chmod +x ./upload-skill.sh
Usage:
# Set your Port credentials
export PORT_CLIENT_ID="your-client-id"
export PORT_CLIENT_SECRET="your-client-secret"
# For US region, also set:
# export PORT_BASE_URL="https://api.us.port.io"
# Test with dry-run first (no changes made)
python upload_skill.py ./my-skill --dry-run # Python
node upload-skill.js ./my-skill --dry-run # JavaScript
./upload-skill.sh ./my-skill --dry-run # Bash
# Upload the skill to Port
python upload_skill.py ./my-skill # Python
node upload-skill.js ./my-skill # JavaScript
./upload-skill.sh ./my-skill # Bash
- Python
- JavaScript
- Bash
#!/usr/bin/env python3
"""
Upload a skill folder to Port as an _ai_skill entity.
Usage:
python upload_skill.py <skill-directory> [--dry-run]
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)
"""
import os
import sys
import json
import re
from pathlib import Path
import requests
import yaml
PORT_BASE_URL = os.environ.get('PORT_BASE_URL', 'https://api.port.io')
def get_port_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 parse_skill_file(skill_dir):
skill_path = skill_dir / 'SKILL.md'
if not skill_path.exists():
raise Exception(f'SKILL.md not found in {skill_dir}')
content = skill_path.read_text()
# Parse YAML frontmatter
match = re.match(r'^---\n(.*?)\n---\n?(.*)$', content, re.DOTALL)
if not match:
raise Exception('Invalid SKILL.md format: missing YAML frontmatter')
frontmatter = yaml.safe_load(match.group(1)) or {}
if not frontmatter.get('name'):
raise Exception('SKILL.md frontmatter must have a "name" field')
if not frontmatter.get('description'):
raise Exception('SKILL.md frontmatter must have a "description" field')
# Optional Agent Skills frontmatter fields, keyed by the _ai_skill property they map to
optional_fields = {'license': 'license', 'compatibility': 'compatibility', 'allowed-tools': 'allowed_tools', 'metadata': 'metadata'}
return {
'name': frontmatter['name'],
'description': frontmatter['description'],
'metadata': frontmatter.get('metadata') or {},
'optional': {prop: frontmatter[key] for key, prop in optional_fields.items() if frontmatter.get(key)},
'instructions': match.group(2).strip()
}
def read_skill_files(skill_dir):
files = []
for file_path in sorted(skill_dir.rglob('*')):
relative_path = file_path.relative_to(skill_dir).as_posix()
if not file_path.is_file() or relative_path == 'SKILL.md' or relative_path.startswith('.'):
continue
try:
files.append({'path': relative_path, 'content': file_path.read_text()})
except UnicodeDecodeError:
print(f' Skipping non-text file: {relative_path}')
return files
def upload_skill(token, entity):
response = requests.post(
f'{PORT_BASE_URL}/v1/blueprints/_ai_skill/entities?upsert=true&merge=true',
headers={
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
},
json=entity
)
response.raise_for_status()
return response.json()
def main():
args = sys.argv[1:]
dry_run = '--dry-run' in args
skill_dir = next((arg for arg in args if not arg.startswith('--')), None)
if not skill_dir:
print('Usage: python upload_skill.py <skill-directory> [--dry-run]')
sys.exit(1)
skill_dir = Path(skill_dir).resolve()
if not skill_dir.exists():
print(f'Error: Directory not found: {skill_dir}')
sys.exit(1)
print(f'Reading skill from: {skill_dir}')
skill = parse_skill_file(skill_dir)
files = read_skill_files(skill_dir)
print(f' Name: {skill["name"]}')
print(f' Files: {len(files)}')
entity = {
'identifier': skill['name'],
'title': skill['metadata'].get('title', skill['name']),
'properties': {
'name': skill['name'],
'description': skill['description'],
'instructions': skill['instructions'],
'files': files,
**skill['optional']
}
}
print('\nEntity to create/update:')
print(json.dumps(entity, indent=2))
if dry_run:
print('\n[DRY RUN] Would create/update entity in Port')
else:
print('\nAuthenticating with Port...')
token = get_port_token()
result = upload_skill(token, entity)
print('\n✅ Entity created/updated successfully!')
print(f' Identifier: {result["entity"]["identifier"]}')
if __name__ == '__main__':
main()
#!/usr/bin/env node
/**
* Upload a skill folder to Port as an _ai_skill entity.
*
* Usage:
* node upload-skill.js <skill-directory> [--dry-run]
*
* 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)
*/
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const PORT_BASE_URL = process.env.PORT_BASE_URL || 'https://api.port.io';
async function getPortToken() {
const clientId = process.env.PORT_CLIENT_ID;
const clientSecret = process.env.PORT_CLIENT_SECRET;
if (!clientId || !clientSecret) {
throw new Error('PORT_CLIENT_ID and PORT_CLIENT_SECRET environment variables are required');
}
const response = await fetch(`${PORT_BASE_URL}/v1/auth/access_token`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ clientId, clientSecret })
});
if (!response.ok) {
throw new Error(`Failed to get Port token: ${response.status} ${response.statusText}`);
}
return (await response.json()).accessToken;
}
function parseSkillFile(skillDir) {
const skillPath = path.join(skillDir, 'SKILL.md');
if (!fs.existsSync(skillPath)) {
throw new Error(`SKILL.md not found in ${skillDir}`);
}
const content = fs.readFileSync(skillPath, 'utf-8');
// Parse YAML frontmatter
const match = content.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
if (!match) {
throw new Error('Invalid SKILL.md format: missing YAML frontmatter');
}
const frontmatter = yaml.load(match[1]) || {};
if (!frontmatter.name) {
throw new Error('SKILL.md frontmatter must have a "name" field');
}
if (!frontmatter.description) {
throw new Error('SKILL.md frontmatter must have a "description" field');
}
// Optional Agent Skills frontmatter fields, keyed by the _ai_skill property they map to
const optionalFields = { license: 'license', compatibility: 'compatibility', 'allowed-tools': 'allowed_tools', metadata: 'metadata' };
const optional = {};
for (const [key, prop] of Object.entries(optionalFields)) {
if (frontmatter[key]) {
optional[prop] = frontmatter[key];
}
}
return {
name: frontmatter.name,
description: frontmatter.description,
metadata: frontmatter.metadata || {},
optional,
instructions: match[2].trim()
};
}
function readSkillFiles(skillDir) {
const files = [];
const entries = fs.readdirSync(skillDir, { recursive: true }).sort();
for (const entry of entries) {
const relativePath = entry.split(path.sep).join('/');
const filePath = path.join(skillDir, entry);
if (relativePath === 'SKILL.md' || relativePath.startsWith('.') || !fs.statSync(filePath).isFile()) {
continue;
}
const buffer = fs.readFileSync(filePath);
if (buffer.includes(0)) {
console.log(` Skipping non-text file: ${relativePath}`);
continue;
}
files.push({ path: relativePath, content: buffer.toString('utf-8') });
}
return files;
}
async function uploadSkill(token, entity) {
const response = await fetch(`${PORT_BASE_URL}/v1/blueprints/_ai_skill/entities?upsert=true&merge=true`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify(entity)
});
if (!response.ok) {
const errorBody = await response.text();
throw new Error(`Failed to create entity: ${response.status} ${response.statusText}\n${errorBody}`);
}
return response.json();
}
async function main() {
const args = process.argv.slice(2);
const dryRun = args.includes('--dry-run');
const skillDir = args.find(arg => !arg.startsWith('--'));
if (!skillDir) {
console.error('Usage: node upload-skill.js <skill-directory> [--dry-run]');
process.exit(1);
}
const resolvedDir = path.resolve(skillDir);
if (!fs.existsSync(resolvedDir)) {
console.error(`Error: Directory not found: ${resolvedDir}`);
process.exit(1);
}
console.log(`Reading skill from: ${resolvedDir}`);
const skill = parseSkillFile(resolvedDir);
const files = readSkillFiles(resolvedDir);
console.log(` Name: ${skill.name}`);
console.log(` Files: ${files.length}`);
const entity = {
identifier: skill.name,
title: skill.metadata.title || skill.name,
properties: {
name: skill.name,
description: skill.description,
instructions: skill.instructions,
files,
...skill.optional
}
};
console.log('\nEntity to create/update:');
console.log(JSON.stringify(entity, null, 2));
if (dryRun) {
console.log('\n[DRY RUN] Would create/update entity in Port');
} else {
console.log('\nAuthenticating with Port...');
const token = await getPortToken();
const result = await uploadSkill(token, entity);
console.log('\n✅ Entity created/updated successfully!');
console.log(` Identifier: ${result.entity.identifier}`);
}
}
main().catch(err => {
console.error('Error:', err.message);
process.exit(1);
});
#!/bin/bash
#
# Upload a skill folder to Port as an _ai_skill entity.
#
# Usage:
# ./upload-skill.sh <skill-directory> [--dry-run]
#
# 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)
#
# Dependencies: jq, yq
set -e
PORT_BASE_URL="${PORT_BASE_URL:-https://api.port.io}"
# Parse arguments
DRY_RUN=false
SKILL_DIR=""
for arg in "$@"; do
if [[ "$arg" == "--dry-run" ]]; then
DRY_RUN=true
elif [[ ! "$arg" == --* ]]; then
SKILL_DIR="$arg"
fi
done
if [[ -z "$SKILL_DIR" || ! -d "$SKILL_DIR" ]]; then
echo "Usage: ./upload-skill.sh <skill-directory> [--dry-run]"
exit 1
fi
SKILL_DIR=$(cd "$SKILL_DIR" && pwd)
SKILL_FILE="$SKILL_DIR/SKILL.md"
if [[ ! -f "$SKILL_FILE" ]]; then
echo "Error: SKILL.md not found in $SKILL_DIR"
exit 1
fi
echo "Reading skill from: $SKILL_DIR"
# Parse SKILL.md frontmatter using yq
FRONTMATTER=$(sed -n '/^---$/,/^---$/p' "$SKILL_FILE" | sed '1d;$d')
SKILL_NAME=$(echo "$FRONTMATTER" | yq -r '.name')
SKILL_DESCRIPTION=$(echo "$FRONTMATTER" | yq -r '.description')
SKILL_TITLE=$(echo "$FRONTMATTER" | yq -r '.metadata.title // .name')
# Optional Agent Skills frontmatter fields, keyed by the _ai_skill property they map to
OPTIONAL=$(echo "$FRONTMATTER" | yq -o=json '{"license": .license, "compatibility": .compatibility, "allowed_tools": .["allowed-tools"], "metadata": .metadata} | with_entries(select(.value != null))')
# Get instructions (everything after the closing --- of frontmatter, trimmed)
INSTRUCTIONS=$(awk '/^---$/{n++; next} n>=2' "$SKILL_FILE" | sed '/./,$!d')
# Read every text file in the skill folder, except SKILL.md, with its relative path
FILES=$(cd "$SKILL_DIR" && find . -type f ! -path './SKILL.md' ! -path './.*' | sort | while read -r file; do
if grep -Iq . "$file" || [[ ! -s "$file" ]]; then
jq -n --arg path "${file#./}" --rawfile content "$file" '{path: $path, content: $content}'
else
echo " Skipping non-text file: ${file#./}" >&2
fi
done | jq -s '.')
echo " Name: $SKILL_NAME"
echo " Files: $(echo "$FILES" | jq 'length')"
# Build entity JSON
ENTITY=$(jq -n \
--arg identifier "$SKILL_NAME" \
--arg title "$SKILL_TITLE" \
--arg description "$SKILL_DESCRIPTION" \
--arg instructions "$INSTRUCTIONS" \
--argjson files "$FILES" \
--argjson optional "$OPTIONAL" \
'{
identifier: $identifier,
title: $title,
properties: ({
name: $identifier,
description: $description,
instructions: $instructions,
files: $files
} + $optional)
}')
echo ""
echo "Entity to create/update:"
echo "$ENTITY" | jq .
if [[ "$DRY_RUN" == "true" ]]; then
echo ""
echo "[DRY RUN] Would create/update entity in Port"
exit 0
fi
if [[ -z "$PORT_CLIENT_ID" || -z "$PORT_CLIENT_SECRET" ]]; then
echo "Error: PORT_CLIENT_ID and PORT_CLIENT_SECRET environment variables are required"
exit 1
fi
echo ""
echo "Authenticating with Port..."
ACCESS_TOKEN=$(curl --silent --location --request POST "${PORT_BASE_URL}/v1/auth/access_token" \
--header 'Content-Type: application/json' \
--data-raw "{
\"clientId\": \"${PORT_CLIENT_ID}\",
\"clientSecret\": \"${PORT_CLIENT_SECRET}\"
}" | jq -r '.accessToken')
RESULT=$(curl --silent --location --request POST "${PORT_BASE_URL}/v1/blueprints/_ai_skill/entities?upsert=true&merge=true" \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data-raw "$ENTITY")
echo ""
echo "✅ Entity created/updated successfully!"
echo " Identifier: $(echo "$RESULT" | jq -r '.entity.identifier')"
Your Port credentials are available in the Port UI under Settings > Credentials.
Priority and overriding
Custom skills take priority over built-in skills. If you create a custom skill with the same identifier as a built-in skill (e.g., troubleshoot-integration), your custom skill will be used instead.
This allows you to:
- Customize built-in workflows for your organization's specific needs.
- Add organization-specific context to existing skills.
- Replace generic instructions with your team's best practices.
Best practices
When creating custom skills, follow these guidelines for best results:
Keep instructions concise
Skills are loaded into the AI's context, so keep instructions under 5000 tokens (approximately 500 lines). Move detailed reference content to supporting files instead of putting everything in the main instructions.
Write clear trigger descriptions
The description field determines when Port AI loads the skill. Write descriptions that clearly indicate:
- What task the skill handles.
- Keywords or phrases users might use.
- When NOT to use the skill (if relevant).
Good example:
"Diagnose and resolve integration sync issues, mapping errors, and data problems. Use when users report missing data, sync failures, or integration errors."
Poor example:
"Helps with integrations."
Structure instructions effectively
Organize instructions with clear structure. Include:
- Step-by-step instructions for completing the task.
- Examples of inputs and outputs.
- Common edge cases and how to handle them.
Use files for detailed content
Put detailed documentation, error catalogs, or assets in the skill's files. The AI can load these on demand when needed, keeping the main instructions focused.
Related pages
- Ingest skills from Git: sync skills from your repositories.
- Migrate to the
_ai_skillblueprint: move skills from a custom skill blueprint. - Skills registry: build an org-wide skills registry with AgentOps.
- Seamlessly distribute skills across your organization: distribute registry skills to any MCP client through a virtual MCP server.
- Enrich Port AI with skills: load skills at runtime in Port AI.
- Skills usage analytics: measure skill adoption from Cursor and Claude.