LinkedIn

user-posts

linkedin.com
InstallationInstalls just this skill for your agent
Side effectread
Authsession
Needsnavigate · evaluate
Summary

Fetch a LinkedIn person's recent posts (activity) given their slug (vanityName, e.g. 'gastonfrancois').

Params
{"slug":"string (the vanityName, i.e. the <slug> in linkedin.com/in/<slug>)","count":"int optional (default 10, max 100)"}
Returns
{"slug":"string","profileUrn":"string","count":"int","posts":"array of { text, urn, shareUrn, url, reactions:int, comments:int, reposts:int, time, isRepost:bool, author, authorSlug, header }"}
SKILL.md58 lines

linkedin-user-posts

Fetches a person's recent posts from their slug, chains straight off linkedin-search-people or linkedin-get-profile. Resolves in a single bridge call: the slug drives the fetch (identity/dash/profilesidentity/profileUpdatesV2), so it works from any page and never touches the DOM.

The extractor lives as text in the site's localStorage (key linkedin-user-posts) and is rebuilt on each call with synchronous eval. It is stored once and then persists across navigation and browser restarts, so on every run except the first it is already there.

Two assertions guard the result (v2). The lookup must return the slug that was asked for, and the posts must not all be authored by someone else, otherwise the call throws tool-broken instead of returning another person's posts. In v1 this skill was a DOM scraper that echoed the slug back while returning whatever the current page showed; those guards are what make the slug meaningful.

Default action: just call (step 1). The call itself reports NEEDS_STORE when the extractor is missing or out of date, only then do you store it (step 2) and call again.

Versioning. The stored extractor is gated by VER (must match the version in the frontmatter above). Both snippets carry VER = "2", keep them in sync with the frontmatter. When evaluate.js changes, bump version and VER in both snippets: the next call sees the mismatch, returns NEEDS_STORE, and re-stores automatically. Storage stays at two keys (linkedin-user-posts and linkedin-user-posts:ver), overwritten each store, versions never accumulate.

1. Call (do this every run, params only, single bridge call)

await (() => {
  const KEY = "linkedin-user-posts", VER = "2";
  const s = localStorage.getItem(KEY);
  if (!s || localStorage.getItem(KEY + ":ver") !== VER) return 'NEEDS_STORE';
  const fn = eval('(' + s + ')');
  return fn(document, { slug: "gastonfrancois", count: 10 });
})()

Returns the person's recent posts. If it returns the string 'NEEDS_STORE', the extractor is missing or stale in this browser → do step 2 once, then run this exact call again.

Run this snippet verbatim. Never add an await before the eval, only the outer await is allowed; a pre-eval await trips LinkedIn's CSP and the call fails.

2. Store (only when step 1 returned NEEDS_STORE; persists until localStorage is cleared)

While logged in at https://www.linkedin.com/feed/ (the JSESSIONID cookie must be present), evaluate the following with the bridge, replacing <FN> with the contents of evaluate.js (the ( async (root, params) => { ... } ) function). Keep VER equal to the call snippet's:

(() => {
  const KEY = "linkedin-user-posts", VER = "2";
  const fn = (<FN>);
  localStorage.setItem(KEY, String(fn));
  localStorage.setItem(KEY + ":ver", VER);
  return 'stored';
})()

Returns "stored". The extractor passes through the model only here, once. Then go back to step 1.

Errors

  • NEEDS_STORE → extractor missing or version-mismatched in this browser; run step 2 once, then retry step 1.
  • Empty posts with a live session → the person genuinely has no visible activity.
  • no-such-profile → the slug does not resolve to a profile.
  • tool-broken: asked for "X" but ... → the lookup answered about someone else; do NOT trust the payload, recapture the extractor.
  • re-auth / no JSESSIONID → no LinkedIn session in this browser; log in once.
  • tool-broken → LinkedIn changed the API shape; recapture the extractor.

Success assertion

{ "type": "json", "jsonPath": "count" }
user-posts: a LinkedIn skill for AI browsing agents · browser-memory