AI for Coding: No Longer Science Fiction and How Devs Are Leveraging AI to Boost Productivity
Since ancient times, man has imagined intelligent machines that were capable of thinking. Further popularized in the annals of science fiction with AIs such as HAL 9000, Skynet, Samantha, and countless others. Mankind has long since sought after machines that help in our search for understanding in the universe.
Today, AI for coding no longer belongs solely in science fiction and has become a reality. It has the potential to upend entire industries, relegating the jobs of today as obsolete. Like any technology, it has enormous pros as well as cons. Concerns for energy consumption, government overreach, data weaponization, and technofeudalism should not, and cannot be overlooked. However, as it’s continually thrust upon us, we must make a choice as to whether we embrace it and understand its potential or fight back against its normalization.
The Top AI for Coding Tools for Web Development You Should Know
Soo, AI for coding?? I, for one, welcome our new AI overlords. Okay, okay in all seriousness, it’s an enormously pivotal moment in history, and shouldn’t be taken so lightly. However, I do see vast potential for AI for coding as a developer, integrating it into my workflow.
Using AI as a WordPress developer
Societal implications aside, using AI as a development tool seems like a prudent decision. So how can we best utilize AI? If you’ve been developing within WordPress you may be familiar with Gutenberg, and the block approach. From my own experience, writing blocks can often become tedious and repetitive, and as I’ve become more familiar with them, I’ve looked for ways to speed up my workflow.
For example, let’s say I need a block for a recipe. Rather than writing the entire block from scratch, I’ll use Google Gemini. With this simple prompt:
Can you write a React WordPress Gutenberg block that has a title, description, list of ingredients, cook time, and temperature?
Gemini generates the below code in a matter of seconds. Huzzah!
import React, { useState } from 'react';
// The following imports are conceptual for a real Gutenberg block.
// In a true WordPress plugin, these would be imported from the @wordpress packages.
// For this self-contained example, we'll implement similar functionality with
// standard React.
// import { RichText, useBlockProps } from '@wordpress/block-editor';
// import { TextControl, TextareaControl } from '@wordpress/components';
// This is a simple mock of the WordPress RichText component for the title and description.
// In a real block, you would use the actual RichText from @wordpress/block-editor
// to enable rich text editing.
const RichText = ({ tagName, value, onChange, placeholder, className }) => {
const [content, setContent] = useState(value);
const handleInput = (event) => {
setContent(event.target.innerText);
onChange(event.target.innerText);
};
return (
<div
contentEditable
suppressContentEditableWarning
onBlur={handleInput}
className={`${className} outline-none`}
data-placeholder={placeholder}
>
{value}
</div>
);
};
// This is a simple mock of the WordPress TextControl component.
const TextControl = ({ label, value, onChange, placeholder, className }) => (
<div className="flex flex-col space-y-1">
<label className="text-sm font-medium text-gray-700">{label}</label>
<input
type="text"
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={placeholder}
className={`px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 ${className}`}
/>
</div>
);
// This is a simple mock of the WordPress TextareaControl component.
const TextareaControl = ({ label, value, onChange, placeholder, className }) => (
<div className="flex flex-col space-y-1">
<label className="text-sm font-medium text-gray-700">{label}</label>
<textarea
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={placeholder}
rows="4"
className={`px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 ${className}`}
/>
</div>
);
const App = () => {
// Define state variables to hold the block's attributes.
// In a real block, these would be props passed from WordPress.
const [title, setTitle] = useState('New Recipe Title');
const [description, setDescription] = useState('A brief and delicious description of the recipe.');
const [ingredients, setIngredients] = useState(['1 cup flour', '2 large eggs']);
const [cookTime, setCookTime] = useState('30 mins');
const [temperature, setTemperature] = useState('375°F');
// Helper function to add a new ingredient.
const handleAddIngredient = () => {
setIngredients([...ingredients, '']);
};
// Helper function to update an ingredient by index.
const handleUpdateIngredient = (index, value) => {
const newIngredients = [...ingredients];
newIngredients[index] = value;
setIngredients(newIngredients);
};
// Helper function to remove an ingredient by index.
const handleRemoveIngredient = (index) => {
const newIngredients = ingredients.filter((_, i) => i !== index);
setIngredients(newIngredients);
};
// This is a simple SVG for the delete icon.
const CloseIcon = () => (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="text-red-500 hover:text-red-700 cursor-pointer transition-colors duration-200">
<path d="M18 6L6 18M6 6l12 12" />
</svg>
);
// This is a simple SVG for the add icon.
const PlusIcon = () => (
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="text-green-500 hover:text-green-700 cursor-pointer transition-colors duration-200">
<path d="M12 5v14M5 12h14" />
</svg>
);
return (
<div className="flex justify-center p-8 bg-gray-100 min-h-screen font-[Inter]">
{/* Main recipe card container with Tailwind styling */}
<div className="w-full max-w-2xl bg-white p-8 rounded-xl shadow-lg border border-gray-200">
{/* Title section */}
<div className="border-b-2 border-gray-200 pb-4 mb-4">
<RichText
tagName="h2"
value={title}
onChange={setTitle}
placeholder="Recipe Title"
className="text-4xl font-bold text-gray-800 focus:outline-none"
/>
</div>
{/* Description section */}
<div className="mb-6">
<label className="block text-sm font-medium text-gray-700 mb-1">Description</label>
<RichText
tagName="p"
value={description}
onChange={setDescription}
placeholder="Enter a description for your recipe..."
className="text-gray-600 leading-relaxed min-h-[50px] focus:outline-none"
/>
</div>
{/* Cook Time & Temperature section */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<TextControl
label="Cook Time"
value={cookTime}
onChange={setCookTime}
placeholder="e.g., 30 mins"
/>
<TextControl
label="Temperature"
value={temperature}
onChange={setTemperature}
placeholder="e.g., 375°F"
/>
</div>
{/* Ingredients section */}
<div className="mb-6">
<div className="flex justify-between items-center mb-2">
<h3 className="text-2xl font-semibold text-gray-800">Ingredients</h3>
<button
onClick={handleAddIngredient}
className="flex items-center space-x-1 text-green-600 hover:text-green-800 transition-colors duration-200 text-sm font-medium"
>
<PlusIcon />
<span>Add Ingredient</span>
</button>
</div>
<ul className="space-y-2">
{ingredients.map((ingredient, index) => (
<li key={index} className="flex items-center space-x-2">
<TextControl
value={ingredient}
onChange={(value) => handleUpdateIngredient(index, value)}
placeholder={`Ingredient ${index + 1}`}
className="flex-grow"
/>
<button
onClick={() => handleRemoveIngredient(index)}
className="p-1 rounded-full hover:bg-red-100 transition-colors duration-200"
>
<CloseIcon />
</button>
</li>
))}
</ul>
</div>
</div>
</div>
);
};
export default App;
This alone saves a massive amount of time. However – and this is why I’ll say you should have an understanding of how to code React blocks – the code is not production ready.
First and foremost, this is only the code for our edit portion of the block, and doesn’t register, or have portions for the save portion of the block. Also, it lacks any styling that you’d need to apply. Furthermore, even within the code that is generated, there are portions that will need updating. For instance, there are definitions for RichText, TextControl, and TextareaControl. In a production environment, you’d want to remove those, and simply import them, like below:
import React, { useState } from 'react';
import { RichText, useBlockProps } from '@wordpress/block-editor';
import { TextControl, TextareaControl } from '@wordpress/components';
Additionally, the App uses state rather than props for our title, description, ingredients, etc. For an actual production ready block, you’d want to use attributes so the data is actually saved. We’d want to update our App definition as follows:
const App = ({attributes, setAttributes}) => {
const { title, description, ingredients, cookTime, temperature } = attributes;
Also, Gemini has decided for you that Tailwinds CSS for styling purposes. This is great if you already use Tailwinds, but if not, you’ll need to be aware of this generated aspect. For most of my projects, I don’t use Tailwinds, however it is a great tool, so for your projects, this may not be an issue. In my case, I went in and removed the classes that Gemini generated for the html. For example, I’ll remove the classes generated in here:
<div className="mb-6">
<div className="flex justify-between items-center mb-2">
<h3 className="text-2xl font-semibold text-gray-800">Ingredients</h3>
<button
onClick={handleAddIngredient}
className="flex items-center space-x-1 text-green-600 hover:text-green-800 transition-colors duration-200 text-sm font-medium"
>
<PlusIcon />
<span>Add Ingredient</span>
</button>
</div>
<ul className="space-y-2">
{ingredients.map((ingredient, index) => (
<li key={index} className="flex items-center space-x-2">
<TextControl
value={ingredient}
onChange={(value) => handleUpdateIngredient(index, value)}
placeholder={`Ingredient ${index + 1}`}
className="flex-grow"
/>
<button
onClick={() => handleRemoveIngredient(index)}
className="p-1 rounded-full hover:bg-red-100 transition-colors duration-200"
>
<CloseIcon />
</button>
</li>
))}
</ul>
</div>
And replace with my own classes:
<div className="my-own-class">
<div className="just-an-example">
<h3>Ingredients</h3>
<button
onClick={handleAddIngredient}
>
<PlusIcon />
<span>Add Ingredient</span>
</button>
</div>
<ul className="another-example">
{ingredients.map((ingredient, index) => (
<li key={index} className="example-ingredient">
<TextControl
value={ingredient}
onChange={(value) => handleUpdateIngredient(index, value)}
placeholder={`Ingredient ${index + 1}`}
className="flex-grow"
/>
<button
onClick={() => handleRemoveIngredient(index)}
>
<CloseIcon />
</button>
</li>
))}
</ul>
</div>
Furthermore, the helper functions are defined to update the state that was initially used. We’ll need them to update our attributes. So for example, we’d update the following:
// Helper function to add a new ingredient.
const handleAddIngredient = () => {
setIngredients([...ingredients, '']);
};
// Helper function to update an ingredient by index.
const handleUpdateIngredient = (index, value) => {
const newIngredients = [...ingredients];
newIngredients[index] = value;
setIngredients(newIngredients);
};
// Helper function to remove an ingredient by index.
const handleRemoveIngredient = (index) => {
const newIngredients = ingredients.filter((_, i) => i !== index);
setIngredients(newIngredients);
};
will become:
// Helper function to add a new ingredient.
const handleAddIngredient = () => {
setAttributes({
ingredients: [...ingredients, '']
});
};
// Helper function to update an ingredient by index.
const handleUpdateIngredient = (index, value) => {
const newIngredients = [...ingredients];
newIngredients[index] = value;
setAttributes({
ingredients: newIngredients
});
};
// Helper function to remove an ingredient by index.
const handleRemoveIngredient = (index) => {
const newIngredients = ingredients.filter((_, i) => i !== index);
setAttributes({
ingredients: newIngredients
});
};
This gets the edit portion of the code much closer to production-ready. Of course, there are further things we can do to clean up the code, and get it production-ready, but overall, it’s in a good place.
The Future of a Web Developer in an AI-Driven World
As demonstrated, AI for coding can be a useful tool, and can definitely speed up your workflow. I wouldn’t recommend it to completely replace all of your coding, but it can help with ideation, and can help with some of the more repetitive tasks. However, it has some major limitations, and if you aren’t aware, it could potentially cause major headaches, and time sinks. That’s why I’d advocate for one to know the ins and outs of the coding language itself, and not just solely rely on “vibe” coding, as the kids say.
How a Full-Scale Marketing Agency Can Help You Thrive in an AI World
In a world increasingly shaped by artificial intelligence, the role of a full-scale marketing agency becomes more vital than ever. While AI tools for web development can streamline tasks and accelerate workflows, they are not a complete solution. A marketing agency provides the crucial human expertise and strategic oversight needed to transform raw AI output into a polished, professional, and effective digital presence.
A full-service agency offers much more than just code generation; it provides a holistic approach to your online strategy. We can help with everything from custom themes and plugin development to content writing and graphic design, ensuring every element works together seamlessly. The true value lies in our ability to take an AI-generated idea and make it production-ready—optimizing the code for performance and security, integrating it with your existing systems, and ensuring it aligns with your brand’s unique goals.
Relying solely on AI for coding can result in a functional website, but one that lacks the strategic depth and flawless execution needed to truly stand out. At Red Egg Marketing, we combine the efficiency of AI with our professional expertise to deliver a superior product. This collaboration saves you time and resources while guaranteeing a high-quality, custom solution that drives real results.
Professional Solutions for AI for Coding
If any of this sounds way too boring and uninteresting – wrap it up, egghead, “Am I right?” – don’t worry, we’ve got you covered. Here at Red Egg Marketing, we can help with all your WordPress development needs. We offer custom themes, plugin development, content writing, graphic design, and more. Feel free to contact us today.