AgentSkillsCN

db-verify

验证数据库是否存在,并确保其已正确初始化。返回状态信息,标明数据库是否已准备好投入使用。在执行任何假定数据库已存在的操作之前,可选用此方法。

SKILL.md
--- frontmatter
name: db-verify
description: Verify that the database exists and is properly initialized. Returns status indicating whether the database is ready for use. Use this before any operation that assumes the database exists.

Verify Database

Check that the database directory and index file exist and are properly structured.

Use TaskCreate to create a task for each step below, then execute them in order. Mark each task in_progress when starting and completed when done using TaskUpdate.

Step 1: Check Database Directory

Use the Bash tool to check if the database/ directory exists:

bash
[ -d "database" ] && echo "EXISTS" || echo "MISSING"

If the output is "MISSING":

  • Report to the caller: "Database not initialized. Use the db-init skill to create it."
  • STOP execution. Do not proceed to further steps.

Step 2: Check Index File

Use the Read tool to read database/index.md.

If the file does not exist or returns an error:

  • Report to the caller: "Database index is missing. Use the db-init skill to reinitialize."
  • STOP execution. Do not proceed to further steps.

Step 3: Validate Index Structure

Verify the index file contains the expected structure:

  • Should have a # Database Index heading
  • Should have a ## Documents section

If the structure is malformed:

  • Report to the caller: "Database index is malformed. Consider reinitializing with db-init."
  • STOP execution.

Step 4: Report Success

If all checks pass, report to the caller: "Database verified and ready."