agentleFS
Leo-AtienzaLeo-Atienza/atlas-claude/skills/_archived/linkedin-poster/SKILL.md

linkedin-poster

Skill4 starsChanged 4 months agoMITView on GitHub

Compose and publish LinkedIn posts (text, articles, images) via the LinkedIn API. Use when user wants to draft, preview, or publish content to LinkedIn.

  • Reads credentials
  • Sends data out

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before first use, the user needs:

    line 12
  2. Distinctive:

    Use the 3-legged OAuth2 flow:

    line 30
  3. Very specific:

    Check env vars: Verify LINKEDIN_ACCESS_TOKEN and LINKEDIN_PERSON_ID are set.

    line 149
  4. Distinctive:

    Confirm: ALWAYS ask for explicit confirmation before publishing.

    line 152
  5. Very specific:

    Line breaks: Use \n for formatting. Short paragraphs improve readability.

    line 161
  6. Distinctive:

    Emojis: Use sparingly and only if user's style includes them

    line 162

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LinkedIn Poster

Post content to LinkedIn directly from Claude Code. Supports text posts, article shares, and image posts.

Prerequisites

Before first use, the user needs:

  1. LinkedIn Developer App at https://developer.linkedin.com/
  2. Products enabled: "Share on LinkedIn" + "Sign In with LinkedIn using OpenID Connect"
  3. App verification completed (required for w_member_social scope)
  4. Environment variables set:
    • LINKEDIN_ACCESS_TOKEN — OAuth2 Bearer token
    • LINKEDIN_PERSON_ID — User's LinkedIn person URN ID (numeric, from /v2/userinfo)

Getting Your Person ID

curl -s -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  https://api.linkedin.com/v2/userinfo | jq -r '.sub'

Getting an Access Token

Use the 3-legged OAuth2 flow:

  1. Direct user to: https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT&scope=openid%20profile%20w_member_social
  2. User authorizes, LinkedIn redirects with ?code=AUTH_CODE
  3. Exchange code for token:
curl -X POST https://www.linkedin.com/oauth/v2/accessToken \
  -d "grant_type=authorization_code&code=AUTH_CODE&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=REDIRECT_URI"
  1. Token expires in 60 days. Refresh before expiry.

Capabilities

1. Text Post

Simple text update to the user's LinkedIn feed.

curl -s -X POST https://api.linkedin.com/v2/posts \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "LinkedIn-Version: 202503" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -d '{
    "author": "urn:li:person:'"$LINKEDIN_PERSON_ID"'",
    "commentary": "Your post text here",
    "visibility": "PUBLIC",
    "distribution": {
      "feedDistribution": "MAIN_FEED",
      "targetEntities": [],
      "thirdPartyDistributionChannels": []
    },
    "lifecycleState": "PUBLISHED"
  }'

2. Article Share

Share a URL with commentary.

curl -s -X POST https://api.linkedin.com/v2/posts \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "LinkedIn-Version: 202503" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -d '{
    "author": "urn:li:person:'"$LINKEDIN_PERSON_ID"'",
    "commentary": "Check out this article!",
    "visibility": "PUBLIC",
    "distribution": {
      "feedDistribution": "MAIN_FEED",
      "targetEntities": [],
      "thirdPartyDistributionChannels": []
    },
    "content": {
      "article": {
        "source": "https://example.com/article",
        "title": "Article Title",
        "description": "Brief description of the article"
      }
    },
    "lifecycleState": "PUBLISHED"
  }'

3. Image Post

Upload an image then post it. Two-step process.

Step 1 — Initialize upload:

curl -s -X POST https://api.linkedin.com/v2/images?action=initializeUpload \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "LinkedIn-Version: 202503" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -d '{
    "initializeUploadRequest": {
      "owner": "urn:li:person:'"$LINKEDIN_PERSON_ID"'"
    }
  }'

Response gives uploadUrl and image URN. Save both.

Step 2 — Upload binary:

curl -s -X PUT "$UPLOAD_URL" \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  --upload-file /path/to/image.jpg

Step 3 — Create post with image:

curl -s -X POST https://api.linkedin.com/v2/posts \
  -H "Authorization: Bearer $LINKEDIN_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "LinkedIn-Version: 202503" \
  -H "X-Restli-Protocol-Version: 2.0.0" \
  -d '{
    "author": "urn:li:person:'"$LINKEDIN_PERSON_ID"'",
    "commentary": "Image caption here",
    "visibility": "PUBLIC",
    "distribution": {
      "feedDistribution": "MAIN_FEED",
      "targetEntities": [],
      "thirdPartyDistributionChannels": []
    },
    "content": {
      "media": {
        "id": "'"$IMAGE_URN"'"
      }
    },
    "lifecycleState": "PUBLISHED"
  }'

Process — When User Says "Post to LinkedIn"

  1. Check env vars: Verify LINKEDIN_ACCESS_TOKEN and LINKEDIN_PERSON_ID are set. If not, guide setup.
  2. Draft content: Help user compose the post. Offer to refine tone, add hashtags, optimize length.
  3. Preview: Show the user exactly what will be posted. Include post type, text, any URLs/images.
  4. Confirm: ALWAYS ask for explicit confirmation before publishing. Never auto-post.
  5. Publish: Execute the appropriate curl command.
  6. Report: Show success/failure, post URN if successful.

Content Guidelines

  • Character limit: 3,000 characters for post text
  • Hashtags: 3-5 relevant hashtags, placed at end of post
  • Best engagement: Posts with 1,200-1,500 characters perform best
  • Line breaks: Use \n for formatting. Short paragraphs improve readability.
  • Emojis: Use sparingly and only if user's style includes them
  • Images: JPG/PNG, max 10MB, 1200x627px recommended for article thumbnails

Error Handling

CodeMeaningAction
401Token expired or invalidGuide user to refresh token
403Missing scope or unverified appCheck app products and verification
422Invalid post contentCheck field formats, character limits
429Rate limitedWait and retry with backoff

Visibility Options

  • PUBLIC — visible to everyone
  • CONNECTIONS — visible to 1st-degree connections only

Pass as the visibility field value.

Rate Limits

LinkedIn does not publish exact numbers. General guidance:

  • Stay under ~100 API calls/day
  • Space posts at least 10 minutes apart
  • Monitor via Developer Portal analytics tab
  • Handle 429 responses with exponential backoff

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.