Code Share
/install code-share
Gist Code Share
When returning code:
- If code is 10 lines or fewer, inline code block is allowed.
- If code is over 10 lines, prefer GitHub Gist.
- Default to secret gist unless user asks for public.
- Return a short summary + gist URL; avoid pasting long duplicate code in chat.
- Never publish secrets in shared code. If sensitive values are needed, use placeholders and tell user to fill them locally.
Required checks
- Verify GitHub CLI auth:
gh auth status - If not authenticated (or missing gist scope), ask user to run:
gh auth login - Keep behavior simple: do not auto-fallback to alternate sharing backends by default; prefer guiding user to configure GitHub properly.
Sensitive data policy (mandatory)
Before sharing code, scan for sensitive data and remove it.
- Never include API keys, tokens, passwords, private keys, cookies, session IDs, webhook secrets, phone/email PII, or absolute local secret paths.
- If code requires secrets, replace with placeholders, for example:
API_KEY="\x3CFILL_ME>"TOKEN="\x3CYOUR_TOKEN_HERE>".enventry with empty value
- Add a short note telling the user to fill placeholders locally after copying.
Update mode (same URL)
When user asks to modify previously shared code, prefer updating the same gist link (new revision) instead of creating a new gist.
Use:
./scripts/update_gist.sh \x3Cgist_url_or_id> \x3Cfile> "\x3Cshort description>" [public|secret] [lang]
Behavior:
- Keep the same gist URL.
- Save changes as a new revision.
- Return the same fixed 3-line response format.
Create a new gist only when:
- user explicitly asks for a new link, or
- existing gist is not editable by current GitHub account.
Create gist
Use:
gh gist create \x3Cfile> --desc "\x3Cshort description>"
If code is generated in-session, write it to a temp file in workspace first. Use language-appropriate extension (.py, .js, .ts, etc.) so Gist syntax highlighting works well.
With bundled script:
./scripts/create_gist.sh \x3Cfile> "\x3Cshort description>" [public|secret] [lang]
If \x3Cfile> has no extension, pass [lang] (for example python, typescript) so the script can upload with a proper extension.
Default behavior: do not use --web (automation-friendly).
Optional: use --web only when the user explicitly asks to open the gist in browser immediately.
Response format (fixed)
Always use exactly this 3-line format:
- One sentence on what was shared.
- Gist URL (separate line).
File: \x3Cfilename> · Lines: \x3Cline_count>
Example:
Shared the full script as a secret Gist for clean copy/paste. https://gist.github.com/... File: lc761_solution.py · Lines: 42
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install code-share - After installation, invoke the skill by name or use
/code-share - Provide required inputs per the skill's parameter spec and get structured output
What is Code Share?
Share code via GitHub Gist instead of inline chat blocks. Use when code output exceeds 10 lines, when the user asks for copy-friendly code sharing in Discord... It is an AI Agent Skill for Claude Code / OpenClaw, with 811 downloads so far.
How do I install Code Share?
Run "/install code-share" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Code Share free?
Yes, Code Share is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Code Share support?
Code Share is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Code Share?
It is built and maintained by Jiayi Wang (@jeromestein); the current version is v0.2.0.