SPB Git

Repository Public

quickstart.md 36.2 KB 1,205 lines markdown

1---2title: Get started with Agent Skills in the API3url: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart4description: Learn how to use Agent Skills to create documents with the Claude API in under 10 minutes.5---67This tutorial shows you how to use Agent Skills to create a PowerPoint presentation. You'll learn how to enable Skills, make a request, and access the generated file.89## Prerequisites1011* A [Claude API key](https://platform.claude.com/settings/keys) or a logged-in [ant CLI](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication)12* A [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) for your language, or `curl` and `jq`13* Basic familiarity with making API requests1415## Agent Skills overview1617Pre-built Agent Skills extend Claude's capabilities with specialized expertise for tasks such as creating documents, analyzing data, and processing files. Anthropic provides the following pre-built Agent Skills in the API:1819* **PowerPoint (pptx):** Create and edit presentations20* **Excel (xlsx):** Create and analyze spreadsheets21* **Word (docx):** Create and edit documents22* **PDF (pdf):** Generate PDF documents2324<Note>25  To create custom Skills, see the [Agent Skills Cookbook](https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction) for examples of building your own Skills with domain-specific expertise.26</Note>2728## Step 1: List available Skills2930First, check what Skills are available. Use the Skills API to list all Anthropic-managed Skills. Each language tab is an excerpt from one continuous script, with any imports and client setup at the top:3132<CodeGroup>33  ```bash cURL34  # List Anthropic-managed Skills35  curl --fail-with-body -sS "https://api.anthropic.com/v1/skills?source=anthropic" \36    -H "x-api-key: $ANTHROPIC_API_KEY" \37    -H "anthropic-version: 2023-06-01"38  ```3940  ```bash CLI41  # List Anthropic-managed Skills42  ant skills list --source anthropic43  ```4445  ```python Python46  # List Anthropic-managed Skills47  skills = client.skills.list(source="anthropic")4849  for skill in skills.data:50      print(f"{skill.id}: {skill.display_name}")51  ```5253  ```typescript TypeScript54  // List Anthropic-managed Skills55  const skills = await client.skills.list({ source: "anthropic" });5657  for (const skill of skills.data) {58    console.log(`${skill.id}: ${skill.display_name}`);59  }60  ```6162  ```csharp C#63  // List Anthropic-managed Skills64  var skills = await client.Skills.List(new SkillListParams { Source = "anthropic" });6566  foreach (var skill in skills.Items)67  {68      Console.WriteLine($"{skill.ID}: {skill.DisplayName}");69  }70  ```7172  ```go Go73  // List Anthropic-managed Skills74  skills, err := client.Skills.List(ctx, anthropic.SkillListParams{75  	Source: anthropic.String("anthropic"),76  })77  if err != nil {78  	panic(err)79  }8081  for _, skill := range skills.Data {82  	fmt.Printf("%s: %s\n", skill.ID, skill.DisplayName)83  }84  ```8586  ```java Java87  // List Anthropic-managed Skills88  SkillListPage skills = client.skills().list(89      SkillListParams.builder().source("anthropic").build()90  );9192  for (Skill skill : skills.data()) {93      IO.println(skill.id() + ": " + skill.displayName());94  }95  ```9697  ```php PHP98  // List Anthropic-managed Skills99  $skills = $client->skills->list(source: 'anthropic');100101  foreach ($skills->getItems() as $skill) {102      echo "{$skill->id}: {$skill->displayName}\n";103  }104  ```105106  ```ruby Ruby107  # List Anthropic-managed Skills108  skills = client.skills.list(source: "anthropic")109110  skills.data.each do |skill|111    puts "#{skill.id}: #{skill.display_name}"112  end113  ```114</CodeGroup>115116You see the following Skills: `pptx`, `xlsx`, `docx`, and `pdf`.117118This API returns each Skill's metadata: its name and description. Claude loads this metadata at startup to determine which Skills are available. This is the first level of **progressive disclosure**, where Claude discovers Skills without loading their full instructions yet.119120## Step 2: Create a presentation121122Use the PowerPoint Skill to create a presentation about renewable energy. Specify Skills using the `container` parameter in the Messages API:123124<CodeGroup>125  ```bash cURL126  # Create a message with the PowerPoint Skill127  response=$(128    curl --fail-with-body -sS https://api.anthropic.com/v1/messages \129      -H "content-type: application/json" \130      -H "x-api-key: $ANTHROPIC_API_KEY" \131      -H "anthropic-version: 2023-06-01" \132      -d @- <<'EOF'133  {134    "model": "claude-opus-5",135    "max_tokens": 16000,136    "container": {137      "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]138    },139    "messages": [140      {"role": "user", "content": "Create a presentation about renewable energy with 5 slides"}141    ],142    "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]143  }144  EOF145  )146  ```147148  ```bash CLI149  # Create a message with the PowerPoint Skill150  response=$(ant messages create --format json <<'YAML'151  model: claude-opus-5152  max_tokens: 16000153  container:154    skills:155      - type: anthropic156        skill_id: pptx157        version: latest158  messages:159    - role: user160      content: Create a presentation about renewable energy with 5 slides161  tools:162    - type: code_execution_20260521163      name: code_execution164  YAML165  )166  ```167168  ```python Python169  # Create a message with the PowerPoint Skill170  response = client.messages.create(171      model="claude-opus-5",172      max_tokens=16000,173      container={174          "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]175      },176      messages=[177          {178              "role": "user",179              "content": "Create a presentation about renewable energy with 5 slides",180          }181      ],182      tools=[{"type": "code_execution_20260521", "name": "code_execution"}],183  )184185  print(f"stop_reason={response.stop_reason}, blocks={len(response.content)}")186  ```187188  ```typescript TypeScript189  // Create a message with the PowerPoint Skill190  const response = await client.messages.create({191    model: "claude-opus-5",192    max_tokens: 16000,193    container: {194      skills: [{ type: "anthropic", skill_id: "pptx", version: "latest" }],195    },196    messages: [197      {198        role: "user",199        content: "Create a presentation about renewable energy with 5 slides",200      },201    ],202    tools: [{ type: "code_execution_20260521", name: "code_execution" }],203  });204205  console.log(206    `stop_reason=${response.stop_reason}, blocks=${response.content.length}`,207  );208  ```209210  ```csharp C#211  // Create a message with the PowerPoint Skill212  var response = await client.Messages.Create(new MessageCreateParams213  {214      Model = Model.ClaudeOpus5,215      MaxTokens = 16000,216      Container = new ContainerParams217      {218          Skills =219          [220              new SkillParams221              {222                  Type = SkillParamsType.Anthropic,223                  SkillID = "pptx",224                  Version = "latest",225              },226          ],227      },228      Messages =229      [230          new MessageParam231          {232              Role = Role.User,233              Content = "Create a presentation about renewable energy with 5 slides",234          },235      ],236      Tools = [new CodeExecutionTool20260521()],237  });238239  Console.WriteLine($"stop_reason={response.StopReason?.Raw()}, blocks={response.Content.Count}");240  ```241242  ```go Go243  // Create a message with the PowerPoint Skill244  response, err := client.Messages.New(ctx, anthropic.MessageNewParams{245  	Model:     anthropic.ModelClaudeOpus5,246  	MaxTokens: 16000,247  	Container: anthropic.MessageCreateParamsContainerUnion{248  		OfContainers: &anthropic.ContainerParams{249  			Skills: []anthropic.SkillParams{250  				{251  					Type:    anthropic.SkillParamsTypeAnthropic,252  					SkillID: "pptx",253  					Version: anthropic.String("latest"),254  				},255  			},256  		},257  	},258  	Messages: []anthropic.MessageParam{259  		anthropic.NewUserMessage(260  			anthropic.NewTextBlock("Create a presentation about renewable energy with 5 slides"),261  		),262  	},263  	Tools: []anthropic.ToolUnionParam{264  		{OfCodeExecutionTool20260521: &anthropic.CodeExecutionTool20260521Param{}},265  	},266  })267  if err != nil {268  	panic(err)269  }270271  fmt.Printf("stop_reason=%s, blocks=%d\n", response.StopReason, len(response.Content))272  ```273274  ```java Java275  // Create a message with the PowerPoint Skill276  Message response = client.messages().create(277      MessageCreateParams.builder()278          .model(Model.CLAUDE_OPUS_5)279          .maxTokens(16000)280          .container(281              ContainerParams.builder()282                  .addSkill(283                      SkillParams.builder()284                          .type(SkillParams.Type.ANTHROPIC)285                          .skillId("pptx")286                          .version("latest")287                          .build()288                  )289                  .build()290          )291          .addUserMessage("Create a presentation about renewable energy with 5 slides")292          .addTool(CodeExecutionTool20260521.builder().build())293          .build()294  );295296  IO.println(297      "stop_reason=" + response.stopReason().orElse(null)298          + ", blocks=" + response.content().size()299  );300  ```301302  ```php PHP303  // Create a message with the PowerPoint Skill304  $response = $client->messages->create(305      model: 'claude-opus-5',306      maxTokens: 16000,307      container: [308          'skills' => [['type' => 'anthropic', 'skillID' => 'pptx', 'version' => 'latest']],309      ],310      messages: [311          [312              'role' => 'user',313              'content' => 'Create a presentation about renewable energy with 5 slides',314          ],315      ],316      tools: [['type' => 'code_execution_20260521', 'name' => 'code_execution']],317  );318319  printf("stop_reason=%s, blocks=%d\n", $response->stopReason, count($response->content));320  ```321322  ```ruby Ruby323  # Create a message with the PowerPoint Skill324  response = client.messages.create(325    model: "claude-opus-5",326    max_tokens: 16_000,327    container: {328      skills: [{type: "anthropic", skill_id: "pptx", version: "latest"}]329    },330    messages: [331      {332        role: "user",333        content: "Create a presentation about renewable energy with 5 slides"334      }335    ],336    tools: [{type: "code_execution_20260521", name: "code_execution"}]337  )338339  puts "stop_reason=#{response.stop_reason}, blocks=#{response.content.length}"340  ```341</CodeGroup>342343The request includes the following parts:344345* **`model`:** A [model that supports the code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#compatibility)346* **`container.skills`:** Specifies which Skills Claude can use347* **`type: "anthropic"`:** Indicates this is an Anthropic-managed Skill348* **`skill_id: "pptx"`:** The PowerPoint Skill identifier349* **`version: "latest"`:** The Skill version set to the most recently published350* **`tools`:** Enables code execution (required for Skills)351352<Note>353  The examples use the `code_execution_20260521` tool version, and the Step 3 code parses the result types that current tool versions return. Skills also work with older [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) versions such as `code_execution_20250825`: any current code execution tool version satisfies the Skills requirement. If you use a different version, use the tool `type` listed on the code execution tool page.354</Note>355356When you make this request, Claude automatically matches your task to the relevant Skill. Because you asked for a presentation, Claude determines the PowerPoint Skill is relevant and loads its full instructions: the second level of progressive disclosure. Then Claude runs the Skill's code to create your presentation.357358## Step 3: Download the created file359360The presentation was created in the code execution container and saved as a file. The Step 2 `response` includes a file reference with a file ID. Extract the file ID and download the file with the Files API. The example saves it to your system temp directory:361362<CodeGroup>363  ```bash cURL364  # Extract the file ID. The code execution tool runs the Skill's code through365  # its Bash sub-tool, and generated files appear as bash_code_execution_output366  # items inside the bash_code_execution_tool_result block.367  file_id=$(jq -r '368    last(369      .content[]370      | select(.type == "bash_code_execution_tool_result")371      | .content372      | select(.type == "bash_code_execution_result")373      | .content[].file_id374    ) // empty375  ' <<<"$response")376377  if [[ -n "$file_id" ]]; then378    # Download the file and save it379    output_path="${TMPDIR:-/tmp}/renewable_energy.pptx"380    curl --fail-with-body -sS "https://api.anthropic.com/v1/files/$file_id/content" \381      -H "x-api-key: $ANTHROPIC_API_KEY" \382      -H "anthropic-version: 2023-06-01" \383      -o "$output_path"384    echo "Presentation saved to $output_path"385  fi386  ```387388  ```bash CLI389  # Extract the file ID. The code execution tool runs the Skill's code through390  # its Bash sub-tool, and generated files appear as bash_code_execution_output391  # items inside the bash_code_execution_tool_result block.392  file_id=$(jq -r '393    last(394      .content[]395      | select(.type == "bash_code_execution_tool_result")396      | .content397      | select(.type == "bash_code_execution_result")398      | .content[].file_id399    ) // empty400  ' <<<"$response")401402  if [[ -n "$file_id" ]]; then403    # Download the file and save it404    output_path="${TMPDIR:-/tmp}/renewable_energy.pptx"405    ant files download --file-id "$file_id" --output "$output_path"406    echo "Presentation saved to $output_path"407  fi408  ```409410  ```python Python411  # Extract the file ID. The code execution tool runs the Skill's code through412  # its Bash sub-tool, and generated files appear as bash_code_execution_output413  # items inside the bash_code_execution_tool_result block.414  file_id = None415  for block in response.content:416      if block.type == "bash_code_execution_tool_result":417          if block.content.type == "bash_code_execution_result":418              for output in block.content.content:419                  file_id = output.file_id420421  if file_id:422      # Download the file and save it423      output_path = Path(tempfile.gettempdir()) / "renewable_energy.pptx"424      file_content = client.files.download(file_id=file_id)425      file_content.write_to_file(output_path)426      print(f"Presentation saved to {output_path}")427  ```428429  ```typescript TypeScript430  // Extract the file ID. The code execution tool runs the Skill's code through431  // its Bash sub-tool, and generated files appear as bash_code_execution_output432  // items inside the bash_code_execution_tool_result block.433  let fileId: string | undefined;434  for (const block of response.content) {435    if (436      block.type === "bash_code_execution_tool_result" &&437      block.content.type === "bash_code_execution_result"438    ) {439      for (const output of block.content.content) {440        fileId = output.file_id;441      }442    }443  }444445  if (fileId) {446    // Download the file and save it447    const outputPath = path.join(os.tmpdir(), "renewable_energy.pptx");448    const fileContent = await client.files.download(fileId);449    await fs.writeFile(outputPath, Buffer.from(await fileContent.arrayBuffer()));450    console.log(`Presentation saved to ${outputPath}`);451  }452  ```453454  ```csharp C#455  // Extract the file ID. The code execution tool runs the Skill's code through456  // its Bash sub-tool, and generated files appear as bash_code_execution_output457  // items inside the bash_code_execution_tool_result block.458  string? fileId = null;459  foreach (var block in response.Content)460  {461      if (block.TryPickBashCodeExecutionToolResult(out var bashResult)462          && bashResult.Content.TryPickBashCodeExecutionResultBlock(out var bashResultBlock))463      {464          foreach (var output in bashResultBlock.Content)465          {466              fileId = output.FileID;467          }468      }469  }470471  if (fileId is not null)472  {473      // Download the file and save it474      var outputPath = Path.Combine(Path.GetTempPath(), "renewable_energy.pptx");475      using var download = await client.Files.Download(fileId);476      await using var source = await download.ReadAsStream();477      await using var destination = File.Create(outputPath);478      await source.CopyToAsync(destination);479      Console.WriteLine($"Presentation saved to {outputPath}");480  }481  ```482483  ```go Go484  // Extract the file ID. The code execution tool runs the Skill's code through485  // its Bash sub-tool, and generated files appear as bash_code_execution_output486  // items inside the bash_code_execution_tool_result block.487  var fileID string488  for _, block := range response.Content {489  	switch result := block.AsAny().(type) {490  	case anthropic.BashCodeExecutionToolResultBlock:491  		if result.Content.Type == "bash_code_execution_result" {492  			for _, output := range result.Content.Content {493  				fileID = output.FileID494  			}495  		}496  	}497  }498499  if fileID != "" {500  	// Download the file and save it501  	outputPath := filepath.Join(os.TempDir(), "renewable_energy.pptx")502  	fileContent, err := client.Files.Download(ctx, fileID, anthropic.FileDownloadParams{})503  	if err != nil {504  		panic(err)505  	}506  	defer fileContent.Body.Close()507  	outFile, err := os.Create(outputPath)508  	if err != nil {509  		panic(err)510  	}511  	defer outFile.Close()512  	if _, err := io.Copy(outFile, fileContent.Body); err != nil {513  		panic(err)514  	}515  	fmt.Printf("Presentation saved to %s\n", outputPath)516  }517  ```518519  ```java Java520  // Extract the file ID. The code execution tool runs the Skill's code through521  // its Bash sub-tool, and generated files appear as bash_code_execution_output522  // items inside the bash_code_execution_tool_result block.523  String fileId = null;524  for (ContentBlock block : response.content()) {525      if (block.isBashCodeExecutionToolResult()) {526          var content = block.asBashCodeExecutionToolResult().content();527          if (content.isBashCodeExecutionResultBlock()) {528              for (var output : content.asBashCodeExecutionResultBlock().content()) {529                  fileId = output.fileId();530              }531          }532      }533  }534535  if (fileId != null) {536      // Download the file and save it537      Path outputPath = Files.createTempFile("renewable_energy", ".pptx");538      try (HttpResponse fileContent = client.files().download(fileId)) {539          Files.copy(fileContent.body(), outputPath, StandardCopyOption.REPLACE_EXISTING);540      }541      IO.println("Presentation saved to " + outputPath);542  }543  ```544545  ```php PHP546  // Extract the file ID. The code execution tool runs the Skill's code through547  // its Bash sub-tool, and generated files appear as bash_code_execution_output548  // items inside the bash_code_execution_tool_result block.549  $fileId = null;550  foreach ($response->content as $block) {551      if ($block->type !== 'bash_code_execution_tool_result') {552          continue;553      }554      $resultBlock = $block->content;555      if ($resultBlock->type !== 'bash_code_execution_result') {556          continue;557      }558      foreach ($resultBlock->content as $output) {559          $fileId = $output->fileID;560      }561  }562563  if ($fileId !== null) {564      // Download the file and save it565      $outputPath = sys_get_temp_dir() . '/renewable_energy.pptx';566      $fileContent = $client->files->download($fileId);567      file_put_contents($outputPath, $fileContent);568      echo "Presentation saved to {$outputPath}\n";569  }570  ```571572  ```ruby Ruby573  # Extract the file ID. The code execution tool runs the Skill's code through574  # its Bash sub-tool, and generated files appear as bash_code_execution_output575  # items inside the bash_code_execution_tool_result block.576  file_id = nil577  response.content.each do |block|578    next unless block.type == :bash_code_execution_tool_result579580    if block.content[:type].to_s == "bash_code_execution_result"581      Array(block.content[:content]).each { |output| file_id = output[:file_id] }582    end583  end584585  if file_id586    # Download the file and save it587    output_path = File.join(Dir.tmpdir, "renewable_energy.pptx")588    file_content = client.files.download(file_id)589    File.binwrite(output_path, file_content.read)590    puts "Presentation saved to #{output_path}"591  end592  ```593</CodeGroup>594595<Note>596  For complete details on working with generated files, see [Retrieve generated files](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#retrieve-generated-files) in the code execution tool documentation.597</Note>598599## Try more examples600601Try these variations:602603### Create a spreadsheet604605<CodeGroup>606  ```bash cURL607  curl --fail-with-body -sS https://api.anthropic.com/v1/messages \608    -H "content-type: application/json" \609    -H "x-api-key: $ANTHROPIC_API_KEY" \610    -H "anthropic-version: 2023-06-01" \611    -d '{612      "model": "claude-opus-5",613      "max_tokens": 16000,614      "container": {615        "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]616      },617      "messages": [618        {"role": "user", "content": "Create a quarterly sales tracking spreadsheet with sample data"}619      ],620      "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]621    }'622  ```623624  ```bash CLI625  ant messages create <<'YAML'626  model: claude-opus-5627  max_tokens: 16000628  container:629    skills:630      - type: anthropic631        skill_id: xlsx632        version: latest633  messages:634    - role: user635      content: Create a quarterly sales tracking spreadsheet with sample data636  tools:637    - type: code_execution_20260521638      name: code_execution639  YAML640  ```641642  ```python Python643  response = client.messages.create(644      model="claude-opus-5",645      max_tokens=16000,646      container={647          "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]648      },649      messages=[650          {651              "role": "user",652              "content": "Create a quarterly sales tracking spreadsheet with sample data",653          }654      ],655      tools=[{"type": "code_execution_20260521", "name": "code_execution"}],656  )657  ```658659  ```typescript TypeScript660  const response = await client.messages.create({661    model: "claude-opus-5",662    max_tokens: 16000,663    container: {664      skills: [{ type: "anthropic", skill_id: "xlsx", version: "latest" }]665    },666    messages: [667      {668        role: "user",669        content: "Create a quarterly sales tracking spreadsheet with sample data"670      }671    ],672    tools: [{ type: "code_execution_20260521", name: "code_execution" }]673  });674  ```675676  ```csharp C#677  var response = await client.Messages.Create(678      new MessageCreateParams679      {680          Model = Model.ClaudeOpus5,681          MaxTokens = 16000,682          Container = new ContainerParams683          {684              Skills =685              [686                  new SkillParams687                  {688                      Type = SkillParamsType.Anthropic,689                      SkillID = "xlsx",690                      Version = "latest",691                  },692              ],693          },694          Messages =695          [696              new MessageParam697              {698                  Role = Role.User,699                  Content = "Create a quarterly sales tracking spreadsheet with sample data",700              },701          ],702          Tools = [new CodeExecutionTool20260521()],703      }704  );705  ```706707  ```go Go708  response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{709  	Model:     anthropic.ModelClaudeOpus5,710  	MaxTokens: 16000,711  	Container: anthropic.MessageCreateParamsContainerUnion{712  		OfContainers: &anthropic.ContainerParams{713  			Skills: []anthropic.SkillParams{714  				{715  					Type:    anthropic.SkillParamsTypeAnthropic,716  					SkillID: "xlsx",717  					Version: anthropic.String("latest"),718  				},719  			},720  		},721  	},722  	Messages: []anthropic.MessageParam{723  		anthropic.NewUserMessage(anthropic.NewTextBlock("Create a quarterly sales tracking spreadsheet with sample data")),724  	},725  	Tools: []anthropic.ToolUnionParam{726  		{727  			OfCodeExecutionTool20260521: &anthropic.CodeExecutionTool20260521Param{},728  		},729  	},730  })731  if err != nil {732  	panic(err)733  }734  ```735736  ```java Java737  Message response = client.messages().create(738      MessageCreateParams.builder()739          .model(CLAUDE_OPUS_5)740          .maxTokens(16000)741          .container(742              ContainerParams.builder()743                  .addSkill(744                      SkillParams.builder()745                          .type(ANTHROPIC)746                          .skillId("xlsx")747                          .version("latest")748                          .build()749                  )750                  .build()751          )752          .addUserMessage("Create a quarterly sales tracking spreadsheet with sample data")753          .addTool(CodeExecutionTool20260521.builder().build())754          .build()755  );756757  ```758759  ```php PHP760  $response = $client->messages->create(761      model: 'claude-opus-5',762      maxTokens: 16000,763      container: [764          'skills' => [765              ['type' => 'anthropic', 'skillID' => 'xlsx', 'version' => 'latest'],766          ],767      ],768      messages: [769          [770              'role' => 'user',771              'content' => 'Create a quarterly sales tracking spreadsheet with sample data',772          ],773      ],774      tools: [['type' => 'code_execution_20260521', 'name' => 'code_execution']],775  );776  ```777778  ```ruby Ruby779  response = client.messages.create(780    model: "claude-opus-5",781    max_tokens: 16_000,782    container: {783      skills: [{type: "anthropic", skill_id: "xlsx", version: "latest"}]784    },785    messages: [786      {787        role: "user",788        content: "Create a quarterly sales tracking spreadsheet with sample data"789      }790    ],791    tools: [{type: "code_execution_20260521", name: "code_execution"}]792  )793  ```794</CodeGroup>795796### Create a Word document797798<CodeGroup>799  ```bash cURL800  curl --fail-with-body -sS https://api.anthropic.com/v1/messages \801    -H "content-type: application/json" \802    -H "x-api-key: $ANTHROPIC_API_KEY" \803    -H "anthropic-version: 2023-06-01" \804    -d '{805      "model": "claude-opus-5",806      "max_tokens": 16000,807      "container": {808        "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]809      },810      "messages": [811        {"role": "user", "content": "Write a 2-page report on the benefits of renewable energy"}812      ],813      "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]814    }'815  ```816817  ```bash CLI818  ant messages create <<'YAML'819  model: claude-opus-5820  max_tokens: 16000821  container:822    skills:823      - type: anthropic824        skill_id: docx825        version: latest826  messages:827    - role: user828      content: Write a 2-page report on the benefits of renewable energy829  tools:830    - type: code_execution_20260521831      name: code_execution832  YAML833  ```834835  ```python Python836  response = client.messages.create(837      model="claude-opus-5",838      max_tokens=16000,839      container={840          "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]841      },842      messages=[843          {844              "role": "user",845              "content": "Write a 2-page report on the benefits of renewable energy",846          }847      ],848      tools=[{"type": "code_execution_20260521", "name": "code_execution"}],849  )850  ```851852  ```typescript TypeScript853  const response = await client.messages.create({854    model: "claude-opus-5",855    max_tokens: 16000,856    container: {857      skills: [{ type: "anthropic", skill_id: "docx", version: "latest" }]858    },859    messages: [860      {861        role: "user",862        content: "Write a 2-page report on the benefits of renewable energy"863      }864    ],865    tools: [{ type: "code_execution_20260521", name: "code_execution" }]866  });867  ```868869  ```csharp C#870  var response = await client.Messages.Create(871      new MessageCreateParams872      {873          Model = Model.ClaudeOpus5,874          MaxTokens = 16000,875          Container = new ContainerParams876          {877              Skills =878              [879                  new SkillParams880                  {881                      Type = SkillParamsType.Anthropic,882                      SkillID = "docx",883                      Version = "latest",884                  },885              ],886          },887          Messages =888          [889              new MessageParam890              {891                  Role = Role.User,892                  Content = "Write a 2-page report on the benefits of renewable energy",893              },894          ],895          Tools = [new CodeExecutionTool20260521()],896      }897  );898  ```899900  ```go Go901  response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{902  	Model:     anthropic.ModelClaudeOpus5,903  	MaxTokens: 16000,904  	Container: anthropic.MessageCreateParamsContainerUnion{905  		OfContainers: &anthropic.ContainerParams{906  			Skills: []anthropic.SkillParams{907  				{908  					Type:    anthropic.SkillParamsTypeAnthropic,909  					SkillID: "docx",910  					Version: anthropic.String("latest"),911  				},912  			},913  		},914  	},915  	Messages: []anthropic.MessageParam{916  		anthropic.NewUserMessage(anthropic.NewTextBlock("Write a 2-page report on the benefits of renewable energy")),917  	},918  	Tools: []anthropic.ToolUnionParam{919  		{920  			OfCodeExecutionTool20260521: &anthropic.CodeExecutionTool20260521Param{},921  		},922  	},923  })924  if err != nil {925  	panic(err)926  }927  ```928929  ```java Java930  Message response = client.messages().create(931      MessageCreateParams.builder()932          .model(CLAUDE_OPUS_5)933          .maxTokens(16000)934          .container(935              ContainerParams.builder()936                  .addSkill(937                      SkillParams.builder()938                          .type(ANTHROPIC)939                          .skillId("docx")940                          .version("latest")941                          .build()942                  )943                  .build()944          )945          .addUserMessage("Write a 2-page report on the benefits of renewable energy")946          .addTool(CodeExecutionTool20260521.builder().build())947          .build()948  );949950  ```951952  ```php PHP953  $response = $client->messages->create(954      model: 'claude-opus-5',955      maxTokens: 16000,956      container: [957          'skills' => [958              ['type' => 'anthropic', 'skillID' => 'docx', 'version' => 'latest'],959          ],960      ],961      messages: [962          [963              'role' => 'user',964              'content' => 'Write a 2-page report on the benefits of renewable energy',965          ],966      ],967      tools: [['type' => 'code_execution_20260521', 'name' => 'code_execution']],968  );969  ```970971  ```ruby Ruby972  response = client.messages.create(973    model: "claude-opus-5",974    max_tokens: 16_000,975    container: {976      skills: [{type: "anthropic", skill_id: "docx", version: "latest"}]977    },978    messages: [979      {980        role: "user",981        content: "Write a 2-page report on the benefits of renewable energy"982      }983    ],984    tools: [{type: "code_execution_20260521", name: "code_execution"}]985  )986  ```987</CodeGroup>988989### Generate a PDF990991<CodeGroup>992  ```bash cURL993  curl --fail-with-body -sS https://api.anthropic.com/v1/messages \994    -H "content-type: application/json" \995    -H "x-api-key: $ANTHROPIC_API_KEY" \996    -H "anthropic-version: 2023-06-01" \997    -d '{998      "model": "claude-opus-5",999      "max_tokens": 16000,1000      "container": {1001        "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]1002      },1003      "messages": [1004        {"role": "user", "content": "Generate a PDF invoice template"}1005      ],1006      "tools": [{"type": "code_execution_20260521", "name": "code_execution"}]1007    }'1008  ```10091010  ```bash CLI1011  ant messages create <<'YAML'1012  model: claude-opus-51013  max_tokens: 160001014  container:1015    skills:1016      - type: anthropic1017        skill_id: pdf1018        version: latest1019  messages:1020    - role: user1021      content: Generate a PDF invoice template1022  tools:1023    - type: code_execution_202605211024      name: code_execution1025  YAML1026  ```10271028  ```python Python1029  response = client.messages.create(1030      model="claude-opus-5",1031      max_tokens=16000,1032      container={1033          "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]1034      },1035      messages=[1036          {1037              "role": "user",1038              "content": "Generate a PDF invoice template",1039          }1040      ],1041      tools=[{"type": "code_execution_20260521", "name": "code_execution"}],1042  )1043  ```10441045  ```typescript TypeScript1046  const response = await client.messages.create({1047    model: "claude-opus-5",1048    max_tokens: 16000,1049    container: {1050      skills: [{ type: "anthropic", skill_id: "pdf", version: "latest" }]1051    },1052    messages: [1053      {1054        role: "user",1055        content: "Generate a PDF invoice template"1056      }1057    ],1058    tools: [{ type: "code_execution_20260521", name: "code_execution" }]1059  });1060  ```10611062  ```csharp C#1063  var response = await client.Messages.Create(1064      new MessageCreateParams1065      {1066          Model = Model.ClaudeOpus5,1067          MaxTokens = 16000,1068          Container = new ContainerParams1069          {1070              Skills =1071              [1072                  new SkillParams1073                  {1074                      Type = SkillParamsType.Anthropic,1075                      SkillID = "pdf",1076                      Version = "latest",1077                  },1078              ],1079          },1080          Messages =1081          [1082              new MessageParam1083              {1084                  Role = Role.User,1085                  Content = "Generate a PDF invoice template",1086              },1087          ],1088          Tools = [new CodeExecutionTool20260521()],1089      }1090  );1091  ```10921093  ```go Go1094  response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{1095  	Model:     anthropic.ModelClaudeOpus5,1096  	MaxTokens: 16000,1097  	Container: anthropic.MessageCreateParamsContainerUnion{1098  		OfContainers: &anthropic.ContainerParams{1099  			Skills: []anthropic.SkillParams{1100  				{1101  					Type:    anthropic.SkillParamsTypeAnthropic,1102  					SkillID: "pdf",1103  					Version: anthropic.String("latest"),1104  				},1105  			},1106  		},1107  	},1108  	Messages: []anthropic.MessageParam{1109  		anthropic.NewUserMessage(anthropic.NewTextBlock("Generate a PDF invoice template")),1110  	},1111  	Tools: []anthropic.ToolUnionParam{1112  		{1113  			OfCodeExecutionTool20260521: &anthropic.CodeExecutionTool20260521Param{},1114  		},1115  	},1116  })1117  if err != nil {1118  	panic(err)1119  }1120  ```11211122  ```java Java1123  Message response = client.messages().create(1124      MessageCreateParams.builder()1125          .model(CLAUDE_OPUS_5)1126          .maxTokens(16000)1127          .container(1128              ContainerParams.builder()1129                  .addSkill(1130                      SkillParams.builder()1131                          .type(ANTHROPIC)1132                          .skillId("pdf")1133                          .version("latest")1134                          .build()1135                  )1136                  .build()1137          )1138          .addUserMessage("Generate a PDF invoice template")1139          .addTool(CodeExecutionTool20260521.builder().build())1140          .build()1141  );11421143  ```11441145  ```php PHP1146  $response = $client->messages->create(1147      model: 'claude-opus-5',1148      maxTokens: 16000,1149      container: [1150          'skills' => [1151              ['type' => 'anthropic', 'skillID' => 'pdf', 'version' => 'latest'],1152          ],1153      ],1154      messages: [1155          [1156              'role' => 'user',1157              'content' => 'Generate a PDF invoice template',1158          ],1159      ],1160      tools: [['type' => 'code_execution_20260521', 'name' => 'code_execution']],1161  );1162  ```11631164  ```ruby Ruby1165  response = client.messages.create(1166    model: "claude-opus-5",1167    max_tokens: 16_000,1168    container: {1169      skills: [{type: "anthropic", skill_id: "pdf", version: "latest"}]1170    },1171    messages: [1172      {1173        role: "user",1174        content: "Generate a PDF invoice template"1175      }1176    ],1177    tools: [{type: "code_execution_20260521", name: "code_execution"}]1178  )1179  ```1180</CodeGroup>11811182## Next steps11831184<CardGroup cols={2}>1185  <Card title="Skill authoring best practices" icon="edit" href="https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices">1186    Learn how to write effective Skills that Claude can discover and use successfully.1187  </Card>11881189  <Card title="Using Agent Skills with the API" icon="book" href="https://platform.claude.com/docs/en/build-with-claude/skills-guide">1190    Learn how to use Agent Skills to extend Claude's capabilities through the API.1191  </Card>11921193  <Card title="Create custom Skills" icon="code" href="https://platform.claude.com/docs/en/api/skills/create">1194    Upload your own Skills for specialized tasks.1195  </Card>11961197  <Card title="Use Skills in Claude Code" icon="terminal" href="https://code.claude.com/docs/en/skills">1198    Learn about Skills in Claude Code.1199  </Card>12001201  <Card title="Agent Skills Cookbook" icon="book" href="https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction">1202    Explore example Skills and implementation patterns.1203  </Card>1204</CardGroup>1205
Files main
Menu

Theme