Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/database/orm-code-generator/skills/generating-orm-code

generating-orm-code

Verified

Execute use when you need to work with ORM code generation. This skill provides ORM model and code generation with comprehensive guidance and automation. Trigger with phrases like "generate ORM models", "create entity classes", or "scaffold database models".

FileKindSize
SKILL.mdskill md6.6 KB
assets/README.mdmarkdown235 B
references/README.mdmarkdown61 B
scripts/README.mdmarkdown459 B
scripts/generate_model.pyexecutablescript3.6 KB
scripts/generate_schema.pyexecutablescript3.5 KB

scripts/generate_schema.py

View on GitHub
#!/usr/bin/env python3
"""
orm-code-generator - Generator Script
Generates database schema based on an ORM model definition.
Generated: 2025-12-10 03:48:17
"""

import json
import argparse
from pathlib import Path
from datetime import datetime
from typing import Dict


class Generator:
    def __init__(self, config: Dict):
        self.config = config
        self.output_dir = Path(config.get("output", "./output"))
        self.output_dir.mkdir(parents=True, exist_ok=True)

    def generate_markdown(self, title: str, content: str) -> Path:
        """Generate markdown document."""
        filename = f"{title.lower().replace(' ', '_')}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.md"
        file_path = self.output_dir / filename

        md_content = f"""# {title}

Generated by orm-code-generator
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}

## Overview
{content}

## Configuration
```json
{json.dumps(self.config, indent=2)}
```

## Category
database

## Plugin
orm-code-generator
"""

        file_path.write_text(md_content)
        return file_path

    def generate_json(self, data: Dict) -> Path:
        """Generate JSON output."""
        filename = f"output_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
        file_path = self.output_dir / filename

        output_data = {
            "generated_by": "orm-code-generator",
            "timestamp": datetime.now().isoformat(),
            "category": "database",
            "plugin": "orm-code-generator",
            "data": data,
            "config": self.config,
        }

        with open(file_path, "w") as f:
            json.dump(output_data, f, indent=2)

        return file_path

    def generate_script(self, name: str, template: str) -> Path:
        """Generate executable script."""
        filename = f"{name}.sh"
        file_path = self.output_dir / filename

        script_content = f"""#!/bin/bash
# Generated by orm-code-generator
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}

set -e  # Exit on error

echo "🚀 Running {name}..."

# Template content
{template}

echo "✅ Completed successfully"
"""

        file_path.write_text(script_content)
        file_path.chmod(0o755)  # Make executable
        return file_path


def main():
    parser = argparse.ArgumentParser(description="Generates database schema based on an ORM model definition.")
    parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
    parser.add_argument("--output", "-o", default="./output", help="Output directory")
    parser.add_argument("--config", "-c", help="Configuration file")
    parser.add_argument("--title", default="orm-code-generator Output")
    parser.add_argument("--content", help="Content to include")

    args = parser.parse_args()

    config = {"output": args.output}
    if args.config and Path(args.config).exists():
        with open(args.config) as f:
            config.update(json.load(f))

    generator = Generator(config)

    print(f"🔧 Generating {args.type} output...")

    if args.type == "markdown":
        output_file = generator.generate_markdown(args.title, args.content or "Generated content")
    elif args.type == "json":
        output_file = generator.generate_json({"title": args.title, "content": args.content})
    else:  # script
        output_file = generator.generate_script(
            args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
        )

    print(f"✅ Generated: {output_file}")
    return 0


if __name__ == "__main__":
    import sys

    sys.exit(main())
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall