AutoSkill 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.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/transform-employee-leave-data-to-calendar-appointments" ~/.claude/skills/ecnu-icalk-autoskill-transform-employee-leave-data-to-calendar-appointments && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/transform-employee-leave-data-to-calendar-appointments/SKILL.mdsource content
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
and aemail_address
array. Each leave object hasleaves
,employee_id
,start_date
,end_date
, andleave_type
.approval_status - Output Structure: An array of objects, each containing
and anname
array.appointments - Filtering: Exclude any leave items where
is "CANCELLED".approval_status - Mapping Logic:
: Usename
from the first leave item. If theemployee_id
array is empty, derive the name fromleaves
(e.g., extracting the local part before the '@').email_address
: Map remaining leaves to objects withappointments
,start
,end
,title
, andtype
.tentative
/start
: Convert date strings (e.g., "YYYY-MM-DD") to the target date format (e.g., UI5Date instances or Date objects).end
/title
: Map fromtype
.leave_type
: Set totentative
iftrue
is "PENDING", otherwiseapproval_status
or undefined.false
- Edge Case Handling: If
is an empty array, return an object with the derived name and an emptyitem.leaves
array.appointments
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