本文へ移動
cccskills
無料GitHub で公開

bear-query

Query the Bear EHR database using the semantic layer. Use when asked about clients, billing, appointments, insurance, clinical data, procedures, scheduling, programs, staff, vitals, diagnoses, revenue, claims, or any data question about the Bear application.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Bear EHR Database Query Skill

You have access to the Bear EHR MariaDB database via MCP tools (mcp__bear-db__execute_query, mcp__bear-db__get_table_info, mcp__bear-db__get_schema).

Before Writing Any Query

  1. Read the semantic layer docs in /home/andres/code/claude/semantic/ to understand the schema
  2. Start with 00_query_guide.md for query patterns, naming conventions, and caveats
  3. Read the relevant domain file (01-15) for the specific tables involved

Domain Files Quick Reference

#FileUse When Asking About
0000_query_guide.mdNL-to-SQL patterns, status derivation, caveats
0101_people_demographics.mdClients, demographics, addresses, phones
0202_programs_enrollment.mdPrograms, enrollment, locations
0303_insurance_coverage.mdInsurance policies, payors, plans, authorizations
0404_appointments_scheduling.mdScheduling, calendar, appointment types
0505_encounters_forms.mdClinical documentation, encounter forms
0606_billing_revenue.mdCharges, claims, payments, revenue cycle
0707_clinical_data.mdDiagnoses, medications, vitals, labs
0808_users_staff.mdStaff, providers, credentials, roles
0909_tfc.mdTreatment Foster Care
1010_otp.mdOpioid Treatment Program
1111_transportation.mdClient transportation
1212_crew_groups.mdGroup therapy sessions
1313_bed_management.mdResidential bed tracking
1414_prescriptions_erx.mdElectronic prescribing
1515_labs.mdLaboratory orders and results

Critical Rules

MariaDB Syntax (NOT PostgreSQL)

  • Use CASE WHEN not FILTER(WHERE)
  • Use CURDATE() not CURRENT_DATE
  • Use TIMESTAMPDIFF() for date math
  • Use DATE_FORMAT() for date formatting
  • tinyint(1) is boolean — use = 1 / = 0, NOT IS TRUE / IS FALSE

Soft Deletes

  • Most tables use deleted_at IS NULL to filter active records
  • Always include this filter unless the user wants historical data
  • Some tables (like cssrs_suicides, suicidal_ideations, client_high_risks) do NOT have deleted_at — check with get_table_info first if unsure

Names Are in a Separate Table

  • Client names: JOIN names n ON n.person_id = p.id AND n.deleted_at IS NULL
  • Staff names: JOIN people p ON p.identifiable_id = u.id AND p.identifiable_type = 'User' then JOIN names n ON n.person_id = p.id
  • For latest name: use MAX(n.id) subquery or ORDER BY n.id DESC LIMIT 1

STI Tables

  • people.type = 'Client' for patients
  • companies.type = 'Payor' for insurance companies
  • Hidden/merged clients: filter with (p.hidden IS NULL OR p.hidden = 0)

Money Columns

  • ALL financial amounts are *_cents columns (integers)
  • Always divide by 100.0 for dollar display: amount_cents / 100.0 AS amount_dollars

Appointment Status (Timestamp-Based)

  • No status column — derive from timestamps:
    • Completed: checked_out_at IS NOT NULL
    • No-show: noshow_at IS NOT NULL
    • Cancelled: cancelled_at IS NOT NULL
    • Checked in: checked_in_at IS NOT NULL AND checked_out_at IS NULL
    • Valid: deleted_by IS NULL AND cancelled_at IS NULL AND noshow_at IS NULL

Insurance

  • Self-pay payor: companies.id = 1 (scope self_pay / not_self_pay in Rails)
  • Priority values: first, second, third, fourth, fifth, self
  • Cards (images): pictures table with picturable_type = 'InsurancePolicy'

Vitals

  • BP columns: bp_right_arm_sys, bp_right_arm_dia, bp_left_arm_sys, bp_left_artm_dia (note typo on left arm diastolic)
  • High BP threshold: systolic >= 130 OR diastolic >= 80

Suicide Risk (C-SSRS)

  • Main table: cssrs_suicides (no deleted_at column)
  • Ideations: suicidal_ideations joined via cssrs_suicide_id
  • Risk assessments: risk_assessments (has deleted_at)

Query Workflow

  1. Read the relevant semantic layer file(s)
  2. If unsure about a column, use mcp__bear-db__get_table_info to verify
  3. Write the query using MariaDB syntax
  4. Present results in a clear table format
  5. Highlight key insights and anomalies
  6. When results are large, get summary counts first, then drill down

Responding

  • Always show the data in a formatted markdown table
  • Add key takeaways / insights after the data
  • Flag data quality issues (nulls, suspicious values, inconsistencies)
  • Offer to drill deeper or pivot the analysis
  • When providing ActiveRecord equivalents, give them as one-liners for easy console paste

$ARGUMENTS

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

Drafts U.S. commercial real estate access and indemnity (right-of-entry) agreements for pre-closing due diligence. Covers license grants, non-invasive vs invasive testing gates, insurance/endorsement requirements, indemnity with discovery carve-outs, restoration and lien remedies, confidentiality, and anti-indemnity guardrails. Trigger: access agreement, right of entry, due diligence access, Phase I/II, invasive testing, pre-PSA site inspection.

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

当用户需要对意外险投保问卷进行专业、结构化的核保审查,提取职业类别、工作环境、作业内容、危险活动参与情况、交通出行习惯、特殊工作暴露及其他可能影响意外险承保判断的高风险信息,并生成适合意外险核保、补问流转和风险分层处理的结构化分析结果时使用本 skill。

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

Inspect, schema, and fill true AcroForm PDFs using sciClaw's pdf_form_inspect, pdf_form_schema, and pdf_form_fill tools. Use when: (1) checking whether a PDF is a real fillable AcroForm, (2) listing form field names, types, and choices, (3) filling a supported form from structured values, (4) preparing reviewable insurance, legal, administrative, or clinical form drafts, (5) reporting skipped fields or unused input keys after a fill. Do not use for scanned PDFs, OCR tasks, or XFA-only forms.

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

Guide actuarial analysis for insurance pricing. TRIGGERS - Use when user needs help with actuarial-analysis related tasks.

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

Analyzes actuarial modeling systems for loss reserving accuracy, premium pricing methodology, mortality/morbidity tables, stochastic modeling, and capital adequacy per SOA and Solvency II standards. USE THIS SKILL WHEN: - You need to review or audit actuarial models (reserving, pricing, capital) - Someone asks about loss triangle analysis or reserve adequacy - You are evaluating IBNR calculations, chain ladder methods, or Bornhuetter-Ferguson - A project involves insurance pricing, GLM rating models, or ratemaking - You need to assess Solvency II SCR calculations or RBC compliance - Someone mentions actuarial opinions, ASOP compliance, or SOA standards - You are reviewing stochastic models, ESG configurations, or DFA frameworks - A codebase uses actuarial libraries (chainladder, lifetables, ChainLadder R package) TRIGGER PHRASES: "actuarial", "loss reserving", "IBNR", "chain ladder", "premium pricing", "mortality table", "Solvency II", "capital adequacy", "ratemaking", "GLM pricing", "risk-based capital", "reserve analysis", "actuarial opinion"

日本語の概要は準備中です。原文の説明を表示しています。

FDU-INS/Insurance-Skills762026年7月12日 更新

FDU-INS のスキルをすべて見る

このスキルの問題を報告する