承接 opencangjie/skills 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

opencangjie/skills

Composer 安装命令:

composer require opencangjie/skills

包简介

PHP SDK for AgentSkills Runtime - Install, manage, and execute AI agent skills with built-in runtime support

README 文档

README

Latest Stable Version Total Downloads License PHP Version Require

PHP SDK for AgentSkills Runtime - Install, manage, and execute AI agent skills with built-in runtime support.

Features

  • 🚀 Easy Installation: One-command runtime installation
  • 🛠️ CLI & Programmatic API: Use via command line or PHP code
  • 🔍 Skill Discovery: Search and install skills from multiple sources
  • Built-in Runtime: Automatic runtime download and management
  • 🔧 Multi-Platform: Support for Windows, macOS, and Linux
  • 📦 PSR Compliant: Follows PHP-FIG standards

Installation

Via Composer (Recommended)

composer require opencangjie/skills

Global Installation (for CLI usage)

composer global require opencangjie/skills

Make sure your global Composer bin directory is in your PATH:

  • Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin
  • macOS/Linux: ~/.composer/vendor/bin or ~/.config/composer/vendor/bin

Install from Source

git clone https://github.com/UCTooCom/agentskills-runtime.git
cd agentskills-runtime/sdk/php
composer install

Quick Start

1. Install Runtime

# Using global installation
skills install-runtime

# Using local installation
./vendor/bin/skills install-runtime

2. Configure AI Model

Edit the .env file in the runtime directory:

  • Windows: %USERPROFILE%\.agentskills-runtime\win-x64\release\.env
  • macOS/Linux: ~/.agentskills-runtime/<platform>-<arch>/release/.env

Add your AI model API key:

# Example: DeepSeek
MODEL_PROVIDER=deepseek
MODEL_NAME=deepseek-chat
DEEPSEEK_API_KEY=your_api_key_here

3. Start Runtime

skills start

4. Install and Run Skills

# Search for skills
skills find "python"

# Install a skill
skills add https://github.com/user/skill-repo

# Execute a skill
skills run <skill-id>

CLI Usage

The SDK provides a command-line interface for managing skills and runtime.

Runtime Commands

# Install runtime
skills install-runtime [--runtime-version 0.0.16]

# Start runtime
skills start [--port 8080] [--host 127.0.0.1] [--foreground]

# Stop runtime
skills stop

# Check status
skills status

Skill Commands

# Search for skills
skills find <query> [--source github] [--limit 10]

# Install skills
skills add <source> [--branch main] [--tag v1.0.0]

# List installed skills
skills list [--page 1] [--limit 20]

# Get skill info
skills info <skill-id>

# Execute skills
skills run <skill-id> [--tool <tool-name>] [--params '{"key": "value"}']

# Remove skills
skills remove <skill-id>

# Initialize new skill project
skills init <name> [--directory ./skills]

# Check for updates
skills check

Programmatic Usage

Create Client

use AgentSkills\SkillsClient;
use AgentSkills\ClientConfig;

// Create client with default settings
$client = new SkillsClient();

// Create client with custom configuration
$config = new ClientConfig(
    baseUrl: 'http://127.0.0.1:8080',
    authToken: 'your-token',
    timeout: 30000,
);
$client = new SkillsClient($config);

Runtime Management

use AgentSkills\RuntimeManager;
use AgentSkills\RuntimeOptions;

$runtime = new RuntimeManager();

// Check if runtime is installed
if (!$runtime->isInstalled()) {
    $runtime->downloadRuntime();
}

// Start runtime
$options = new RuntimeOptions(
    port: 8080,
    detached: true,
);
$runtime->start($options);

// Check status
$status = $runtime->status();
if ($status->running) {
    echo "Runtime version: " . $status->version . "\n";
}

// Stop runtime
$runtime->stop();

List Skills

$result = $client->listSkills([
    'limit' => 10,
    'page' => 0,
]);

foreach ($result->skills as $skill) {
    echo $skill->name . " v" . $skill->version . "\n";
}

Search Skills

$result = $client->searchSkills([
    'query' => 'python',
    'source' => 'github',
    'limit' => 10,
]);

foreach ($result->results as $skill) {
    echo $skill->full_name . "\n";
    echo $skill->description . "\n";
}

Install Skills

use AgentSkills\SkillInstallOptions;

$options = new SkillInstallOptions(
    source: 'https://github.com/user/skill-repo',
    branch: 'main',
);

$result = $client->installSkill($options);

