> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建或替换上传的插件中的技能。

> 将 ``skills/{skill_name}/SKILL.md`` 写入现有 plugin。

在组织内上传的插件中创建技能，若该技能已存在则将其替换。可在自动化流程中调用此接口，使[技能](https://docs.devinenterprise.com/zh/product-guides/skills.md)保持最新，正如此前通过知识笔记 API 更新笔记一样。

## 权限

需要使用对指定组织拥有 `ManageOrgPlugins` 权限的[服务用户](https://docs.devinenterprise.com/zh/api-reference/v3/service-users/members-service-users.md)或[个人访问令牌](https://docs.devinenterprise.com/zh/api-reference/personal-access-tokens.md)。当该组织的 Knowledge 或操作手册已迁移至技能后，拥有 `ManageOrgKnowledge` 或 `ManageOrgPlaybooks` 权限同样可以访问。

## 行为

* `content` 是完整的 `SKILL.md`，包含前置元数据。它存储在 `skills/<skill_name>/SKILL.md`；plugin 的其他文件保持不变。
* plugin 必须已存在。如需创建 plugin，请[上传 plugin](https://docs.devinenterprise.com/zh/api-reference/v3/plugins/put-organizations-plugin-upload.md)，或在 [Customize](https://docs.devinenterprise.com/zh/product-guides/plugins.md) 中创建。
* 如果未提供 `revision_token`，写入会直接替换已存储的内容。为避免覆盖你尚未看到的更改，请发送你最近一次读取到的 `revision_token`：如果 plugin 在此之后发生过更改，写入将被拒绝并返回 `409`。
* 每次写入都会更新该 plugin 的 `revision_token`，且对其下所有技能生效。响应中会返回新的令牌。
* 新会话会加载新技能；正在运行的会话仍使用启动时加载的内容。
* 在企业中，主组织本身没有 plugin，因此该请求会返回 `400`。请改用对应的[企业端点](https://docs.devinenterprise.com/zh/api-reference/v3/plugins/put-enterprise-managed-plugin-skill.md)。

## 状态代码

* `400`：技能名称或 `SKILL.md` 无效。
* `403`：调用方缺少相应权限；或该账户已禁用上传的插件且该技能尚不存在；或该 plugin 为 Devin 保留。
* `404`：没有与此 `bundle_id` 对应的上传的插件。
* `409`：请求中包含 `revision_token`，且该 plugin 自该修订版本以来已发生变更。


## OpenAPI

````yaml zh/v3-openapi.yaml PUT /v3beta1/organizations/{org_id}/managed-plugins/bundles/{bundle_id}/skills/{skill_name}
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/organizations/{org_id}/managed-plugins/bundles/{bundle_id}/skills/{skill_name}:
    put:
      tags:
        - managed-plugins
      summary: 创建或替换上传的插件中的技能。
      description: 将 ``skills/{skill_name}/SKILL.md`` 写入现有 plugin。
      operationId: >-
        handle_put_org_managed_plugin_skill_v3beta1_organizations__org_id__managed_plugins_bundles__bundle_id__skills__skill_name__put
      parameters:
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - in: path
          name: bundle_id
          required: true
          schema:
            title: Bundle Id
            type: string
        - in: path
          name: skill_name
          required: true
          schema:
            title: Skill Name
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagedPluginSkillUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedPluginSkillResponse'
          description: 成功响应
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未授权
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 禁止访问
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未找到
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 冲突
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 已失效
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 无法处理的内容
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 请求过多
components:
  schemas:
    ManagedPluginSkillUpdateRequest:
      properties:
        content:
          description: 完整的 SKILL.md，包含前置元数据。
          title: Content
          type: string
        revision_token:
          anyOf:
            - type: string
            - type: 'null'
          description: 仅当文件包仍处于此修订版本时才写入。
          title: Revision Token
      required:
        - content
      title: ManagedPluginSkillUpdateRequest
      type: object
    ManagedPluginSkillResponse:
      properties:
        bundle_id:
          title: Bundle Id
          type: string
        content:
          description: 技能的 SKILL.md。
          title: Content
          type: string
        name:
          title: Name
          type: string
        revision_token:
          description: 其所在文件包的修订版本。
          title: Revision Token
          type: string
      required:
        - bundle_id
        - name
        - content
        - revision_token
      title: ManagedPluginSkillResponse
      type: object
    ProblemDetail:
      description: >-
        v3 API 的 RFC 9457 application/problem+json 错误响应体。


        detail 沿用自旧版 {"detail": ...} 响应体，以保持向后兼容；其他成员字段为新增字段。errors
        包含字段级验证失败信息（仅 422）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: 针对此次具体情况的、便于人理解的说明。
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: 因操作被阻止而拒绝请求时返回的机器可读代码（例如 "user_frozen"、"migrated_session"）。
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: 字段级验证错误（仅适用于 422 响应）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: 此次出现对应的 URI 引用（请求路径）。
          title: Instance
        status:
          description: HTTP 状态码。
          title: Status
          type: integer
        title:
          description: 对问题类型的简短、便于理解的概述。
          title: Title
          type: string
        type:
          default: about:blank
          description: 用于标识问题类型的 URI 引用。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.