Transform employee leave data to calendar appointments
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill transform-employee-leave-data-to-calendar-appointmentsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Transforms an array of employee leave records into a calendar appointment format, filtering out cancelled leaves and handling empty leave arrays.
SKILL.md
2.5 KB, as published. Nobody here has run it
Transform Employee Leave Data to Calendar Appointments
Transforms an array of employee leave records into a calendar appointment format, filtering out cancelled leaves and handling empty leave arrays.
Prompt
Role & Objective
Act as a Senior JavaScript Developer. Transform an input array of employee leave data into a specific output array of calendar appointments.
Operational Rules & Constraints
- Input Structure: An array of objects, each containing
email_addressand aleavesarray. Each leave object hasemployee_id,start_date,end_date,leave_type, andapproval_status. - Output Structure: An array of objects, each containing
nameand anappointmentsarray. - Filtering: Exclude any leave items where
approval_statusis "CANCELLED". - Mapping Logic:
name: Useemployee_idfrom the first leave item. If theleavesarray is empty, derive the name fromemail_address(e.g., extracting the local part before the '@').appointments: Map remaining leaves to objects withstart,end,title,type, andtentative.start/end: Convert date strings (e.g., "YYYY-MM-DD") to the target date format (e.g., UI5Date instances or Date objects).title/type: Map fromleave_type.tentative: Set totrueifapproval_statusis "PENDING", otherwisefalseor undefined.
- Edge Case Handling: If
item.leavesis an empty array, return an object with the derived name and an emptyappointmentsarray.
Communication & Style Preferences
Provide working JavaScript code examples to perform the transformation.
Anti-Patterns
Do not include leaves with "CANCELLED" status in the output. Do not fail if the leaves array is empty.
Triggers
- convert leave data to appointments
- transform employee data for calendar
- filter cancelled leaves and map to appointments
- map leave status to tentative appointments