if ($result->isMultiSkillRepo()) {
    // Handle multi-skill repository
    foreach ($result->available_skills as $skill) {
        echo $skill->name . "\n";
    }
} else {
    echo "Installed: " . $result->name . "\n";
}

Execute Skills

// Execute skill
$result = $client->executeSkill('skill-id', [
    'param1' => 'value1',
]);

if ($result->success) {
    echo $result->output . "\n";
} else {
    echo "Error: " . $result->errorMessage . "\n";
}

// Execute specific tool
$result = $client->executeSkillTool('skill-id', 'tool-name', [
    'param1' => 'value1',
]);

Get Skill Information

$skill = $client->getSkill('skill-id');

echo $skill->name . "\n";
echo $skill->description . "\n";
echo $skill->version . "\n";

foreach ($skill->tools as $tool) {
    echo "Tool: " . $tool->name . "\n";
    echo "  " . $tool->description . "\n";
}

Remove Skills

$result = $client->uninstallSkill('skill-id');

if ($result['success']) {
    echo "Skill removed successfully\n";
}

Skill Configuration

// Get skill config
$config = $client->getSkillConfig('skill-id');

// Set skill config
$client->setSkillConfig('skill-id', [
    'option1' => 'value1',
]);

Define Skills

use AgentSkills\defineSkill;
use AgentSkills\ToolDefinition;
use AgentSkills\ToolParameter;
use AgentSkills\ToolParameterType;

$skill = defineSkill([
    'metadata' => [
        'name' => 'my-skill',
        'version' => '1.0.0',
        'description' => 'My custom skill',
        'author' => 'Your Name',
    ],
    'tools' => [
        new ToolDefinition(
            name: 'my-tool',
            description: 'A tool that does something',
            parameters: [
                new ToolParameter(
                    name: 'input',
                    paramType: ToolParameterType::String,
                    description: 'Input parameter',
                    required: true,
                ),
            ],
        ),
    ],
]);

Configuration

The SDK reads configuration from environment variables prefixed with SKILL_:

use AgentSkills\getConfig;

$config = getConfig();
// Returns array with keys like 'API_URL', 'AUTH_TOKEN', etc.

Error Handling

use AgentSkills\handleApiError;
use AgentSkills\ApiError;

try {
    $client->installSkill($options);
} catch (\Exception $e) {
    $error = handleApiError($e);
    echo "Error {$error->errno}: {$error->errmsg}\n";
}

AI Model Configuration

Before starting the runtime, you need to configure the AI model API key. The runtime requires an AI model to process skill execution and natural language understanding.

Edit the .env file in the runtime directory:

  • Windows: %USERPROFILE%\.agentskills-runtime\win-x64\release\.env
  • macOS/Linux: ~/.agentskills-runtime/<platform>-<arch>/release/.env

Add your AI model configuration (choose one provider):

# Option 1: StepFun (阶跃星辰)
MODEL_PROVIDER=stepfun
MODEL_NAME=step-1-8k
STEPFUN_API_KEY=your_stepfun_api_key_here
STEPFUN_BASE_URL=https://api.stepfun.com/v1

# Option 2: DeepSeek
MODEL_PROVIDER=deepseek
MODEL_NAME=deepseek-chat
DEEPSEEK_API_KEY=your_deepseek_api_key_here

# Option 3: 华为云 MaaS
MODEL_PROVIDER=maas
MAAS_API_KEY=your_maas_api_key_here
MAAS_BASE_URL=https://api.modelarts-maas.com/v2
MAAS_MODEL_NAME=qwen3-coder-480b-a35b-instruct

# Option 4: Sophnet
MODEL_PROVIDER=sophnet
SOPHNET_API_KEY=your_sophnet_api_key_here
SOPHNET_BASE_URL=https://www.sophnet.com/api/open-apis/v1

Note: Without proper AI model configuration, the runtime will fail to start with an error like "Get env variable XXX_API_KEY error."

Requirements

  • PHP 8.1 or higher
  • Composer 2.0 or higher
  • Extensions: json, phar, zip

Development

Run Tests

composer test

Code Analysis

composer analyze

Code Style

composer cs-check
composer cs-fix

Run All Checks

composer check

Documentation

Contributing

Please see CONTRIBUTING.md for details.

License

MIT License - see LICENSE file for details.

Support

Related Projects

opencangjie/skills 适用场景与选型建议

opencangjie/skills 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cli」 「runtime」 「Agent」 「ai」 「skills」 「mcp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 opencangjie/skills 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 opencangjie/skills 我们能提供哪些服务?
定制开发 / 二次开发

基于 opencangjie/skills 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-03