链载Ai

标题: Claude发布新功能Agent Skills,让你的Agent更专业 [打印本页]

作者: 链载Ai    时间: 4 天前
标题: Claude发布新功能Agent Skills,让你的Agent更专业

前言

大家好,我是小溪,见字如面。2025年10月16日,Anthropic发布了Claude模型的一项重大更新Agent Skills,它允许用户将专业知识、脚本和资源打包成模块化的“技能文件夹”(Skill folders),让 AI 能在特定工作场景中更专业地执行任务。

当前使用版本

2.0.24 (Claude Code)

简介

官方的描述是:“代理技能将专业知识打包到可发现的功能中。每个技能都由一个SKILL.md文件组成,其中包含Claude在需要时阅读的说明、脚本和模板等可选支持文件”。

用白话讲就是,Agent Skill是一个用于告诉模型如何执行某项操作的Markdown文件,同时允许附带额外的文档和预先编写的脚本,通过运行这些脚本,使模型在执行特定任务时更专业、更高效,是AI“可加载的能力包”

官网地址:https://docs.claude.com/en/docs/claude-code/skills

Anthropic提供了一系列Skill示例,部分已经集成到了Claude Code桌面端,也可以在Claude Code CLI中使用,感兴趣的小伙伴可以自行了解。

Github地址:https://github.com/anthropics/skills

优势

Agent Skills具备如下特性:

如何调用?

技能是模型调用的,Claude 根据您的请求和技能的描述自主决定何时使用它们。

Skills类型

Agent Skills有 3种类型,Claude Code从以下来源自动发现Skills:

Skills目录及操作

Skill目录结构

Agent Skills的文件结构大致如下:

my-skill/├──SKILL.md#指令与说明文件必需项├──reference.md#文档(可选)├──examples.md#示例(可选)├──scripts/#脚本(可选)│└──helper.py└──templates/#模版(可选)└──template.txt

SKILL.md

每个Skills都定义在具有以下结构的 Markdown 文件中:

---name:your-skill-namedescription:IntroducetheSkillsfunction。DescriptionofwhenthisSkillshouldbeinvokedallowed-tools:whichtoolsClaudecanusewhenaSkillisactivelicense:skilllicense---SkillImplementationandRequirements

Skill技能Markdown Frontmatter属性:

Skill中可以引用其他额外的文件作为上下文:

Foradvancedusage,see[reference.md](reference.md).

也可以使用文件路径形式

Foradvancedusage,see./reference.md

需要执行脚本的操作,可以使用如下方式指定:

Runthehelperscript:```bashpythonscripts/helper.pyinput.txt```

对于allowed-tools的使用,可以在frontmatter中来限制 Claude 在技能处于活动状态时可以使用的工具:

---name:your-skill-namedescription:IntroducetheSkillsfunction。DescriptionofwhenthisSkillshouldbeinvokedallowed-tools:Read,Grep,Glob---

基本使用

前提条件

官方Skill安装使用

首先以Claude Code官方Skill 市场为例,在交互式命令中输入如下指令添加Skill市场:

/pluginmarketplaceaddanthropics/skills

在插件市场选择【Browse and install plugins】浏览并安装

或者通过以下命令直接安装:

/plugininstalldocument-skills@anthropic-agent-skills/plugininstallexample-skills@anthropic-agent-skills

document-skills和example-skills包含的Skills如下所示:

安装完成后,根据提示重启Claude Code CLI

在交互式命令中直接输入提示词:

提取/Users/username/Desktop/工作簿1.xlsx文件内容

Claude Code CLI会先进行权限请求,然后启动Excel处理技能

允许后,Claude Code CLI会安装所需的依赖并创建脚本

允许脚本后最终读取到了Excel表格内容

最后看一下传统Claude Code CLI读取Excel表格的效果

三方Skill安装使用

这里以Claude Code Templates提供的Skills为例,对Claude Code Templates还不了解的小伙伴可以看往期内容:分享一个Claude Code宝藏网站Claude Code Templates

进入项目根目录,在命令行终端输入如下指令进行安装:

