/_astro/cto4ai.D847-Qm2.png

Claude Code Deep Dive: Hugo to Astro+Beehiiv in 9 Days

Migrating from Hugo to Astro/Beehiiv with Claude Code doing ~87% of the work

JACK IVERS ESSAY 11 MIN READ

This wasn’t my first Claude Code deep dive, but it was definitely the deepest—something that became obvious as I upgraded from pay-per-token Anthropic API use to Claude Max $100 and finally to Max $200 after seeing $10 Anthropic credit reload emails rolling in two, three, or even four times a day during the early stage of the project.

Claude Code interface showing migration work

Why?

The project really wasn’t about Hugo => Astro at all. Rather, it was about splitting out my fairly substantial, mostly-AI-themed blog from its home as a branch of my corporate site (craftycto.com/blog), to an all-new domain (cto4.ai), while at the same time setting up full-strength email newsletter capabilities.

The new cto4.ai website homepage

Why leave Hugo, which has served me well since 2022? The Hugo project made a breaking change sometime in 2024, during a multi-month lull in my writing; when I came back to restart publishing, I figured I’d upgrade to latest Hugo version, and kaboom—the build was broken. Even with LLM help and quite a few hours of research, no joy; so I downgraded to the last release before the breaking change and got things running. But I definitely lost some of my love for Hugo in the process.

Hugo static site generator website

Achieving an all new look on the new standalone blog would mean choosing a new Hugo theme, and then migrating all my content, plus my theme-specific customizations in the form of Hugo shortcodes and templates written with Golang templating, to the new theme. On top of the unresolved breaking change, this meant I faced a rather unpleasant chunk of Hugo work.

I had been keeping tabs on other static site generators, with Astro getting a lot of buzz as best/most modern, and I realized it might not be that much more work to build the new site on Astro …

Astro static site generator website

AI Coding Courage

As Simon Willison and others have pointed out, having a great language model backing you up takes a lot of the fear out of tackling a challenging project, he said that when his AI coding tools were maybe 1/10th as powerful as they are today. There’s no way I would have taken on this project at all, let alone switched platforms in the process, without an AI as co-conspirator.

The results justified my confidence that the AI would help, a lot … Claude Code was responsible for ~86.7% of commits during the project. The numbers we were able to gather, mainly via git commit logs, indicated that Claude’s percentage of the lines of code+content was lower, at 63%. My guess is that, of the real code written (versus content work), Claude did much closer to 100% of the work. I didn’t vibe code the project, in that I was paying close attention to what Claude Code was up to, often redirecting it, and sometimes initiating major refactoring. But I didn’t actually write much code myself. Why should I, when I could turn Claude loose and its code is almost certainly have been better than what I would have written, especially with minimal knowledge of Astro and limited TypeScript chops. Architecturally, I gave a lot of help and redirection, but at the code level, very little.

Beyond Coding: Research and Architectural Discussions

Probably 25% of my interactions with Claude involved sending it off to do some research for me—often along the lines of “What’s the Astro best practice to do X? Research it! Web search!” Claude’s really good at that (I assume Opus 4.1 is getting called on a lot), and when it had results, we’d talk through them and I’d provide additional context or poke holes in bad ideas. Every single one of these situations would have been painful without my AI colleague: it would have been Jack doing painstaking research, followed by Jack agonizing and second-guessing himself. It is so much more effective, and so much more enjoyable, to work alongside a well-read, very smart AI pair.

Content Migration Grunt Work

Claude is tireless, and that’s pretty great on not-fun tasks like migrating Hugo-flavored Markdown to Astro’s Markdown + JSX (.mdx) format. With the quantity of content I was migrating, about 100 posts or so, Migrating content often found Claude on the boundary of “should I write a Python script for this?” versus “I’ll just do this myself,” which was an interesting model-decision-making process to see happen. Claude was also often at the boundary of being able to hold to all the threads in its mind (context)—indeed, one of my main jobs was guiding Claude back onto the path when it lost its way. The dreaded “0% context left until auto-compact” always seems to come at a bad time, and Claude Code is especially prone to losing its way post-compact. Not a perfect tool, yet.

