Preface¶
Building an automation assistant for medical scenarios usually involves hand-writing HTTP clients, managing login sessions and captcha flows yourself, and then cramming all that logic into prompts. That approach is error-prone, easy to misconfigure, and hard to reuse in tools like Cursor or Claude Code.
Below we introduce a community Skill on SkillHub called “Peking University International Hospital Patient Service” (coordinates @user_36426f8f/pkuih-patient-service). It packages PKU-IH patient service capabilities as Node.js modules and ships an Agent-readable SKILL.md, enabling in-chat, step-by-step actions like looking up departments, checking schedules, and making appointments. Report querying and online payment are marked “coming soon” in the official Skill documentation; appointment-related capabilities are the main focus currently spelled out.
What is this¶
One-liner: an Agent Skill for the Peking University International Hospital (PKU-IH) patient portal that wraps appointment APIs and documents security policies.
- Distribution channel: SkillHub, sourced from
community, categoryprofessional, current listed version 1.0.1 (as shown on the SkillHub page). - Maintainer info: The in-package documentation lists the author as Gao Kun; the upstream repository is
pkuih_serviceon Gitee; the SkillHub publisher isuser_36426f8f. - Problem it solves: Centralizes API key configuration, login and token management, and appointment module invocation, so an Agent can follow the docs instead of stitching endpoints together from scratch each time.
The backend API base URL is fixed to https://server.pkucare.com in the Skill config. The SkillHub metadata tag is requires_api_key=true; you must configure PKUIH_API_KEY before use.
Core functionality¶
All capabilities below come from the SKILL.md and module implementation notes within the Skill package, grouped by module.
Appointment service¶
- Query department list (
appointment.getDepartments, public endpoint, can flatten the department tree). - Query doctor schedules (
appointment.getDoctorSchedule(deptCode, startDate, endDate)). - Book appointments (
appointment.book(doctor, slot, sequence)). - Query appointment records (
appointment.getAppointments).
Auxiliary capabilities include image captcha, SMS verification codes, login/logout (getCaptcha, sendSms, login, logout), as well as interactive login (loginInteractive, as documented).
Reports and payment¶
SKILL.md marks lab/imaging report queries, pending payment, and online payment as “coming soon.” The package includes skeletons for report and payment modules with some API wrappers; production availability depends on the hospital’s opened scope and should not be treated as dependencies in Agent workflows by default.
Security and state¶
| Mechanism | Description |
|---|---|
| Token validity | 30 minutes; re-login required after expiration |
| Sensitive operations | Payment and cancellation require re-authentication (see security level table in the docs) |
| State file | /tmp/pkuih_state.json, cleaned up on logout or expiration |
| API key | Environment variable PKUIH_API_KEY or local .pkuih.config.json (do not commit) |
SMS verification codes are documented to be valid for 5 minutes.
Installation and activation¶
Prerequisites¶
- Node.js: 18.0 or above (see
INSTALL.md). - API Key: Apply via the WeChat mini program “北京大学国际医院” or contact the hospital IT department per the docs; the key is a long string (see examples in the docs—do not paste a real key in public places).
Install via SkillHub (recommended)¶
The SkillHub page provides installation instructions: follow the SkillHub installation guide and install @user_36426f8f/pkuih-patient-service.
Ensure the skillhub CLI is available on your machine, then install into the current Agent’s skills directory. If you don’t specify --dir, the default is ./skills/, which many clients won’t load automatically; pass an explicit path.
command -v skillhub && skillhub --version
skillhub install @user_36426f8f/pkuih-patient-service --dir ~/.cursor/skills/
Common skills directories (excerpted from the SkillHub installation docs):
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/under your project
After installing, refresh or restart according to the client’s requirements so the new Skill gets indexed.
Configure API key¶
The docs emphasize writing the key into ~/.profile so non-interactive shells (including Node subprocesses) can read the environment variable; placing it only in ~/.bashrc may result in process.env.PKUIH_API_KEY being empty.
echo 'export PKUIH_API_KEY="your API key"' >> ~/.profile
source ~/.profile
echo $PKUIH_API_KEY
You can run a configuration check inside the Skill directory:
cd ~/.cursor/skills/@user_36426f8f/pkuih-patient-service
node check-config.js
Typical usage¶
The examples below come from SKILL.md, with paths written assuming you’ve entered the Skill installation directory; the module entry point is index.js.
Login flow: first get a captcha, then send the SMS, and finally log in with the SMS code.
const pkuih = require('./index.js');
const captcha = await pkuih.getCaptcha();
await pkuih.sendSms('phone number', captcha.captcha_key, captcha.captcha_code);
const user = await pkuih.login('phone number', 'SMS code');
Check schedules and book: use getDateRange to generate a date window, query doctors by department code, pick a slot with remaining capacity, and call book.
const { startDate, endDate } = pkuih.getDateRange(7);
const doctors = await pkuih.appointment.getDoctorSchedule('005003', startDate, endDate);
const doctor = doctors.find(d => d.name.includes('target doctor name'));
const slot = doctor.sch_list.find(s => s.ampm === 'a' && s.remain > 0);
const result = await pkuih.appointment.book(doctor, slot);
Cross-session: The docs note that the login session can persist for about 30 minutes; requiring the same module in a new process can attempt to restore state, and re-login is required after timeout.
On the Agent side, once this Skill is enabled, map users’ natural language intents (e.g., “Check next week’s schedule for a department”) to the above API sequences, and perform confirmation and re-authentication as required by SKILL.md before appointment and payment actions.
Use cases and notes¶
Who it’s for
- Developers who need to connect PKU-IH appointment, schedule lookup, and appointment record queries to an Agent in development environments or personal workflows.
- Teams that can obtain a legitimate
PKUIH_API_KEYand accept that this is a community-maintained Skill without direct endorsement from the hospital’s official channels.
Limitations and cautions
- Compliance and accounts: Only operate on data within your own account’s authorized scope; API keys and tokens are sensitive—never commit them to repos or logs.
- Community source: SkillHub marks this as
community; actual API behavior, available departments, and appointment slots depend on the hospital’s live services. - Feature boundaries: Reports and payment are “coming soon” per the docs; validate production workflows primarily around appointment capabilities.
- Environment: The Agent must be able to read
PKUIH_API_KEYwhen executing Node scripts; inject the key separately in sandboxes or CI. - Listing data: The SkillHub page shows a rating of 100000, ~1110 downloads, and 2 installs (data captured at that time; refer to the backend for current figures).
Wrap-up¶
“Peking University International Hospital Patient Service” consolidates patient appointment calls, login state, and security policies into an installable Agent Skill. It’s suitable—provided you’ve configured an API key—for installing via SkillHub into clients like Cursor and driving conversational appointment workflows according to SKILL.md.
- SkillHub skill page: https://www.skillhub.cn/skills/user_36426f8f/pkuih-patient-service
- Official coordinate URL: https://api.skillhub.cn/user_36426f8f/pkuih-patient-service
- Installation guide: https://skillhub.cn/install/skillhub.md