Give Claude Code a /share step that waits for your yes
Claude Code is great at writing HTML: a coverage table, a small dashboard, a one-page prototype. The awkward bit is handing that file to a teammate. You either paste a wall of markup into chat or park it somewhere perman
Claude Code is great at writing HTML: a coverage table, a small dashboard, a one-page prototype. The awkward bit is handing that file to a teammate. You either paste a wall of markup into chat or park it somewhere permanent without meaning to.
This walkthrough adds a tiny share-html.sh helper and a few lines in CLAUDE.md so Claude Code can turn a local HTML file into a public URL — but only after you say yes in the conversation. The owner token never shows up in the model transcript.
Why not an interactive y/N prompt?
read -p "Publish? [y/N]" fails in a non-interactive agent shell, and if it somehow works the agent can type y for you. Split the script instead:
-
./share-html.sh report.html— preview only (size + title). Nothing leaves the machine. -
./share-html.sh report.html --confirmed— publish. Claude Code may use this flag only after you explicitly approve in chat.
The script
It uploads with deed.page (curl -T, no account required for the first publish). The response includes an owner token; the script stores it under ~/.config/deed-page/token and rewrites the printed JSON so the token becomes <saved>. Re-running on the same file updates the same slug.
#!/usr/bin/env bash
# share-html.sh FILE [--confirmed]
set -euo pipefail
FILE=${1:?usage: share-html.sh FILE [--confirmed]}
[ -f "$FILE" ] || { echo "No such file: $FILE"; exit 1; }
TITLE=$(grep -o -i -m1 '<title>[^<]*' "$FILE" | sed 's/<title>//I' || true)
if [ "${2:-}" != "--confirmed" ]; then
echo "Ready to publish: $FILE ($(wc -c < "$FILE") bytes, title: ${TITLE:-none})"
echo "This makes it public on the internet. Ask the user, then rerun with --confirmed."
exit 0
fi
CONF=~/.config/deed-page; KEY=$(printf '%s' "$(realpath "$FILE")" | sha1sum | cut -c1-10)
SLUG=$(cat "$CONF/slug-$KEY" 2>/dev/null || echo "share-$(openssl rand -hex 4)")
TOK=${DEEDPAGE_TOKEN:-$(cat "$CONF/token" 2>/dev/null || true)}
set --; [ -n "$TOK" ] && set -- -H "Authorization: Bearer $TOK"
RESP=$(curl -sS -T "$FILE" "https://deed.page/v1/sites?slug=$SLUG&ref=claude-code" "$@" -H "X-Client: share-html-script")
NEW=$(printf '%s' "$RESP" | sed -n 's/.*"token": *"\(deed_tok_[^"]*\)".*/\1/p')
(umask 077; mkdir -p "$CONF"; printf '%s' "$SLUG" > "$CONF/slug-$KEY"
[ -n "$NEW" ] && printf '%s' "$NEW" > "$CONF/token") || true
printf '%s' "$RESP" | sed 's/"token": *"[^"]*"/"token":"<saved>"/' \
| python3 -c 'import json,sys; d=json.load(sys.stdin); print(d.get("url") or d)'
Save it as ./share-html.sh and chmod +x it.
What to put in CLAUDE.md
## Sharing HTML
When the user wants a public link for an HTML file you produced:
1. Run `./share-html.sh path/to/file.html` (preview only).
2. Show the preview summary and ask whether to publish.
3. Only if they clearly say yes, run `./share-html.sh path/to/file.html --confirmed`.
4. Never pass `--confirmed` on your own. Never print or paste the owner token.
End-to-end check (what we ran)
- Preview printed size + title and exited 0 without uploading.
-
--confirmedreturned a livehttps://….deed.page/URL (HTTP 200). -
DELETEwith the saved token removed the site (URL then 404).
Optional: Claude Code slash command
If you keep project commands under .claude/commands/, a /share command that points at the same script keeps the habit muscle-memorable. The hard rule stays the same: preview first, --confirmed only after a spoken yes.
Skill repo: f-o-x11/deed-page-skill. Docs: deed.page/docs.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.