Skip to main content
command

publisher-linkedin — Claude Code command: what it does, how to install

Drafts LinkedIn posts from blog articles or local files and attaches media via API. Useful for developers sharing written content.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command marketing/publisher-linkedin
Open on GitHub

What publisher-linkedin does

The /publisher:linkedin command processes source content from a repository slug or local file path. It reads Markdown and PDF documents directly. The prompt pulls core takeaways from the text, adds up to four hashtags, and attaches a link back to the source piece.

Two output languages are supported: thought leadership tone for English and formal keigo for Japanese. It can discover diagrams in the repository or attach a custom file in PNG or PDF format.

Uploads rely on Bash and curl rather than a Node.js runtime. Without LINKEDIN_CLIENT_ID and LINKEDIN_CLIENT_SECRET in your .env file, the command cannot open draft reviews or publish via API, leaving you with text to paste manually.

What it helps with

  • draft a LinkedIn post from a blog slug or local file
  • compose social copy in Japanese using formal keigo
  • attach diagrams or PDF documents to social drafts
  • publish drafts directly via LinkedIn API without Node.js

Example prompts for the agent

  • /publisher:linkedin my-post
  • /publisher:linkedin my-post en image.png
  • /publisher:linkedin my-post ja report.pdf

How to install publisher-linkedin

1claude-code-templates

npx claude-code-templates@latest --command marketing/publisher-linkedin

2Manually: put the files in place

.claude/commands/publisher-linkedin.md

Call it with /publisher-linkedin. For all projects use ~/.claude/commands/

Questions about publisher-linkedin

How to install publisher-linkedin in Claude Code?

Run npx claude-code-templates@latest --command marketing/publisher-linkedin. This saves the configuration to .claude/commands/publisher-linkedin.md.

What does publisher-linkedin do?

It summarizes source articles into LinkedIn posts, appends relevant hashtags, and handles media uploads. The tool can also trigger draft creation through the platform API.

Are LinkedIn API credentials required?

No credentials are required to draft the copy. You only need LINKEDIN_CLIENT_ID and LINKEDIN_CLIENT_SECRET in .env if you want automatic API uploads and browser review.

Source text

publisher-linkedin.md · MIT
---
allowed-tools: Read, Write, Bash, Glob, WebFetch
argument-hint: <input> [lang] [custom-file-path]
description: Generate LinkedIn posts from blog content with automatic media attachment via LinkedIn API
---

# LinkedIn Post Generator

Create professional LinkedIn posts from any content source with optional media attachment.

**Usage:** `$ARGUMENTS`

**Examples:**
```bash
/publisher:linkedin my-post                    # Auto-detect and attach blog diagrams
/publisher:linkedin my-post en                 # English with diagrams
/publisher:linkedin my-post en image.png       # Custom image attachment
/publisher:linkedin my-post ja report.pdf      # Japanese with custom PDF
```

**Process:**

1. **Parse Input Arguments**
   - Content input (slug, file path, or URL)
   - Optional language parameter (en/ja)
   - Optional custom file path for attachment

2. **Universal Input Detection**
   - **File path**: Read and parse (markdown, PDF, HTML, text, JSON)
   - **URL**: Use WebFetch to retrieve content
   - **Slug**: Search codebase for matching blog post

3. **Generate Professional LinkedIn Post**
   - Use thought leadership tone for English
   - Use professional business tone (敬語) for Japanese
   - Extract key insights from actual content
   - Include relevant hashtags (2-4 max)
   - Add link to full article

4. **Handle Media Attachment**
   - **Custom file**: Use specified image/PDF if provided
   - **Auto-detect**: Find blog diagrams if available
   - Supported formats: PNG, JPG, JPEG, PDF

5. **Post via LinkedIn API** (using Bash + curl)
   - Check for credentials in .env file
   - Handle OAuth flow if needed
   - **CRITICAL**: Escape LinkedIn Little Text Format reserved characters: `| { } @ [ ] ( ) < > # * _ ~`
   - Upload media file and get asset URN
   - Create draft post with commentary and media
   - Open LinkedIn in browser for review

**LinkedIn API Authentication:**
1. Create LinkedIn app at https://www.linkedin.com/developers/apps
2. Add credentials to .env:
   ```
   LINKEDIN_CLIENT_ID=your_client_id
   LINKEDIN_CLIENT_SECRET=your_secret
   LINKEDIN_ACCESS_TOKEN=your_token (auto-generated on first use)
   ```

**Without API setup**: Command still generates the post content for manual copy-paste.

**Note**: Works in ANY repo type (Python, Rust, Go, etc.) - uses only bash and curl, no Node.js required.

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

Everything for Marketing and content →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor