Skip to content

Generating Themes Blocks using AI

Tile Image

Generating Themes Blocks using AI

Blake Anderson's avatar
Blake Anderson(Arc XP)May 29, 2025

A practical guide to using AI-enabled IDEs to generate production-ready Arc XP features

AI
Themes
Blocks
Copilot

Modern AI coding tools already know how to read your repo, spot patterns, and clone them at warp speed. You can create production-ready Themes blocks with a single request if you have these three things:

  1. A tool (Cursor with GPT-4 or GitHub Copilot)
  2. A corpus (your existing block code)
  3. A clear prompt

This blog will walk through that minimal recipe—no fine-tuning, complex configuration or no custom embeddings, no secret config files. Just your IDE, Out-of-the-box Themes block code, and a well-crafted prompt. By the end, you’ll spin up new blocks (or layouts, content sources, chains, output types) with ease.

Before getting started, there are a few prerequisites that are necessary to follow along:

1. The Tool

In order to utilize AI models with Themes blocks, you must have access to an IDE that can read your local code. AI Chat tools such as ChatGPT have access to developer docs and are capable of generating quality code, but without having the context of Themes blocks code these tools are unable to effectively generate Arc features.

There are several IDEs that you can use to achieve similar results, such as Cursor AI and Windsurf, but in this blog, I will focus on using GitHub Copilot. For other IDEs, the process is similar but the specifc commands and file configurations may vary slightly.

For the model, I recommend using OpenAI’s ChatGPT (GPT-4 series) instead of Anthropic’s Claude, since ChatGPT has already ingested and indexed our Arc XP developer documentation, giving it deeper, first-party context for more accurate answers.

2. The Corpus

Arc features are designed for optimal performance, front-end customization, and usability within Pagebuilder. But understanding how these Arc-specific pieces of code, from custom hooks to Arc Themes components, come together to create features that work in Pagebuilder can be complicated. The good news? With Arc XP Themes blocks, there are already 77 blocks that incorporate the latest pieces of Arc Functionality. These include layouts, chains, blocks, content sources, and more. Add the Themes Blocks folder to your bundle and your IDE will have enough working examples to generate new features with the required Arc functionality.

To add the blocks to your bundle, you can simply run the following command: npx degit WPMedia/arc-themes-blocks/blocks#arc-themes-release-version-3.0.0 blocks or you can clone the blocks repo, and copy the blocks folder into your local bundle.

Lastly, you just need to make sure your IDE includes this /blocks folder in the context for your request. In Copilot Chat, type #folder:blocks (or use Attach → Folder and pick /blocks) so the assistant pulls the entire folder into its retrieval window before generating code.

3. The Prompt

The code that is generated by the model is only as good as the prompt it is given. For this reason, an understanding of the different types of Arc features is required.

A few tips to make your prompt as effective as possible:

  • Name the new block - makes folder paths obvious
  • Make it clear what type of block you’re looking for - “create a new content source, layout, etc.”
  • Call out an existing block as a reference - “model it after card-list-block”. This will help Copilot prioritize the most relevant code.
  • For front end blocks, explicitly call out how you would like the block to be styled

The Results

To test the viability of using Copilot to generate Arc features, I tested a variety of different block types. Specifically, I tested with blocks, layouts, and content sources in order to get a well rounded view of how well the model can generate code for Arc features. Below are the results of each test, including the prompt used, the resulting code, and any comments on the generated code.

Blocks

Prompt

Create a new block in the blocks folder that displays 3 stories side by side, numbered 1-3, using roman numerals. The block should have the numeral, with the image from the story, the headline (linked to the story), the subheadline, and the author’s name all included beneath the numeral. Create toggles for each of these elements, using the medium-promo-block as an example.

Resulting Code

AI Generated Content Block

Comments

The generated block included all of the functionality specified in the prompt and worked correctly. The styles would need some tweaks since the roman numerals were very small, but the implementation of the styles correctly followed the Themes styling format so this would be an easy change.

Layouts

Prompt

Using the the right-rail-block as an example, generate a new layout block with a label “Multiple Section Layout”, and the following sections in order:

  • navigation: which extends the full width

  • header: which extends the full width

  • triple-column: which has 3 columns of equal width

  • left rail: with the same styles as the right rail, but flipped

  • main: with the same styles as the right rail block

  • footer: which extends the full width.

Make sure the layout is responsive and uses the Themes folder for styling

Follow the same file structure as the right-rail-layout-block. It should have a Themes folder with a news.json file that contains the styles

Resulting Code

AI Generated Layout

Comments

Despite the fact that layouts are conceptually simple, the fact that there are only 3 Themes layout blocks and they include some Arc-specific syntax, I had to refine my prompt with more specific instructions to get the resulting layout to function correctly, and to get the model to structure the files in the correct structure.

Content Sources

Prompt

Create a content source that allows a user to specify both a section and an author

Resulting Code

AI Generated Content Source

Comments

Despite having an extremely simple prompt, the generated content source worked exactly as expected. There are 11 example content sources, all of which have the same basic elements and structure, which allows the AI models to do a great job generating the code.

Optimize Results with Custom Instructions

The prompts listed above were run with no additional setup, but there were a few pitfalls that I encountered during testing. For example, the model would sometimes generate the wrong kind of block (i.e. a front-end block instead of a content source), or it would generate the code with the wrong file structure. Thankfully, GitHub Copilot has a feature called Custom Instructions that allows you to specify how you want the model to behave. This is a great way to improve the quality of the generated code and tailor the output to your organization.

Below is a basic instruction file to provide more clear instructions for the model, to help avoid common mistakes. To add the instructions file, simply create a new copilot-instructions.md file in the .github folder at the root of your repository (.github/copilot-instructions.md), and paste in the code below. This file can also be modified to include specific style guidelines, naming conventions and Architectural rules for your organization that you’d like for Copilot to consider when generating code.

Once the file is added and committed, GitHub Copilot will reference it during code generation and chat, as long as the feature is enabled. In VS Code, make sure it’s turned on by adding the following setting to your settings.json:

"github.copilot.chat.codeGeneration.useInstructionFiles": true

To confirm it’s working, open Copilot Chat, run a prompt, and expand the “References” section. You should see your .copilot-instructions.md file listed there.

Copilot Instructions

Give it a try and don’t be afraid to play around. The more you refine your prompts and update your instructions file, the better your results will get. Whether you ‘re building a new layout, content source, or display block, Copilot and Themes Blocks can take you a long way with just a little guidance.