AI AgentsXiaohongshuBuild LogProduct Engineering

How We Built a Xiaohongshu Content Agent in 48 Hours

A behind-the-scenes look at how we built 内容搭子Pro — a Xiaohongshu content agent that generates platform-native posts, hashtags, and scheduling plans — in 48 hours using our Agent Stack method.

We launched 内容搭子Pro (Content Partner Pro) — a Xiaohongshu content agent — in 48 hours from blank screen to paying users. Here's exactly how we did it, what broke, and what the Agent Stack method looks like in practice.


What Is 内容搭子Pro?

Q: What problem does it solve?

Xiaohongshu (RedNote) is China's fastest-growing social commerce platform with 300M+ monthly active users. The problem: creating native-feeling content for XHS is hard. The algorithm rewards a very specific style — warm, personal, detail-rich, with strategic hashtags. Most creators either spend 2-3 hours per post or produce generic content that gets buried.

Q: What does the agent do?

Users paste their product, brand, or idea. The agent outputs:

  • A native XHS post in the right tone and format
  • 15-20 hashtags (mix of high-volume and niche)
  • A 7-day content calendar
  • Platform-specific style guidance

The difference from a "writing tool": the agent understands XHS culture. It writes like a local, not a translator.


The 48-Hour Build Log

Hour 0–4: Define the Agent Stack

Before writing a line of code, we defined the agent's job in one sentence:

"Turn any product/brand description into a ready-to-publish XHS post, with hashtags and a weekly plan, using platform-native tone."

This matters because it determines everything downstream — the prompt architecture, the UI flow, the success metric.

Q: What's the Agent Stack method?

We use a 6-layer approach for every product:

Layer What we built
Database User sessions, generation history, usage limits
Auth Supabase email auth, free tier (5 gens/day)
API /api/generate endpoint, Gemini 2.5 Flash
Payment Z-Pay integration, premium unlock
Frontend Three-panel workspace: input → generate → preview
Deploy Vercel, custom domain, edge caching

Most "48-hour builds" skip layers 1-4. That's how you get demos that don't ship as real products.

Hour 4–12: The Prompt Is the Product

The hardest part wasn't the code. It was the prompt.

Q: How do you make AI write like a Xiaohongshu creator?

Three techniques we discovered:

1. Platform memory injection. We included 8 example XHS posts (real viral content) in the system prompt. Not as templates — as tone calibration. The model learns what "sounds like XHS" before writing a single word.

2. Structural constraints. XHS posts have a specific anatomy: hook (emotional opening) → problem → journey → result → CTA. We enforce this structure explicitly in the prompt.

3. Hashtag taxonomy. XHS hashtags work in tiers: super-broad (100M+ views), mid-tier (10-50M views), niche (1-5M views). The agent generates a mix, not just popular ones. Niche hashtags get 3x more reach per impression for small accounts.

The prompt went through 11 iterations in the first 12 hours.

Hour 12–24: Build the Stack, Bottom to Top

Database first. We designed the schema before the UI:

-- users table
id, email, tier (free|pro), daily_count, created_at

-- generations table  
id, user_id, input, output_json, created_at

Auth second. Email magic link via Supabase. Free tier limited to 5 generations per day.

API third. One endpoint /api/generate that takes input and returns structured JSON: {post, hashtags, calendar}.

Q: Why structure the output as JSON instead of plain text?

Because we display each section differently in the UI. The post renders in a phone mockup. Hashtags display as clickable chips. The calendar renders as a 7-day grid. If the model returns unstructured text, you're doing brittle string parsing. JSON = reliable rendering.

Frontend fourth. A three-column layout: input panel, generate button + options, preview panel with XHS phone mockup. Built with Next.js 14 and Tailwind.

Payment fifth. Z-Pay integration for premium unlock. The free tier is intentionally useful — not crippled. Users who hit the 5-gen limit have already validated the product's value.

Hour 24–36: The Three Things That Broke

1. The phone mockup on mobile.

The XHS phone preview rendered beautifully on desktop. On mobile, it overflowed the viewport. Fix: CSS transform: scale() with viewport-aware sizing. The mockup now scales to 85% of viewport width on small screens.

2. Hashtag deduplication.

The model occasionally returned duplicate hashtags (same tag with different capitalization). Fix: normalize to lowercase, deduplicate on the API side before returning.

3. The content calendar was too generic.

"Day 1: Post about [topic]" is not useful. We added a second Gemini call specifically for the calendar — it takes the generated post as context and creates specific, actionable day-by-day themes. Two-pass generation increased the calendar quality dramatically.

Hour 36–48: Ship, Measure, Iterate

We deployed to Vercel at hour 36 and shared the product with 12 XHS creators in our network.

Feedback from the first 12 users:

  • 9/12 said the posts felt "like something I'd actually write"
  • 8/12 said they'd use it regularly
  • 3/12 asked for a mode to "post from drafts" (added to roadmap)
  • 2/12 said the hashtags were too safe (added an "aggressive growth" hashtag mode)

The iteration from user feedback took 8 hours. Product improvement after launch is 10x more efficient than pre-launch speculation.


What We Learned

Q: What made this build fast?

Three things:

1. Clear agent definition. One sentence. If you can't state what the agent does in one sentence, it'll take 3 weeks instead of 48 hours.

2. Build bottom-to-top. Database before UI. This sounds counterintuitive — shouldn't you validate the idea first with a quick UI? No. Building UI first creates technical debt that slows you down on day 3. The database forces you to think clearly about what data you actually need.

3. Prompt iteration > feature iteration. In the first 12 hours, we changed the prompt 11 times. We changed the UI once. The leverage is in the prompt. UI is a surface; the prompt is the brain.

Q: What would you do differently?

Ship 12 hours earlier and get user feedback sooner. The two issues users found (mockup scaling, calendar quality) were invisible to us because we were too close to the product. Earlier feedback = earlier fixes = better product at launch.


The Agent Stack in Practice

Every product we've shipped at Rootnest uses the same 6-layer Agent Stack. The stack doesn't make products faster to build in isolation — it makes them faster to build correctly.

Tools without a database don't remember users. Tools without auth can't have paid tiers. Tools without structure can't render output richly. The stack forces completeness.

Q: Can this method apply to products outside XHS/China?

Yes. We've used the same stack for an English resume doctor, a landing page roast tool, and a trade intelligence agent. The layers are the same. The prompts change.


Try 内容搭子Pro

If you're building for the Chinese market and need platform-native XHS content, 内容搭子Pro is live at rootnest.ai. Free tier: 5 generations per day. Pro tier: unlimited + priority generation.


Building something with AI agents? We write about agent product strategy, prompt engineering, and build logs. Subscribe to the Rootnest Journal.

Built by Rootnest

We build digital employees, not just tools

内容搭子Pro, 外贸搭子 — AI agents that work for you, 24/7.

内容搭子 →外贸搭子 →
← Back to Blog