Class: Anthropic::Resources::Beta::Skills

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/skills.rb,
lib/anthropic/resources/beta/skills/versions.rb

Defined Under Namespace

Classes: Versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Skills

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Skills.

Parameters:



137
138
139
140
# File 'lib/anthropic/resources/beta/skills.rb', line 137

def initialize(client:)
  @client = client
  @versions = Anthropic::Resources::Beta::Skills::Versions.new(client: client)
end

Instance Attribute Details

#versionsAnthropic::Resources::Beta::Skills::Versions (readonly)



8
9
10
# File 'lib/anthropic/resources/beta/skills.rb', line 8

def versions
  @versions
end

Instance Method Details

#create(display_title: nil, files: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::SkillCreateResponse

Some parameter documentations has been truncated, see Models::Beta::SkillCreateParams for more details.

Create Skill

Parameters:

  • display_title (String, nil)

    Body param: Display title for the skill.

  • files (Array<Pathname, StringIO, IO, String, Anthropic::FilePart>, nil)

    Body param: Files to upload for the skill.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/anthropic/resources/beta/skills.rb', line 28

def create(params = {})
  parsed, options = Anthropic::Beta::SkillCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @client.request(
    method: :post,
    path: "v1/skills?beta=true",
    headers: {
      "content-type" => "multipart/form-data",
      **parsed.slice(*header_params.keys)
    }.transform_keys(
      header_params
    ),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Models::Beta::SkillCreateResponse,
    options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
  )
end

#delete(skill_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::SkillDeleteResponse

Some parameter documentations has been truncated, see Models::Beta::SkillDeleteParams for more details.

Delete Skill

Parameters:

Returns:

See Also:



123
124
125
126
127
128
129
130
131
132
# File 'lib/anthropic/resources/beta/skills.rb', line 123

def delete(skill_id, params = {})
  parsed, options = Anthropic::Beta::SkillDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/skills/%1$s?beta=true", skill_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Models::Beta::SkillDeleteResponse,
    options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
  )
end

#list(limit: nil, page: nil, source: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::SkillListResponse>

Some parameter documentations has been truncated, see Models::Beta::SkillListParams for more details.

List Skills

Parameters:

  • limit (Integer)

    Query param: Number of results to return per page.

  • page (String, nil)

    Query param: Pagination token for fetching a specific page of results.

  • source (String, nil)

    Query param: Filter skills by source.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/anthropic/resources/beta/skills.rb', line 93

def list(params = {})
  parsed, options = Anthropic::Beta::SkillListParams.dump_request(params)
  query_params = [:limit, :page, :source]
  @client.request(
    method: :get,
    path: "v1/skills?beta=true",
    query: parsed.slice(*query_params),
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Models::Beta::SkillListResponse,
    options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
  )
end

#retrieve(skill_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::SkillRetrieveResponse

Some parameter documentations has been truncated, see Models::Beta::SkillRetrieveParams for more details.

Get Skill

Parameters:

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
# File 'lib/anthropic/resources/beta/skills.rb', line 62

def retrieve(skill_id, params = {})
  parsed, options = Anthropic::Beta::SkillRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/skills/%1$s?beta=true", skill_id],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Models::Beta::SkillRetrieveResponse,
    options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
  )
end