| name | hn-submit |
| description | Submits a URL to Hacker News (news.ycombinator.com) using Playwright MCP browser automation. Trigger when the user says anything like "post to HN", "submit to Hacker News", "share on HN", "submit this to hackernews", "post this article to HN", or any similar intent to share a URL or article on Hacker News. Do NOT trigger for general HN browsing or reading tasks. |
HN Submit
Automates posting content to Hacker News using Playwright MCP browser tools.
Prerequisites
This skill requires the Playwright MCP server to be installed and configured.
Install browsers:
npx playwright install
Add to your Codex MCP config:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
See https://github.com/microsoft/playwright-mcp for full setup instructions.
Credentials Setup
Credentials come from environment variables. Before using this skill, ensure these are set:
HN_USERNAME — Hacker News username
HN_PASSWORD — Hacker News password
One-time setup:
- Create a
.socials file in the project root (add it to .gitignore)
- Add:
HN_USERNAME=your_hn_username
HN_PASSWORD=your_hn_password
- Or export them in your shell:
export HN_USERNAME=... HN_PASSWORD=...
If the env vars are not set, ask the user for their HN credentials before proceeding. Do NOT hardcode credentials anywhere.
Inputs
You need two things from the user:
- Title — the submission title
- URL — the full public URL to submit
If either is unclear, ask the user before proceeding.
Workflow
Step 1: Read credentials
Read HN_USERNAME and HN_PASSWORD from environment:
echo $HN_USERNAME
echo $HN_PASSWORD
If blank, check for a .socials file:
grep -E "^HN_(USERNAME|PASSWORD)=" .socials 2>/dev/null
If still not found, ask the user to provide them.
Step 2: Log in to Hacker News
- Navigate to
https://news.ycombinator.com/login
- Take a snapshot to confirm the login form is present
- Fill in the
acct field with the username
- Fill in the
pw field with the password
- Click the login button (
<input type="submit" value="login">)
- Take a snapshot to verify login succeeded — the username should appear in the top nav bar. If login failed, stop and tell the user.
Step 3: Submit
- Navigate to
https://news.ycombinator.com/submit
- Take a snapshot to confirm the submit form is present
- Fill in the
title field with the submission title
- Fill in the
url field with the URL (leave text blank — per HN guidelines, text is optional when a URL is provided)
- Click the submit button
- Take a snapshot to verify submission succeeded
Step 4: Confirm and report
After submission, tell the user:
- Whether it succeeded or failed
- The submission thread URL if visible (HN usually redirects to the post thread)
- Any error messages if it failed
Error Handling
- Already submitted: HN will say "You have already submitted this link." — report this and provide the existing thread URL if shown.
- Rate limited: HN may say you're submitting too fast. Tell the user to wait a few minutes.
- Login failure: Stop immediately, report the error, ask the user to verify credentials.
- Form not found: Take a screenshot and report what the page shows instead.
Important Notes
- HN has a rate limit — don't submit the same URL twice.
- Leave the
text field blank when posting a URL (per HN norms).
- Titles should match the actual article title; avoid editorializing per HN community guidelines.
- After submitting, the post may not appear on the front page immediately — that's normal, ranking is based on votes and time.