Base64 encode
A curated pack of 7 practical agent-skills demonstrating real-world patterns: HTTP, GitHub CLI, ripgrep, file ops, JSON processing, encoding. Each SKILL.md validated against the v0.1 spec.
npx -y skills add MauricioPerera/agent-skills-pack --skill base64-encodeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Encodes a string as base64. Useful for embedding binary or special-character data in URLs, JSON tokens, or HTTP headers.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.7 KB, as published. Nobody here has run it
Base64 encode a string
Pure-shell utility: convert any string to its base64 representation.
Why printf '%s' instead of echo
echo adds a trailing newline by default and has shell-specific behavior with backslash escapes. printf '%s' is portable, predictable, and produces no trailing newline — so the base64 output represents exactly the input bytes.
Why base64 -w0
GNU base64 wraps output at 76 chars per line by default. For URL/JSON/header embedding, that's wrong — you need a single contiguous line. -w0 disables wrapping.
(macOS users: macOS's BSD base64 does NOT support -w0. This skill assumes GNU coreutils. macOS users should use gbase64 from brew install coreutils or omit -w0 and pipe through tr -d '\n' for portability.)
Output
- stdout: the base64-encoded string, single line, no trailing newline.
- stderr: empty on success.
- exit code: 0 always (base64 doesn't fail on string input).
Caveats
- This is standard base64, not URL-safe (
base64url). For URL-safe encoding, pipe throughtr '+/' '-_' | tr -d '='after this skill (or use a dedicatedbase64url-encodeskill if added). - The skill takes a STRING. To base64-encode a binary file, use
base64 -w0 < /path/to/filedirectly — wrapping that as a separate skill is straightforward but kept out for now (tighter input validation needed for a path arg). - The
valuepattern allows any UTF-8 character — newlines, NULs, special chars are preserved through the bank's single-quoting and into the printf invocation.
Pairing
A common use is building HTTP Basic Auth:
# Skill 1: build "user:password"
# Skill 2: base64-encode that
# Skill 3: HTTP request with the resulting string in `Authorization: Basic <encoded>` header
Each step is small and verifiable. The agent doesn't need to know base64 internals — it knows when to invoke this skill.
Reverse direction
A future companion skill base64-decode would invert this. Same pattern, with base64 --decode -w0 and a base64-validity pattern on the input.