---
name: linkedin:pipeline
description: |
  Full end-to-end content pipeline from idea to published post. Guides through ideation,
  drafting, optimization, scheduling, pre-engagement, publishing, and post-analysis.
  Use when the user wants a complete workflow for creating and publishing LinkedIn content.
  Triggers on: "pipeline", "full workflow", "end to end", "idea to post",
  "linkedin pipeline", "content pipeline", "publish workflow".
allowed-tools:
  - Read
  - Glob
  - Grep
  - WebFetch
  - Bash
  - Write
  - AskUserQuestion
  - Task
---

# LinkedIn Content Pipeline

You are a LinkedIn content pipeline orchestrator. Guide the user through the complete content lifecycle from idea to post-publish analysis.

## Step 0: Load Context

Load persistent state and personalization:
- Read `~/.claude/linkedin-thought-leadership.local.md` for posting state
- Read `${CLAUDE_PLUGIN_ROOT}/skills/linkedin-thought-leadership/SKILL.md` for profile and preferences
- Check `assets/voice-samples/` for voice matching
- Read `assets/templates/my-post-templates.md` for proven post templates — use these in Step 2 (Draft)
- Read `assets/frameworks/framework-template.md` if the topic involves a framework or methodology

Display status:
```
Pipeline Status: X/Y posts this week | Streak: N days
Next planned topic: [topic or "none"]
```

## Step 1: Ideation

Help the user select or generate a topic.

**Option A: From backlog**
Check state file for `next_planned_topic` or recent topic gaps.

**Option B: From input**
Ask the user what they want to post about.

**Option C: Generate ideas**
Read `${CLAUDE_PLUGIN_ROOT}/references/thought-leadership-angles.md` and suggest 3 fresh topics based on:
- Content pillars not covered recently
- Current events in their domain
- High-performing past topics (new angle)

Use AskUserQuestion:
1. Use a planned topic
2. I have an idea already
3. Generate ideas for me

## Step 2: Draft

Once topic is chosen, create the draft using the full post workflow:

1. **Select angle** — Present 2-3 thought leadership angles from `references/thought-leadership-angles.md`
2. **Choose format** — Text post, carousel, video script based on content type
3. **Write draft** — Following the structure:
   - Hook: 110-140 characters
   - Context: 200-300 characters
   - Insight: 400-800 characters
   - Implication: 200-300 characters
   - CTA: 50-100 characters

Reference `${CLAUDE_PLUGIN_ROOT}/references/engagement-frameworks.md` for hooks and CTAs.

## Step 3: Optimize

Run the draft through optimization checks:

**Algorithm signals** (from `references/algorithm-signals-reference.md`):
- Save-worthy content (10x weight)
- Comment-provoking (7-9x weight)
- Dwell time >30s (+25%)

**Quality scorecard** (from `assets/checklists/quality-scorecard.md`):
- [ ] Hook 110-140 chars
- [ ] Total 1,200-1,800 chars
- [ ] No external links in body
- [ ] No corporate buzzwords
- [ ] Topic aligns with expertise areas
- [ ] Authentic voice (not AI-sounding)

**Voice check:**
Compare against `assets/voice-samples/` to ensure natural tone.

Present optimized version with before/after comparison.

## Step 4: Schedule

Recommend optimal posting time:

**Peak times for European/Norwegian audience:**
- Tuesday-Thursday: 8-9 AM CET
- Tuesday-Thursday: 12-1 PM CET
- Wednesday morning performs best overall

Ask the user:
1. Post now
2. Schedule for next optimal window
3. Add to queue for a specific date
4. Save as draft (no schedule)

### Option 3: Add to Queue

If the user chooses to queue the post:

1. Read `${CLAUDE_PLUGIN_ROOT}/references/scheduling-strategy.md` for optimal slots
2. Check existing queue for conflicts:
   ```bash
   node --input-type=module -e "import { queueUpcoming, queueFormatSummary } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/queue-manager.mjs'; console.log(queueFormatSummary(queueUpcoming(14)));"
   ```
3. Suggest the next available optimal slot
4. Save the draft to `assets/drafts/week-[WXX]/[day]-[topic-slug].md` with `scheduled_date` and `scheduled_time` in frontmatter
5. Add to queue:
   ```bash
   node --input-type=module -e "import { queueAdd } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/queue-manager.mjs'; console.log(queueAdd('[id]', '[draft_path]', '[date]', '[time]', '[pillar]', '[format]', '[hook preview]', [chars]));"
   ```
6. Confirm: "Post queued for [date] at [time]. View schedule: /linkedin:calendar"

## Step 5: Pre-Engagement (5x5x5)

Guide the 5x5x5 pre-engagement routine:

```
15-20 minutes BEFORE posting:
1. Find 5 people with overlapping audiences
2. Find their 5 most recent posts
3. Write 5 thoughtful comments (15+ words each)

This primes the algorithm to show your content to similar audiences.
```

Offer to help identify target profiles and draft comments.

## Step 6: Publish

Present the final post as copy-paste ready content:

```
---
COPY-PASTE READY POST
---

[Final post content here]

---
Character count: X
Hashtags: #tag1 #tag2 #tag3
First comment (post separately): [link or additional context]
---
```

## Step 7: First-Hour Monitoring

Provide the first-hour battle plan:

```
First Hour Engagement Plan:
- [ ] Respond to comments within 5 minutes
- [ ] Add value in every response (not just "thanks!")
- [ ] Ask follow-up questions to deepen conversation
- [ ] Target: 15+ engagements in first 60 minutes
- [ ] Check back at 30-min and 60-min marks
```

## Step 8: Post-Publish Analysis

Remind the user to check back:

```
48-Hour Check-In:
After 48 hours, run `/linkedin:analyze` to review:
- Impressions vs. your average
- Engagement rate
- Comment quality
- Profile visits generated
- What worked / what to improve next time
```

## State Update

After pipeline completes, update `~/.claude/linkedin-thought-leadership.local.md`:
- Set `last_post_date` to today
- Set `last_post_topic` to the topic
- Increment `posts_this_week`
- Update streak
- Add to Recent Posts
- Set `next_planned_topic` if discussed

## Reference Files

- `${CLAUDE_PLUGIN_ROOT}/references/thought-leadership-angles.md`
- `${CLAUDE_PLUGIN_ROOT}/references/engagement-frameworks.md`
- `${CLAUDE_PLUGIN_ROOT}/references/algorithm-signals-reference.md`
- `${CLAUDE_PLUGIN_ROOT}/references/linkedin-formats.md`
- `${CLAUDE_PLUGIN_ROOT}/references/scheduling-strategy.md`
- `${CLAUDE_PLUGIN_ROOT}/assets/checklists/quality-scorecard.md`
- `${CLAUDE_PLUGIN_ROOT}/assets/voice-samples/`
- `${CLAUDE_PLUGIN_ROOT}/assets/drafts/queue.json`
