One of the most powerful features in Claude Code is the ability to create custom slash commands. Instead of repeatedly typing long or error-prone commands, you can encapsulate workflows into a reusable command.
If you work with Java-based systems, you’ve likely had to import certificates into the JVM truststore using keytool. This process usually involves:
sudo accessThis is exactly the kind of repetitive task that benefits from automation.
askpass (The Key Concept)Normally, sudo requires a password entered through a terminal (TTY). But tools like Claude Code don’t always run in an interactive terminal environment.
This is where SUDO_ASKPASS comes in.
askpass is a helper mechanism that allows sudo to retrieve a password programmatically instead of prompting the user interactively.
When you run:
sudo -A <command>
-A tells sudo to use the askpass programSUDO_ASKPASS defines which script to runCreate a secure script that returns your password:
YOUR_PASSWORD_HERE with your actual passwordchmod 700 ensures only your user can access itAdd this to your shell configuration (.zshrc or .bashrc):
export SUDO_ASKPASS="$HOME/bin/askpass.sh"
Update your Claude settings:
~/.claude/settings.json
Claude requires explicit permission for commands involving sudo. This keeps execution controlled and predictable.
/import-cert CommandNow we define a reusable workflow.
Create:
~/.claude/commands/import-cert.md
Restart Claude Code after creating this file.
Add this to your project’s CLAUDE.md: