Skip to main content

Command Palette

Search for a command to run...

Prompt #1: Turn Your AI Agent into Your Hashnode Publishing Assistant

One prompt that lets an LLM read, draft, and publish on your Hashnode blog - token stays safe in an env var.

Updated
โ€ข4 min readโ€ขView as Markdown
J

A Software Product Engineer, Cloud enthusiast | Blogger | DevOps | SRE | Python Developer. I usually automate my day-to-day stuff and Blog my experience on challenging items.

Hello All,

Have you noticed how we consume tech content these days? Nobody reads a 10-minute blog post anymore โ€” we paste a prompt into Claude or ChatGPT and say "do this for me." ๐Ÿค–

So I'm trying something new on this blog. Welcome to the Prompts series โ€” instead of long walkthroughs, each post here gives you one battle-tested prompt you can copy, paste into your AI assistant, and get the job done.

And this first one is a bit meta: the prompt below is the exact one I used to build this very series. My AI agent read my blog, verified my API access, created the draft, and published it โ€” all through the Hashnode GraphQL API. I didn't open the dashboard once. It was a beautiful thing to see!

Sounds interesting? Let's dive in.


What Does This Prompt Do?

It turns any LLM agent that can run curl โ€” Claude Code, Cursor, Cline, you name it โ€” into your personal Hashnode blog assistant. Once loaded, it can:

  • List all your posts with views and stats

  • Create drafts and publish posts into a series

  • Update existing posts (fix that typo without leaving the terminal!)

  • Do all of this safely โ€” your token stays in an environment variable, never in the chat

The key idea: your PAT (Personal Access Token) is a password. The prompt explicitly tells the LLM to never ask for it, never print it, and never write it to a file.


When Would You Use This?

  • You publish on Hashnode and live in the terminal like me

  • You want to automate your publishing workflow

  • You want quick answers like "which of my posts has the most views?" or "which posts are missing tags?" without clicking through the dashboard


The Setup is Super Simple

  1. Grab a Personal Access Token: Hashnode dashboard โ†’ Account Settings โ†’ Developer โ†’ Generate token.

  2. Export it where your agent's shell can actually see it โ€” add it to your shell profile:

    echo 'export HASHNODE_PAT=<your-token>' >> ~/.zshrc
    

That's it. Now hand your AI assistant the prompt below.


The Prompt ๐Ÿ“‹

You are my Hashnode blog assistant. Talk to the Hashnode GraphQL API directly with curl.

Endpoint: POST https://gql-beta.hashnode.com
Body format: {"query": "...", "variables": {...}}

Auth: my Personal Access Token is in the HASHNODE_PAT environment variable.
Send it as the header "Authorization: Bearer $HASHNODE_PAT", always
shell-interpolated. Never ask me to paste the token, never print or echo it,
and never write it into a file.

Rules:
- Public reads (post, feed, user, tag) need no token. `me`, drafts, and every
  mutation require it.
- Pagination is cursor-based: read pageInfo.endCursor and hasNextPage, pass
  endCursor as the next "after". Page size caps at 100 (drafts: 50).
- Tags are referenced by slug, max 15 per post.
- Introspection is enabled โ€” if you're unsure about a field name, introspect
  the schema instead of guessing.
- If a call returns FORBIDDEN with a "Pro plan" message, stop and tell me.
  Do not retry.
- Before any mutation (publish, update, delete), show me exactly what you're
  about to change and wait for my confirmation.

Start by querying `me` to confirm auth works and find my publication id.
Then wait for my instruction โ€” for example: "list my posts with view counts",
"draft a post titled X in series Y", or "fix the typo in post Z".

The Catch (Gotchas I Hit Today)

As with any workflow, there are a few things you should be aware of before jumping in:

  • Exporting in your terminal is not enough. ๐Ÿคฆโ€โ™‚๏ธ Agent tools spawn fresh shells โ€” a variable exported in your open terminal window never reaches them. Put it in ~/.zshrc (or ~/.bashrc) so every new shell picks it up. This one cost me three tries.

  • Navbar items and series are read-only via the API. You can query them, but creating them is dashboard-only. Everything else โ€” drafts, posts, series assignment โ€” is fully scriptable.

  • Queries are cached for ~25 seconds. If you just published and a read looks stale, wait a moment before assuming something went wrong.


Key Takeaways

  • Your blog is now an API away โ€” one prompt turns any LLM agent into a publishing assistant

  • Keep the token in an env var, and let the prompt enforce the safety rules

  • Ask for confirmation before every mutation โ€” trust, but verify

Paste the prompt, say "list my posts", and enjoy never opening the dashboard again. ๐Ÿ˜‰

More prompts coming soon โ€” keep an eye on the Prompts tab in the navbar. Happy prompting!

Prompts

Part 2 of 2

Copy-paste-ready LLM prompts for DevOps and SRE work. Instead of reading a whole blog post, grab a single battle-tested prompt โ€” for Kubernetes, AWS, Terraform, CI/CD, and incident debugging โ€” and let your AI assistant do the rest. Each entry is one focused prompt: what it does, when to use it, and the prompt itself, ready to drop into Claude, ChatGPT, or your agent of choice.

Start from the beginning

Prompt #2: CloudWatch Agent Setup for a Java App Load Test - in One Prompt

Deep metrics, log shipping, and a ready dashboard before your performance test starts - plus the war story of why it matters.