linkedin-cli CLAUDE.md

A set of coding instructions for linkedin-cli, a command-line tool that automates LinkedIn through the Linked API.

In plain words
What is it for?
Use it when developing linkedin-cli to install dependencies, build or check the TypeScript code, handle authentication, call LinkedIn operations, and format command output.
Why use it?
It explains how the project is structured, built, authenticated, and how its commands return results.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/linked-api/linkedin-cli/claude-md
Clone the repo
git clone --depth 1 https://github.com/Linked-API/linkedin-cli
Per session 732 This file is loaded in full into every session.
When invoked 732 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00732 $0.00732
Opus 5 $0.00366 $0.00366
Sonnet 5 $0.00146 $0.00146
Haiku 4.5 $0.00073 $0.00073

Measured yesterday against content hash 7b18eff6e9d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

linkedin-cli CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code when working with code in this repository.

Product

linkedin-cli is an AI-agent-friendly CLI for LinkedIn automation via Linked API. It wraps the linkedapi-node SDK (v2.0.0) to give AI agents (Claude Code, Cursor, Codex, etc.) a token-efficient interface to control LinkedIn.

Package: linkedin-cli on npm, binary: linkedin Framework: oclif (TypeScript CLI framework by Salesforce)

Build Commands

npm ci                # Install dependencies
npm run build         # tsc + tsc-alias + oclif manifest
npm run typecheck     # Type check without emitting
npm run lint          # ESLint with auto-fix
npm run format        # Prettier

Architecture

User/Agent -> CLI (oclif command) -> linkedapi-node SDK -> Linked API HTTP endpoints

Every command:

  1. Resolves auth tokens via auth-manager.ts (config file -> error)
  2. Creates SDK instance via build-client.ts
  3. Calls operation.execute(params) -> gets workflowId
  4. Polls via operation.result(workflowId) with progress on stderr
  5. Outputs result to stdout (JSON or table based on TTY)

Path Aliases

Defined in tsconfig.json, resolved at build time by tsc-alias:

  • @base-command -> src/base-command
  • @core/* -> src/core/*
  • @utils/* -> src/utils/*

All imports MUST use aliases (not relative paths) when crossing module boundaries.

Code Style

Follows the shared code style guide:

  • @../docs/CODESTYLE.md — TypeScript code style and naming conventions

Error Handling (Three Levels)

  1. Request errors (SDK throws LinkedApiError) -> non-zero exit, JSON on stderr
  2. Workflow failures (SDK throws LinkedApiError) -> exit 1, JSON on stderr
  3. Action outcomes (returned in result.errors) -> exit 0, {success: false} on stdout

Exit codes: 0=success, 1=general, 2=auth, 3=subscription, 4=account, 5=validation, 6=rate-limit, 7=network, 8=timeout

Key Files

File Purpose
src/base-command.ts Abstract base for all commands (global flags, auth, error handling)
src/core/auth/auth-manager.ts Token resolution: config file -> error, supports --account override
src/core/auth/config-store.ts Multi-account config at ~/.config/linkedin-cli/config.json
src/core/client/build-client.ts Build LinkedApi instance
src/core/errors/exit-codes.ts Semantic exit codes
src/core/errors/error-handler.ts Map SDK errors -> exit codes + messages
src/core/output/formatter.ts JSON/table output with response envelope
src/core/output/field-selector.ts --fields filtering
src/core/workflow/workflow-runner.ts execute + poll with stderr progress
src/commands/message/get.ts Sync-then-poll pattern for conversations

Read the full file on GitHub · 72 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 72 lines · 732 tokens per session scan A 7b18eff6e9d4

Subscribe to this mod's changes

linkedin-cli CLAUDE.md is an instructions file published in the GitHub repository Linked-API/linkedin-cli (59 stars, last pushed 7d ago), licensed MIT. It adds 732 tokens to every session, about $0.0037 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.