Claude マルチエージェント システムによる SQL データベースの完全なデータベース スキーマ生成

上級

これは自動化ワークフローで、31個のノードを含みます。主にIf, Set, Form, Postgres, FormTriggerなどのノードを使用。 Claudeマルチエージェントシステムを使ってSQLデータベースの完全なデータベーススキーマ生成

前提条件
  • PostgreSQLデータベース接続情報
  • Anthropic API Key

カテゴリー

-
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "nodes": [
    {
      "id": "6372d515-3314-4ca8-acf4-462fb4e2fbb1",
      "name": "変数の初期化",
      "type": "n8n-nodes-base.set",
      "position": [
        -832,
        -3104
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "init_iteration",
              "name": "iteration_count",
              "type": "number",
              "value": 0
            },
            {
              "id": "init_feedback",
              "name": "previous_feedback",
              "type": "string",
              "value": "="
            },
            {
              "id": "form_data",
              "name": "form_data",
              "type": "object",
              "value": "={{ $json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e102d0ff-e176-49b5-a999-a3ccf2fb7f42",
      "name": "アーキテクトモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -480,
        -2880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "topP": 0.9,
          "temperature": 0.3
        }
      },
      "credentials": {
        "anthropicApi": {
          "id": "rFsH3A7ko19Tb8xL",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "1648a9d6-a261-45b8-8dc9-516fd62a7a3e",
      "name": "レビュアーモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -64,
        -2944
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "topP": 0.85,
          "temperature": 0.1
        }
      },
      "credentials": {
        "anthropicApi": {
          "id": "rFsH3A7ko19Tb8xL",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "87d374f8-babb-41f5-ac5c-f45be51df90c",
      "name": "オプティマイザーモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        320,
        -2928
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "topP": 0.95,
          "temperature": 0.5
        }
      },
      "credentials": {
        "anthropicApi": {
          "id": "rFsH3A7ko19Tb8xL",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "a5028fd9-b726-413b-86aa-9f3735395bb9",
      "name": "エージェント1: データベースアーキテクト",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -544,
        -3120
      ],
      "parameters": {
        "text": "=Database Requirements:\n- What they're building: {{ $json.form_data['What are you building?'] }}\n- Database Technology: {{ $json.form_data['Database Technology'] }}\n- Industry: {{ $json.form_data['Industry/Niche'] }}\n- Data to track: {{ $json.form_data['What data do you need to track?'] }}\n- Team size: {{ $json.form_data['Team Size'] }}\n- Expected scale: {{ $json.form_data['Expected Scale'] }}\n- Key workflows: {{ $json.form_data['Key Workflows'] }}\n- Integrations: {{ $json.form_data['Any integrations needed?'] }}\n- Special requirements: {{ $json.form_data['Special Requirements'] }}\n\n{{ $json.previous_feedback ? '⚠️ PREVIOUS DESIGN HAD ISSUES - ITERATION ' + ($json.iteration_count + 1) + '/3:\\n\\nPrevious Feedback:\\n' + $json.previous_feedback + '\\n\\nPlease redesign the schema addressing ALL the concerns mentioned above. Focus especially on CRITICAL and HIGH priority items.\\n\\n' : '' }}\n\nPlease design a complete {{ $json.form_data['Database Technology'] }} database schema for this use case. Output your design as structured JSON.",
        "options": {
          "systemMessage": "=You are a senior {{ $json.form_data['Database Technology'] }} database architect with 15+ years experience.\nYou design production-grade schemas that are scalable, normalized, and follow best practices. You consider performance, indexing, and future growth.\n\nOutput your design as structured JSON with:\n- tables: Array of table objects with:\n  - name: string\n  - columns: Array of {name, type, constraints, description}\n  - primary_key: string or array\n  - indexes: Array of {name, columns, type}\n  - foreign_keys: Array of {column, references_table, references_column}\n- enums: Array of {name, values}\n- extensions: Array of extension names needed\n- relationships: Description of how tables relate\n- reasoning: Explanation for key design decisions\n\nBe thorough and production-ready. Consider the scale and requirements carefully."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "58921f8a-0b6f-460b-8202-69327c364d45",
      "name": "エージェント2: スキーマレビュアー",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -144,
        -3120
      ],
      "parameters": {
        "text": "=Original Requirements:\n{{ JSON.stringify($('Initialize Variables').item.json.form_data, null, 2) }}\n\nProposed Schema from Agent 1:\n{{ $('Agent 1: Database Architect').item.json.output }}\n\nPlease conduct a thorough review of this database schema design. Check for issues in normalization, indexing, data types, constraints, performance, scalability, and security.\n\nOutput structured feedback with severity levels: CRITICAL, HIGH, MEDIUM, LOW",
        "options": {
          "systemMessage": "You are a {{ $('Initialize Variables').item.json.form_data['Database Technology'] }} code reviewer and database optimization expert.\nYour job is to find issues, enforce best practices, and ensure production-readiness.\n\nReview checklist:\n- Normalization (3NF minimum, appropriate denormalization)\n- Indexing strategy (missing indexes? over-indexing?)\n- Data types (appropriate choices for the database type)\n- Constraints (missing NOT NULL? need CHECK constraints?)\n- Performance (N+1 query risks? missing composite indexes?)\n- Scalability (will this work at 10x, 100x scale?)\n- Security (sensitive data? need encryption? row-level security?)\n- Missing common fields (created_at, updated_at, soft deletes)\n- Relationships properly defined\n\nOutput structured feedback in this format:\n\nCRITICAL Issues:\n- [Issue 1]\n- [Issue 2]\n\nHIGH Priority:\n- [Issue 1]\n\nMEDIUM Priority:\n- [Issue 1]\n\nLOW Priority / Suggestions:\n- [Issue 1]\n\nPositive Aspects:\n- [Good thing 1]\n\nBe thorough but fair. If the design is solid, say so."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "4e2a9518-4587-4ffe-a4a0-3f771019f22e",
      "name": "エージェント3: オプティマイザー&スコアラー",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        272,
        -3120
      ],
      "parameters": {
        "text": "=Original Requirements:\n{{ JSON.stringify($('Initialize Variables').item.json.form_data, null, 2) }}\n\nProposed Schema:\n{{ $('Agent 1: Database Architect').item.json.output }}\n\nReview Feedback:\n{{ $('Agent 2: Schema Reviewer').item.json.output }}\n\nPlease:\n1. Apply final polish and optimizations to the schema\n2. Add advanced features (materialized views, helper functions, useful views)\n3. Provide monitoring recommendations\n4. Create a comprehensive score card\n5. Generate implementation guidance\n\nScore each dimension 0-10 with justification. Be honest but constructive.",
        "options": {
          "systemMessage": "You are a {{ $('Initialize Variables').item.json.form_data['Database Technology'] }} performance optimizer and database strategist.\nApply final polish, add advanced features, and score the design holistically.\n\nAdd:\n- Performance optimizations (materialized views, covering indexes, partitioning if needed)\n- Developer experience improvements (useful views, helper functions)\n- Monitoring recommendations (what to track in production)\n- Migration strategy (how to deploy safely)\n- Backup and disaster recovery considerations\n\nCreate a comprehensive score card:\n\n📊 DATABASE ARCHITECTURE SCORE\n\nOverall Grade: [A+, A, A-, B+, B, B-, C+, C, C-, D, F] ([score]/100)\n\nDetailed Scores:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nSchema Design: [X]/10\n[Brief justification]\n\nPerformance: [X]/10\n[Brief justification]\n\nScalability: [X]/10\n[Brief justification]\n\nDeveloper Experience: [X]/10\n[Brief justification]\n\nProduction Readiness: [X]/10\n[Brief justification]\n\nSecurity: [X]/10\n[Brief justification]\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n💪 Key Strengths:\n• [Strength 1]\n• [Strength 2]\n• [Strength 3]\n\n⚠️ Recommended Improvements:\n• [Improvement 1]\n• [Improvement 2]\n\n🚀 Next Steps:\n1. [Step 1]\n2. [Step 2]\n3. [Step 3]\n\nScore fairly but be honest. Grade A/B means production-ready, C means needs work, D/F means major issues."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "0b898ea5-9799-4b59-b26b-0b0521a8e2c6",
      "name": "イテレーションの追跡",
      "type": "n8n-nodes-base.set",
      "position": [
        608,
        -2896
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "iteration",
              "name": "iteration_count",
              "type": "number",
              "value": "={{ $('Initialize Variables').item.json.iteration_count + 1 }}"
            },
            {
              "id": "feedback",
              "name": "previous_feedback",
              "type": "string",
              "value": "={{ $('Agent 3: Optimizer & Scorer').item.json.output }}"
            },
            {
              "id": "form_data_passthrough",
              "name": "form_data",
              "type": "object",
              "value": "={{ $('Initialize Variables').item.json.form_data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "21ea3c45-a89d-4f45-b044-958be52b13be",
      "name": "SQL ジェネレーターモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        1248,
        -2944
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "topP": 0.85,
          "temperature": 0.2
        }
      },
      "credentials": {
        "anthropicApi": {
          "id": "rFsH3A7ko19Tb8xL",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "739b10a8-f533-403f-b71f-9095d982b669",
      "name": "エージェント4: SQL スクリプト生成",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1232,
        -3200
      ],
      "parameters": {
        "text": "=Database Technology: {{ $('Initialize Variables').item.json.form_data['Database Technology'] }}\n\nFinal Approved Schema:\n{{ $('Agent 1: Database Architect').item.json.output }}\n\nOptimizations and Enhancements:\n{{ $('Agent 3: Optimizer & Scorer').item.json.output }}\n\nPlease generate a complete, production-ready SQL migration script for {{ $('Initialize Variables').item.json.form_data['Database Technology'] }}.\n\nOutput ONLY the SQL script, no markdown formatting, no additional commentary.",
        "options": {
          "systemMessage": "=You are a {{ $('Initialize Variables').item.json.form_data['Database Technology'] }} SQL script generator.\n\nTake the database schema design and convert it into a complete, production-ready SQL migration script.\n\nYour output must:\n- Start with proper transaction handling (BEGIN; ... COMMIT;)\n- Include all necessary extensions (for PostgreSQL)\n- Create ENUMs before tables that use them\n- Create tables in correct dependency order (referenced tables first)\n- Add all indexes after table creation\n- Add all constraints and triggers\n- Include helpful comments explaining complex parts\n- Be idempotent where possible (IF NOT EXISTS clauses)\n- End with a commented-out rollback script\n\nFormat:\n-- ============================================\n-- Database Migration Script\n-- Generated: [timestamp]\n-- Database: {{ $('Initialize Variables').item.json.form_data['Database Technology'] }}\n-- ============================================\n\nBEGIN;\n\n[Your SQL here]\n\nCOMMIT;\n\n-- ============================================\n-- ROLLBACK SCRIPT (commented out)\n-- ============================================\n-- BEGIN;\n-- [DROP statements in reverse order]\n-- COMMIT;\n\nOutput ONLY the SQL script. No markdown code blocks, no explanations."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "509218a4-3447-49f9-a8bc-b789ba3432ec",
      "name": "成功レスポンス",
      "type": "n8n-nodes-base.set",
      "position": [
        2320,
        -3312
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "status",
              "name": "execution_status",
              "type": "string",
              "value": "success"
            },
            {
              "id": "message",
              "name": "message",
              "type": "string",
              "value": "✅ Database created successfully!"
            },
            {
              "id": "sql_script",
              "name": "sql_script",
              "type": "string",
              "value": "={{ $('Agent 4: Generate SQL Script').item.json.output }}"
            },
            {
              "id": "schema_design",
              "name": "schema_design",
              "type": "string",
              "value": "={{ $('Agent 1: Database Architect').item.json.output }}"
            },
            {
              "id": "review_feedback",
              "name": "review_feedback",
              "type": "string",
              "value": "={{ $('Agent 2: Schema Reviewer').item.json.output }}"
            },
            {
              "id": "score_card",
              "name": "score_card",
              "type": "string",
              "value": "={{ $('Agent 3: Optimizer & Scorer').item.json.output }}"
            },
            {
              "id": "iterations",
              "name": "iterations_needed",
              "type": "number",
              "value": "={{ $('Initialize Variables').item.json.iteration_count }}"
            },
            {
              "id": "database_tech",
              "name": "database_technology",
              "type": "string",
              "value": "={{ $('Initialize Variables').item.json.form_data['Database Technology'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fa2b059f-7347-4c81-a194-4e7b02e0a033",
      "name": "エラーレスポンス",
      "type": "n8n-nodes-base.set",
      "position": [
        2320,
        -3088
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "status",
              "name": "execution_status",
              "type": "string",
              "value": "failed"
            },
            {
              "id": "message",
              "name": "message",
              "type": "string",
              "value": "⚠️ SQL script generated but execution failed. You can still use the script manually."
            },
            {
              "id": "error",
              "name": "sql_error",
              "type": "string",
              "value": "={{ $('Execute SQL in PostgreSQL').item.json.error }}"
            },
            {
              "id": "sql_script",
              "name": "sql_script",
              "type": "string",
              "value": "={{ $('Agent 4: Generate SQL Script').item.json.output }}"
            },
            {
              "id": "schema_design",
              "name": "schema_design",
              "type": "string",
              "value": "={{ $('Agent 1: Database Architect').item.json.output }}"
            },
            {
              "id": "review_feedback",
              "name": "review_feedback",
              "type": "string",
              "value": "={{ $('Agent 2: Schema Reviewer').item.json.output }}"
            },
            {
              "id": "score_card",
              "name": "score_card",
              "type": "string",
              "value": "={{ $('Agent 3: Optimizer & Scorer').item.json.output }}"
            },
            {
              "id": "iterations",
              "name": "iterations_needed",
              "type": "number",
              "value": "={{ $('Initialize Variables').item.json.iteration_count }}"
            },
            {
              "id": "database_tech",
              "name": "database_technology",
              "type": "string",
              "value": "={{ $('Initialize Variables').item.json.form_data['Database Technology'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0b8ee65f-e057-4e2e-93c4-859797612c93",
      "name": "最大イテレーション回数到達",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        -3024
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "max_iterations_msg",
              "name": "message",
              "type": "string",
              "value": "⚠️ Reached maximum iterations (3). Proceeding with best available design."
            },
            {
              "id": "passthrough_iteration",
              "name": "iteration_count",
              "type": "number",
              "value": "={{ $json.iteration_count }}"
            },
            {
              "id": "passthrough_form",
              "name": "form_data",
              "type": "object",
              "value": "={{ $json.form_data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ccef25b6-60e3-408e-8d2f-dbc9d907bcc4",
      "name": "スコアはAまたはBか?",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        -3168
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fdbb64c0-d9c9-4568-8aec-2e7679ae846f",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "Overall Grade: [AB][+-]?"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b25d8d4c-46dc-4a65-99a3-3c03a4ba819c",
      "name": "リトライ可能か?",
      "type": "n8n-nodes-base.if",
      "position": [
        832,
        -2848
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fdbb64c0-d9c9-4568-8aec-2e7679ae846f",
              "operator": {
                "type": "number",
                "operation": "lte"
              },
              "leftValue": "={{ $json.iteration_count }}",
              "rightValue": 3
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c8d4da4b-62af-4d22-8bab-ddfca874ed72",
      "name": "フォーム",
      "type": "n8n-nodes-base.form",
      "position": [
        2608,
        -3184
      ],
      "webhookId": "0ef42fe9-17ab-4887-b49b-e889d2056d87",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "SQL Creation Finished",
        "completionMessage": "={{ $json }}"
      },
      "typeVersion": 2.3
    },
    {
      "id": "e5fbeabe-a5de-492e-8cbe-6849882db5fc",
      "name": "PostgreSQL で SQL を実行",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        2000,
        -3200
      ],
      "parameters": {
        "query": "{{ $json.output }}",
        "options": {},
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "id": "pYPv5XduSxmDtomy",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "146b4b49-a91a-4280-8e2e-74f54f40c9ac",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        -3104
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 256,
        "content": "## 📝 Form Intake\n**User fills database requirements**\n\n⚙️ **Customization Options:**\n- Add more fields for specific industries\n- Add file upload for existing schema\n- Add budget field for pricing tiers\n- Collect company name for personalization\n\n💡 **Tip:** The more detailed the input, the better the AI agents perform!"
      },
      "typeVersion": 1
    },
    {
      "id": "c707c920-7fda-4fb0-a175-e6ab1aed64f8",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -3424
      ],
      "parameters": {
        "color": 4,
        "width": 352,
        "height": 240,
        "content": "## 🔧 Setup Phase\n**Prepares data for agent pipeline**\n\n⚙️ **Customization:**\n- Store user data in CRM here\n- Log to analytics (Mixpanel/Segment)\n- Add user identification/tracking\n\n🎯 **Purpose:** Enables retry loop with context"
      },
      "typeVersion": 1
    },
    {
      "id": "b375bb08-5363-463d-b34a-76e98eff5443",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -3488
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 320,
        "content": "## 🤖 Agent 1: Architect\n**Creates initial schema design**\n\n⚙️ **Model Config:**\n- Temp: 0.3 (creative but consistent)\n- Max tokens: 4000\n\n🎨 **Customization:**\n- Switch to GPT-4 for cost savings\n- Increase temperature for creative solutions\n- Add industry-specific templates\n\n📊 **Expected time:** 30-45 seconds"
      },
      "typeVersion": 1
    },
    {
      "id": "3d373fbc-87de-42c2-82e1-536bc7550cef",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -3488
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 320,
        "content": "## 🤖 Agent 2: Reviewer\n**Quality control & validation**\n\n⚙️ **Model Config:**\n- Temp: 0.1 (strict & analytical)\n- Max tokens: 3000\n\n🎨 **Customization:**\n- Add compliance checks (GDPR, HIPAA)\n- Add industry-specific validations\n- Integrate with linting tools\n\n⚡ **Expected time:** 20-30 seconds"
      },
      "typeVersion": 1
    },
    {
      "id": "28deacd5-06af-4ec2-b77b-823354b9e306",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -3488
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 320,
        "content": "## 🤖 Agent 3: Optimizer\n**Final polish & scoring**\n\n⚙️ **Model Config:**\n- Temp: 0.5 (balanced creativity)\n- Max tokens: 3500\n\n🎨 **Customization:**\n- Adjust scoring criteria\n- Add performance benchmarking\n- Custom grading rubrics per industry\n\n🎯 **Outputs:** Score card + enhancements"
      },
      "typeVersion": 1
    },
    {
      "id": "b71dce06-6436-446f-8d77-b0f5c46e87e1",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -3536
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 336,
        "content": "## 🔄 Quality Gate\n**Ensures high-quality output**\n\n⚙️ **Current Logic:**\n- A/B grades → Proceed ✅\n- C/D/F grades → Retry (max 3x)\n\n🎨 **Customization:**\n- Change threshold (accept C+?)\n- Add manual approval step\n- Send low scores to human review\n- Adjust max retries (1-5)\n\n💰 **Trade-off:** More retries = higher cost but better quality"
      },
      "typeVersion": 1
    },
    {
      "id": "2a05b10e-906c-4be7-919e-b22d74ac15cb",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -2720
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 304,
        "content": "## 🔁 Retry Loop\n**Iterative improvement system**\n\n⚙️ **Current:** Max 3 attempts\n\n🎨 **Customization:**\n- Increase max retries for complex projects\n- Add different agents for retries\n- Implement escalation (retry with Opus)\n- Track retry metrics for optimization\n\n📊 **Insight:** Most designs pass in 1-2 iterations"
      },
      "typeVersion": 1
    },
    {
      "id": "881ff4d6-e9ad-4d12-8c88-9b742288161f",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -3568
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 336,
        "content": "## 🤖 Agent 4: SQL Generator\n**Converts schema to executable SQL**\n\n⚙️ **Model Config:**\n- Temp: 0.2 (precision critical)\n- Max tokens: 4000\n\n🎨 **Customization:**\n- Add migration versioning (Flyway/Liquibase)\n- Generate ORM models (Prisma schema)\n- Add seed data generation\n- Support multiple SQL dialects\n\n💾 **Output:** Production-ready SQL script"
      },
      "typeVersion": 1
    },
    {
      "id": "1bb0fab6-680e-4dad-9d94-4563b3752987",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        -3696
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 336,
        "content": "## ✅ Execution Validation\n**Handles success & failures gracefully**\n\n⚙️ **Current Behavior:**\n- Success → Full response\n- Failure → Script + error details\n\n🎨 **Customization:**\n- Retry failed SQL automatically\n- Send errors to monitoring (Sentry)\n- Trigger webhook on success\n- Add rollback capability\n\n🎯 **User always gets usable output**"
      },
      "typeVersion": 1
    },
    {
      "id": "fd648a76-f6c8-460b-92d4-b00493d98d05",
      "name": "付箋9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        -3616
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 480,
        "content": "## 🚀 Workflow Overview\n**AI Database Architect - Multi-Agent System**\n\n📊 **Performance:**\n- Average time: 60-90 seconds\n- Success rate: ~85% first attempt\n- Cost per run: ~$0.15-0.30\n\n🎯 **Conversion Strategy:**\n1. Free: Blueprint + Score\n2. Paid: Implementation + 3 automations\n3. Enterprise: Full setup + optimization\n\n📈 **Optimization Ideas:**\n- A/B test agent prompts\n- Cache common patterns\n- Pre-built templates for industries\n- Parallel agent execution\n\n💡 **Track:** Completion rate, avg score, retry count"
      },
      "typeVersion": 1
    },
    {
      "id": "7febe33c-181c-4c01-9900-71c8ff27249c",
      "name": "付箋10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        -2992
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 176,
        "content": "## Query Execute\n\nIf you are using **PostgreSQL** this will automatically run the script on your database"
      },
      "typeVersion": 1
    },
    {
      "id": "d289f031-8814-4478-8993-00d5c09c03f1",
      "name": "フォーム送信",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1120,
        -3024
      ],
      "webhookId": "7da47f69-23f9-49e0-8de8-3af4adce1db3",
      "parameters": {
        "options": {},
        "formTitle": "AI Database Architect - By Evervise",
        "formFields": {
          "values": [
            {
              "fieldType": "textarea",
              "fieldLabel": "What are you building?",
              "placeholder": "e.g. CRM for real estate agents",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Database Technology",
              "fieldOptions": {
                "values": [
                  {
                    "option": "PostgreSQL"
                  },
                  {
                    "option": "MySQL"
                  },
                  {
                    "option": "MSSQL"
                  },
                  {
                    "option": "MariaDB"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Industry/Niche",
              "placeholder": "e.g. Real Estate, SaaS, E-commerce",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "What data do you need to track?",
              "placeholder": "e.g. contacts, deals, properties, interactions, documents"
            },
            {
              "fieldType": "number",
              "fieldLabel": "Team Size",
              "placeholder": "5"
            },
            {
              "fieldLabel": "Expected Scale",
              "placeholder": "e.g. 1000 records, 100k records, 1M+ records"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Key Workflows",
              "placeholder": "e.g. lead comes in → assign to agent → track showings → close deal → commission calculation"
            },
            {
              "fieldLabel": "Any integrations needed?",
              "placeholder": "email, calendar, WhatsApp, Stripe, etc."
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Special Requirements",
              "placeholder": "multi-language, file uploads, complex relationships, audit logging, etc."
            },
            {
              "fieldType": "email",
              "fieldLabel": "Your Email",
              "placeholder": "your@email.com",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Get a production-grade database schema designed and reviewed by 3 AI experts"
      },
      "typeVersion": 2.3
    },
    {
      "id": "a4f3bc0e-9293-4917-bd55-2b0309f9d31c",
      "name": "ユーザーがExcelを使用している場合",
      "type": "n8n-nodes-base.if",
      "position": [
        1568,
        -3184
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3ba71a4a-01e0-4be3-bf2e-349fe5c6710c",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('Form Submission').item.json['Database Technology'].toLowerCase() }}",
              "rightValue": "postgres"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "93879c3e-e2be-44cc-a5ae-050be780ae42",
      "name": "実行なしでのフォーム終了",
      "type": "n8n-nodes-base.form",
      "position": [
        1888,
        -2736
      ],
      "webhookId": "0ef42fe9-17ab-4887-b49b-e889d2056d87",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "SQL Creation Finished",
        "completionMessage": "={{ $json }}"
      },
      "typeVersion": 2.3
    }
  ],
  "connections": {
    "b25d8d4c-46dc-4a65-99a3-3c03a4ba819c": {
      "main": [
        [
          {
            "node": "a5028fd9-b726-413b-86aa-9f3735395bb9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "0b8ee65f-e057-4e2e-93c4-859797612c93",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fa2b059f-7347-4c81-a194-4e7b02e0a033": {
      "main": [
        [
          {
            "node": "c8d4da4b-62af-4d22-8bab-ddfca874ed72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1648a9d6-a261-45b8-8dc9-516fd62a7a3e": {
      "ai_languageModel": [
        [
          {
            "node": "58921f8a-0b6f-460b-8202-69327c364d45",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "e102d0ff-e176-49b5-a999-a3ccf2fb7f42": {
      "ai_languageModel": [
        [
          {
            "node": "a5028fd9-b726-413b-86aa-9f3735395bb9",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "d289f031-8814-4478-8993-00d5c09c03f1": {
      "main": [
        [
          {
            "node": "6372d515-3314-4ca8-acf4-462fb4e2fbb1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "87d374f8-babb-41f5-ac5c-f45be51df90c": {
      "ai_languageModel": [
        [
          {
            "node": "4e2a9518-4587-4ffe-a4a0-3f771019f22e",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "0b898ea5-9799-4b59-b26b-0b0521a8e2c6": {
      "main": [
        [
          {
            "node": "b25d8d4c-46dc-4a65-99a3-3c03a4ba819c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ccef25b6-60e3-408e-8d2f-dbc9d907bcc4": {
      "main": [
        [
          {
            "node": "739b10a8-f533-403f-b71f-9095d982b669",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "0b898ea5-9799-4b59-b26b-0b0521a8e2c6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "509218a4-3447-49f9-a8bc-b789ba3432ec": {
      "main": [
        [
          {
            "node": "c8d4da4b-62af-4d22-8bab-ddfca874ed72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "21ea3c45-a89d-4f45-b044-958be52b13be": {
      "ai_languageModel": [
        [
          {
            "node": "739b10a8-f533-403f-b71f-9095d982b669",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6372d515-3314-4ca8-acf4-462fb4e2fbb1": {
      "main": [
        [
          {
            "node": "a5028fd9-b726-413b-86aa-9f3735395bb9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a4f3bc0e-9293-4917-bd55-2b0309f9d31c": {
      "main": [
        [
          {
            "node": "e5fbeabe-a5de-492e-8cbe-6849882db5fc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "93879c3e-e2be-44cc-a5ae-050be780ae42",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0b8ee65f-e057-4e2e-93c4-859797612c93": {
      "main": [
        [
          {
            "node": "739b10a8-f533-403f-b71f-9095d982b669",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "58921f8a-0b6f-460b-8202-69327c364d45": {
      "main": [
        [
          {
            "node": "4e2a9518-4587-4ffe-a4a0-3f771019f22e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e5fbeabe-a5de-492e-8cbe-6849882db5fc": {
      "main": [
        [
          {
            "node": "509218a4-3447-49f9-a8bc-b789ba3432ec",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "fa2b059f-7347-4c81-a194-4e7b02e0a033",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a5028fd9-b726-413b-86aa-9f3735395bb9": {
      "main": [
        [
          {
            "node": "58921f8a-0b6f-460b-8202-69327c364d45",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4e2a9518-4587-4ffe-a4a0-3f771019f22e": {
      "main": [
        [
          {
            "node": "ccef25b6-60e3-408e-8d2f-dbc9d907bcc4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "739b10a8-f533-403f-b71f-9095d982b669": {
      "main": [
        [
          {
            "node": "a4f3bc0e-9293-4917-bd55-2b0309f9d31c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数31
カテゴリー-
ノードタイプ8
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34