Data-Driven Content Strategy: A Four-Step Method Using AI Coding Tools

    This article presents a four-step method for turning content topic selection from subjective guesswork into a reproducible data pipeline built with AI coding tools. It shows how to profile your own historical content to find high-performing topic clusters, collect external market data under clear compliance constraints, build cross-comparable efficiency metrics that hold up to scrutiny, and combine your strengths with market opportunities through a weighted scoring matrix validated by sensitivity analysis. You also get practical guidance on where agentic coding tools fit each stage, collaboration best practices, and a reusable prompt skeleton—so you can convert "what should I create next" into a concrete, executable task list.

    1. The Real Problem: Reframing “What to Create” as a Computable Data Task

    The typical creator’s struggle is not a lack of execution but a lack of decision inputs. “I want to make everything” really means the candidate space hasn’t been constrained, and “nothing is easy to make well” means there’s no clear judgment criterion. When an intuitive question keeps draining your energy in circles, it usually means it hasn’t yet been translated into an engineering problem.

    This is exactly where data practitioners have an edge: faced with a vague need, their first instinct isn’t to look for inspiration but to build a metric system. Take “content positioning” as an example—it can be broken into four objects a program can process:

    Stage Business meaning Engineering abstraction
    Self-assessment How has my historical content performed? Collecting and labeling owned data
    Market exploration What is gaining traction in the market? Structured collection of external public data
    Data analysis What is worth doing? Metric computation and layering across multiple data sources
    Strategy generation What exactly should I create? Cross-scoring, candidate ranking, and visualized output

    Once you complete this layer of abstraction, the task shifts from “waiting for inspiration” to “running a pipeline”: every stage has a clear input, a clear output, and is reproducible and iterable. This is also the premise for the AI coding tool collaboration discussed later in this article.

    2. Step 1 — Self-Assessment: Extracting Your Content’s “DNA” from Owned Data

    The first step uses only data sources you control: historical articles, past work, and exported backend data from your own channels. The goal is to answer one concrete question: for which category of topic does each unit of exposure buy the most positive feedback?

    On the engineering side, it’s recommended to collect the following fields: title, publish time, category tags, body length, views, likes, comments, shares, and saves. After collection, do three things:

    1. Unify the measurement basis: Convert all absolute-count metrics into ratios to eliminate bias from differences in time span and traffic fluctuations. Between the time you had 10K followers and when you had 100K, absolute view counts aren’t comparable, but ratios are far more stable.
    2. Remove anomalies: Identify accidental hits (outliers caused by recommendation-stream swings) and articles that got zero distribution. Flag them rather than deleting them outright, preserving traceability.
    3. Cluster by topic: Extract keywords from titles and summaries to form coarse-grained topic clusters, then compute each cluster’s metric distribution.

    The key conclusions usually live in the shape of the distribution, not the average. Platform data follows a classic long-tail distribution, so the mean is almost always pulled up by a few viral hits. Use the median plus percentiles as the primary basis for judgment. A common practice is to compute the median and 75th percentile of engagement rate for each topic cluster: clusters whose “median exceeds the site-wide median” are stable advantage zones, while clusters with “a notably high 75th percentile but an ordinary median” are high-potential, high-variance zones. The former is your baseline; the latter is your breakout point.

    Illustrative implementation (pseudocode, using general-purpose libraries for HTTP and HTML parsing):

    1. # Collect owned-content data and aggregate metrics per topic cluster
    2. def profile_own_content(articles):
    3. # articles: [{title, ts, tags, words, views, likes, comments, shares, saves}]
    4. rows = []
    5. for a in articles:
    6. v = max(a["views"], 1)
    7. rows.append({
    8. "topic": extract_topic(a["title"], a["tags"]),
    9. "engagement": (a["likes"] + a["comments"] + a["shares"]) / v,
    10. "save_rate": a["saves"] / v,
    11. "comment_rate": a["comments"] / v,
    12. "words": a["words"],
    13. })
    14. df = to_frame(rows)
    15. summary = (
    16. df.groupby("topic")
    17. .agg(
    18. n=("engagement", "size"),
    19. med_engagement=("engagement", "median"),
    20. p75_engagement=("engagement", lambda s: s.quantile(0.75)),
    21. med_save=("save_rate", "median"),
    22. )
    23. .query("n >= 5") # minimum sample size, avoids small-sample misjudgment
    24. .sort_values("med_engagement", ascending=False)
    25. )
    26. return summary

    The output should be a three-column reference table of “topic — stability — potential,” not a paragraph of conclusions. This table will be reused as one of the scoring dimensions in later steps.

    3. Step 2 — Market Exploration: Compliant External Data Reconnaissance

    The second step targets trending content on public platforms. The boundaries must be stated clearly first, otherwise even the best technical implementation won’t hold up.

    Compliance and engineering constraints:

    • Collect only pages that are publicly accessible without login; do not bypass login, CAPTCHAs, or access controls;
    • Strictly respect the target site’s robots protocol and terms of service; abandon any path that explicitly prohibits collection;
    • Limit concurrency and request frequency, and add backoff retries to avoid stressing the target service;
    • Do not collect personally identifiable information such as user identity or contact details; keep only aggregate-level content metrics;
    • Cache results locally and update incrementally—repeatedly requesting the same resource is pointless.

    Under these constraints, the collected fields typically include: title, publish time, author tier (follower-count range), section, views, likes, coins, favorites, comments, shares, and bullet comments (danmaku) or description keywords. The author’s follower tier is critical: the same one million views is a completely different matter when it comes from an account with a million followers versus a brand-new account. The former is “cashing in existing stock,” while the latter is genuine “topic validation.”

    A robust fetcher must handle three kinds of problems:

    1. class PoliteFetcher:
    2. def __init__(self, session, min_interval=2.0, max_retry=3):
    3. self.session = session
    4. self.min_interval = min_interval # global request interval for client-side rate limiting
    5. self.max_retry = max_retry
    6. def get(self, url, params=None):
    7. for attempt in range(self.max_retry):
    8. resp = self.session.get(url, params=params, timeout=10)
    9. if resp.status_code == 200:
    10. return resp.text
    11. if resp.status_code in (429, 503):
    12. backoff(min(2 ** attempt, 30)) # exponential backoff
    13. continue
    14. break
    15. raise FetchError(url)
    1. Pagination and deduplication: Build a seen-set keyed on each item’s unique identifier to prevent double counting from overlapping pages;
    2. Anti-scraping and rate-limit responses: Apply exponential backoff to 429/503 rather than hard retries;
    3. Field fault tolerance: Site structure changes will cause missing fields, so the parsing layer must have defaults and alerts and must never let the whole pipeline fail silently.

    4. Step 3 — Data Analysis: A Reproducible Definition of What Drives Traffic

    The core of this step is not algorithmic complexity but whether your metric definitions hold up. Build at least four layers of metrics:

    Layer 1: Efficiency metrics (comparable across scale)

    • Engagement rate = (likes + comments + shares + favorites) ÷ views
    • Save rate = favorites ÷ views, reflecting the content’s “utility” value and long-term reuse
    • Comment rate = comments ÷ views, reflecting how controversial or discussion-worthy a topic is
    • Efficiency per character = engagement ÷ description length (used to judge whether long descriptions add value)

    Layer 2: Layering and comparison

    Bin by follower tier (e.g., <10K, 10K–100K, 100K–1M, >1M) and rank separately within each bin. Directly comparing view counts across bins is the most common analytical mistake: the baseline traffic differences between tiers are far larger than differences in content quality.

    Layer 3: Topic × format cross-analysis

    Map title keywords into topic clusters and map cover/title structure into format categories (tutorial, opinion, retrospective, roundup). Build a two-dimensional table and observe interaction effects. Many so-called “viral patterns” exist only in specific combinations—looking at either dimension in isolation leads to wrong conclusions.

    Layer 4: Timeliness

    Compute the time series of publish volume for each topic cluster. A track with good metrics but declining publish volume means platform traffic is migrating away, and the marginal return of entering late is low. A track with rising publish volume and sustained top-tier efficiency is the real window of opportunity.

    1. def rank_topics(market_df):
    2. # Compute within-tier relative efficiency to avoid size bias
    3. market_df = market_df.assign(
    4. tier=pd_qcut(market_df["fans"], [0, .5, .9, 1.0],
    5. labels=["small", "mid", "large"])
    6. )
    7. grouped = (
    8. market_df.groupby(["tier", "topic"])
    9. .agg(plays=("views", "median"),
    10. save_rate=("saves", lambda s: (s / plays(s)).median()))
    11. )
    12. # Standardize within each tier, then combine into a size-comparable topic efficiency score
    13. z = grouped.groupby("tier")["save_rate"].transform(zscore)
    14. return grouped.assign(score=z).sort_values("score", ascending=False)

    5. Step 4 — Strategy Generation: Weighted Cross of Strengths and Opportunities

    With owned data (strengths) and market data (opportunities) in hand, you can place candidate directions into the same two-dimensional matrix. Define two normalized dimensions:

    • Capability fit C: The median engagement rate of that topic cluster in your own content, normalized against your own site-wide median;
    • Market opportunity O: A weighted combination of that topic’s within-tier efficiency score in the external market and the growth slope of its publish volume.

    The composite score uses explicit weights, which makes human intervention and sensitivity testing easy:

    1. Score = w1 * C + w2 * O - w3 * R

    Here R is a penalty term for competitive crowding (the number and concentration of top content in the same topic), and w1, w2, w3 are recommended to start at 0.4 / 0.4 / 0.2. Then apply small perturbations to the weights and observe whether the ranking stays stable. If a candidate direction consistently ranks in the top three under weight perturbation, the conclusion is robust; if the ranking flips dramatically, the evidence is insufficient and you should collect more data rather than place your bet.

    The final output should be an executable candidate list, where each entry includes: topic positioning, target audience, recommended content format, benchmark references (retaining only content-level characteristics), expected metric ranges, and specific draft titles for the first 3–5 topics. A report’s value lies in being actionable, not in looking pretty.

    6. What AI Coding Tools Contribute to This Workflow

    Every step above involves writing scripts, debugging, data processing, and visualization—exactly the scenarios where agentic coding tools shine. Unlike one-shot code completion, they can read files, execute commands, observe errors, modify code, and retry across multiple loops, making them well suited to delivering a small analysis project end to end.

    General dimensions worth attention when choosing a tool:

    1. Tool-calling reliability: In long-chain tasks, whether it can correctly select tools, pass parameters correctly, and self-correct after failures directly determines the completion rate;
    2. Context capacity: Analytical tasks produce many intermediate artifacts (field definitions, sample data, statistical summaries); too small a context leads to inconsistencies and forces frequent manual restatement;
    3. Code runnability: Whether the generated scripts run on the first or with few fixes, including dependency declarations and error handling;
    4. Visualization aesthetics: Default chart styling, color schemes, and layout directly affect report readability—this is often underestimated in practice;
    5. Output throughput: This noticeably affects interaction rhythm, and the wait cost for long reports and long scripts shouldn’t be ignored.

    A few practical tips on how to collaborate:

    • Define the contract before writing code: Lock down field names, metric formulas, and output formats in the prompt to avoid the model improvising and drifting off-spec;
    • One stage at a time: Have the agent first produce and validate the field-extraction script, then move to metric computation, and finally generate visualizations—this succeeds far more often than asking it to “complete the entire report” at once;
    • Let errors flow back: Explicitly allow it to run scripts and iterate on real errors, rather than only letting it “write blind”;
    • Keep judgment with the human: Metric definitions, minimum sample sizes, and weight settings are business decisions that people should make; the tool handles implementation and presentation.

    A reusable prompt skeleton you can adapt directly:

    1. Role: senior data analyst + Python developer
    2. Goal: from the given HTML samples, produce runnable data collection and metric analysis scripts
    3. Constraints:
    4. 1. Request public pages only; global request interval >= 2s; exponential backoff on 429/503;
    5. 2. All metrics must be output in ratio form; keep raw fields for verification;
    6. 3. Topic clusters with sample size < 5 do not participate in ranking, only listed in an observation pool;
    7. 4. Bin by follower count [0, 10K, 100K, 1M, inf) into four tiers; standardize within each bin before comparing;
    8. 5. Output: CSV detail + topic ranking table + three sets of comparison charts + conclusion list
    9. Deliverable: scripts first, then run, then write conclusions based on real output

    7. Transferring the Methodology to Other Domains

    What’s truly reusable here isn’t the scraper script but the mindset of “turning subjective decisions into computable problems.” It transfers to many scenarios: technology selection comparisons can draw on community discussions and documentation update frequency; product pricing can reference the price-sensitivity distribution in public reviews; channel selection for campaigns can compare efficiency metrics across sources.

    The unified pattern is: define the decision variables → identify both an owned-data source and an external-data source → define ratio metrics that are comparable across samples → cross-rank with a weighted matrix → test robustness with sensitivity analysis → output an executable list.

    There’s only one standard for judging whether an analysis is qualified: did it turn “how should I choose” into “which three things can I do right now”? When the output can directly become a task list, the internal struggle naturally disappears—because what remains is no longer a decision problem but an execution problem.