agentleFS
farukzahrafarukzahra/agent-skills/skills/instagram-chrome-post/SKILL.md

instagram-chrome-post

Skill0 starsChanged 2 months agoMITView on GitHub

Publish Instagram posts via real Chrome + Playwright CDP (not Cursor browser MCP). Use when automating Instagram create-post, launch posts, or social publishing on Windows; handles Chrome 136+ debug profile, manual login, account verification, and JPEG upload.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Kill stray Chrome: if chrome:debug reports processes still running (Stop-Process -Name chrome -Force when user approves).

    line 52
  2. Very specific:

    Verify: curl http://127.0.0.1:9222/json/version → HTTP 200 JSON.

    line 59
  3. Very specific:

    Verify active account: before posting — getByRole('link', { name: /^Perfil$|^Profile$/i }) → href must match target @username.

    line 66
  4. Distinctive:

    If wrong account: user switches via Instagram Switch accounts.

    line 67
  5. Very specific:

    Verify: profile a[href*="/p/"] count > 0

    line 84
  6. Very specific:

    Prefer .jpg in the publish script when both exist.

    line 94
  7. Very specific:

    Never commit secrets or .chrome-cdp-profile/.

    line 99
  8. Distinctive:

    When adding to a new repo, copy patterns from reference/project-integration.md.

    line 109

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Instagram — publish via Chrome + Playwright

Automate single-image Instagram posts for a Business/Creator account using real Chrome and Playwright connectOverCDP.

Do not use

ApproachWhy
Cursor IDE browser MCPDOM.setFileInputFiles blocked; paste/upload unreliable
Playwright isolated profile without CDPTriggers captcha / “suspicious login” more often
--remote-debugging-port on default Chrome User DataIgnored on Chrome 136+ — port never opens
Automated password loginCaptcha / 2FA — user logs in manually once
PNG in create-post file inputInput often accept="image/jpeg" — convert to .jpg

Preferred long-term path

Instagram Graph API (container + publish) when recurring automation is needed — no browser, no captcha. Browser flow below is for one-off / until API is wired.

Architecture

chrome.exe  --remote-debugging-port=9222  --user-data-dir=<project>/.chrome-cdp-profile
     ↑
Playwright chromium.connectOverCDP('http://127.0.0.1:9222')
     ↑
setInputFiles(image.jpg) → Next → caption → Share

Session persists in .chrome-cdp-profile (gitignore it).

Workflow (agent)

1. Prerequisites in consumer project

  • @playwright/test installed (or playwright with chromium)
  • Scripts under scripts/ — see reference/project-integration.md
  • package.json scripts: chrome:debug, instagram:post:chrome
  • Marketing copy / image paths owned by the project (e.g. docs/instagram/, social-copy.ts)

2. Start Chrome with CDP

  1. Kill stray Chrome if chrome:debug reports processes still running (Stop-Process -Name chrome -Force when user approves).
  2. From project root:

    npm run chrome:debug
  3. Verify: curl http://127.0.0.1:9222/json/version → HTTP 200 JSON.

Uses non-default --user-data-dir (required since Chrome 136). Template: reference/chrome-debug-start.ps1.

3. Login (manual, once per profile)

  • User logs in on the opened Chrome window (captcha / 2FA OK).
  • Verify active account before posting — getByRole('link', { name: /^Perfil$|^Profile$/i }) → href must match target @username.
  • If wrong account: user switches via Instagram Switch accounts; never post to the wrong profile.

4. Publish

npm run instagram:post:chrome

Script must:

  1. connectOverCDP → find or open instagram.com tab
  2. ensureInstagramAccount(expectedUsername) — fail fast if mismatch
  3. Go to /create/select/ or click a[href*="/create/"]
  4. input[type="file"] — waitFor({ state: 'attached' }) then setInputFiles (hidden input is OK)
  5. Click Next / Avançar until caption field visible (loop, max ~5)
  6. Fill caption (PT or EN selectors: legenda, caption, role=textbox)
  7. Share / Compartilhar
  8. Verify: profile a[href*="/p/"] count > 0

5. Image format

Convert PNG → JPEG before post if needed:

python -c "from PIL import Image; Image.open('post.png').convert('RGB').save('post.jpg', quality=95)"

Prefer .jpg in the publish script when both exist.

Secrets

  • Optional login hints in ../secrets/instagram/<project>-login.env — never auto-submit password in browser automation.
  • Never commit secrets or .chrome-cdp-profile/.

Troubleshooting

See reference/troubleshooting.md.

Consumer project reference

First implementation: Numinoso (sessao-gravador) — scripts/instagram-post-cdp.ts, scripts/lib/instagram-*.ts, npm run instagram:post:chrome.

When adding to a new repo, copy patterns from reference/project-integration.md; keep captions/images in project-specific modules.

Related skills

  • automate-before-manual — try scripts/PAT before asking user
  • dont-be-lazy — user said “you do it”; still use Chrome CDP, not Cursor MCP upload hacks
  • validate-before-share — confirm post on profile URL before reporting success

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.