AstroWind theme components and features

Setting Up the Infrastructure

Another normally-excruciating task on a project like this is setting up complex parts of the infrastructure, along with diagnosing related glitches. In my case, this involved Cloudflare DNS, Pages, Functions, and Scrape Shield configs. Each one of those might have mean hours of digging, left to my own devices, but I rarely got sidetracked for more that a few minutes with the model’s help. Beehiiv and email-specific DNS settings and DMARC config were another cluster of potential pain, avoided with Claude’s assistance.

Beehiiv newsletter platform dashboard

Anyway: you get the idea. This was a meaty piece of work, and I was doing it my spare hours around my fractional CTO day job. But 9 days after the repo came into being, cto4.ai launched, not just blog- but also newsletter-ready.

Claude’s Also Good At Reports

I had Claude sift through various data sources, most importantly git logs, but also research we had done together earlier, such as comparing Astro vs Hugo site performance over a representative set of pages. (I always have Claude Code create a Markdown file in the /docs directory for any substantial research it does for me.) And then I had it build the report below, complete with statistics, analyses, executive summaries—the whole works.

Aside from the report below, this entire piece is written by Jack. But I will quote one phrase from the rough draft that Claude wrote for me, unasked:

What started as a typical web migration quickly evolved into something far more interesting—a case study in effective human-AI collaboration.

Cheers!

📊 CraftyCTO.com/blog to cto4.AI Migration Report

📋 Executive Summary

This report documents the migration of the CraftyCTO blog from a Hugo-based corporate site to a standalone Astro-powered blog at cto4.ai. The migration began in August 2025 and represents a strategic separation of blog content from corporate presence.

The migration was accomplished through an AI-assisted development approach, with Claude Code handling 86.7% of commits and 90.6% of the actual code/content additions, while human guidance provided strategic direction through brief, iterative commits (13.3% of commits, 9.4% of additions). This partnership enabled rapid feature development and modernization in a compressed timeframe.

📅 Repository Timeline

CTO4.AI Blog Repository

  • Repository Created: August 17, 2025
  • Total Project Commits: 173 (excluding AstroWind template history)
  • cto4.ai Live: August 25, 2025

CraftyCTO Repository

  • Created: April 14, 2022
  • First Commit: “Set up new blog” by Jack Ivers
  • Migration Planning Started: August 14, 2025
🔧 Technology Stack Comparison
AspectCraftyCTO (Original)CTO4.AI (New)
FrameworkHugoAstro v5.13
Content FormatMarkdownMDX with Content Collections
StylingTailwind and Custom CSSTailwind CSS v3.4
SearchPagefindPagefind
Build ToolHugoVite
ThemeCustomAstroWind (heavily modified)
DeploymentCloudflare PagesCloudflare Pages
📈 Migration Phases

Phase 1: Planning & Setup (August 14-16, 2025)

Key commits from CraftyCTO repo:

  • 839e57da - Add Claude Code documentation and multi-repo migration plan
  • 01df3f77 - Update migration docs with cto4.ai domain and AstroWind theme
  • 595f99f5 - Add critical migration directive to preserve Hugo blog operation
  • 75fe949f - Document final logo selection and usage guidelines

Phase 2: Content Migration (August 19-21, 2025)

Notable activity:

  • Multiple posts migrated with scaffolding for social media content
  • Image asset reorganization from Hugo’s structure to Astro’s
  • Creation of unified content structure (/src/data/content/[slug]/)

Phase 3: Feature Implementation (August 22-25, 2025)

Key developments:

  • Newsletter integration with Beehiiv platform
  • Attio CRM integration for subscriber management
  • Search functionality with Pagefind
  • Social media Open Graph optimization
  • Cloudflare Functions for API endpoints

