are prompts you may retailer to your coding agent for straightforward entry. That is usually very helpful for prompts you employ repeatedly, comparable to:
- Create a launch pull request from the dev to the prod department
- Analyze these log teams, and inform me of any points
- Run pre-commit checks, push the code, and make a PR
These are all instructions I run each day. As an alternative of typing out the prompts every time or storing the prompts someplace, I can merely save them as slash instructions in Claude Code or Warp.
This offers me super-fast entry to my mostly used prompts, saving me a variety of time each day.
On this article, I’ll focus on slash instructions, what they’re, and why they’re so efficient. Moreover, I’ll cowl some particular instructions that I’ve saved and make the most of frequently.
Why it’s best to use slash instructions
Slash instructions are merely easy-to-access prompts which might be tremendous helpful if you end up operating a variety of repetitive prompts. I imagine that a variety of the prompts most programmers use might be repeated prompts. It could, for instance ,be:
- Creating pull requests
- Checking if the code is production-ready
- Writing documentation for a code base
These are all prompts you possible run frequently. In that case, it’s best to make these prompts into slash instructions. As an alternative of writing:
Examine if the code is manufacturing prepared, run pre-commit checks with black,
mypy and pytest, commit and push the code, and create PR and supply me
the url to the PR.
You possibly can merely retailer this as a command and write:
/make-pr
With the latest developments of coding brokers, I discover myself writing much more code and thus making much more pull requests. I subsequently write this immediate anyplace from 2 to 10 occasions a day. The time writing out the immediate, subsequently, provides up rapidly, and I save a variety of time merely utilizing the slash command as a substitute.
An extra advantage of utilizing slash instructions is that your instructions might be constant. You’ll all the time be operating the identical command, and always remember to write down out components of the command, for instance, forgetting to run pre-commit checks. That is additionally an enormous time-saver.
The best way to make slash instructions
You create slash instructions in several methods, relying on which device you might be utilizing. Nevertheless, I’ll present hyperlink to 3 of the commonest coding agent instruments, and hyperlinks to their respective documentation about slash instructions:
On the whole nonetheless, you may merely immediate any coding device, give it a immediate and a reputation, and inform it to create the slash command for you.
You possibly can then use the command by typing, slash and the command title. For instance, to run the command make-pr you’d write the command beneath into your coding agent
/make-pr
A few of my slash instructions
On this part, I’ll describe a number of the slash instructions that I take advantage of each day. For every command, I’ll clarify why it’s helpful and learn how to use it.
Create launch PR
A typical coding observe is to have 3 forms of branches:
- Function branches (private branches individuals use)
- A shared growth department
- A shared manufacturing department
If you’re utilizing this construction, you possible create launch PR’s from the event department to the manufacturing department. These PR’s usually comply with an ordinary construction, highlighting the totally different modifications which might be being merged in. For instance:
- Every change being added, and by whom
- Any helpful hyperlinks to documentation, Slack messages, or different related context
- A guidelines that should be stuffed out earlier than merging the code (high quality assurance, and so forth.)
To create this, you usually immediate your coding agent to make a PR, with the specs from the bullet level listing above. Nevertheless, this each takes time and could be inconsistent (as you might need small modifications in your immediate each time you write it).
As an alternative, create a slash command like:
Create a launch PR from the dev department to the principle department. The PR ought to
embody:
- every change being added, and by whom
- hyperlinks to related context used for an of the modifications (slack messages and so forth)
- a guidelines of things that must be performed earlier than merging, if related. For
instance: "carry out QA testing in dev department"
Now you may rapidly and persistently create launch PR’s to your repository.
Create new function department PR
Most likely the commonest command I take advantage of it to create a brand new function department PR. After I’ve carried out a brand new function, or mounted a bug, I’ve to do the next:
- Pull newest dev department, to verify I’m up to date
- Department off to a function department, from the newly pulled dev department
- Run pre-commit checks on the brand new code
- Commit and push the code within the new function department
- Create a PR from the function department to the dev department
I run this a number of occasions a day, and it’s thus manner sooner to run it as a slash command, such as you see beneath:
Given the modifications, I now must create a PR. Do the next:
- Pull the most recent dev department
- Department off to a brand new function department from the dev department
- Run pre-commit checks to verify my code is manufacturing prepared
- Commit and push the function department
- Create a PR from the function department to the principle department
I usually additionally present the function department title, as I take advantage of Linear department naming, to routinely replace the standing of my points, given the standing of my code (if it’s in a function department, in dev, or in prod).
Generalize the data from a thread
One other command command I take advantage of it to generalize data from a thread. That is very helpful, as a result of I usually discover that brokers behave a bit otherwise than desired, for instance in the way it implements a function. Or the mannequin would possibly lack some data that may be helpful to have in any future interplay.
Thus, I inform the mannequin to generalize the data from the thread the place I carried out a brand new function, or mounted a bug. I take advantage of a immediate like:
Generalize the data from this thread, saving all helpful, generalizable
data that's helpful for future coding on this repository. Retailer the
knowedge in AGENTS.md
I usually run this command after the final command which creates a brand new pull request from my function department.
Manufacturing-ready code
I usually discover that asking my coding agent if the code is production-ready, is environment friendly at discovering bugs and different points. For some cause, prompting the mannequin about manufacturing readiness, makes the mannequin replicate on its implementation, and uncover points it neglected earlier. I thus have a separate immediate I take advantage of to test whether or not my immediate is production-ready:
Examine if the brand new code created on this department is manufacturing prepared. You must
search for any potential points when operating this code in manufacturing, and
guarantee all exams and pre-commit checks run as anticipated. In the event you detect any
points, present me a report concerning the points, their severity, and the way we will
resolve them.
A Cursor instance
I additionally need to spotlight a slash command instance that Cursor supplies in their documentation.
They for instance present a code assessment guidelines, which the mannequin can undergo to carry out code critiques. That is very helpful to run critiques after you create PR’s, however can also be helpful to run as a pre-commit test.
You possibly can see the code assessment slash command beneath:
# Code Evaluate Guidelines
## Overview
Complete guidelines for conducting thorough code critiques to make sure high quality, safety, and maintainability.
## Evaluate Classes
### Performance
- [ ] Code does what it is speculated to do
- [ ] Edge instances are dealt with
- [ ] Error dealing with is suitable
- [ ] No apparent bugs or logic errors
### Code High quality
- [ ] Code is readable and well-structured
- [ ] Features are small and centered
- [ ] Variable names are descriptive
- [ ] No code duplication
- [ ] Follows mission conventions
### Safety
- [ ] No apparent safety vulnerabilities
- [ ] Enter validation is current
- [ ] Delicate knowledge is dealt with correctly
- [ ] No hardcoded secrets and techniques
Conclusion
On this article, I’ve mentioned slash instructions, and the way they will make you a more practical programmer. Slash instructions are merely prompts you retailer for straightforward entry, usually used for prompts you run on a repeated foundation. Utilizing slash instructions saves me a variety of time day by day. I urge you to consider repeated processes and prompts you employ in your day-to-day programming, and consider how one can convert it into slash instructions. I belive this mindset is extremely essential if you wish to grow to be a extra environment friendly. programmer.
👉 My Free Sources
🚀 10x Your Engineering with LLMs (Free 3-Day E mail Course)
📚 Get my free Imaginative and prescient Language Fashions e book
💻 My webinar on Imaginative and prescient Language Fashions
👉 Discover me on socials:
📩 Subscribe to my e-newsletter
🧑💻 Get in contact
✍️ Medium
