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
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/automate-before-manual.mdcCursor rule
- .cursor/rules/finish-task-dev-server.mdcCursor rule
- brainstormingSkill
- caveman-commitSkill
- find-skillsSkill
- semantic-versionSkill
- systematic-debuggingSkill
- verification-before-completionSkill
- writing-plansSkill
- ask-before-architectureSkill
- automate-before-manualSkill
- caveman-commitSkill
- diagrams-mermaidSkill
- dont-be-lazySkill
- dont-forgetSkill
- find-jobSkill
- finish-with-dev-serverSkill
- google-calendar-mcpSkill
- init-fmzSkill
- project-initSkill
- recapSkill
- semantic-versionSkill
- skills-sh-maintainerSkill
- ui-change-e2eSkill
- validate-before-shareSkill
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
- Very specific: line 52
Kill stray Chrome: if chrome:debug reports processes still running (Stop-Process -Name chrome -Force when user approves).
- Very specific: line 59
Verify: curl http://127.0.0.1:9222/json/version → HTTP 200 JSON.
- Very specific: line 66
Verify active account: before posting — getByRole('link', { name: /^Perfil$|^Profile$/i }) → href must match target @username.
- Distinctive: line 67
If wrong account: user switches via Instagram Switch accounts.
- Very specific: line 84
Verify: profile a[href*="/p/"] count > 0
- Very specific: line 94
Prefer .jpg in the publish script when both exist.
- Very specific: line 99
Never commit secrets or .chrome-cdp-profile/.
- Distinctive: line 109
When adding to a new repo, copy patterns from reference/project-integration.md.
≈ “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.
Files
Instagram — publish via Chrome + Playwright
Automate single-image Instagram posts for a Business/Creator account using real Chrome and Playwright connectOverCDP.
Do not use
| Approach | Why |
| Cursor IDE browser MCP | DOM.setFileInputFiles blocked; paste/upload unreliable |
| Playwright isolated profile without CDP | Triggers captcha / “suspicious login” more often |
--remote-debugging-port on default Chrome User Data | Ignored on Chrome 136+ — port never opens |
| Automated password login | Captcha / 2FA — user logs in manually once |
| PNG in create-post file input | Input 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 → ShareSession persists in .chrome-cdp-profile (gitignore it).
Workflow (agent)
1. Prerequisites in consumer project
@playwright/testinstalled (orplaywrightwith chromium)- Scripts under
scripts/— see reference/project-integration.md package.jsonscripts: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
- Kill stray Chrome if
chrome:debugreports processes still running (Stop-Process -Name chrome -Forcewhen user approves). From project root:
npm run chrome:debug- 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:chromeScript must:
connectOverCDP→ find or openinstagram.comtabensureInstagramAccount(expectedUsername)— fail fast if mismatch- Go to
/create/select/or clicka[href*="/create/"] input[type="file"]—waitFor({ state: 'attached' })thensetInputFiles(hidden input is OK)- Click Next / Avançar until caption field visible (loop, max ~5)
- Fill caption (PT or EN selectors:
legenda,caption,role=textbox) - Share / Compartilhar
- 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 userdont-be-lazy— user said “you do it”; still use Chrome CDP, not Cursor MCP upload hacksvalidate-before-share— confirm post on profile URL before reporting success
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
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.