Phase 4: Refinement (August 26, 2025)

Recent improvements:

  • Text sizing optimization for large screens (Claude Code assisted)
  • Newsletter modal timing adjustments
  • Cursor rules documentation updates
  • 301 redirects from craftycto.com/blog (already implemented)
🤖 Claude Code Contributions

Authorship Analysis

Based on commit message patterns for YOUR actual migration work (excluding AstroWind template):

  • Total Your Migration Commits: 173
  • Claude Code Authored: 150 commits (86.7%)
  • Human Authored: 23 commits (13.3%)

Identifying Authorship Patterns

Jack’s Commit Style (Human)

  • Message length: 1-20 characters
  • Examples: “y”, “reorg”, “rules”, “ng wip”, “linking”, “ng live”, “footer fixes”
  • Pattern: Minimal descriptions, often single words or brief phrases

Claude Code’s Commit Style

  • Message length: 30+ characters
  • Examples:
    • “Fix newsletter modal form submission”
    • “Add Attio CRM integration for newsletter subscribers”
    • “Implement redirect from /blog to /archive”
    • “Update OG image with correct tagline and branding”
  • Pattern: Detailed technical descriptions with proper capitalization and clear explanations

Notable Claude Code Contributions

  • Newsletter integration with Beehiiv
  • CRM integration with Attio
  • Image loading fixes for production
  • TypeScript error resolutions
  • Search indexing improvements
  • Social media optimization
  • Modal and form submissions
  • Cloudflare Functions implementation
  • Text sizing optimization (only commit with explicit Claude Code attribution)
📊 Code Statistics

Overall Migration Impact

  • Total Lines Added: +15,740 (excluding generated files)
  • Total Lines Deleted: -1,528
  • Net Lines of Code/Content: +14,212
  • Files Changed: ~200+

Breakdown by Type

  • MDX Content: 5,857 lines (83 blog posts)
  • Documentation: 4,331 lines (migration docs, reports)
  • Scripts/Python: 2,353 lines (migration tools)
  • Code (Astro/TS/JS): 2,258 lines (new application code)
  • Other Files: 941 lines

Contribution Breakdown by Author

Human (Jack) - 13.3% of commits

  • Commits: 23
  • Lines Added: +1,479 (9.4% of total additions)
  • Lines Deleted: -196
  • Net Change: +1,283

Claude Code - 86.7% of commits

  • Commits: 150
  • Lines Added: +14,261 (90.6% of total additions)
  • Lines Deleted: -1,332
  • Net Change: +12,929

Top 10 Largest Commits

  1. a0b8060 (+298/-1409) - Complete Hugo-to-Astro blog migration with systematic shortcode conversion
  2. 84ce8ce (+1640/-7) - Implement smart fallback system for description vs excerpt
  3. afa78d0 (+1325/-2) - cover images etc. (Human)
  4. e127bbc (+1121/-0) - Phase 3: Migration script with test migration complete
  5. df2742e (+630/-289) - Implement clean newsletter-first homepage with Substack-style modal
  6. 9cad969 (+737/-176) - wip services (Human)
  7. e3d1597 (+908/-1) - ng live (Human)
  8. f1793f5 (+883/-0) - Add performance comparison scripts and report
  9. 1a2a800 (+756/-82) - Update Cursor rules for Astro blog migration
  10. 9e4e679 (+832/-1) - Add Attio CRM integration for newsletter subscribers

Key Insights

  • Claude Code handled 86.7% of commits and 90.6% of line additions
  • Human commits (13.3%) contributed only 9.4% of lines, showing more directive than implementation work
  • The largest single change was refactoring/cleanup (-1409/+298), showing significant optimization
  • Major human contributions included content migration (“cover images”, “ng live”, “wip services”)
🎯 Key Migration Decisions

