audience-builder
Skill4 starsChanged 7 months agoMITView on GitHub
Create or update audience segments from natural language descriptions. Use when the user wants to build, create, or define an audience or segment from a natural language description.
- Sends data out
2 other projects use a version of this.
Adopted by
Most recently taken up by
- kelpi-ai/meta-ads-skillstheir own version, first seen Jul 2, 2026
- ReachRobin/skillstheir own version, first seen May 28, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- kelpi-ai/meta-ads-skills★ 4same name
- ReachRobin/skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- account-syncSkill
- audience-advisorSkill
- audience-snapshotSkill
- campaign-flow-builderSkill
- connection-managerSkill
- data-health-monitorSkill
- entity-lookupSkill
- export-debuggerSkill
- filterql-builderSkill
- flow-managerSkill
- integration-advisorSkill
- integration-setupSkill
- job-managerSkill
- lytics-agentSkill
- profile-explorerSkill
- profile-investigatorSkill
- schema-discoverySkill
- schema-managerSkill
- schema-optimizerSkill
- segment-managerSkill
- stream-inspectorSkill
- webhook-template-builderSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
If the user's request is goal-oriented rather than specific (e.g., "I want to drive more conversions" vs "US users who visited 5+ times"), …
- Distinctive: line 26
If the user has a specific audience description, proceed directly to Step 1.
- Very specific: line 41
Use schema-discovery skill to find matching fields:
- Very specific: line 63
Use filterql-builder skill to construct the filter expression.
- Distinctive: line 91
If still failing, show the error and ask the user for guidance
- Distinctive: line 139
Ask for confirmation: "Proceed with creating this segment?
- Very specific: line 155
After successful creation, offer an audience snapshot: "Segment created successfully.
- Very specific: line 157
If yes, invoke the audience-snapshot skill with the new segment ID.
- Distinctive: line 161
When field mapping is ambiguous (multiple equally strong candidates):
- Distinctive: line 164
Only ask the user when there's a genuine tie or the field purpose is unclear
- Distinctive: line 168
If the user wants to update an existing segment:
- Very specific: line 171
Use PUT /v2/segment/${ID} instead of POST
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audience Builder
Purpose
The primary end-to-end skill. Takes a natural language audience description and produces a validated, sized, and confirmed segment. Composes schema-discovery, filterql-builder, segment-manager, and confirmation-gate.
Environment
Requires authenticated API access. See ../references/auth.md for credential resolution.
Inputs
- Natural language description of the desired audience
- Optional: segment name, table (default:
user), kind (default:segment), tags
End-to-End Flow
Step 0: Check if Advisor Would Be Better
If the user's request is goal-oriented rather than specific (e.g., "I want to drive more conversions" vs "US users who visited 5+ times"), suggest starting with the audience-advisor skill first:
"It sounds like you have a business goal in mind. Would you like me to analyze your data first to recommend the best targeting strategy? I can look at ML models, field distributions, and existing segments to suggest evidence-based filters."
If the user has a specific audience description, proceed directly to Step 1.
Step 1: Parse Intent
Extract the key concepts from the natural language description:
- Target attributes (demographics, behaviors, properties)
- Inclusion criteria (what they have/did)
- Exclusion criteria (what they lack/didn't do)
- Temporal constraints (time-based conditions)
Example: "US customers who haven't purchased socks in over a year"
- Attribute: country = US
- Exclusion: no sock purchases
- Temporal: over 1 year ago
Step 2: Schema Discovery
Use schema-discovery skill to find matching fields:
# Get all fields to find candidates
curl -s "${LYTICS_API_URL:-https://api.lytics.io}/v2/schema/user/field" \
-H "Authorization: ${LYTICS_API_TOKEN}"Score candidate fields by name match, type compatibility, and value distribution. For the example:
- "US customers" -> look for:
country,geo_country,country_code(string type) - "purchased socks" -> look for:
products_purchased(set),purchase_categories(set),last_purchase_date(date)
Fetch value suggestions for top candidates -- the q parameter is required:
curl -s "${LYTICS_API_URL:-https://api.lytics.io}/api/schema/user/fieldsuggest/${FIELD}?q=${QUERY}" \
-H "Authorization: ${LYTICS_API_TOKEN}"Example: /api/schema/user/fieldsuggest/country?q=US
Confirm field values match (e.g., country contains "US", products_purchased contains "socks").
Step 3: Build FilterQL
Use filterql-builder skill to construct the filter expression.
Map each concept to a FilterQL condition based on field type (see ../references/field-types.md):
- String equality:
country = "US" - Set non-membership:
NOT products_purchased INTERSECTS ("socks") - Date comparison:
last_sock_purchase < "now-1y"
Compose with AND/OR:
FILTER AND (
country = "US",
NOT products_purchased INTERSECTS ("socks")
) FROM user ALIAS us_no_socksStep 4: Validate FilterQL
curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/api/segment/validate" \
-H "Authorization: ${LYTICS_API_TOKEN}" \
-H "Content-Type: text/plain" \
-d 'FILTER AND (country = "US", NOT products_purchased INTERSECTS ("socks")) FROM user ALIAS us_no_socks'If validation fails:
- Parse the error message
- Identify the syntax issue
- Fix the FilterQL
- Retry (max 3 attempts)
- If still failing, show the error and ask the user for guidance
Step 5: Estimate Size
curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/api/segment/size" \
-H "Authorization: ${LYTICS_API_TOKEN}" \
-H "Content-Type: text/plain" \
-d 'FILTER AND (country = "US", NOT products_purchased INTERSECTS ("socks")) FROM user ALIAS us_no_socks'Step 6: Present Draft (Confirmation Gate)
Show the user a complete summary before creating:
## Proposed Audience: US Non-Sock Buyers
**Name**: US Non-Sock Buyers
**Slug**: us_no_socks
**Table**: user
**Kind**: segment
**Description**: US customers who have not purchased socks
**Field Mapping**:
- "US customers" -> `country = "US"` (field type: string, sample values: US, CA, UK)
- "haven't purchased socks" -> `NOT products_purchased INTERSECTS ("socks")` (field type: []string)
**FilterQL**:
FILTER AND (country = "US", NOT products_purchased INTERSECTS ("socks")) FROM user ALIAS us_no_socks
**Estimated Size**: ~45,000 profilesThen show the raw API payload:
{
"name": "US Non-Sock Buyers",
"slug_name": "us_no_socks",
"description": "US customers who have not purchased socks",
"segment_ql": "FILTER AND (country = \"US\", NOT products_purchased INTERSECTS (\"socks\")) FROM user ALIAS us_no_socks",
"kind": "segment",
"table": "user",
"is_public": true,
"save_hist": true,
"tags": []
}Ask for confirmation: "Proceed with creating this segment? (yes/no)"
Step 7: Execute on Approval
curl -s -X POST "${LYTICS_API_URL:-https://api.lytics.io}/v2/segment" \
-H "Authorization: ${LYTICS_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{ ... approved payload ... }'Report the result:
Successfully created segment "US Non-Sock Buyers" (id: abc123)
View at: ${LYTICS_API_URL}/segment/us_no_socksAfter successful creation, offer an audience snapshot:
"Segment created successfully. Would you like to see an audience snapshot showing the demographic breakdown and field distributions?"
If yes, invoke the audience-snapshot skill with the new segment ID.
Handling Ambiguity
When field mapping is ambiguous (multiple equally strong candidates):
- Present the top candidates with sample values
- Let the agent pick the best match based on context -- do NOT prompt the user unless truly ambiguous
- Only ask the user when there's a genuine tie or the field purpose is unclear
Updating Existing Segments
If the user wants to update an existing segment:
- Fetch the current segment:
GET /v2/segment/${ID}?inline=true - Show current FilterQL and proposed changes
- Use
PUT /v2/segment/${ID}instead of POST
Error Handling
- No matching fields: Report clearly, suggest the user describe their data differently
- Validation failure after 3 retries: Show the FilterQL and error, ask for help
- Empty segment (size 0): Warn and suggest broadening criteria
- Very large segment (>90% of total): Note this and confirm intent
Dependencies
- Composes:
schema-discovery skill,filterql-builder skill,segment-manager skill,../references/confirmation-gate.md - References:
../references/auth.md,../references/filterql-grammar.md,../references/field-types.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

