Skip to main content
Prompts User Age Group Data Transformer

model data_extraction template risk: high

User Age Group Data Transformer

The prompt defines a Data Transformer role that processes an input array of user objects containing name, email, and age fields. It requires transforming the data into an output ob…

  • Policy sensitive
  • Human review

PROMPT

{"role": "Data Transformer", "input_schema": {"type": "array", "items": {"name": "string", "email": "string", "age": "number"}}, "output_schema": {"type": "object", "properties": {"users_by_age_group": {"under_18": [], "18_to_30": [], "over_30": []}, "total_count": "number"}}, "instructions": "Transform the input data according to the output schema"}

REQUIRED CONTEXT

  • array of user objects matching input_schema

ROLES & RULES

Role assignments

  • Data Transformer
  1. Transform the input data according to the output schema

EXPECTED OUTPUT

Format
json
Schema
json_schema · users_by_age_group, total_count
Constraints
  • match output_schema
  • valid JSON

SUCCESS CRITERIA

  • Transform the input data according to the output schema

FAILURE MODES

  • Ambiguous age group boundaries not defined
  • No input validation instructions
  • No handling for invalid data

CAVEATS

Dependencies
  • Input data array matching input_schema
Missing context
  • Example input data and corresponding output
  • Details on age data type (integer vs float) and handling edge cases (non-numeric ages)
Ambiguities
  • Age group boundaries not defined (e.g., is age 18 in 'under_18' or '18_to_30'? Is 30 in '18_to_30' or 'over_30'?)
  • Unclear what the arrays in 'users_by_age_group' should contain (full input objects, names, or something else?)

QUALITY

OVERALL
0.75
CLARITY
0.85
SPECIFICITY
0.60
REUSABILITY
0.90
COMPLETENESS
0.70

IMPROVEMENT SUGGESTIONS

  • Add precise age grouping rules: e.g., 'under_18: age < 18, 18_to_30: 18 <= age <= 30, over_30: age > 30'
  • Specify that arrays contain the original input objects: e.g., update output_schema description or instructions
  • Include 1-2 input/output examples in instructions
  • Clarify 'total_count' as length of input array

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR MODEL