# Agent Orchestration Prompts

> **One tool call to rule them all.** Tell your AI agent what you want to do and the agent orchestrates the entire workflow — extraction, JSON generation, UI derivation, and implementation completion — automatically.

## How to Use

Just tell your AI agent what you want to do. The agent detects your intent, loads the right conventions and guides, then executes the workflow autonomously.

**Copy-paste any prompt below into your AI agent chat:**

### Phase 1 — Extraction & Analysis

**Analyze a BRD:**

```
Analyze this BRD and prepare FlexBase files
```

**Migrate a legacy application:**

```
Migrate this legacy application to FlexBase
```

**Migrate with stored procedure & trigger extraction:**

```
Migrate this legacy application to FlexBase — extract stored procedures and triggers too
```

**Design a new application:**

```
Design a new scheduling app for healthcare
```

**Full pipeline (extract → Studio → complete):**

```
Build me the full app from this requirements doc
```

### Phase 3 — Implementation Completion

**Complete API business logic (after FlexBase Studio code generation):**

```
Complete the implementation — code was generated by FlexBase Studio
```

**Complete with stored procedure strategy override:**

```
Complete the implementation — use stored procedures for complex queries
```

### Phase 3 — UI Generation

**Generate Blazor UI for a module:**

```
Generate Blazor pages for the Orders module
```

**Setup FlexBase theme (one-time, before any UI work):**

```
Setup FlexBase theme for my Blazor FluentUI project
```

### Standalone — Optional Tasks

**Apply original database names to domain models:**

```
Apply original database names to the domain models
```

**Integrate a DataStore or Provider:**

```
Add CosmosDB document storage to the Orders handler
```

***

## Task Catalog

### Task 1: Full Pipeline (Extract → Studio Handoff → Complete)

**Goal:** End-to-end: analyze source → generate JSON → \[user does Studio] → complete API + UI\
**User provides:** Source material (BRD, legacy code, or business requirements)

### Task 2: Extract from Source (Phase 1 Only)

**Goal:** Analyze source material and produce Markdown + JSON files\
**User provides:** BRD, legacy code, or business description\
**Produces:** Markdown extraction files, JSON import files with UI metadata, Studio handoff instructions

### Task 3: Complete Implementation (Phase 3 Only)

**Goal:** Complete API business logic and generate UI pages from generated skeleton code\
**User provides:** Generated FlexBase solution + extraction artifacts (JSON/Markdown)

### Task 4: Resume After Studio

**Goal:** Pick up where Phase 1 left off — user has generated code and wants implementation completed\
**User provides:** Says "I've generated the code" or "complete the implementation"

### Task 5: Generate UI Only — Complete Module UI from One Command

**Goal:** Generate the complete UI stack for a module — REST client, DTOs, dialog, list page, navigation — without touching the API project\
**User provides:** Module name (e.g., "Products", "Orders", "Customers") and optionally UI framework preference\
**User says:** "Generate Blazor pages for the Products module" or "Build the UI for Orders"

### Task 6: Setup FlexBase Theme for Blazor FluentUI (One-Time)

**Goal:** Configure business-domain-themed admin layout with FluentDesignTheme, sidebar navigation, and FluentUI providers — first step before any functional UI work\
**User provides:** Generated Blazor FluentUI solution + business domain context

### Task 7: Apply Original Database Names to Domain Models

**Goal:** Add `[Table]` and `[Column]` EF Core annotations to domain models for legacy database compatibility\
**User provides:** FlexBase solution with domain models + extraction JSON containing `originalName` / `sourceTable` metadata\
**This task is standalone** — run it independently at any time after domain models are generated.

### Task 8: Legacy Migration with Database Stored Procedure & Trigger Extraction

**Goal:** Same as Task 2 (Legacy Migration extraction) **plus** extract stored procedure and trigger definitions from the legacy database\
**User provides:** Legacy source material (+ optionally exported SP/trigger scripts)\
**User says:** "Migrate this legacy application to FlexBase — extract stored procedures and triggers too"\
**Default behavior:** SP logic will be implemented as C# code in Phase 3\
**User override:** Say "keep the stored procedures" to retain them in the database

### Task 9: Stored Procedure Implementation Strategy (Phase 3) — OVERRIDE Only

**Goal:** Override the default SP handling during implementation completion\
**When needed:** Only when the user explicitly says "use stored procedures" or "keep stored procedures". The default implementation automatically translates SP logic to C# code without any extra prompt.\
**Options:**

* **Move to Code (DEFAULT):** SP logic becomes C# handler/query code
* **Call Stored Procedures:** Keep SPs in the database and call them from FlexBase handlers
* **Mixed Strategy:** Per-feature control — some SPs move to code, others stay as stored procedures

### Task 10: DataStore & Provider Integration

**Goal:** Integrate FlexBase DataStore or Provider operations into handlers, queries, subscribers, or validation plugins\
**User provides:** The store/provider type and business use case\
**User says:** Any of the following:

```
Add CosmosDB document storage to the Orders handler
```

```
Implement vector search with PgVector for product recommendations
```

```
Set up email notifications using SendGrid for order confirmations
```

```
Add Redis caching to the GetProducts query
```

```
Store uploaded files in Azure Blob Storage from the Documents handler
```

**Supported stores and providers:**

| Type              | Examples                                        |
| ----------------- | ----------------------------------------------- |
| Document Store    | CosmosDB, MongoDB, DynamoDB, RavenDB            |
| Vector Store      | PgVector, Azure AI Search, OpenSearch           |
| Graph Store       | Neo4j, Apache AGE, Amazon Neptune               |
| Search Store      | Elasticsearch, Azure AI Search, Algolia         |
| File Store        | Azure Blob, AWS S3, GCP Storage                 |
| Time Series Store | TimescaleDB, InfluxDB, Azure Data Explorer      |
| Cache Store       | Redis, Memcached, NCache                        |
| AI Provider       | Azure OpenAI, OpenAI, Anthropic, Gemini, Ollama |
| Email Provider    | SMTP, SendGrid, Console (dev)                   |

### Sub-Prompt: Workflow State Extraction

**When:** During Phase 1 extraction, any domain entity that has a status/state column (e.g., `Status`, `State`, `OrderStatus`, `IsActive`)\
**Goal:** Extract complete workflow state definitions and transitions per entity — handled automatically during extraction.

***

## Intent Detection — Quick Reference

| User Says                                               | What Happens                             |
| ------------------------------------------------------- | ---------------------------------------- |
| "analyze this BRD", "extract requirements"              | Phase 1 — BRD extraction                 |
| "migrate this app", "convert this code"                 | Phase 1 — Legacy migration               |
| "design a new app", "build me an app for..."            | Phase 1 — New application                |
| "complete the implementation", "finish the code"        | Phase 3 — Implementation completion      |
| "generate Blazor pages", "build the UI"                 | Phase 3 — UI generation                  |
| "setup FlexBase theme"                                  | Phase 3 — Theme setup                    |
| "apply original database names"                         | Phase 3 — Domain name annotations        |
| "migrate with stored procedures"                        | Phase 1 — Legacy + SP extraction         |
| "use stored procedures", "create database scripts"      | Phase 3 — SP implementation override     |
| "add CosmosDB to handler", "set up email notifications" | Phase 3 — DataStore/Provider integration |

***

## Scope Control

The agent stays within the documented scope. It does NOT:

* Invent features not in the source material
* Add entities not in the extraction JSON
* Create UI screens for features that don't exist
* Expand scope unless the user explicitly asks


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flexbase.in/flexbase-mcp-ai-prompts/agent-orchestration-prompts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
