# abilzerian/llm-prompt-library architecture

> Architecture diagram of the GitHub repository abilzerian/llm-prompt-library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abilzerian/llm-prompt-library
- Repository: https://github.com/abilzerian/llm-prompt-library

## Overview

##### Project Type and Purpose
- The project is not a runtime server or full-stack application but a “library” of prompt templates organized by domains (finance, medical, programming, prompt generation, writing/editing, miscellaneous) plus a suite of standalone scripts.
- The README clearly describes it as a curated collection of LLM prompts targeting multiple LLMs (Deepseek, GPT o3, Claude 3, Llama3, Gemini, etc.), along with command-line tools to process and analyze those prompts.

##### Main Components
a. Prompt Repository:

b. Script and Tools Suite:
- A separate block representing “Prompt Tools/Utilities.” This includes components such as:
- Prompt Validator – checks format and content of prompt files.
- Prompt Mixer – creates new prompt variations by mixing elements.
- Token Counter – estimates token counts and API costs.
- Prompt Analyzer – evaluates prompt quality and suggests improvements.
- Financial Metacognition Tool – processes financial prompts with specialized configuration (note the JSON configuration files used for bias, confidence, limitation patterns).
- Prompt Evolution – iteratively optimizes prompts.
- Optionally, mention auxiliary scripts (e.g., prompt_mixer.py, prompt_analyzer.py, prompt_evolution.py, validate_prompts.py) in a separate block labeled “Command-line Utilities.”

c. External Interactions:

##### Relationships and Data Flow
- From “Prompt Library” to “Prompt Analyzer” to show the path of prompt evaluation.

##### Architectural Patterns and Design Principles
- Modularity – the collection of prompt files is cleanly organized into categories, each fulfilling a domain-specific purpose.
- Clear separation of concerns: one layer for data (prompts) and one for processing or transformation (scripts/utilities).

##### Technology Stack and Implementation Details
- That the project is built using simple file-based storage (flat file system) supplemented by Python scripts.
- Mention configuration management in the “Financial Metacognition” component (i.e., JSON config files for bias, confidence, and limitation patterns).
- Optionally, note version control (.gitignore, LICENSE, README) as part of the overall project management, though they can be seen as peripheral to the runtime architecture.

- Bottom Layer: “Prompt Library” split into its various categories (Finance, Medical, Programming, etc.).
- Interactions such as:
- “Prompt Tools” reading from “Prompt Library”
- Output from “Prompt Tools” feeding into external LLM Systems.
- Feedback cycles (for example, Prompt Evolution tool) updating the Prompt Library.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    %% Top Layer: External LLM Providers
    subgraph "LLM Providers"
        deepseek["Deepseek"]:::external
        gpt_o3["GPT o3"]:::external
        claude3["Claude 3"]:::external
        llama3["Llama3"]:::external
        gemini["Gemini"]:::external
    end

    %% Middle Layer: Prompt Tools/Utilities
    subgraph "Prompt Tools/Utilities"
        validator["Prompt Validator Script"]:::tool
        mixer["Prompt Mixer"]:::tool
        token["Token Counter"]:::tool
        analyzer["Prompt Analyzer"]:::tool
        finMeta["Financial Metacognition Tool"]:::tool
        evolution["Prompt Evolution"]:::tool
    end

    %% Bottom Layer: Prompt Library
    subgraph "Prompt Library"
        finance["Finance Prompts"]:::repository
        medical["Medical Prompts"]:::repository
        programming["Programming Prompts"]:::repository
        promptGen["Prompt Generation"]:::repository
        writing["Writing & Editing Prompts"]:::repository
        misc["Miscellaneous Prompts"]:::repository
    end

    %% Connections from Prompt Library to Prompt Tools/Utilities
    finance -->|"read_prompts"| finMeta
    medical -->|"analyze"| analyzer
    programming -->|"mix"| mixer
    promptGen -->|"mix"| mixer
    writing -->|"analyze"| analyzer
    misc -->|"validate"| validator

    %% Connections from Tools/Utilities to LLM Providers
    validator -->|"prepare"| deepseek
    validator -->|"prepare"| gpt_o3
    validator -->|"prepare"| claude3
    validator -->|"prepare"| llama3
    validator -->|"prepare"| gemini

    analyzer -->|"feedback"| deepseek
    analyzer -->|"feedback"| gpt_o3
    analyzer -->|"feedback"| claude3
    analyzer -->|"feedback"| llama3
    analyzer -->|"feedback"| gemini

    mixer -->|"generate_variants"| deepseek
    mixer -->|"generate_variants"| gpt_o3
    mixer -->|"generate_variants"| claude3
    mixer -->|"generate_variants"| llama3
    mixer -->|"generate_variants"| gemini

    token -->|"cost_estimate"| deepseek
    token -->|"cost_estimate"| gpt_o3
    token -->|"cost_estimate"| claude3
    token -->|"cost_estimate"| llama3
    token -->|"cost_estimate"| gemini

    finMeta -->|"financial_analysis"| deepseek
    finMeta -->|"financial_analysis"| gpt_o3
    finMeta -->|"financial_analysis"| claude3
    finMeta -->|"financial_analysis"| llama3
    finMeta -->|"financial_analysis"| gemini

    %% Feedback Loop from Prompt Evolution back to Prompt Library (representative)
    evolution -->|"update_prompts"| finance

    %% Class Styles
    classDef repository fill:#ADD8E6,stroke:#000,color:#000;
    classDef tool fill:#FFFACD,stroke:#000,color:#000;
    classDef external fill:#90EE90,stroke:#000,color:#000;

    %% Click Events
    click finance "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/finance"
    click medical "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/medical"
    click programming "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/programming"
    click promptGen "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/prompt_generation"
    click writing "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/writing_editing"
    click misc "https://github.com/abilzerian/llm-prompt-library/tree/main/prompts/miscellaneous"
    click validator "https://github.com/abilzerian/llm-prompt-library/blob/main/scripts/validate_prompts.py"
    click mixer "https://github.com/abilzerian/llm-prompt-library/blob/main/scripts/prompt_mixer.py"
    click token "https://github.com/abilzerian/llm-prompt-library/blob/main/scripts/token_counter.py"
    click analyzer "https://github.com/abilzerian/llm-prompt-library/blob/main/scripts/prompt_analyzer.py"
    click finMeta "https://github.com/abilzerian/llm-prompt-library/tree/main/scripts/financial_metacognition"
    click evolution "https://github.com/abilzerian/llm-prompt-library/blob/main/scripts/prompt_evolution.py"
```
