Algorithmic ASO Keyword Portfolio Allocation Pipeline
Generates a Python script using semantic clustering and linear optimization to construct optimal App Store keyword metadata allocations.
Use this template when building data-driven App Store Optimization metadata strategies. It generates a quantitative script that selects and packs keywords into strict app store character limits to maximize discoverability.
Role: Lead App Store Optimization (ASO) Data Scientist
Context
- Raw Candidate Keywords Dataset: {{raw_keyword_dataset}}
- Competitor Metadata JSON: {{competitor_metadata_json}}
- Metadata Slot Constraints: {{metadata_slot_constraints}}
- Minimum Search Volume Threshold: {{min_search_volume_threshold}}
- Keyword Difficulty Decay Factor (Alpha): {{decay_factor_weight}}
- App Category Taxonomy: {{app_category_taxonomy}}
Task
Write a Python optimization script that processes {{raw_keyword_dataset}}, calculates keyword opportunity scores via non-linear utility functions factoring in {{decay_factor_weight}}, and solves a multi-choice knapsack optimization problem to maximize keyword reach within the exact string constraints in {{metadata_slot_constraints}}.
Method
- Ingest candidate keywords from {{raw_keyword_dataset}} and filter entries below {{min_search_volume_threshold}}.
- Extract competitor keyword frequency and positioning metrics from {{competitor_metadata_json}}.
- Compute semantic token uniqueness and eliminate cross-field duplicates between Title, Subtitle, and Keyword Field.
- Calculate an Opportunity Index for each token:
Score = (Volume^1.0) / (Difficulty^alpha)using {{decay_factor_weight}}. - Formulate a 0/1 Integer Linear Programming (ILP) or greedy knapsack model constrained by {{metadata_slot_constraints}}.
- Optimize character budget packing (e.g., Title: 30 chars, Subtitle: 30 chars, Keywords: 100 chars comma-separated).
- Output the allocated metadata sets along with mathematical efficiency ratios and coverage diagnostics.
Constraints
- MUST use standard mathematical optimization libraries (e.g., PuLP or SciPy) for the allocation solver.
- MUST NOT exceed the character ceiling specified for any metadata field in {{metadata_slot_constraints}}.
- Repetitive words across different fields MUST be penalized to zero value to preserve byte budget.
- All text transformations MUST preserve international UTF-8 character length accuracy.
Output format
Fully commented Python 3 script structured into:
- Math formulation docstring defining the objective function and constraint equations
- Tokenization, cleaning, and de-duplication pipeline functions
- Linear Programming allocation solver class
- Reporting routine printing allocated slots, remaining character padding, and total predicted portfolio reach
Self-review
- Check that comma separators in the App Store keyword field are correctly counted in the 100-character budget.
- Verify that the decay parameter {{decay_factor_weight}} correctly penalizes high-difficulty keywords.
- Ensure non-ASCII string handling computes character counts rather than raw byte counts.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.