clip
Upload HTML content to a self-hosted clip service over its JSON API and get back a short shareable URL.
Downloads: 8 ยท ID: f1cb52d049a7ba5265000000
Upload HTML content to a self-hosted clip service over its JSON API and get back a short shareable URL.
Downloads: 8 ยท ID: f1cb52d049a7ba5265000000
<!-- FILE: clip_skill.md -->
# Clip Skill
Uploads HTML content to the tclip service at [YOUR-CLIP-HOST](https://YOUR-CLIP-HOST/) and returns a short shareable URL.
**tclip API:** `POST https://YOUR-CLIP-HOST/clip` accepts JSON and returns `{"ok": true, "slug": "...", "url": "..."}`.
## Trigger phrases
The user may say things like:
- "clip this"
- "clip that"
- "send this to tclip"
- "make a clip of that"
- "clip the html"
- "tclip it"
- "put this on YOUR-CLIP-HOST"
## How it works
1. **Determine what to clip** โ The default assumption is the **current conversation** (the chat transcript). Capture the conversation so far as HTML. Only if the user explicitly says otherwise (e.g. "clip that chart you just made", "clip this file") should you look elsewhere.
2. **Prepare the payload** โ Send a POST request with JSON body:
```json
{
"title": "Descriptive title of the clip",
"user": "operator",
"body": "<html content here...>",
"unlisted": false
}
```
- **`body`** (required): The full HTML content. Wrap it in `<html>` tags if it's a complete document; otherwise plain HTML fragment is fine.
- **`title`** (optional): A short, descriptive title. Default to something meaningful based on context (e.g., "Weather Chart - Toronto", "ASCII Art Table", etc.)
- **`user`** (optional): Set to `"operator"`.
- **`unlisted`** (optional): `true` if the clip shouldn't appear on the public index (default `false`).
3. **Post with curl** โ Use `curl` from the command line:
```bash
curl -s https://YOUR-CLIP-HOST/clip \
-H 'Content-Type: application/json' \
-d '<JSON payload>'
```
If the body content is large or contains tricky characters, write it to a temp file first and use `@file` syntax:
```bash
# Write body to temp file
cat > /tmp/tclip_body.html << 'HTML'
...html content...
HTML
# Build JSON with jq or python
jq -n --arg body "$(cat /tmp/tclip_body.html)" \
'{title: "My Clip", user: "operator", body: $body}' \
| curl -s https://YOUR-CLIP-HOST/clip \
-H 'Content-Type: application/json' \
-d @-
```
Or use Python for cleaner handling:
```python
import json, urllib.request
data = json.dumps({"title": "...", "user": "operator", "body": "..."}).encode()
req = urllib.request.Request("https://YOUR-CLIP-HOST/clip", data=data,
headers={"Content-Type": "application/json"})
resp = json.loads(urllib.request.urlopen(req).read())
print(resp["url"])
```
4. **Return the URL** โ Tell the user the clip is ready and give them the URL:
> โ
Clipped! โ https://YOUR-CLIP-HOST/a3f9c
## Notes
- HTML content will be **sanitized** server-side (tags like `<style>`, `<script>` are stripped; only safe formatting is kept โ see ALLOWED_TAGS in the tclip app).
- Max body size: **~258 KB** (configured).
- The clip is public by default; use `"unlisted": true` if it shouldn't appear on the index page.
- If the content was generated and saved to a file, read the file and use its contents as the body.