bravo-search

Tool for searching and downloading building records from the Hong Kong Buildings Department BRAVO system (bravo.bd.gov.hk). Handles login flow, jQuery UI autocomplete address/lot search, plan list navigation, and high-resolution plan extraction via the Daeja tile API. Intended for any BRAVO building plan search or download task.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "bravo-search" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0458b9e81e082ec03994178bd8265f634b515e914003c5245c590b1056f168e1. Verify the upstream source and version against https://skillhub.cn/skills/user_502121dc/bravo-search before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Tool for searching and downloading building records from the Hong Kong Buildings Department BRAVO system (bravo.bd.gov.hk). Handles login flow, jQuery UI autocomplete address/lot search, plan list navigation, and high-resolution plan extraction via the Daeja tile API. Intended for any BRAVO building plan search or download task.

0 Downloads

Introduction source: third_party · user_502121dc · 1.0.0 Reference

SkillPi interpretation

Tasks
Search for and download building records from the Hong Kong Buildings Department BRAVO (Building Records Access and Viewing On-line) system. Works for any project — not tied to a specific building or lot.
Software, accounts and paid services
Use `playwright-cli` for browser automation. `agent-browser` is NOT suitable for BRAVO (element interaction issues). Ask the user for BRAVO credentials if not already provided.
Limits and differences
Auth tokens are unique per inspection page load — must extract fresh for each plan Different plans may have different base resolutions (`tw`×`th`) Canvas extraction at any zoom level captures only visible tiles Fit-to-window gives full plan but at base 96 DPI resolution Direct `getInspectionPlanImage` URL requires Daeja auth headers Scale factor choice: 6x is a safe default; higher may hit server limits
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: bravo-search
description: "Search for and download building records from Hong Kong Buildings Department BRAVO system at bravo.bd.gov.hk. Handles login flow, jQuery UI autocomplete address/lot search, plan list navigation, and high-resolution plan extraction via the Daeja tile API. Use for any BRAVO building plan search or plan download task."
agent_created: true

BRAVO Search Skill

Search for and download building records from the Hong Kong Buildings Department BRAVO (Building Records Access and Viewing On-line) system. Works for any project — not tied to a specific building or lot.

Prerequisites

  • Use playwright-cli for browser automation.
  • agent-browser is NOT suitable for BRAVO (element interaction issues).
  • Ask the user for BRAVO credentials if not already provided.

Login Flow

BRAVO has a multi-step login. These steps are identical for all users:

  1. Navigate to https://bravo.bd.gov.hk/login?request_locale=zh_HK
  2. Fill textbox "登入名稱" with username
  3. Fill textbox "密碼" with password
  4. Click button "登入"
  5. On the notice page (/notice):
    • Check checkbox "本人確認已閱讀..."
    • Click button "接受"
  6. On the declaration page (/noticeProcess.action):
    • Check checkbox "選項 A" (building construction matters)
    • Click button "遞交"
  7. On the multi-login page (/checkMulitpleSignOn):
    • Click button "是"
  8. Now at the home page (/home)

Always take a fresh snapshot after each page transition to get current element refs. Refs change between sessions.

Location Search with Autocomplete

BRAVO uses jQuery UI autocomplete for address search.

Correct method:

  1. Ask the user for the address or lot to search
  2. Find textbox "位置" on the home page, click to focus
  3. Use playwright-cli type "<address>" — type character-by-character
  4. Wait ~2-3 seconds for autocomplete dropdown
  5. Click the .ui-menu-item-wrapper element in the dropdown
  6. Click button "搜尋" or press Enter
  7. If results panel is collapsed, click button "只顯示搜尋結果"

Wrong methods (will NOT work):

  • fill command — no autocomplete trigger
  • Direct API calls — require Daeja-specific auth, not session cookies
  • goto to internal pages — kills the session

Navigating Search Results

Results appear in a table with columns:

  • 圖則/文件/小型工程 | 檔案編號 | 地址 | 大廈名稱 | 地段編號 | 檔案類型 | OP編號 | 備註

To open a record's plan list:

  • Find the row matching the target file number (e.g., 3/4003/72)
  • Click the button "圖則" in that row
  • A new tab opens with the plan list at viewPlanList?recId=<recId>
  • Switch to the new tab with tab-select

Each plan in the list has:

  • button "Preview" — thumbnail view (low res, full plan)
  • button "Inspect Full Image" — Daeja ViewONE viewer

Downloading High-Resolution Plans via Tile API