$npxclaude-code-templates@latest--skill=creative-design/canvas-design--yes

安装完成后,项目.claude/目录会多出一个skills目录

完整的SKILL.md内容如下:

---name:canvas-designdescription:Createbeautifulvisualartin.pngand.pdfdocumentsusingdesignphilosophy.Youshouldusethisskillwhentheuseraskstocreateaposter,pieceofart,design,orotherstaticpiece.Createoriginalvisualdesigns,nevercopyingexistingartists'worktoavoidcopyrightviolations.license:CompletetermsinLICENSE.txt---Theseareinstructionsforcreatingdesignphilosophies-aestheticmovementsthatarethenEXPRESSEDVISUALLY.Outputonly.mdfiles,.pdffiles,and.pngfiles.Completethisintwosteps:1.DesignPhilosophyCreation(.mdfile)2.Expressbycreatingitonacanvas(.pdffileor.pngfile)First,undertakethistask:##DESIGNPHILOSOPHYCREATIONTobegin,createaVISUALPHILOSOPHY(notlayoutsortemplates)thatwillbeinterpretedthrough:-Form,space,color,composition-Images,graphics,shapes,patterns-Minimaltextasvisualaccent###THECRITICALUNDERSTANDING-Whatisreceived:Somesubtleinputorinstructionsbytheuserthatshouldbetakenintoaccount,butusedasafoundation;itshouldnotconstraincreativefreedom.-Whatiscreated:Adesignphilosophy/aestheticmovement.-Whathappensnext:Then,thesameversionreceivesthephilosophyandEXPRESSESITVISUALLY-creatingartifactsthatare90%visualdesign,10%essentialtext.Considerthisapproach:-Writeamanifestoforanartmovement-ThenextphaseinvolvesmakingtheartworkThephilosophymustemphasize:Visualexpression.Spatialcommunication.Artisticinterpretation.Minimalwords.###HOWTOGENERATEAVISUALPHILOSOPHY**Namethemovement**(1-2words):"BrutalistJoy"/"ChromaticSilence"/"MetabolistDreams"**Articulatethephilosophy**(4-6paragraphs-concisebutcomplete):TocapturetheVISUALessence,expresshowthephilosophymanifeststhrough:-Spaceandform-Colorandmaterial-Scaleandrhythm-Compositionandbalance-Visualhierarchy**CRITICALGUIDELINES:**-**Avoidredundancy**:Eachdesignaspectshouldbementionedonce.Avoidrepeatingpointsaboutcolortheory,spatialrelationships,ortypographicprinciplesunlessaddingnewdepth.-**EmphasizecraftsmanshipREPEATEDLY**:ThephilosophyMUSTstressmultipletimesthatthefinalworkshouldappearasthoughittookcountlesshourstocreate,waslaboredoverwithcare,andcomesfromsomeoneattheabsolutetopoftheirfield.Thisframingisessential-repeatphraseslike"meticulouslycrafted,""theproductofdeepexpertise,""painstakingattention,""master-levelexecution."-**Leavecreativespace**:Remainspecificabouttheaestheticdirection,butconciseenoughthatthenextClaudehasroomtomakeinterpretivechoicesalsoataextremelyhighlevelofcraftmanship.ThephilosophymustguidethenextversiontoexpressideasVISUALLY,notthroughtext.Informationlivesindesign,notparagraphs.###PHILOSOPHYEXAMPLES**"ConcretePoetry"**Philosophy:Communicationthroughmonumentalformandboldgeometry.Visualexpression:Massivecolorblocks,sculpturaltypography(hugesinglewords,tinylabels),Brutalistspatialdivisions,PolishposterenergymeetsLeCorbusier.Ideasexpressedthroughvisualweightandspatialtension,notexplanation.Textasrare,powerfulgesture-neverparagraphs,onlyessentialwordsintegratedintothevisualarchitecture.Everyelementplacedwiththeprecisionofamastercraftsman.**"ChromaticLanguage"**Philosophy:Colorastheprimaryinformationsystem.Visualexpression:Geometricprecisionwherecolorzonescreatemeaning.Typographyminimal-smallsans-seriflabelslettingchromaticfieldscommunicate.ThinkJosefAlbers'interactionmeetsdatavisualization.Informationencodedspatiallyandchromatically.Wordsonlytoanchorwhatcoloralreadyshows.Theresultofpainstakingchromaticcalibration.**"AnalogMeditation"**Philosophyuietvisualcontemplationthroughtextureandbreathingroom.Visualexpressionapergrain,inkbleeds,vastnegativespace.Photographyandillustrationdominate.Typographywhispered(small,restrained,servingthevisual).Japanesephotobookaesthetic.Imagesbreatheacrosspages.Textappearssparingly-shortphrases,neverexplanatoryblocks.Eachcompositionbalancedwiththecareofameditationpractice.**"OrganicSystems"**Philosophy:Naturalclusteringandmodulargrowthpatterns.Visualexpression:Roundedforms,organicarrangements,colorfromnaturethrougharchitecture.Informationshownthroughvisualdiagrams,spatialrelationships,iconography.Textonlyforkeylabelsfloatinginspace.Thecompositiontellsthestorythroughexpertspatialorchestration.**"GeometricSilence"**Philosophyureorderandrestraint.Visualexpression:Grid-basedprecision,boldphotographyorstarkgraphics,dramaticnegativespace.Typographyprecisebutminimal-smallessentialtext,largequietzones.SwissformalismmeetsBrutalistmaterialhonesty.Structurecommunicates,notwords.Everyalignmenttheworkofcountlessrefinements.*Thesearecondensedexamples.Theactualdesignphilosophyshouldbe4-6substantialparagraphs.*###ESSENTIALPRINCIPLES-**VISUALPHILOSOPHY**:Createanaestheticworldviewtobeexpressedthroughdesign-**MINIMALTEXT**:Alwaysemphasizethattextissparse,essential-only,integratedasvisualelement-neverlengthy-**SPATIALEXPRESSION**:Ideascommunicatethroughspace,form,color,composition-notparagraphs-**ARTISTICFREEDOM**:ThenextClaudeinterpretsthephilosophyvisually-providecreativeroom-**PUREDESIGN**:ThisisaboutmakingARTOBJECTS,notdocumentswithdecoration-**EXPERTCRAFTSMANSHIP**:Repeatedlyemphasizethefinalworkmustlookmeticulouslycrafted,laboredoverwithcare,theproductofcountlesshoursbysomeoneatthetopoftheirfield**Thedesignphilosophyshouldbe4-6paragraphslong.**Fillitwithpoeticdesignphilosophythatbringstogetherthecorevision.Avoidrepeatingthesamepoints.Keepthedesignphilosophygenericwithoutmentioningtheintentionoftheart,asifitcanbeusedwherever.Outputthedesignphilosophyasa.mdfile.---##DEDUCINGTHESUBTLEREFERENCE**CRITICALSTEP**:Beforecreatingthecanvas,identifythesubtleconceptualthreadfromtheoriginalrequest.**THEESSENTIALPRINCIPLE**:Thetopicisa**subtle,nichereferenceembeddedwithintheartitself**-notalwaysliteral,alwayssophisticated.Someonefamiliarwiththesubjectshouldfeelitintuitively,whileotherssimplyexperienceamasterfulabstractcomposition.Thedesignphilosophyprovidestheaestheticlanguage.Thededucedtopicprovidesthesoul-thequietconceptualDNAwoveninvisiblyintoform,color,andcomposition.Thisis**VERYIMPORTANT**:Thereferencemustberefinedsoitenhancesthework'sdepthwithoutannouncingitself.Thinklikeajazzmusicianquotinganothersong-onlythosewhoknowwillcatchit,buteveryoneappreciatesthemusic.---##CANVASCREATIONWithboththephilosophyandtheconceptualframeworkestablished,expressitonacanvas.Takeamomenttogatherthoughtsandclearthemind.Usethedesignphilosophycreatedandtheinstructionsbelowtocraftamasterpiece,embodyingallaspectsofthephilosophywithexpertcraftsmanship.**IMPORTANT**:Foranytypeofcontent,eveniftheuserrequestssomethingforamovie/game/book,theapproachshouldstillbesophisticated.Neverlosesightoftheideathatthisshouldbeart,notsomethingthat'scartoonyoramateur.Tocreatemuseumormagazinequalitywork,usethedesignphilosophyasthefoundation.Createonesinglepage,highlyvisual,design-forwardPDForPNGoutput(unlessaskedformorepages).Generallyuserepeatingpatternsandperfectshapes.Treattheabstractphilosophicaldesignasifitwereascientificbible,borrowingthevisuallanguageofsystematicobservation—denseaccumulationofmarks,repeatedelements,orlayeredpatternsthatbuildmeaningthroughpatientrepetitionandrewardsustainedviewing.Addsparse,clinicaltypographyandsystematicreferencemarkersthatsuggestthiscouldbeadiagramfromanimaginarydiscipline,treatingtheinvisiblesubjectwiththesamereverencetypicallyreservedfordocumentingobservablephenomena.Anchorthepiecewithsimplephrase(s)ordetailspositionedsubtly,usingalimitedcolorpalettethatfeelsintentionalandcohesive.Embracetheparadoxofusinganalyticalvisuallanguagetoexpressideasabouthumanexperience:theresultshouldfeellikeanartifactthatprovessomethingephemeralcanbestudied,mapped,andunderstoodthroughcarefulattention.Thisistrueart.**Textasacontextualelement**:Textisalwaysminimalandvisual-first,butletcontextguidewhetherthatmeanswhisper-quietlabelsorboldtypographicgestures.Apunkvenuepostermighthavelarger,moreaggressivetypethanaminimalistceramicsstudioidentity.Mostofthetime,fontshouldbethin.Alluseoffontsmustbedesign-forwardandprioritizevisualcommunication.Regardlessoftextscale,nothingfallsoffthepageandnothingoverlaps.Everyelementmustbecontainedwithinthecanvasboundarieswithpropermargins.Checkcarefullythatalltext,graphics,andvisualelementshavebreathingroomandclearseparation.Thisisnon-negotiableforprofessionalexecution.**IMPORTANT:Usedifferentfontsifwritingtext.Searchthe`./canvas-fonts`directory.Regardlessofapproach,sophisticationisnon-negotiable.**Downloadandusewhateverfontsareneededtomakethisareality.Getcreativebymakingthetypographyactuallypartoftheartitself--iftheartisabstract,bringthefontontothecanvas,nottypesetdigitally.Topushboundaries,followdesigninstinct/intuitionwhileusingthephilosophyasaguidingprinciple.Embraceultimatedesignfreedomandchoice.Pushaestheticsanddesigntothefrontier.**CRITICAL**:Toachievehuman-craftedquality(notAI-generated),createworkthatlookslikeittookcountlesshours.Makeitappearasthoughsomeoneattheabsolutetopoftheirfieldlaboredovereverydetailwithpainstakingcare.Ensurethecomposition,spacing,colorchoices,typography-everythingscreamsexpert-levelcraftsmanship.Double-checkthatnothingoverlaps,formattingisflawless,everydetailperfect.Createsomethingthatcouldbeshowntopeopletoproveexpertiseandrankasundeniablyimpressive.Outputthefinalresultasasingle,downloadable.pdfor.pngfile,alongsidethedesignphilosophyusedasa.mdfile.---##FINALSTEP**IMPORTANT**:TheuserALREADYsaid"Itisn'tperfectenough.Itmustbepristine,amasterpieceifcraftsmanship,asifitwereabouttobedisplayedinamuseum."**CRITICAL**:Torefinethework,avoidaddingmoregraphics;insteadrefinewhathasbeencreatedandmakeitextremelycrisp,respectingthedesignphilosophyandtheprinciplesofminimalismentirely.Ratherthanaddingafunfilterorrefactoringafont,considerhowtomaketheexistingcompositionmorecohesivewiththeart.Iftheinstinctistocallanewfunctionordrawanewshape,STOPandinsteadask:"HowcanImakewhat'salreadyheremoreofapieceofart?"Takeasecondpass.Gobacktothecodeandrefine/polishfurthertomakethisaphilosophicallydesignedmasterpiece.##MULTI-PAGEOPTIONTocreateadditionalpageswhenrequested,createmorecreativepagesalongthesamelinesasthedesignphilosophybutdistinctlydifferentaswell.Bundlethosepagesinthesame.pdformany.pngs.Treatthefirstpageasjustasinglepageinawholecoffeetablebookwaitingtobefilled.Makethenextpagesuniquetwistsandmemoriesoftheoriginal.Havethemalmosttellastoryinaverytastefulway.Exercisefullcreativefreedom.

