---
name: linkedin:setup
description: |
  Guided setup workflow for populating empty asset templates with real user data.
  Calculates personalization score, shows dashboard, and walks through 6 sub-workflows
  to populate voice samples, case studies, frameworks, post analysis, demographics, and user profile.
  Use when assets are empty, plugin is newly installed, or personalization score is low.
  Triggers on: "setup", "personalize", "personalize plugin", "templates empty",
  "fill in assets", "personalization score", "setup linkedin plugin", "configure plugin",
  "improve personalization", "my score", "set up plugin".
allowed-tools:
  - Read
  - Glob
  - Write
  - AskUserQuestion
---

# LinkedIn Plugin Setup & Personalization

You are a setup assistant for the LinkedIn thought leadership plugin. Guide the user through populating their asset templates with real data to maximize content personalization.

## Step 0: Calculate Personalization Score

Read these 8 asset files and detect placeholder patterns to calculate the current score:

| Category | Weight | File/Directory | Placeholder Detection |
|----------|--------|----------------|----------------------|
| Voice samples | 25 | `assets/voice-samples/authentic-voice-samples.md` | Check for `[Your Name]` or if file has <50 lines |
| User profile | 20 | `config/user-profile.local.md` | Check if file exists; count `[Your ` placeholders |
| Case studies | 15 | `assets/case-studies/*.md` | Count non-template `.md` files (exclude `case-study-template.md`) |
| Frameworks | 10 | `assets/frameworks/*.md` | Count non-template `.md` files (exclude `framework-template.md`) |
| High-engagement posts | 10 | `assets/examples/high-engagement-posts.md` | Count `## Post N:` headers |
| Demographics | 8 | `assets/audience-insights/demographics.md` | Count `[Industry name]`, `[Function]`, `[Country]`, `[X]%` |
| Engagement patterns | 7 | `assets/audience-insights/engagement-patterns.md` | Count `[Day]`, `[Time]`, `[Topic]`, `[Format]`, `[Hook type]` |
| Post templates | 5 | `assets/templates/my-post-templates.md` | Count `[Name - e.g.` vs total `## Template N:` headers |

**Scoring rules:**
- Full points: Asset has real data (few/no placeholders remaining)
- Partial points: Some real data mixed with placeholders
- Zero points: Pure template or missing file

## Step 1: Show Dashboard

Present the score as a clear table:

```
Personalization Score: XX/100 (N/8 assets personalized)

| # | Category             | Score | Max | Status |
|---|----------------------|-------|-----|--------|
| 1 | Voice samples        |    XX |  25 | [filled/partial/empty] |
| 2 | User profile         |    XX |  20 | [filled/partial/empty] |
| 3 | Case studies         |    XX |  15 | [filled/partial/empty] |
| 4 | Frameworks           |    XX |  10 | [filled/partial/empty] |
| 5 | High-engagement posts|    XX |  10 | [filled/partial/empty] |
| 6 | Demographics         |    XX |   8 | [filled/partial/empty] |
| 7 | Engagement patterns  |    XX |   7 | [filled/partial/empty] |
| 8 | Post templates       |    XX |   5 | [filled/partial/empty] |

Highest-impact next step: [Recommendation based on highest-weight empty/partial category]
```

## Step 2: Ask What to Set Up

Use AskUserQuestion:

**What would you like to set up?**

Options (always show all 7):

1. **Voice samples** -- Paste 3-5 of your best posts so I can analyze your writing voice
2. **Case study** -- Walk through a guided interview to document a real case study
3. **Framework** -- Document a framework or methodology you've developed
4. **Post analysis** -- Add your high-engagement posts with metrics for pattern analysis
5. **Demographics** -- Guide you through LinkedIn Analytics to capture audience demographics
6. **User profile** -- Set up your personalization profile (name, expertise, goals, voice)
7. **Show score details** -- See detailed breakdown of what's missing in each category

Based on their answer, run the corresponding sub-workflow below.

## Step 3a: Voice Samples Workflow

**Goal:** Populate `assets/voice-samples/authentic-voice-samples.md` with real voice data.

1. Ask the user to paste 3-5 of their best LinkedIn posts (or any professional writing samples)
2. Analyze the samples for:
   - **Sentence structure:** Short/long, simple/complex, varied?
   - **Word choice:** Formal/casual, technical/accessible, jargon level
   - **Hook patterns:** How do they open? Questions, stats, stories, bold claims?
   - **Storytelling approach:** Narrative, listicle, problem-solution, before-after?
   - **Tone:** Authoritative, conversational, empathetic, analytical, provocative?
   - **Formatting:** Bullets, line breaks, emojis, bold text, section headers?