The Daeja ViewONE viewer often shows "Lost connection to the server" while the actual tile API remains functional. This is the most reliable method for full-resolution plan extraction.

Step 1: Navigate and Get Base Resolution + Auth Tokens

Navigate to the inspection page for a plan and extract both the base dimensions and auth tokens from the tile request:

var entries = performance.getEntriesByType('resource');
for (var e of entries) {
  if (e.name.includes('op=tile') && e.name.includes('tw=')) {
    var url = e.name;
    var getP = function(n) {
      var m = url.match(new RegExp('[&?]' + n + '=([^&]*)'));
      return m ? m[1] : '';
    };
    var baseW = parseInt(getP('tw'));  // e.g., 794
    var baseH = parseInt(getP('th'));  // e.g., 554
    var tokens = {
      fch: getP('fch'), xCCH: getP('X-CCH'), xCDH: getP('X-CDH'),
      xCId: getP('X-CId'), xLCId: getP('X-LCId'),
      version: getP('v') || '45571'
    };
    // Use these for the HD request
  }
}

The tw and th values tell you the base resolution at 96 DPI. Multiply by the desired scale factor to get target HD dimensions.

Step 2: Request HD Tile

Construct a tile URL with increased DPI. The scale factor determines output quality — 6x gives ~4764px for a typical 794px base, suitable for 300 DPI printing at A3 size.

https://bravo.bd.gov.hk/v1files/?v=<version>&op=tile
  &tw=<baseW * scale>&th=<baseH * scale>&x=0&y=0&page=1
  &DPI=<96 * scale>&rxr=<96 * scale>&ryr=<96 * scale>
  &w=<baseW * scale>&h=<baseH * scale>&enh=1&iv=0
  &fch=<fch>&err=0
  &X-CCH=<xCCH>&X-CDH=<xCDH>&X-CId=<xCId>&X-LCId=<xLCId>
  &X-Client-Version=<version>

This returns the FULL plan as a single PNG tile. Unlike zoom+canvas extraction, this captures the entire drawing at once.

Step 3: Base64 Chunking and Download

Large HD images require chunked base64 encoding inside page.evaluate() to avoid "Maximum call stack size exceeded":

const arr = new Uint8Array(await blob.arrayBuffer());
let b64 = '';
for (let i = 0; i < arr.length; i += 8192) {
  b64 += String.fromCharCode.apply(null, arr.subarray(i, i + 8192));
}
return { b64: btoa(b64), size: arr.length };

Then decode in Python and save via Pillow:

data = base64.b64decode(result["b64"])
with open(output_path, "wb") as f:
    f.write(data)

Step 4: Combine to PDF

Use Pillow to combine all downloaded PNGs:

from PIL import Image
images = [Image.open(f).convert("RGB") for f in png_files]
images[0].save("output.pdf", "PDF", save_all=True,
               append_images=images[1:], resolution=300)

Key Constraints

  • Auth tokens are unique per inspection page load — must extract fresh for each plan
  • Different plans may have different base resolutions (tw×th)
  • Canvas extraction at any zoom level captures only visible tiles
  • Fit-to-window gives full plan but at base 96 DPI resolution
  • Direct getInspectionPlanImage URL requires Daeja auth headers
  • Scale factor choice: 6x is a safe default; higher may hit server limits

Common Issues

  1. Modal backdrop: Close with eval on #systemMsgModal button
  2. Autocomplete 503: Transient server issue; retry in a few minutes
  3. Session lost on navigation: Use history.back() or tab switching, never goto to internal URLs
  4. "Lost connection to the server": Daeja viewer UI issue only; tile API still works — proceed with HD tile download method

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决香港建筑图纸查询和下载的实际痛点,具有明确的专业用途
  • 支持完整的登录流程、地址搜索、图纸列表导航和高分辨率下载
  • 提供详细的异常处理和最佳实践指导
Trigger Precision85/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰
  • 明确指定了使用场景和工具要求
Structure and Standards88/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,文档结构良好
  • 提供了详细的代码示例和约束说明
Execution Reliability82/100

Highlights

  • 工具来源明确,参数正确
  • 覆盖主要异常,不可逆操作有确认机制
  • 提供了详细的错误处理和重试策略
Evidence Verifiability (mean of the first four)87/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • bravo.bd.gov.hk

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Use `playwright-cli` for browser automation. `agent-browser` is NOT suitable for BRAVO (element interaction issues). Ask the user for BRAVO credentials if not already provided.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.