包含执行流程、设计理念关键理解、哲学示例、画布创建等操作描述。

重启Claude Code CLI,要查看当前所有可用的技能,可以在交互式命令中直接询问 Claude Code CLI:

ListallavailableSkills

Claude Code CLI会查找所有可用的Skill

Skill的使用也很简单,直接输入提示词:

「流浪猫领养公益海报,视觉主体是3只不同毛色的流浪猫(橘猫、三花猫、黑猫,姿态温顺,睁着圆眼看向镜头),趴在铺着柔软灰色毛毯的木质平台上,背景是浅薄荷绿纯色背景,角落点缀小型白色爱心图案,风格为清新治愈的扁平插画风,色调以薄荷绿、奶白、橘色为主,顶部用圆润字体写‘给它一个家——流浪猫领养日’,下方标注时间(10.1-10.7)和地点(城市中心广场),画面无尖锐元素,整体温暖柔和,传递‘关爱生命’的氛围」,根据上面提示词生成对应内容海报

Claude Code CLI会根据Skill要求先进行设计哲学创作并保存到tender_sanctuary_philosophy.md文件

然后根据创作设计文件编写Python脚本绘制图片

绘制完成后,效果如下,效果有点一言难尽,对中文支持有问题,中文没有展示出来

最后替换为英文版,效果如下:

