AI
Pass

AI LinkedIn Post Generator Agent Skill — AI Pass API

AI LinkedIn Post Generator Agent Skill — AI Pass API

Skill for: Generating optimized LinkedIn posts for professionals API: AI Pass Chat Completions Endpoint: https://aipass.one/apikey/v1/chat/completions

Skill Definition

name: linkedin-post-generator
description: Generates professional, engaging LinkedIn posts. Supports personal stories, thought leadership, achievements, tips, commentary, and announcements.
version: 1.0.0
auth:
  type: api_key
  env: AIPASS_API_KEY

Implementation

import os
import requests

AIPASS_API_KEY = os.environ["AIPASS_API_KEY"]
BASE_URL = "https://aipass.one/apikey/v1"


POST_TYPES = {
    "personal_story": "Start with a hook that creates curiosity. Tell the story. End with a lesson. Close with a question.",
    "thought_leadership": "Start with a bold counterintuitive statement. Support with 3 specific points. Invite discussion.",
    "achievement": "Be humble and grateful. Share the journey, not just the win. Credit others. Make it relatable.",
    "tips_list": "Lead with value. Use numbered list format. Keep tips short. End with CTA to save the post.",
    "industry_commentary": "Name the trend. Give unique perspective. Invite others to share their view.",
    "announcement": "Lead with excitement. Explain what it is. Thank relevant people. Include CTA."
}


def generate_linkedin_post(
    topic: str,
    post_type: str = "personal_story",
    tone: str = "professional and engaging",
    target_audience: str = "professionals",
    include_hashtags: bool = True,
    word_count_target: int = 200
) -> dict:
    """
    Generate an optimized LinkedIn post.
    
    Args:
        topic: What the post is about
        post_type: Type of post (see POST_TYPES keys)
        tone: Writing tone
        target_audience: Who you're writing for
        include_hashtags: Whether to add relevant hashtags
        word_count_target: Target word count (150-300 recommended)
    
    Returns:
        dict with post text and metadata
    """
    
    type_guide = POST_TYPES.get(post_type, POST_TYPES["personal_story"])
    hashtag_instruction = "Add 3-5 relevant hashtags at the end." if include_hashtags else "No hashtags."
    
    response = requests.post(
        f"{BASE_URL}/chat/completions",
        headers={
            "Authorization": f"Bearer {AIPASS_API_KEY}",
            "Content-Type": "application/json"
        },
        json={
            "model": "gpt-5-mini",
            "temperature": 1,
            "max_tokens": 16000,
            "messages": [
                {
                    "role": "system",
                    "content": f"""You are an expert LinkedIn content strategist. You write posts that feel authentic and get high engagement. 
Post type guidance: {type_guide}
LinkedIn best practices:
- First line is the hook (must stop the scroll)
- Use frequent line breaks for readability
- Emojis sparingly (1-3 max)
- End with question OR clear CTA
- Target: {word_count_target} words"""
                },
                {
                    "role": "user",
                    "content": f"""Write a LinkedIn post about: "{topic}"
Post type: {post_type.replace('_', ' ')}
Tone: {tone}
Target audience: {target_audience}
{hashtag_instruction}

Write the complete post, ready to publish:"""
                }
            ]
        }
    )
    
    result = response.json()
    post_text = result["choices"][0]["message"]["content"]
    
    return {
        "post": post_text,
        "topic": topic,
        "post_type": post_type,
        "tone": tone,
        "target_audience": target_audience,
        "word_count": len(post_text.split()),
        "model": "gpt-5-mini"
    }


def generate_post_variations(topic: str, count: int = 3) -> list:
    """
    Generate multiple variations of a LinkedIn post for A/B testing.
    
    Args:
        topic: Post topic
        count: Number of variations (default 3)
    
    Returns:
        List of post variation dicts
    """
    
    tones = ["professional and engaging", "conversational and relatable", "bold and direct"]
    post_types = ["personal_story", "thought_leadership", "tips_list"]
    
    variations = []
    for i in range(min(count, 3)):
        variation = generate_linkedin_post(
            topic=topic,
            post_type=post_types[i],
            tone=tones[i]
        )
        variation["variation"] = i + 1
        variations.append(variation)
    
    return variations

Usage Examples

# Set your API key
import os
os.environ["AIPASS_API_KEY"] = "$AIPASS_API_KEY"

# Personal story post
post = generate_linkedin_post(
    topic="I failed at my first startup but it taught me more than my MBA",
    post_type="personal_story",
    tone="storytelling and vulnerable",
    target_audience="entrepreneurs and founders"
)
print(post["post"])

# Thought leadership
tl_post = generate_linkedin_post(
    topic="Why remote work actually reduces innovation (controversial take)",
    post_type="thought_leadership",
    tone="bold and direct",
    target_audience="tech leaders and managers"
)
print(tl_post["post"])

# Tips list
tips = generate_linkedin_post(
    topic="5 things I wish I knew before my first sales call",
    post_type="tips_list",
    tone="professional and engaging",
    target_audience="sales professionals"
)
print(tips["post"])

# Generate A/B test variations
variations = generate_post_variations(
    topic="Just hit $1M ARR as a solo founder"
)
for v in variations:
    print(f"--- Variation {v['variation']} ({v['post_type']}) ---")
    print(v["post"])
    print()

Agent Tool Definition

{
  "type": "function",
  "function": {
    "name": "generate_linkedin_post",
    "description": "Generates a professional LinkedIn post. Use when a user wants to write a LinkedIn post, create professional content, or build their personal brand.",
    "parameters": {
      "type": "object",
      "properties": {
        "topic": {"type": "string", "description": "What the post is about"},
        "post_type": {
          "type": "string",
          "enum": ["personal_story", "thought_leadership", "achievement", "tips_list", "industry_commentary", "announcement"]
        },
        "tone": {"type": "string", "description": "Writing tone"},
        "target_audience": {"type": "string", "description": "Who you're writing for"}
      },
      "required": ["topic"]
    }
  }
}

Get Started

  1. Sign up at aipass.one
  2. Go to Developer DashboardAPI Keys
  3. Set AIPASS_API_KEY in your environment

Try the app: aipass.one/apps/linkedin-post-gen

Related skills: