Logo Calendar Scheduling Logic

Calendar Scheduling Logic

Tổ chức
cxcscmu
calendar-scheduling-logic

Tìm khung giờ trống trong lịch và lên lịch họp, đồng thời tuân thủ các ràng buộc

Tổng quan

Nhà phát hànhcxcscmu
Kho mãSkillLearnBench
Tên kỹ năngcalendar-scheduling-logic
Sao
91
Bản fork
7
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được cxcscmu công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Calendar Scheduling Logic trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/cxcscmu/SkillLearnBench/tree/main/skills/b1-one-shot-claude-haiku-4-5/schedule-planning/calendar-scheduling-logic
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/cxcscmu/SkillLearnBench.git /tmp/SkillLearnBench
mkdir -p .claude/skills
cp -r /tmp/SkillLearnBench/skills/b1-one-shot-claude-haiku-4-5/schedule-planning/calendar-scheduling-logic .claude/skills/calendar-scheduling-logic
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Calendar Scheduling Logic trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Calendar Scheduling Logic ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Calendar Scheduling Logic với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Calendar Scheduling Logic Skill

Overview

This skill covers scheduling algorithms to find available time slots in a calendar, handle time conflicts, prioritize blue-colored flexible blocks, and match meeting requests with available time windows.

Key Concepts

Calendar Representation

python
# Event representation
event = {
    'name': 'Weekly Group Meeting',
    'start_hour': 10,
    'start_minute': 0,
    'end_hour': 11,
    'end_minute': 0,
    'color': 'red',           # 'red', 'blue', 'yellow', 'gray'
    'is_flexible': True/False # Only blue is True
}

# 15-minute interval representation
# 9:00am = index 0, 9:15am = index 1, etc.

Constraint Types

  1. User Availability Window: Person only available during specific hours
  2. Date Constraint: Meeting must be on specific date
  3. Duration Requirement: Meeting needs exact duration
  4. Block Overriding: Blue blocks can be overridden for higher priority meetings

Code Examples

Time Conversion to Minutes

python
def time_to_minutes(hour, minute):
    """Convert hour:minute to total minutes since midnight"""
    return hour * 60 + minute

def minutes_to_time(minutes):
    """Convert total minutes to (hour, minute) tuple"""
    hour = minutes // 60
    minute = minutes % 60
    return (hour, minute)

Convert Time Slots to Intervals

