The whole hunk
from line 2162, old and new numbered
/
lines
from line 2162
21622162
21632163A Skill bundle is a directory containing a `SKILL.md` file at the top level with `name` and `description` YAML frontmatter, plus any supporting scripts or resources. See [Get started with Agent Skills in the API](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart) to author one, and the **Requirements** list following the examples for the full constraints.
21642164
2165Upload your custom Skill to make it available in your workspace. You can upload a zip archive or individual file objects. The Python SDK also provides a `files_from_dir` helper that accepts a directory path.
2165Upload your custom Skill to make it available in your workspace. You can upload a zip archive or individual file objects. The Python SDK also provides a `files_from_dir` helper that accepts a directory path, and the CLI's `ant apply` uploads the directory itself.
21662166
21672167Files are identified by the filename you attach (the `;filename=` suffix in the cURL example and the filename arguments in the SDK examples). For the walkthrough's skill, create a zip with `zip -r financial_skill.zip financial_skill/` and substitute it for the `example_skill.zip` placeholder in the zip-upload options.
21682168
2169<CodeGroup>
2169<CodeGroup defaultLanguage="CLI">
21702170 ```bash cURL
21712171 curl -X POST "https://api.anthropic.com/v1/skills" \
21722172 -H "x-api-key: $ANTHROPIC_API_KEY" \
from line 2177
21772177
21782178 <MultiFileExample language="cli" label="CLI">
21792179 ```bash CLI
2180 zip -r financial_skill.zip financial_skill/
2181 ant skills create --file financial_skill.zip
2180 ant apply financial_skill
21822181 ```
21832182
21842183 <File filename="financial_skill/SKILL.md">
from line 3336
33373336
33383337### Example: financial modeling
33393338
3340Combine Excel and custom DCF analysis Skills:
3339Combine Excel and custom DCF analysis Skills. First, create the custom DCF analysis Skill:
33413340
3342<CodeGroup>
3341<CodeGroup defaultLanguage="CLI">
33433342 ```bash cURL
3344 # Create custom DCF analysis Skill
3345 DCF_SKILL=$(curl -X POST "https://api.anthropic.com/v1/skills" \
3343 curl -X POST "https://api.anthropic.com/v1/skills" \
33463344 -H "x-api-key: $ANTHROPIC_API_KEY" \
33473345 -H "anthropic-version: 2023-06-01" \
3348 -F "files[]=@dcf_skill/SKILL.md;filename=dcf_skill/SKILL.md")
3346 -F "files[]=@dcf_skill/SKILL.md;filename=dcf_skill/SKILL.md"
3347 ```
33493348
3350 DCF_SKILL_ID=$(echo "$DCF_SKILL" | jq -r '.id')
3349 ```bash CLI
3350 ant apply dcf_skill
3351 ```
33513352
3352 # Use with Excel to create financial model
3353 ```python Python
3354 from anthropic.lib import files_from_dir
3355
3356 client = anthropic.Anthropic()
3357
3358 dcf_skill = client.skills.create(
3359 files=files_from_dir("/path/to/dcf_skill"),
3360 )
3361 print(dcf_skill.id)
3362 ```
3363
3364 ```typescript TypeScript
3365 import Anthropic, { toFile } from "@anthropic-ai/sdk";
3366 import fs from "node:fs";
3367
3368 const client = new Anthropic();
3369
3370 const dcfSkill = await client.skills.create({
3371 files: [await toFile(fs.createReadStream("dcf_skill.zip"), "dcf_skill.zip")]
3372 });
3373 console.log(dcfSkill.id);
3374 ```
3375
3376 ```csharp C#
3377 using Anthropic.Core;
3378 // ...
3379 AnthropicClient client = new();
3380
3381 var dcfSkill = await client.Skills.Create(new SkillCreateParams
3382 {
3383 Files =
3384 [
3385 new BinaryContent
3386 {
3387 Stream = File.OpenRead("dcf_skill/SKILL.md"),
3388 FileName = "dcf_skill/SKILL.md",
3389 },
3390 ],
3391 });
3392 Console.WriteLine(dcfSkill.ID);
3393 ```
3394
3395 ```go Go
3396 client := anthropic.NewClient()
3397
3398 skillMd, err := os.Open("dcf_skill/SKILL.md")
3399 if err != nil {
3400 log.Fatal(err)
3401 }
3402 defer skillMd.Close()
3403
3404 dcfSkill, err := client.Skills.New(context.TODO(), anthropic.SkillNewParams{
3405 Files: []io.Reader{
3406 anthropic.File(skillMd, "dcf_skill/SKILL.md", "text/markdown"),
3407 },
3408 })
3409 if err != nil {
3410 log.Fatal(err)
3411 }
3412 fmt.Println(dcfSkill.ID)
3413 ```
3414
3415 ```java Java
3416 import com.anthropic.core.MultipartField;
3417 import com.anthropic.models.skills.SkillCreateParams;
3418 import com.anthropic.models.skills.Skill;
3419 // ...
3420 void main() throws Exception {
3421 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
3422
3423 SkillCreateParams params = SkillCreateParams.builder()
3424 .addFile(MultipartField.<InputStream>builder()
3425 .value(Files.newInputStream(Path.of("dcf_skill/SKILL.md")))
3426 .filename("dcf_skill/SKILL.md")
3427 .contentType("text/markdown")
3428 .build())
3429 .build();
3430
3431 Skill dcfSkill = client.skills().create(params);
3432 System.out.println(dcfSkill.id());
3433 }
3434 ```
3435
3436 ```php PHP
3437 use Anthropic\Core\FileParam;
3438
3439 $client = new Client();
3440
3441 $dcfSkill = $client->skills->create(
3442 files: [
3443 FileParam::fromResource(
3444 fopen('dcf_skill/SKILL.md', 'r'),
3445 filename: 'dcf_skill/SKILL.md',
3446 contentType: 'text/markdown',
3447 ),
3448 ],
3449 );
3450 echo "{$dcfSkill->id}\n";
3451 ```
3452
3453 ```ruby Ruby
3454 client = Anthropic::Client.new
3455
3456 dcf_skill = client.skills.create(
3457 files: [
3458 Anthropic::FilePart.new(
3459 Pathname("dcf_skill/SKILL.md"),
3460 filename: "dcf_skill/SKILL.md",
3461 content_type: "text/markdown"
3462 )
3463 ]
3464 )
3465 puts dcf_skill.id
3466 ```
3467</CodeGroup>
3468
3469Then use it with the Excel Skill to create a financial model. Pass the ID of the Skill you created as the custom Skill's `skill_id`:
3470
3471<CodeGroup>
3472 ```bash cURL
33533473 curl https://api.anthropic.com/v1/messages \
33543474 -H "x-api-key: $ANTHROPIC_API_KEY" \
33553475 -H "anthropic-version: 2023-06-01" \
33563476 -H "content-type: application/json" \
3357 -d "{
3358 \"model\": \"claude-opus-5\",
3359 \"max_tokens\": 4096,
3360 \"container\": {
3361 \"skills\": [
3477 -d '{
3478 "model": "claude-opus-5",
3479 "max_tokens": 4096,
3480 "container": {
3481 "skills": [
33623482 {
3363 \"type\": \"anthropic\",
3364 \"skill_id\": \"xlsx\",
3365 \"version\": \"latest\"
3483 "type": "anthropic",
3484 "skill_id": "xlsx",
3485 "version": "latest"
33663486 },
33673487 {
3368 \"type\": \"custom\",
3369 \"skill_id\": \"$DCF_SKILL_ID\",
3370 \"version\": \"latest\"
3488 "type": "custom",
3489 "skill_id": "skill_01AbCdEfGhIjKlMnOpQrStUv",
3490 "version": "latest"
33713491 }
33723492 ]
33733493 },
3374 \"messages\": [{
3375 \"role\": \"user\",
3376 \"content\": \"Build a DCF valuation model for a SaaS company\"
3494 "messages": [{
3495 "role": "user",
3496 "content": "Build a DCF valuation model for a SaaS company"
33773497 }],
3378 \"tools\": [{
3379 \"type\": \"code_execution_20250825\",
3380 \"name\": \"code_execution\"
3498 "tools": [{
3499 "type": "code_execution_20250825",
3500 "name": "code_execution"
33813501 }]
3382 }"
3502 }'
33833503 ```
33843504
33853505 ```bash CLI
3386 # Create custom DCF analysis Skill
3387 DCF_SKILL_ID=$(ant skills create \
3388 --file dcf_skill.zip \
3389 --transform id \
3390 --raw-output)
3391
3392 # Use with Excel to create financial model
3393 ant messages create <<YAML
3506 ant messages create <<'YAML'
33943507 model: claude-opus-5
33953508 max_tokens: 4096
33963509 container:
from line 3512
33993512 skill_id: xlsx
34003513 version: latest
34013514 - type: custom
3402 skill_id: $DCF_SKILL_ID
3515 skill_id: skill_01AbCdEfGhIjKlMnOpQrStUv
34033516 version: latest
34043517 messages:
34053518 - role: user
from line 3524
34113524 ```
34123525
34133526 ```python Python
3414 from anthropic.lib import files_from_dir
3415
34163527 client = anthropic.Anthropic()
34173528
3418 # Create custom DCF analysis Skill
3529 # Custom DCF analysis Skill (ID obtained from Skills API create response)
3530 dcf_skill_id = "skill_01AbCdEfGhIjKlMnOpQrStUv"
34193531
3420 dcf_skill = client.skills.create(
3421 files=files_from_dir("/path/to/dcf_skill"),
3422 )
3423
34243532 # Use with Excel to create financial model
34253533 response = client.messages.create(
34263534 model="claude-opus-5",
from line 3536
34283536 container={
34293537 "skills": [
34303538 {"type": "anthropic", "skill_id": "xlsx", "version": "latest"},
3431 {"type": "custom", "skill_id": dcf_skill.id, "version": "latest"},
3539 {"type": "custom", "skill_id": dcf_skill_id, "version": "latest"},
34323540 ]
34333541 },
34343542 messages=[
from line 3551
34433551 ```
34443552
34453553 ```typescript TypeScript
3446 import Anthropic, { toFile } from "@anthropic-ai/sdk";
3447 import fs from "node:fs";
3448
34493554 const client = new Anthropic();
34503555
3451 // Create custom DCF analysis Skill
3452 const dcfSkill = await client.skills.create({
3453 files: [await toFile(fs.createReadStream("dcf_skill.zip"), "dcf_skill.zip")]
3454 });
3556 // Custom DCF analysis Skill (ID obtained from Skills API create response)
3557 const dcfSkillId = "skill_01AbCdEfGhIjKlMnOpQrStUv";
34553558
34563559 // Use with Excel to create financial model
34573560 const response = await client.messages.create({
from line 3563
34603563 container: {
34613564 skills: [
34623565 { type: "anthropic", skill_id: "xlsx", version: "latest" },
3463 { type: "custom", skill_id: dcfSkill.id, version: "latest" }
3566 { type: "custom", skill_id: dcfSkillId, version: "latest" }
34643567 ]
34653568 },
34663569 messages: [
from line 3578
34753578 ```
34763579
34773580 ```csharp C#
3478 using Anthropic.Core;
3479 // ...
34803581 AnthropicClient client = new();
34813582
3482 // Create custom DCF analysis Skill
3483 var dcfSkill = await client.Skills.Create(new SkillCreateParams
3484 {
3485 Files =
3486 [
3487 new BinaryContent
3488 {
3489 Stream = File.OpenRead("dcf_skill/SKILL.md"),
3490 FileName = "dcf_skill/SKILL.md",
3491 },
3492 ],
3493 });
3583 // Custom DCF analysis Skill (ID obtained from Skills API create response)
3584 var dcfSkillId = "skill_01AbCdEfGhIjKlMnOpQrStUv";
34943585
34953586 // Use with Excel to create financial model
34963587 var parameters = new MessageCreateParams
from line 3601
35103601 new SkillParams
35113602 {
35123603 Type = SkillParamsType.Custom,
3513 SkillID = dcfSkill.ID,
3604 SkillID = dcfSkillId,
35143605 Version = "latest",
35153606 },
35163607 ],
from line 3720
36293720 ```ruby Ruby
36303721 client = Anthropic::Client.new
36313722
3632 # Create custom DCF analysis Skill
3633 dcf_skill = client.skills.create(
3634 files: [
3635 Anthropic::FilePart.new(
3636 Pathname("dcf_skill/SKILL.md"),
3637 filename: "dcf_skill/SKILL.md",
3638 content_type: "text/markdown"
3639 )
3640 ]
3641 )
3723 # Custom DCF analysis Skill (ID obtained from Skills API create response)
3724 dcf_skill_id = "skill_01AbCdEfGhIjKlMnOpQrStUv"
36423725
36433726 # Use with Excel to create financial model
36443727 response = client.messages.create(
from line 3730
36473730 container: {
36483731 skills: [
36493732 { type: "anthropic", skill_id: "xlsx", version: "latest" },
3650 { type: "custom", skill_id: dcf_skill.id, version: "latest" }
3733 { type: "custom", skill_id: dcf_skill_id, version: "latest" }
36513734 ]
36523735 },
36533736 messages: [