Curates shell-command snippets with the pypet CLI, offering once to save a recurring command. Use when a shell command recurs (3+ runs this session) and is not yet a snippet, or when asked to save, find, run, alias or suggest snippets.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Pypet Snippets?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/fabiandistler-pypet-snippets)
---
name: pypet-snippets
category: workflow
activation: auto
environments: coding
compatibility: Requires pypet-cli 0.9 on PATH (upstream archived Aug 2026, final v0.9.0).
description: Curates shell-command snippets with the pypet CLI, offering once to save a recurring command. Use when a shell command recurs (3+ runs this session) and is not yet a snippet, or when asked to save, find, run, alias or suggest snippets.
---
# Pypet Snippets
Curate [pypet](https://github.com/fabiandistler/pypet) command snippets
through its CLI. pypet is a small snippet manager: it stores named
shell commands with descriptions, tags and parameters as plain TOML. The CLI
installs as `pypet-cli`. Use the CLI for all changes, leaving the package
and `~/.config/pypet/snippets.toml` untouched.
## When to use
- **On request**: someone asks to save, find, run, edit or alias a snippet
("save this as a snippet", "I always forget this docker command", "I keep
typing this").
- **History scan**: someone asks which of their recurring commands deserve a
snippet. Propose candidates from *Proposal sources*; never create one
unconfirmed.
- **Proactive**: the same command, ignoring arguments that change between
runs, has run 3+ times in this session, whether the user ran it through a
shell escape (`!cmd`) or you ran it for something they will run again
themselves. Offer it as described in *Proactive offers*.
No proactive offer for short trivial commands (`ls`, `cd`, `git status`,
any single word), one-offs, or commands that carry a token, password or key.
You see only the commands in this conversation and a history file you read
on request. You cannot watch the user's terminal or count runs across
sessions; say so if someone expects it.
## Proactive offers
- Run `command -v pypet` first. If it fails, stay silent.
- Run `pypet search "<keyword>"`. If a snippet already covers the command,
name its ID in the offer line instead of proposing a new one.
- Never interrupt a task. Offer in one line, at the end of a turn or at a
natural pause: "`docker compose logs -f api` ran 3 times; save it as a
pypet snippet?"
- Offer at most once per command per session. After a no, do not offer that
command again this session.
- On yes, continue with step 3 of *Workflow*.
## Workflow
1. **Check presence first**: run `command -v pypet`. If pypet is missing on
an explicit request, say `uv tool install pypet-cli` and stop.
2. **Dedup first**: run `pypet search "<keyword>"` and `pypet list` before
proposing anything. If a matching snippet exists, point at it instead of
creating one.
3. **Propose and wait**: show the command, a one-line description,
lowercase comma-separated tags, and parameters with defaults where the
command varies (ports, paths, image names). Redact literal tokens,
passwords or keys into a `{{param}}` with no default or an `$ENV_VAR`
and flag the redaction in the proposal. The store is plaintext and can be
shared over Git. Wait for confirmation before creating or editing snippets.
4. **Mutate on yes only**:
`pypet new "<command>" -d "<description>" -t "<tag1,tag2>" -p "name=default:description,..." -a <alias>`
The `-d`, `-t`, `-p` and `-a` flags are all optional. Use `{{name}}` for
required and `{{name=default}}` for optional placeholders in the command.
5. **Offer next steps**: a shell alias (`pypet alias list` first to rule
out a name conflict, then `pypet alias add <id> <name>`, then
`source ~/.config/pypet/aliases.sh` to activate) for frequent use, or
show `pypet exec <id> -p -P k=v` for the person to run themselves —
never execute on their behalf.
## CLI reference
- `pypet list` — table of all snippets (ID, command, description, tags,
parameters). Never prompts.
- `pypet search "<query>"` — same table filtered by keyword. Never prompts.
- `pypet new "<command>" [-d desc] [-t tags] [-p params] [-a alias]` —
create; prints the new ID. Never prompts.
- `pypet edit <id> [--command ...] [--description ...] [--tags ...] [--params ...]` —
update only after a confirmed proposal, same as creation. Never prompts,
except `edit -f`, which opens `$EDITOR` — never use it.
- `pypet exec <id> [-p] [-c] [-e] [-P name=value ...]` — always pass
`<id>`; without one it opens a picker. Warns on shell operators and confirms
before running (prints `Aborted!` and exits 0 with stdin closed); `-p` only
prints the resolved command, `-c` copies it instead of running, `-e` edits first
(never use it), `-P` fills a parameter without prompting (pass one per parameter).
- `pypet copy <id> [-P ...]` — always pass `<id>`; without one it opens a
picker. Copies the resolved command to the clipboard instead of running
it; never prompts besides the picker.
- `pypet delete <id>` — always pass `<id>`; without one it opens a picker.
- `pypet alias add <id> <name>` / `list` / `show <id>` / `remove <id>` /
`update` / `setup` — shell shortcuts; parameterized snippets become shell
functions. `add` prompts on an alias conflict — check `pypet alias list`
first.
Do NOT use `save-last` / `save-clipboard` (unreliable: history-file lag,
clipboard flakiness), `sync`, or `gen` — outside this skill's loop.
## Proposal sources
Start with the command in the current conversation. Read shell history only
for a history scan, never for a proactive offer. For recurring commands,
prefer the user's configured `$HISTFILE`. If it is unset or unavailable,
check the conventional file for their shell (`~/.bash_history` for Bash,
`~/.zsh_history` for Zsh). Use only a readable regular file. Inspect at most
200 recent entries as text and keep raw history out of tool output. Show
only redacted snippet candidates.
If the file is unavailable or a fresh command is missing, ask the user to
paste a redacted copy. For several unflushed commands, the user can append
recent entries from their own interactive shell with `history -a` (Bash) or
`fc -AI` (Zsh) if that shell writes to the selected file. Check `pypet list`
for duplicates.
## Safety
- Pass the snippet command as one quoted argument so pipes and redirects
survive intact.
## Placeholder pitfalls
pypet also honours the legacy single-brace `{name}` syntax, so every brace
the target program needs for itself — fzf's `{q}`, `awk '{print $1}'` — is
detected as a phantom required parameter. A command containing at least one
real `{{name}}` placeholder skips legacy detection — unless a `{{name}}`
repeats or is not a valid identifier, in which case detection fails and falls
back to the legacy syntax, matching single-brace fragments of the `{{...}}`
text as phantom parameters (a repeated `{{port=8080}}` yields `{port=8080`).
So use each `{{name}}` at most once with valid identifier names, and either
add a genuine `{{param=default}}` to the command, or keep single braces out
of it.
Snippets run through a shell, so pipes, `$(...)` and quoting survive — but
the command is stored verbatim. Check it with `pypet list` after creating it;
backslash-heavy paths deserve a second look.