python
def time_range_to_intervals(start_hour, start_min, end_hour, end_min, interval_minutes=15):
    """Convert a time range to 15-minute interval indices"""
    start_total_min = time_to_minutes(start_hour, start_min)
    end_total_min = time_to_minutes(end_hour, end_min)

    intervals = []
    current = start_total_min
    while current < end_total_min:
        intervals.append(current // interval_minutes)
        current += interval_minutes

    return intervals

Track Busy Intervals

python
def mark_busy_intervals(calendar_events, day_start_hour=0, day_end_hour=24):
    """Mark all busy intervals in a day"""
    total_intervals = (day_end_hour - day_start_hour) * 60 // 15
    busy = [False] * total_intervals

    for event in calendar_events:
        intervals = time_range_to_intervals(
            event['start_hour'], event['start_minute'],
            event['end_hour'], event['end_minute']
        )
        for i in intervals:
            if 0 <= i < total_intervals:
                busy[i] = True

    return busy

Find Available Slots (Basic)

python
def find_available_slots(busy_array, duration_intervals):
    """Find all available slots of at least duration_intervals length"""
    available_slots = []
    consecutive = 0
    start_idx = None

    for i, is_busy in enumerate(busy_array):
        if not is_busy:
            if consecutive == 0:
                start_idx = i
            consecutive += 1

            if consecutive >= duration_intervals:
                available_slots.append((start_idx, i + 1))
        else:
            consecutive = 0

    return available_slots

Filter by User Availability Window

python
def filter_by_availability_window(available_slots, user_start, user_end, interval_minutes=15):
    """Filter slots to only those within user's available window"""
    user_start_intervals = time_to_minutes(user_start[0], user_start[1]) // interval_minutes
    user_end_intervals = time_to_minutes(user_end[0], user_end[1]) // interval_minutes

    filtered = []
    for start_idx, end_idx in available_slots:
        # Check if slot overlaps with user's availability
        if end_idx > user_start_intervals and start_idx < user_end_intervals:
            # Constrain to user's window
            constrained_start = max(start_idx, user_start_intervals)
            constrained_end = min(end_idx, user_end_intervals)
            filtered.append((constrained_start, constrained_end))

    return filtered

Select Earliest Valid Slot

python
def select_earliest_slot(available_slots, duration_intervals):
    """Select the earliest slot that can fit the duration"""
    for start_idx, end_idx in available_slots:
        slot_duration = end_idx - start_idx
        if slot_duration >= duration_intervals:
            return (start_idx, start_idx + duration_intervals)

    return None

Handle Blue Block Override

python
def create_busy_with_overrides(calendar_events, allow_blue_override=True):
    """Mark busy intervals, but allow blue blocks to be overridden"""
    total_intervals = 24 * 60 // 15
    busy = [False] * total_intervals
    blue_blocks = []

    for event in calendar_events:
        intervals = time_range_to_intervals(
            event['start_hour'], event['start_minute'],
            event['end_hour'], event['end_minute']
        )

        if event.get('color') == 'blue' and allow_blue_override:
            blue_blocks.append((intervals[0], intervals[-1]))
        else:
            for i in intervals:
                if 0 <= i < total_intervals:
                    busy[i] = True

    return busy, blue_blocks

Complete Scheduling Algorithm

python
def schedule_meeting(calendar_events, request):
    """
    Schedule a meeting respecting all constraints

    request = {
        'duration_hours': 1.0,
        'available_times': {'start': (10, 0), 'end': (14, 0), 'timezone': None},
        'timezone': 'US/Eastern'
    }
    """
    duration_minutes = request['duration_hours'] * 60
    duration_intervals = duration_minutes // 15

    # Get busy times and blue overridable blocks
    busy, blue_blocks = create_busy_with_overrides(calendar_events)

    # Find all available slots
    available_slots = find_available_slots(busy, duration_intervals)

    # Filter by user's availability window
    if request['available_times']:
        available_slots = filter_by_availability_window(
            available_slots,
            request['available_times']['start'],
            request['available_times']['end']
        )

    # Select earliest slot
    selected = select_earliest_slot(available_slots, duration_intervals)

    if selected:
        start_intervals, end_intervals = selected
        start_hour, start_min = minutes_to_time(start_intervals * 15)
        end_hour, end_min = minutes_to_time(end_intervals * 15)
        return {
            'start': (start_hour, start_min),
            'end': (end_hour, end_min),
            'success': True
        }

    return {'success': False, 'reason': 'No available slots'}

Advanced: Priority-Based Scheduling

python
def schedule_multiple_meetings(calendar_events, requests, priority_fn=None):
    """
    Schedule multiple meetings, resolving conflicts with priority function

    priority_fn: function that returns numeric priority (higher = more important)
    """
    # Sort by priority
    if priority_fn:
        requests = sorted(requests, key=priority_fn, reverse=True)
    else:
        # Default: earlier constraint window = higher priority
        requests = sorted(
            requests,
            key=lambda r: time_to_minutes(r['available_times']['end'][0], r['available_times']['end'][1])
        )

    scheduled = []
    working_events = calendar_events.copy()

    for request in requests:
        slot = schedule_meeting(working_events, request)
        if slot['success']:
            # Add booked meeting to calendar
            working_events.append({
                'name': f"Meeting: {request['sender']}",
                'start_hour': slot['start'][0],
                'start_minute': slot['start'][1],
                'end_hour': slot['end'][0],
                'end_minute': slot['end'][1],
                'color': 'booked'
            })
            scheduled.append({'request': request, 'slot': slot})

    return scheduled

Best Practices

  1. Always work with intervals to avoid floating-point time issues
  2. Store both interval indices and actual times for clarity
  3. Handle timezone conversions before scheduling
  4. Validate that proposed times fall within business hours
  5. Log which blue blocks were overridden for transparency
  6. Ensure slot duration exactly matches requirement (no partial hours unless specified)

Câu hỏi thường gặp

Kỹ năng AI Calendar Scheduling Logic làm được gì?

Tìm khung giờ trống trong lịch và lên lịch họp, đồng thời tuân thủ các ràng buộc

Vì sao nên dùng Calendar Scheduling Logic trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Calendar Scheduling Logic là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Calendar Scheduling Logic trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/cxcscmu/SkillLearnBench/tree/main/skills/b1-one-shot-claude-haiku-4-5/schedule-planning/calendar-scheduling-logic. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Calendar Scheduling Logic?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Calendar Scheduling Logic với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Calendar Scheduling Logic với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Calendar Scheduling Logic có miễn phí không?

Có. Kỹ năng này được cxcscmu phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