# Install the "linkedin" skill (Linked API)

Follow this runbook to install the Linked API **linkedin** skill (General LinkedIn automation) for the user.

Drive everything through the flag-driven, JSON commands below — never run the bare `npx @linkedapi/skills` (no arguments): it opens an interactive terminal UI you cannot operate.

When a step needs a decision that isn't already fixed, ask the user in plain language and use their answer instead of assuming. (Example: if more than one agent is installed, ask which ones to install into.)

## 1. Inspect the environment

```bash
npx @linkedapi/skills detect --json
```

Parse `data`: installed agents (`agents[].detected`), whether this is a git repo (`git.inRepo`),
and prerequisite status (`linkedinCli`, `tokens`).

## 2. Prerequisites

- If `linkedinCli.installed` is false: run `npm install -g @linkedapi/linkedin-cli`.
- If `tokens.configured` is false: have the user get both tokens at https://app.linkedapi.io, then run `linkedin setup --linked-api-token=<token> --identification-token=<token>`.

## 3. Install

```bash
npx @linkedapi/skills add linkedin --agent <id> [--agent <id> …] --scope <project|global> --yes --json
```

Ask the user which detected agents and which scope to use if it isn't obvious (default scope:
project in a git repo, else global).

Parse the JSON — don't judge by the exit code alone (the only special exit is `2` = bad arguments). For each skill the result has two separate flags:

- `ok` — the install itself succeeded (files placed + dependencies installed).
- `ready` — the skill is fully configured and usable right now.

A skill is commonly `ok: true` with `ready: false` — installed fine but still needs setup (for example, LinkedIn tokens not connected yet). **This is not a failure.** Read the top-level `pending` list (per skill, with a human-readable message for each item), walk the user through those items, and continue. Only an `ok: false` skill is an actual install failure to report.

## 4. Verify

Run `npx @linkedapi/skills doctor --json`, then remind the user to restart their agent — skills
load at startup.

## Fallback (no Node / npx)

Copy `linkedin/` from https://github.com/Linked-API/linkedin-skills into the agent's skills directory (e.g.
`.claude/skills/linkedin/`).
