Skip to content

Instantly share code, notes, and snippets.

@s1moe2
Created January 27, 2026 01:06
Show Gist options
  • Select an option

  • Save s1moe2/1f58d2b9449bfe8e29991e6f4f7bdfe2 to your computer and use it in GitHub Desktop.

Select an option

Save s1moe2/1f58d2b9449bfe8e29991e6f4f7bdfe2 to your computer and use it in GitHub Desktop.
Prompt-Based Style Replication

Prompt-Based Style Replication (No Fine-Tuning)

Objective

Generate a reusable system prompt that enables an LLM to produce blog posts that closely replicate an author’s writing style, using only prior writing samples—without model fine-tuning or external infrastructure.


High-Level Overview

The approach works by:

  1. Analyzing a set of the author’s writing samples
  2. Extracting stable stylistic patterns (not content)
  3. Converting those patterns into explicit, enforceable constraints
  4. Packaging the constraints + examples into a system prompt

This system prompt is then reused for all future generations.


Inputs

  • Primary input: 10–30 authored blog posts (plain text)
  • Optional: Metadata tags (topic, length, date)
  • Optional: Author-provided preferences (e.g., “avoid emojis”)

Output

A single system prompt containing:

  1. A short role definition
  2. A structured list of style rules
  3. Negative constraints (what to avoid)
  4. Optional self-evaluation instructions
  5. Optional example excerpts

Step-by-Step Process

Step 1: Normalize Inputs

Preprocess all texts to reduce noise:

  • Strip HTML/Markdown formatting
  • Remove headings that are structural only
  • Remove links, footnotes, CTAs
  • Preserve paragraph and sentence boundaries

Goal: give the model clean prose to analyze.


Step 2: Extract Style Features

Use an LLM to analyze the corpus and extract style signals, not themes.

Prompt template for analysis:

Analyze the following writing samples.

Extract consistent stylistic patterns, including:
- Sentence length and structure
- Paragraph length and pacing
- Tone and attitude
- Point of view and pronoun usage
- Rhetorical devices (e.g., analogies, questions)
- Typical openings and closings
- Common patterns the author avoids
- Vocabulary preferences (formal vs casual)
- Structural habits (lists, sections, flow)

Do NOT summarize content or topics.
Focus only on how the author writes.

The output should be a structured description of the style.


Step 3: Convert Analysis into Constraints

Transform the extracted analysis into clear, enforceable rules.

Example transformation:

  • “Uses conversational tone” → “Write in a conversational, non-corporate tone. Avoid marketing language.”

  • “Uses short paragraphs” → “Paragraphs should rarely exceed 3 sentences.”

Avoid vague instructions like “write naturally” or “match the vibe.”


Step 4: Generate the System Prompt

Assemble the final system prompt using a fixed template.

Recommended System Prompt Structure

You are writing as [Author Name].

Follow these writing rules exactly:

STYLE
- [Rule 1]
- [Rule 2]
- [Rule 3]

STRUCTURE
- [Rule 1]
- [Rule 2]

TONE & VOICE
- [Rule 1]
- [Rule 2]

AVOID
- [Thing to avoid 1]
- [Thing to avoid 2]

QUALITY CHECK
Before finalizing:
- Identify any sentence that sounds generic or AI-like
- Rewrite it to better match the author’s natural voice

Rules should be:

  • Concrete
  • Testable
  • Limited to ~15–25 total items

Step 5: Attach Optional Reference Examples

Optionally append 2–3 short excerpts (200–400 words total) from the author’s writing.

Guidance to the model:

The following excerpts are provided to demonstrate rhythm, voice, and phrasing.
They are not templates to copy and should not influence factual content.

This improves rhythm and sentence-level mimicry without overfitting.


Key Design Principles

  • Constraints > vibes
  • Specific > abstract
  • “Avoid X” is often more powerful than “Do Y”
  • Fewer, stronger rules outperform long wishlists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment