How to create themes for ghost cms using vibe coding tools?
In 2025, "vibe coding"—the practice of using AI agents and natural language prompts to build software—is the fastest way to develop custom Ghost CMS themes. By using agentic IDEs like Windsurf or Cursor, you can generate the required Handlebars (.hbs) files and CSS without deep manual coding. 1. Setup Your Vibe Coding Environment To "vibe code" effectively, your AI needs to see your files in real-time.
- Download an Agentic IDE: Use Windsurf (with its "Cascade" agent) or Cursor (using "Composer" mode). These tools can edit multiple files simultaneously based on one prompt.
- Install Ghost Locally: Run
npm install ghost-cli -gand thenghost install localin a fresh directory so you can preview changes as the AI makes them. - Initialize a Starter: Instead of starting from zero, clone the Ghost Starter Theme into your
/content/themes/folder. This gives the AI a "vibe" to follow.
2. Prompting the Theme into ExistenceSwitch your IDE to "Agent" or "Composer" mode and use "vibe" prompts that describe your desired aesthetic and functionality.
To add specific features:
"Add a dark/light mode toggle to the header. Store the user's preference in localStorage and ensure it maps to Casper's native .dark-mode classes so it doesn't flicker on load."
To build the post loop:
"Edit index.hbs to display posts in a 3-column masonry grid. Add a 'Reading Time' helper to each post card and make the featured image have a hover zoom effect."To create the layout:
"Create a minimal, brutalist Ghost theme layout in default.hbs. Use Tailwind CSS for styling. Ensure it includes a sticky navigation bar and a custom footer with my social links."3. Key Files the AI Must HandleGhost themes require specific files to function. Ensure your AI agent creates or modifies these:
package.json: This is the "brain." It must include the theme name, version, and any custom configuration settings you want to appear in the Ghost Admin.default.hbs: The main wrapper for all pages.index.hbs: The homepage template that usually contains the{{#foreach posts}}loop.post.hbs: The template for individual articles.
4. Safety and ValidationVibe coding can occasionally produce "hallucinated" syntax that Ghost doesn't recognize.
- Use GScan: Ghost provides an official validator tool. Ask your AI to run
zip -r theme.zip .and then check it against GScan to ensure all Handlebars helpers are valid. - Iterative Refinement: If a layout looks "off," don't fix the code manually. Highlight the code in your IDE and prompt: "This looks too crowded on mobile. Refactor the CSS to add more whitespace and use a larger font size for headings on screens under 768px".
Recommended 2025 AI Workflow
- Cursor/Windsurf + Tailwind CSS: Most "vibe" developers use Tailwind because AI is highly proficient at generating utility classes compared to raw CSS.
- MCP (Model Context Protocol): If using Windsurf, enable MCP to allow the AI to directly interact with your local Ghost terminal to restart the server or run build scripts automatically.