PageSourceSearch

https://academy.claude-code.club/_next/static/chunks/pages/en/gett…/custom-slash-commands-7602d43d8ce55a36.js

js claude-code.club collected 2026-10-06 16:57:20 UTC 11,875 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[291],{52305:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/en/getting-started/claude-code/how-to/custom-slash-commands",function(){return n(78419)}])},78419:function(e,s,n){"use strict";n.r(s),n.d(s,{useTOC:function(){return c}});var i=n(52676),a=n(21396),r=n(53381),d=n(26768),t=n(5629),l=n(18873),o=n(38274);function c(e){return[{value:"Create Project-Specific Commands",id:"create-project-specific-commands",depth:2},{value:"Create the Commands Directory in Your Project",id:"create-the-commands-directory-in-your-project",depth:3},{value:"Create a Markdown File for Each Command",id:"create-a-markdown-file-for-each-command",depth:3},{value:"Use the Custom Command in Claude Code",id:"use-the-custom-command-in-claude-code",depth:3},{value:"Add Command Arguments Using $ARGUMENTS",id:"add-command-arguments-using-arguments",depth:2},{value:"Create a Command File with the $ARGUMENTS Placeholder",id:"create-a-command-file-with-the-arguments-placeholder",depth:3},{value:"Use the Command with an Issue Number",id:"use-the-command-with-an-issue-number",depth:3},{value:"Create Personal Slash Commands",id:"create-personal-slash-commands",depth:2},{value:"Create the Commands Directory in Your Home Folder",id:"create-the-commands-directory-in-your-home-folder",depth:3},{value:"Create a Markdown File for Each Command",id:"create-a-markdown-file-for-each-command-1",depth:3},{value:"Use Your Personal Custom Command",id:"use-your-personal-custom-command",depth:3}]}s.default=(0,a.c)(function(e){let{toc:s=c(e)}=e,n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",span:"span",strong:"strong",ul:"ul",...(0,d.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{children:"Create Custom Slash Commands"}),"\n",(0,i.jsx)(n.p,{children:"Claude Code supports custom slash commands, which you can create to quickly execute specific prompts or tasks."}),"\n",(0,i.jsxs)(n.p,{children:["For more details, see the ",(0,i.jsx)(n.a,{href:"https://docs.claude.com/en/docs/claude-code/slash-commands",children:"Slash Commands"})," reference page."]}),"\n",(0,i.jsx)(n.h2,{id:s[0].id,children:s[0].value}),"\n",(0,i.jsx)(n.p,{children:"Suppose you want to create reusable slash commands for your project that all team members can use."}),"\n",(0,i.jsxs)(t.R,{children:[(0,i.jsx)(n.h3,{id:s[1].id,children:s[1].value}),(0,i.jsx)(n.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"mkdir"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" -p"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" .claude/commands"})]})})}),(0,i.jsx)(n.h3,{id:s[2].id,children:s[2].value}),(0,i.jsx)(n.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"echo"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "Analyze the performance of this code and suggest three specific optimizations:"'}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" >"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" .claude/commands/optimize.md"})]})})}),(0,i.jsx)(n.h3,{id:s[3].id,children:s[3].value}),(0,i.jsx)(n.pre,{tabIndex:"0","data-language":"plaintext","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{children:"> /optimize"})})})})]}),"\n",(0,i.jsxs)(l.U,{type:"info",children:[(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Tips:"})}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The command name is derived from the filename (e.g., ",(0,i.jsx)(n.code,{children:"optimize.md"})," becomes ",(0,i.jsx)(n.code,{children:"/optimize"}),")"]}),"\n",(0,i.jsxs)(n.li,{children:["You can organize commands in subdirectories (e.g., ",(0,i.jsx)(n.code,{children:".claude/commands/frontend/component.md"})," creates ",(0,i.jsx)(n.code,{children:"/component"}),", shown as “(project:frontend)” in the description)"]}),"\n",(0,i.jsx)(n.li,{children:"Project commands are available to everyone who clones the repository"}),"\n",(0,i.jsx)(n.li,{children:"The Markdown file content becomes the prompt sent to Claude when the command is invoked"}),"\n"]})]}),"\n",(0,i.jsx)(n.h2,{id:s[4].id,children:s[4].value}),"\n",(0,i.jsx)(n.p,{children:"Suppose you want to create flexible slash commands that can accept additional input from the user."}),"\n",(0,i.jsxs)(t.R,{children:[(0,i.jsx)(n.h3,{id:s[5].id,children:s[5].value}),(0,i.jsx)(n.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"",children:(0,i.jsxs)(n.code,{children:[(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"echo"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'Find and fix issue #$ARGUMENTS. Follow these steps:"})]}),"\n",(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"}
1,children:"1. Understand the issue described in the ticket"})}),"\n",(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"2. Locate the relevant code in our codebase"})}),"\n",(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"3. Implement a solution that addresses the root cause"})}),"\n",(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"4. Add appropriate tests"})}),"\n",(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"5. Prepare a concise PR description'"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" >"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" .claude/commands/fix-issue.md"})]})]})}),(0,i.jsx)(n.h3,{id:s[6].id,children:s[6].value}),(0,i.jsx)(n.p,{children:"In a Claude session, use the command with an argument."}),(0,i.jsx)(n.pre,{tabIndex:"0","data-language":"plaintext","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{children:"> /fix-issue 123"})})})}),(0,i.jsxs)(n.p,{children:["This replaces ",(0,i.jsx)(n.code,{children:"$ARGUMENTS"})," with “123” in the prompt."]})]}),"\n",(0,i.jsxs)(l.U,{type:"info",children:[(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Tips:"})}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["The ",(0,i.jsx)(n.code,{children:"$ARGUMENTS"})," placeholder is replaced with any text that follows the command"]}),"\n",(0,i.jsxs)(n.li,{children:["You can place ",(0,i.jsx)(n.code,{children:"$ARGUMENTS"})," anywhere in the command template"]}),"\n",(0,i.jsx)(n.li,{children:"Other useful applications: generating test cases for specific functions, creating documentation for components, reviewing code in specific files, or translating content into a specified language"}),"\n"]})]}),"\n",(0,i.jsx)(n.h2,{id:s[7].id,children:s[7].value}),"\n",(0,i.jsx)(n.p,{children:"Suppose you want to create personal slash commands that work across all your projects."}),"\n",(0,i.jsxs)(t.R,{children:[(0,i.jsx)(n.h3,{id:s[8].id,children:s[8].value}),(0,i.jsx)(n.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"mkdir"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:" -p"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" ~/.claude/commands"})]})})}),(0,i.jsx)(n.h3,{id:s[9].id,children:s[9].value}),(0,i.jsx)(n.pre,{icon:o.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsxs)(n.span,{children:[(0,i.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"echo"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:' "Review this code for security vulnerabilities, focusing on:"'}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" >"}),(0,i.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" ~/.claude/commands/security-review.md"})]})})}),(0,i.jsx)(n.h3,{id:s[10].id,children:s[10].value}),(0,i.jsx)(n.pre,{tabIndex:"0","data-language":"plaintext","data-word-wrap":"",children:(0,i.jsx)(n.code,{children:(0,i.jsx)(n.span,{children:(0,i.jsx)(n.span,{children:"> /security-review"})})})})]}),"\n",(0,i.jsxs)(l.U,{type:"info",children:[(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Tips:"})}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Personal commands are shown with “(user)” in their description when listed via ",(0,i.jsx)(n.code,{children:"/help"})]}),"\n",(0,i.jsx)(n.li,{children:"Personal commands are only available to you and are not shared with your team"}),"\n",(0,i.jsx)(n.li,{children:"Personal commands work across all your projects"}),"\n",(0,i.jsx)(n.li,{children:"You can use these commands to maintain a consistent workflow across different c
1odebases"}),"\n"]})]})]})},"/en/getting-started/claude-code/how-to/custom-slash-commands",{filePath:"pages/en/getting-started/claude-code/how-to/custom-slash-commands.mdx",timestamp:1778940118e3,pageMap:r.v,frontMatter:{title:"Create Custom Slash Commands",description:"Learn how to create custom slash commands to quickly execute specific prompts or tasks"},title:"Create Custom Slash Commands"},"undefined"==typeof RemoteContent?c:RemoteContent.useTOC)},18873:function(e,s,n){"use strict";n.d(s,{U:function(){return l}});var i=n(52676),a=n(4814),r=n(38274);let d={default:"\uD83D\uDCA1",error:"\uD83D\uDEAB",info:(0,i.jsx)(r.AV,{className:"_mt-1"}),warning:"⚠️"},t={default:(0,a.Z)("_border-orange-100 _bg-orange-50 _text-orange-800 dark:_border-orange-400/30 dark:_bg-orange-400/20 dark:_text-orange-300"),error:(0,a.Z)("_border-red-200 _bg-red-100 _text-red-900 dark:_border-red-200/30 dark:_bg-red-900/30 dark:_text-red-200"),info:(0,a.Z)("_border-blue-200 _bg-blue-100 _text-blue-900 dark:_border-blue-200/30 dark:_bg-blue-900/30 dark:_text-blue-200"),warning:(0,a.Z)("_border-yellow-100 _bg-yellow-50 _text-yellow-900 dark:_border-yellow-200/30 dark:_bg-yellow-700/30 dark:_text-yellow-200")};function l({children:e,type:s="default",emoji:n=d[s]}){return(0,i.jsxs)("div",{className:(0,a.Z)("nextra-callout _overflow-x-auto _mt-6 _flex _rounded-lg _border _py-2 ltr:_pr-4 rtl:_pl-4","contrast-more:_border-current contrast-more:dark:_border-current",t[s]),children:[(0,i.jsx)("div",{className:"_select-none _text-xl ltr:_pl-3 ltr:_pr-2 rtl:_pr-3 rtl:_pl-2",style:{fontFamily:'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},children:n}),(0,i.jsx)("div",{className:"_w-full _min-w-0 _leading-7",children:e})]})}},5629:function(e,s,n){"use strict";n.d(s,{R:function(){return d}});var i=n(52676),a=n(4814),r=n(75271);function d({children:e,className:s,style:n,...d}){let t=(0,r.useId)().replaceAll(":","");return(0,i.jsx)("div",{className:(0,a.Z)("nextra-steps _ms-4 _mb-12 _border-s _border-gray-200 _ps-6","dark:_border-neutral-800",s),style:{...n,"--counter-id":t},...d,children:e})}}},function(e){e.O(0,[1396,3381,2888,9774,179],function(){return e(e.s=52305)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.