Linkedin Reply Handler
by @sergebulaev
Drafts precise LinkedIn comment replies from a given comment URL, handling thread structure to post under the correct top-level comment URN.
clawhub install linkedin-reply-handlerπ About This Skill
name: linkedin-reply-handler description: Draft a reply to any existing LinkedIn comment from a URL. Use when the user wants to reply to a comment on someone else's post, reply to a reply on their own post, or follow up in a thread where the author just responded. The skill parses the commentUrn from the URL, figures out the correct parentComment target (LinkedIn flattens threads to 2 levels), drafts the reply in the user's voice, and waits for approval before posting via Publora. Keywords: linkedin reply, reply to comment, thread continuation, comment URL, parent comment URN.
LinkedIn Reply Handler
Drafts a reply to a specific LinkedIn comment. Correctly handles LinkedIn's 2-level thread flattening: if you're replying to a reply, the Publora API needs the TOP-level comment URN as parentComment, not the reply's URN.
When to use
?commentUrn=...) and says "reply to this"Input
A LinkedIn URL containing commentUrn=urn:li:comment:(activity:POST,COMMENT_ID) β either the direct comment permalink or a feed URL with the query fragment.
Output
Steps
1. Parse the URL. lib.url_parser.parse_linkedin_url returns post_urn, comment_id, comment_urn.
2. Determine thread structure. Fetch the post's comment thread (HarvestAPI if available) and locate the comment. Figure out whether it's:
- a top-level comment (parentComment = this comment's URN when replying)
- a reply to a top-level comment (parentComment = the TOP comment's URN, not this reply's URN β LinkedIn flattens)
3. Read the full context. Author post text, top-level comment text, any intermediate replies. Include the user's own prior comment if they're in the thread.
4. Draft the reply. Follow the engagement templates in references/reply-templates.md. If the counterpart asked a question, answer it directly. If they pushed back, concede then sharpen.
5. Humanizer pass. Strip em dashes, AI vocab, enforce varied sentence length.
6. Approval card. Include thread preview (who said what in last 3 turns), the draft, reaction suggestion, and the parentComment URN we'll send.
7. On approval β adapt to the active backend. Call lib.active_backend():
- publora (PUBLORA_API_KEY set) β react on the specific comment being replied to, pause 8-15s, then post reply with the correct top-level parentComment URN.
- manual (no backend configured β the default) β output the approved reply via lib.manual_mode_message(draft_text, target_url, kind="reply"). Include the parent comment URL so the user knows exactly where to paste. Do NOT attempt to post.
- diy (LINKEDIN_SKILLS_CUSTOM_POSTER set) β invoke the custom poster with draft, target URL, and parent-comment URN.
The flattening gotcha
LinkedIn only nests replies two levels deep. Visually the thread looks like:
Top comment by Alice (id: 111)
ββ Reply by Bob (id: 222) β parentComment: urn:li:comment:(activity:POST, 111)
ββ Reply by Carol (id: 333) β parentComment: STILL urn:li:comment:(activity:POST, 111)
Carol's reply doesn't nest under Bob's β it's pinned at level 2 to the same top comment. If you pass urn:li:comment:(activity:POST, 222) as parentComment, the API returns 400 on some paths or silently misplaces the reply.
Rule in this skill: always use the TOP-level comment's URN as parentComment. If you're replying to a 2nd-level reply, we walk up the tree to find the top comment.
Templates (references/reply-templates.md)
Hard rules
linkedin-thread-engagement).Example
> User: "Reply to this: https://www.linkedin.com/feed/update/urn:li:activity:7449018753880834048?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7449018753880834048%2C7449758545140453376%29" > > Skill: parses β post 7449018753880834048, comment 7449758545140453376. Fetches thread. Sees: Kevin Payne's post β Serge's comment ("moat moved to taste") β Kevin's reply ("How are you building that conviction muscle with your team?"). Drafts R1 Answer-Their-Question variant. Shows approval card. > > User: "post" > > Skill: react APPRECIATION on Kevin's reply β pause 12s β post reply with parentComment set to Serge's original comment URN (the TOP level, not Kevin's reply).
Files
SKILL.md β this filereferences/reply-templates.md β 5 reply templates with examplesreferences/threading-rules.md β LinkedIn's 2-level flattening explained with edge casesβ‘ When to Use
π‘ Examples
> User: "Reply to this: https://www.linkedin.com/feed/update/urn:li:activity:7449018753880834048?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7449018753880834048%2C7449758545140453376%29" > > Skill: parses β post 7449018753880834048, comment 7449758545140453376. Fetches thread. Sees: Kevin Payne's post β Serge's comment ("moat moved to taste") β Kevin's reply ("How are you building that conviction muscle with your team?"). Drafts R1 Answer-Their-Question variant. Shows approval card. > > User: "post" > > Skill: react APPRECIATION on Kevin's reply β pause 12s β post reply with parentComment set to Serge's original comment URN (the TOP level, not Kevin's reply).