Generative Development Framework
GDF.ai
  • Intro to GDF-FSE
    • Generative AI, Large Language Models, ChatGPT?
    • Knowledge Areas
    • Access a Chat Based LLM
    • Why GDF?
    • Expectations
  • Limitations
  • Prompting
    • Prompt Patterns
    • Prompt Context
    • Prompt Stores
    • Prompt Operators
    • Prompt Chaining
  • Security
    • Protecting Data
    • Protecting Application Security
    • Protecting Intellectual Property
    • Protection Stores
    • AI Security Assessments and Penetration Testing
    • Social Engineering Testing with AI
  • Subject Knowledge Areas
    • Ideation
      • Identifying a Problem Statement
      • Plan and Prioritize Features
      • Develop User Stories
      • Requirement Gathering
      • Ideation Prompting
      • Ideation Template
    • Specification
      • Specifying Languages
      • Specifying Libraries
      • Specifying Project Structures
      • Specify Schemas
      • Specifying Elements
      • Specifying API Specs
    • Generation
      • Generating UI Elements
      • Generating Mock Data
      • Generating Schemas
      • Generating Parsers
      • Generating Databases
      • Generate Functions
      • Generate APIs
      • Generate Diagrams
      • Generating Documentation
    • Transformation
      • Converting Languages
      • Converting Libraries
    • Replacement
      • Replacing Functions
      • Replacing Data Types
    • Integration
      • Connecting UI Components
      • Connecting UI to Backend
      • Connecting Multiple Services Together
      • Connecting Cloud Infrastructure (AWS)
    • Separation
      • Abstraction
      • Model View Controller (MVC)
    • Consolidation
      • Combining UI Elements
      • Deduplicating Code Fragments
    • Templating
      • Layouts
      • Schemas
      • Project Structures
      • Content Management Systems
    • Visualization
      • General Styling
      • Visual Referencing
      • Visual Variations
    • Verification
      • Test Classes
      • Logging and Monitoring
      • Automated Testing
      • Synthetic Monitoring
    • Implementation
      • Infrastructure
      • DevOps / Deployment
    • Optimization
      • General Optimization
      • Performance Monitoring
      • Code Review
  • Guidance
    • Business Process
    • Regulatory Guidance
  • Generative Pipelines
  • Troubleshooting
    • Client Side Troubleshooting
    • Server Side Troubleshooting
    • Troubleshooting with AI
    • Documentation
    • Infrastructure Engineering
  • Terminology
Powered by GitBook
On this page
  • Summary
  • Example: Creating an Object Schema in MongoDB using ChatGPT
  • Prompt:
  • Response:
  • Discussion

Was this helpful?

Export as PDF
  1. Subject Knowledge Areas
  2. Templating

Schemas

Aligning to well defined schema for clients and backends using AI

Summary

By employing prompt stores in generative AI, developers can maintain context regarding specific libraries or configurations, such as "bicycle-app-config," to streamline the process of generating consistent schema records in databases. This approach enhances code maintainability, readability, and reduces the likelihood of errors when accessing data.

Example: Creating an Object Schema in MongoDB using ChatGPT

A developer wants to create consistent schema records for their MongoDB database while utilizing the "bicycle-app-config" context. They can provide a template prompt to the generative AI model like ChatGPT, which outlines the desired structure and standard fields for the schema.

Prompt:

prompt
Generate a MongoDB schema definition using Mongoose that includes the following standard fields: id, createdDate, lastModifiedDate, createdBy, and lastModifiedBy. The schema should automatically handle the createdDate and lastModifiedDate fields. Consider the bicycle-app-config context.

Response:

const mongoose = require('mongoose');
const { Schema } = mongoose;

const BaseSchema = new Schema(
  {
    _id: {
      type: Schema.Types.ObjectId,
      auto: true,
    },
    createdDate: {
      type: Date,
      default: Date.now,
    },
    lastModifiedDate: {
      type: Date,
      default: Date.now,
    },
    createdBy: {
      type: String,
      required: true,
    },
    lastModifiedBy: {
      type: String,
      required: true,
    },
  },
  {
    timestamps: {
      createdAt: 'createdDate',
      updatedAt: 'lastModifiedDate',
    },
  }
);

module.exports = BaseSchema;

Discussion

Utilizing prompt stores in generative AI can enhance the development process and bring unity and standardization to the output:

Pros:

  1. Streamlines the process of generating code by maintaining context and reducing redundancy.

  2. Enhances code maintainability and readability by ensuring consistency.

  3. Reduces the likelihood of errors when accessing data.

Cons:

  1. Requires careful management of the prompt store context to avoid confusion or unintended consequences.

PreviousLayoutsNextProject Structures

Last updated 3 months ago

Was this helpful?