Content Structure

  • Moved from Hugo’s /content/posts/ to Astro’s /src/data/content/[slug]/
  • Unified content types (essay, brief, elsewhere, quote, episodes) in single directory
  • Images maintained in parallel structure with content in /src/assets/images/content/[slug]/

Technical Improvements

  1. Performance: Astro’s partial hydration vs Hugo’s static generation
  2. Developer Experience: MDX support with component imports
  3. Search: Continued use of Pagefind (same as CraftyCTO)
  4. Typography: Consistent prose-lg sizing vs responsive scaling

Feature Additions

  • Newsletter modal with Beehiiv integration
  • CRM integration with Attio
  • Enhanced social media sharing
  • Improved dark mode support
  • View Transitions API for smooth navigation
✅ Current Status

Completed

  • ✅ Core blog functionality
  • ✅ Content migration structure
  • ✅ Full content migration from Hugo
  • ✅ Newsletter integration
  • ✅ Search functionality
  • ✅ Social media optimization
  • ✅ Responsive design
  • ✅ Dark mode
  • ✅ RSS feed
  • ✅ XML sitemap generation (sitemap-index.xml)
  • ✅ Cloudflare deployment
  • ✅ 301 redirects from craftycto.com/blog to cto4.ai

Pending

  • ⏳ Analytics integration
  • ⏳ Comment system
  • ⏳ Full SEO audit
⚠️ Technical Debt & Considerations

From AstroWind Heritage

The cto4ai-blog repository inherits ~950 commits from the AstroWind template project (2022-2025), providing:

  • Mature component library
  • Accessibility features
  • Performance optimizations
  • Community-tested patterns

Migration Challenges

  1. URL Structure: Different permalink patterns between Hugo and Astro
  2. Image Handling: Hugo’s image processing vs Astro’s Image component
  3. Frontmatter: Schema differences requiring transformation
  4. Shortcodes: Hugo shortcodes need conversion to MDX components
⚡ Performance Metrics

Build Times

  • Hugo (CraftyCTO): ~2-3 seconds
  • Astro (CTO4.AI): ~10-15 seconds (with image optimization)

PageSpeed Insights Mobile Scores

MetricCraftyCTO (Hugo)CTO4.AI (Astro)Difference
Performance9896-2 points
Accessibility10098-2 points
Best Practices1001000
SEO1001000

Core Web Vitals Comparison (Mobile)

MetricCraftyCTO (Hugo)CTO4.AI (Astro)Status
First Contentful Paint1.1s1.4sGood
Largest Contentful Paint1.1s2.0sGood
Total Blocking Time0ms30msGood
Cumulative Layout Shift00Perfect
Speed Index3.8s4.4sGood

Performance Analysis

  • Both sites achieve excellent performance (96-98 scores)
  • Hugo has a slight edge in initial load metrics
  • Astro site still delivers strong user experience
  • Main opportunity: Optimize LCP from 2.0s to match Hugo’s 1.1s
🎬 Conclusion

The migration from Hugo to Astro represents a successful modernization of the blog platform, with improved developer experience, better performance, and enhanced features. The separation of blog content from corporate site allows for independent evolution and optimization of each property.

This migration was primarily accomplished through Claude Code assistance (86.7% of commits, 90.6% of code additions), with human guidance providing strategic direction through brief commits (13.3% of commits, 9.4% of additions). This AI-assisted approach enabled rapid implementation of complex features including newsletter integrations, CRM connectivity, and performance optimizations that might have taken significantly longer with traditional development methods.

The collaboration pattern shows an effective human-AI partnership: humans providing brief directional commits (“reorg”, “ng wip”, “linking”) with larger structural changes, while Claude Code handled the detailed technical implementation with properly documented, descriptive commits. This approach maintained high code quality while accelerating the migration timeline.


Report Generated: August 26, 2025
Live Site: cto4.ai

Back to Archive

Related Posts

View All Posts »