← Back to Skills Marketplace
gitoftom

database-doc-generator

by fqy_hjy · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
193
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install database-doc-generator
Description
Generate professional database structure documentation from PostgreSQL databases. Creates Excel files with table schemas, column details, and formatting. Use...
README (SKILL.md)

\r \r

Database Documentation Generator\r

\r This skill generates professional database structure documentation from PostgreSQL databases. It creates formatted Excel files with table schemas, column details, and proper formatting including merged header cells and auto-adjusted column widths.\r \r

⚠️ SECURITY WARNING\r

\r IMPORTANT SECURITY NOTES:\r \r

  1. Never commit real database credentials to source control\r
  2. Use environment variables or secure configuration files for credentials\r
  3. Review all database connections before use\r
  4. This skill requires network access to PostgreSQL databases\r
  5. Install dependencies manually - automatic installation is disabled for security\r \r

Security-First Installation & Usage\r

\r

Installation Method: Instruction-Only (No Auto-Download)\r

\r This skill uses a secure instruction-only installation model:\r

  • ✅ No automatic code downloads\r
  • ✅ No archive extraction\r
  • ✅ No arbitrary URL fetching\r
  • ✅ No elevated permissions required\r \r

Step 1: Secure Environment Setup\r

\r

# Method A: Virtual Environment (RECOMMENDED)\r
python -m venv venv-database-docs\r
source venv-database-docs/bin/activate  # On Windows: venv-database-docs\Scripts\activate\r
\r
# Method B: With pinned versions for security\r
pip install -r requirements.txt\r
\r
# Method C: Manual installation\r
pip install psycopg2-binary==2.9.9 pandas==2.2.1 openpyxl==3.1.2\r
```\r
\r
### Step 2: Security Validation (MANDATORY)\r
\r
```bash\r
# Run comprehensive security check\r
python scripts/security_check.py\r
\r
# Expected output: "SECURITY CHECK PASSED"\r
# If warnings appear, review and fix before proceeding\r
```\r
\r
### Step 2: Set Secure Credentials\r
**NEVER hardcode credentials. Use environment variables:**\r
\r
```bash\r
# Set credentials via environment variables (RECOMMENDED)\r
export DB_HOST=your-actual-host\r
export DB_PORT=5432\r
export DB_NAME=your-actual-database\r
export DB_USER=your-actual-username\r
export DB_PASSWORD=your-actual-EXAMPLE_PASSWORD\r
\r
# Optional: Enable SSL for secure connections\r
export DB_SSLMODE=require\r
```\r
\r
### Step 3: Generate Documentation Securely\r
```bash\r
# Method A: Using environment variables (most secure)\r
python scripts/generate_database_doc.py\r
\r
# Method B: With command-line arguments\r
python scripts/generate_database_doc.py \\r
  --host your-host \\r
  --database your-db \\r
  --user your-user \\r
  --EXAMPLE_PASSWORD your-EXAMPLE_PASSWORD\r
