AgentSkillsCN

appointment-booking

通过诊所的 REST API 预订、查看、取消及重新安排预约。

SKILL.md
--- frontmatter
name: appointment-booking
description: Book, view, cancel, and reschedule appointments via the clinic's REST API
metadata: {"clawdbot":{"requires":{"env":["APPOINTMENT_API_URL"]},"primaryEnv":"APPOINTMENT_API_URL"}}

Appointment Booking Skill

You help users manage their medical appointments through the clinic's booking system.

API Base URL

Use the environment variable APPOINTMENT_API_URL (default: http://localhost:3001/api).

Available Operations

1. List Available Services

Get all services offered by the clinic.

bash
curl -s "${APPOINTMENT_API_URL}/services"

Response contains: id, name, description, duration (minutes), price, color.

2. Check Available Time Slots

Get available appointment slots for a date.

bash
# Single day
curl -s "${APPOINTMENT_API_URL}/slots?date=YYYY-MM-DD"

# With specific service (adjusts for service duration)
curl -s "${APPOINTMENT_API_URL}/slots?date=YYYY-MM-DD&serviceId=SERVICE_ID"

# Multiple days
curl -s "${APPOINTMENT_API_URL}/slots?date=YYYY-MM-DD&days=7"

Response: Array of { date, slots: [{ time: "HH:mm", available: boolean }] }.

3. Book an Appointment

Create a new appointment for the user.

bash
curl -s -X POST "${APPOINTMENT_API_URL}/appointments/book" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "name": "Client Name",
    "email": "optional@email.com",
    "serviceId": "SERVICE_ID",
    "date": "YYYY-MM-DD",
    "startTime": "HH:mm",
    "notes": "Optional notes"
  }'

Required fields: phone, name, serviceId, date, startTime.

4. View User's Appointments

Get all upcoming appointments for a phone number.

bash
curl -s "${APPOINTMENT_API_URL}/appointments/client/PHONE_NUMBER"

Returns appointments with status PENDING or CONFIRMED.

5. Cancel an Appointment

Cancel an existing appointment.

bash
curl -s -X POST "${APPOINTMENT_API_URL}/appointments/cancel-client" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "appointmentId": "APPOINTMENT_ID"
  }'

6. Reschedule an Appointment

Move an appointment to a new date/time.

bash
curl -s -X POST "${APPOINTMENT_API_URL}/appointments/reschedule-client" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "appointmentId": "APPOINTMENT_ID",
    "date": "YYYY-MM-DD",
    "startTime": "HH:mm"
  }'

Workflow Guidelines

  1. Always identify the user first - Use their phone number from the chat context.

  2. When booking:

    • First, list services if user hasn't specified one
    • Check available slots for their preferred date
    • Confirm the booking details before submitting
    • Provide confirmation with date, time, and service name
  3. When viewing appointments:

    • Format dates and times in a user-friendly way
    • Group by date if multiple appointments
    • Show service name and status
  4. When cancelling/rescheduling:

    • First fetch their appointments to get the appointment ID
    • Confirm the action before executing
    • For rescheduling, check slot availability first
  5. Error handling:

    • "Selected time slot is not available" → Suggest alternative times
    • "Appointment not found" → List their current appointments
    • "This appointment does not belong to you" → Verify phone number

Response Formatting

Format responses in a friendly, conversational tone:

Booking confirmed:

code
Your appointment has been booked!

📅 Service: General Consultation
📆 Date: Monday, January 28, 2026
🕐 Time: 10:00 AM

We look forward to seeing you!

Listing appointments:

code
Your upcoming appointments:

1. General Consultation
   📆 Jan 28, 2026 at 10:00 AM
   Status: Confirmed

2. Dental Cleaning
   📆 Feb 5, 2026 at 2:00 PM
   Status: Pending

Available slots:

code
Available times for Monday, January 28:
9:00 AM, 9:30 AM, 10:30 AM, 11:00 AM, 2:00 PM, 2:30 PM, 3:00 PM

Would you like to book one of these?

Business Hours

  • Monday to Friday: 9:00 AM - 6:00 PM
  • Lunch break: 1:00 PM - 2:00 PM (no appointments)
  • Weekends: Closed

Appointment Statuses

  • PENDING - Awaiting confirmation
  • CONFIRMED - Appointment confirmed
  • CANCELLED - Appointment cancelled
  • COMPLETED - Appointment completed
  • NO_SHOW - Client did not attend