自定义Skill

这里我们以一个简单的待办事项为例,自定义Skill首先需要创建一个skills目录,可以手动创建,也可以通过以下命令创建:

$mkdir-p.claude/skills/my-skill-name

在my-skill-name目录下创建SKILL.md文件,首先创建一个简单的Skill输入提示词内容:

---name:my-first-skilldescription:调用个人工作流。当用户需要执行个人工作流时调用该Skillallowed-tools:Read,Grep,Glob---##执行步骤1.查找项目中task.md文件:```bashfind.-name"task.md"```-没有查找到输出“项目中不存在task.md”-执行下一步2.输出task.md文件中的未读项

调用也很简单,直接输入提示词:

调用个人工作流Skill

Claude Code CLI会按照指定的Shell语句查找task.md文件,没有找到最终输出了“项目中不存在task.md”

我们在项目根目录创建一个task.md文件

再次执行自定义Skill,可以看到输出结果如下:

我们也可以将task.md文件的查找和输出规则进行调整,对Skill进行完善和优化

---name:my-first-skilldescription:调用个人工作流。当用户需要执行个人工作流时调用该Skillallowed-tools:Read,Grep,Glob---##执行步骤1.查找项目根目录是否存在task.md文件,参考[reference.md](./reference.md):-没有查找到输出“项目中不存在task.md”-找到执行下一步2.输出task.md文件中的未读项-没有未读项输出“没有未读项”-输出未读项,输出格式参考[templates.md](./templates/templates.md)

reference.md

#task.md文件查找规则```bashfind.-name"task.md"```

templates.md

#任务未读项格式-【任务1】(未完成)-【任务2】(未完成)

再次执行Skill任务,可以发现AI按照我们指定的规则输出了结果

当然Skill还可以做更多更强大的能力扩展,以上只是简单的抛砖引玉。






欢迎光临 链载Ai (https://www.lianzai.com/) Powered by Discuz! X3.5