\r
# Method C: Using secure config file\r
python scripts/generate_database_doc.py --config /path/to/secure_config.json\r
```\r
\r
### Step 4: Verify Output Security\r
```bash\r
# Check file permissions\r
ls -la output.xlsx\r
\r
# Set secure permissions (Unix)\r
chmod 600 output.xlsx\r
```\r
\r
## Quick Start (Simplified)\r
\r
1. **Install dependencies**:\r
   ```bash\r
   pip install psycopg2-binary pandas openpyxl\r
   ```\r
\r
2. **Set environment variables**:\r
   ```bash\r
   export DB_HOST=localhost DB_NAME=mydb DB_USER=EXAMPLE_USER DB_PASSWORD=secret\r
   ```\r
\r
3. **Run security check**:\r
   ```bash\r
   python scripts/security_check.py\r
   ```\r
\r
4. **Generate documentation**:\r
   ```bash\r
   python scripts/generate_database_doc.py\r
   ```\r
\r
5. **The skill will**:\r
   - Validate security configuration\r
   - Connect to the database (with SSL if configured)\r
   - Extract table structure information (read-only)\r
   - Generate formatted Excel documentation\r
   - Apply proper formatting\r
   - Set secure file permissions when possible\r
\r
## Database Connection\r
\r
The skill supports PostgreSQL databases. Provide connection details in this format:\r
\r
```python\r
{\r
    'host': 'your-host',\r
    'port': 5432,\r
    'database': 'your-database',\r
    'user': 'your-username',\r
    'EXAMPLE_PASSWORD': 'your-EXAMPLE_PASSWORD'\r
}\r
```\r
\r
## Output Features\r
\r
The generated Excel file includes:\r
\r
1. **Professional Formatting**:\r
   - Each table on a separate worksheet\r
   - Table name as merged header cell above columns\r
   - Auto-adjusted column widths for readability\r
   - Clear column headers\r
\r
2. **Column Information**:\r
   - Column name (代码)\r
   - Data type (数据类型)\r
   - Length/precision (长度)\r
   - Mandatory flag (强制)\r
   - Description/comment (注释)\r
\r
3. **Default Values**:\r
   - varchar/character varying: Default length 2000\r
   - timestamp/timestamptz/time/timetz: Default precision 6\r
\r
## Usage Examples\r
\r
### Example 1: Generate documentation for specific tables\r
```\r
Generate database documentation for tables: users, orders, products\r
Host: EXAMPLE_HOST, Port: 5432, Database: mydb\r
Username: EXAMPLE_USER, Password: EXAMPLE_PASSWORD\r
```\r
\r
### Example 2: Generate documentation for all tables\r
```\r
Create database structure documentation for all tables\r
Connection: localhost:5432/mydb\r
Credentials: EXAMPLE_USER/EXAMPLE_PASSWORD\r
```\r
\r
### Example 3: Export schema with custom output path\r
```\r
Export database schema to D:/docs/database.xlsx\r
Tables: customers, invoices, payments\r
Connection details: [provide details]\r
```\r
\r
## Advanced Features\r
\r
### Custom Table Selection\r
- Specify individual table names\r
- Use wildcards or patterns (via SQL WHERE clause)\r
- Omit to include all tables\r
\r
### Output Customization\r
- Default output: `EXAMPLE_PATH/database_documentation.xlsx`\r
- Can specify custom output path\r
- Creates directory if it doesn't exist\r
\r
### Error Handling\r
- Validates database connection\r
- Handles missing tables gracefully\r
- Provides detailed error messages\r
- Continues processing other tables if one fails\r
\r
## Scripts\r
\r
The skill includes Python scripts for database documentation generation. See [scripts/](scripts/) for implementation details.\r
\r
## References\r
\r
For detailed SQL queries and formatting options, see [references/](references/).\r
\r
## Notes\r
\r
- Only executes SELECT queries (no modifications)\r
- Respects database permissions\r
- Handles large schemas efficiently\r
- Preserves data integrity
Usage Guidance
This package appears to be what it says: a read-only PostgreSQL-to-Excel documentation generator. Before installing/using it: 1) Review scripts/security_check.py and run it locally to see what checks it performs. 2) Run everything in an isolated environment (venv, container) and install pinned dependencies manually. 3) Provide database credentials via a least-privilege, read-only account and/or a secrets manager (do not hardcode). 4) Inspect scripts (generate_database_doc.py, quick_generate.py, security_check.py, clean_credentials.py) yourself — the cleanup script creates .bak files and can delete them interactively, so review backups before deletion. 5) Restrict output file permissions (chmod 600) and store outputs in secure locations. 6) Because the registry metadata doesn't list required env vars, treat DB credentials as required at runtime even though the registry shows none. If you need higher assurance, request the full contents of security_check.py and any truncated files to review their behavior.
Capability Analysis
Type: OpenClaw Skill Name: database-doc-generator Version: 1.0.1 The database-doc-generator skill is a well-structured tool for exporting PostgreSQL schemas to Excel. It demonstrates an exceptionally high level of security awareness, including dedicated scripts for credential scrubbing (clean_credentials.py), security validation (security_check.py), and extensive documentation on credential hygiene and emergency response. The core logic in generate_database_doc.py uses standard, parameterized queries to fetch metadata from information_schema and lacks any indicators of data exfiltration, unauthorized network calls, or malicious execution.
Capability Assessment
Purpose & Capability
The skill's name/description (PostgreSQL -> Excel docs) matches the included scripts (connect to PostgreSQL, query information_schema, produce formatted Excel). One minor mismatch: registry metadata declares no required environment variables, but the SKILL.md and scripts expect DB credentials via environment variables or a config file. This is a metadata omission (the skill legitimately needs DB credentials at runtime).
Instruction Scope
The SKILL.md instructions are focused and bounded: install dependencies manually, run a security_check, set DB credentials via env or secure config, run the generator scripts. The scripts operate on local DB connections and local files. The only file-modifying behavior called out is the credential-cleanup helper which writes .bak files and optionally deletes them — that behavior is documented and interactive.
Install Mechanism
No automatic install/spec is included (instruction-only install). Dependencies must be installed manually into an isolated environment (venv/Docker). This is low-risk and consistent with the security-first documentation. The repository does include Python scripts that will be executed by the user.
Credentials
The skill requires database credentials to function (DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD or a secure config file) — the README and SKILL.md correctly instruct the user to provide these. However the registry's 'required env vars' field is empty; the runtime requirement for DB credentials should be declared in metadata. No unrelated secrets or extra service credentials are requested by the code.
Persistence & Privilege
The skill does not request permanent/always-on presence and uses no elevated system privileges. It does not modify other skills or system-wide settings. The only noteworthy persistence behavior is creation of output Excel files and optional .bak backup files from the cleanup script; those are documented and under user control.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install database-doc-generator
  3. After installation, invoke the skill by name or use /database-doc-generator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
**Security-focused update with new scripts and installation guidance** - Major security upgrades: explicit warnings, secure credential handling, and a dedicated security check script. - Added 27 new files including installation/security docs, pre-commit config, secret baseline, and Python scripts for credential cleaning and security validation. - Installation and setup instructions now emphasize manual dependency management, use of environment variables, and disabling of any auto-downloads. - Environment variable and config file usage strongly encouraged for credentials; hardcoding discouraged. - Includes new guidance for setting file permissions on output files to prevent unauthorized access. - Documentation thoroughly updated to reflect and enforce a security-first workflow.
v1.0.0
Initial release of database-doc-generator. - Generates professional Excel documentation of PostgreSQL database schemas. - Exports table schemas, column details, and descriptions with clear formatting. - Supports custom table selection and custom output paths. - Handles connection validation, missing tables, and continues processing on errors. - Designed for efficient documentation and large schema support.
Metadata
Slug database-doc-generator
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is database-doc-generator?

Generate professional database structure documentation from PostgreSQL databases. Creates Excel files with table schemas, column details, and formatting. Use... It is an AI Agent Skill for Claude Code / OpenClaw, with 193 downloads so far.

How do I install database-doc-generator?

Run "/install database-doc-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is database-doc-generator free?

Yes, database-doc-generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does database-doc-generator support?

database-doc-generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created database-doc-generator?

It is built and maintained by fqy_hjy (@gitoftom); the current version is v1.0.1.

💬 Comments