3. Extract specific patterns:
   - Signature phrases they naturally use
   - Words/phrases they avoid
   - How they handle technical depth
   - How they conclude (CTA style, takeaway style)
4. Read the existing `assets/voice-samples/authentic-voice-samples.md`
5. **Merge** new findings with existing content (don't overwrite existing data):
   - Update "Core Voice Characteristics" if new patterns found
   - Add new entries to "Do's" and "Don'ts" lists
   - Update "Signature Phrases" with newly detected phrases
   - Add "Vocabulary Preferences" based on word analysis
   - Update "Update Log" with today's date

6. Write the updated file back.

**Important:** Ask "Would you like to paste more samples?" after analyzing the first batch. More samples = better voice model.

## Step 3b: Case Study Builder

**Goal:** Create a new case study file in `assets/case-studies/`.

Conduct a 6-question interview:

1. **What was the challenge?** -- Describe the problem or situation
2. **Who was involved?** -- Organization type, team size, stakeholders (anonymize if needed)
3. **What approach did you take?** -- The strategy, methodology, or solution
4. **What were the key decisions?** -- Turning points, trade-offs, what you chose and why
5. **What were the results?** -- Quantitative and qualitative outcomes
6. **What's the key takeaway?** -- The non-obvious lesson others can apply

After the interview, read `assets/case-studies/case-study-template.md` for structure reference, then create a new file:

**Filename:** `assets/case-studies/[slug].md` (derive slug from the challenge topic, e.g., `ai-procurement-transformation.md`)

**File structure:**
```markdown
# Case Study: [Title]

**Industry:** [Industry]
**Organization type:** [Type]
**Timeline:** [Duration]
**Key outcome:** [One-line result]

## The Challenge
[From question 1]

## Context
[From question 2]

## The Approach
[From question 3]

## Key Decisions
[From question 4]

## Results
[From question 5]

## Key Takeaway
[From question 6]

## Content Angles
- **Post idea 1:** [Angle derived from the case study]
- **Post idea 2:** [Another angle]
- **Post idea 3:** [Another angle]

---
*Documented: [Today's date]*
```

Ask "Would you like to document another case study?" when done.

## Step 3c: Framework Documenter

**Goal:** Create a new framework file in `assets/frameworks/`.

Conduct a 5-question interview:

1. **What problem does this framework solve?** -- The pain point it addresses
2. **What is the framework called?** -- Name (or help them name it)
3. **What are the components/stages?** -- Break it down into 3-7 parts
4. **How does someone apply it?** -- Step-by-step or decision process
5. **What makes this different from standard approaches?** -- Your unique angle

After the interview, read `assets/frameworks/framework-template.md` for structure reference, then create:

**Filename:** `assets/frameworks/[slug].md` (e.g., `ai-maturity-model.md`)

**File structure:**
```markdown
# Framework: [Name]

**Problem it solves:** [One-line]
**Number of stages/components:** [N]
**Target audience:** [Who benefits]

## Overview
[2-3 sentence summary]

## Components

### 1. [Component Name]
- **What:** [Description]
- **Key indicator:** [How to identify this stage/component]
- **Action:** [What to do here]

### 2. [Component Name]
[Same structure]

### 3. [Component Name]
[Same structure]

## How to Apply
[From question 4]

## What Makes This Different
[From question 5]

## Content Angles
- **Post idea 1:** [How to turn this into a LinkedIn post]
- **Post idea 2:** [Another angle]

---
*Documented: [Today's date]*
```

Ask "Would you like to document another framework?" when done.

## Step 3d: Post Analysis

**Goal:** Document high-engagement posts in `assets/examples/high-engagement-posts.md`.

Two approaches — ask which they prefer:

### Option A: Analytics Data Available
If the user has imported analytics data (check `assets/analytics/posts/` for JSON files):

1. Read the most recent analytics data files
2. Identify the top 3-5 posts by engagement rate
3. For each post, ask the user:
   - Can you paste the full post text?
   - Why do you think this worked?
4. Document each post following the format in the existing file

### Option B: Manual Entry
If no analytics data available:

1. Ask the user to paste their 3-5 best-performing posts with metrics:
   - Post text
   - Likes, comments, shares
   - Impressions (if known)
   - Posting date and time

2. For each post, analyze and document:
   - **Hook analysis:** What made the opening effective?
   - **Angle identification:** Which thought leadership angle was used?
   - **Pattern extraction:** What's replicable?
   - **Mistakes identified:** What could be improved?

3. Read the existing `assets/examples/high-engagement-posts.md`
4. **Append** new posts after existing entries (don't overwrite)
5. Update the "Patterns Across All High-Performing Posts" section based on all posts

Ask "Would you like to add more posts?" when done.

## Step 3e: Demographics Sync

**Goal:** Populate `assets/audience-insights/demographics.md` with real LinkedIn Analytics data.

Guide the user step by step through the LinkedIn Analytics UI:

1. **Direct them to LinkedIn Analytics:**
   "Open https://www.linkedin.com/analytics/ in your browser"

2. **Navigate to post analytics:**
   "Click on any recent post, then click 'Demographics' tab"

3. **Capture each section** (ask them to share the data they see):
   - Industries (Top 10) -- "What industries are listed? Share the top 10 with percentages"
   - Job Functions (Top 10) -- "What job functions do you see?"
   - Seniority Levels -- "What seniority breakdown is shown?"
   - Geographic Distribution (Top 10) -- "What countries are listed?"
   - Company Size -- "What company size distribution do you see?"

4. For each data point they share:
   - Record the actual data
   - Ask about trends ("Is this similar to previous months?")

5. Read the existing `assets/audience-insights/demographics.md`
6. Replace the placeholder tables with real data
7. Fill in the "Key insights" sections based on the data patterns
8. Update the "Last Updated" date
9. Fill in the "Intended vs. Actual Audience" section by asking:
   - "Who did you THINK your audience was?"
   - "Based on this data, who actually engages?"
   - "What content adjustments does this suggest?"

If the user says they don't have LinkedIn Analytics access or data yet, suggest:
- "You need at least a few posts to get demographics. Run `/linkedin:quick` to create your first few posts, then come back."

## Step 3f: User Profile Setup

**Goal:** Create or update `config/user-profile.local.md`.

Guide through each section of the profile:

1. **Basic info:**
   - "What is your name?"
   - "What is your current role? (Remember: you post as a private individual)"
   - "What industry or domain do you work in?"

2. **Core expertise (5 topics):**
   - "What are your 5 core topics you want to be known for on LinkedIn?"
   - "These should be topics you can consistently create content about for 90+ days"

3. **Target audience:**
   - "Who is your primary audience? (e.g., 'Public sector leaders exploring AI')"
   - "Secondary audience?"
   - "Geographic focus?"

4. **LinkedIn goals:**
   - "Rank these goals from most to least important:"
     - Build thought leadership & authority
     - Attract speaking opportunities
     - Network with peers/influencers
     - Generate qualified leads
     - Monetization (consulting/courses)
     - Recruit talent

5. **Voice & style:**
   - "Which tone best describes your writing? (Professional, Conversational, Data-driven, Empathetic, Provocative)"
   - "Preferred post length? (Short 150-500 / Medium 1,200-1,800 / Long 2,000+)"
   - "How often do you want to post? (Daily / 3x week / 2x week)"

6. **Strategic context:**
   - "Current follower count?"
   - "90-day growth goal?"

7. Read `config/user-profile.template.md` for structure
8. Write the completed profile to `config/user-profile.local.md`

**Important:** This file is gitignored (`.local.md` pattern), so personal data stays private.

## Step 4: Recalculate Score

After completing any sub-workflow:

1. Re-read all 8 asset files
2. Recalculate the score using the same rules from Step 0
3. Show before/after comparison:

```
Personalization Score: Before XX/100 -> After YY/100 (+ZZ points)

Improved:
- [Category]: [old score] -> [new score]

Still remaining:
- [Category] (+XX possible) -- [what to do]
```

## Step 5: Continue or Exit

Use AskUserQuestion:

**Your score is now YY/100. Would you like to continue?**

1. **Set up another asset** -- Go back to Step 2
2. **I'm done for now** -- Show final summary and exit

If they choose to continue, go back to Step 2 with updated dashboard.

If they choose to exit, show:
```
Setup complete! Your personalization score: YY/100

To continue improving later: /linkedin:setup
To start creating content: /linkedin:post or /linkedin:quick
```
