> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abv.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Folders

> Organize prompts into hierarchical folders using slash notation for better management, team collaboration, and namespace separation.

# How Folders Work

<Steps>
  <Step title="Use slash notation in prompt names" icon="slash">
    Folders are virtual—they don't exist as separate entities. Instead, create folders by including forward slashes (`/`) in prompt names. Each slash-separated segment becomes a folder level.

    **Flat prompt name:**

    ```python theme={null}
    name="customer-support-billing"
    ```

    **Hierarchical folder path:**

    ```python theme={null}
    name="customer-support/billing"
    # Creates folder: customer-support/
    # Prompt name: billing
    ```

    **Nested folders:**

    ```python theme={null}
    name="customer-support/billing/refund-policy"
    # Creates folders: customer-support/ → billing/
    # Prompt name: refund-policy
    ```

    The ABV platform automatically treats everything before the final segment as folder path.
  </Step>

  <Step title="UI automatically creates folder hierarchy" icon="sitemap">
    When you create a prompt with slashes in its name, the ABV UI automatically renders the folder structure in the Prompt Management interface.

    **Example hierarchy:**

    ```text theme={null}
    📁 customer-support/
      📁 billing/
        📄 refund-policy
        📄 payment-issues
      📁 technical/
        📄 troubleshooting
        📄 account-access
    📁 marketing/
      📄 email-campaign
      📄 social-media
    ```

    Folders appear as collapsible sections, allowing you to expand and navigate the hierarchy visually.
  </Step>

  <Step title="Navigate through folders in UI" icon="arrows-turn-to-dots">
    In the ABV dashboard Prompt Management section:

    * Click folder names to expand/collapse them
    * View all prompts within a folder
    * Filter by folder to narrow search results
    * Create new prompts within folders by entering the folder path in the name field

    The folder structure provides visual organization without affecting how you reference prompts in code.
  </Step>

  <Step title="Reference prompts with folder paths in code" icon="code">
    When fetching prompts via SDK or API, include the full folder path in the prompt name.

    ```python theme={null}
    # Fetch prompt from nested folder
    prompt = abv.get_prompt("customer-support/billing/refund-policy")

    # The folder path is part of the prompt name
    # No special "folder" parameter required
    ```

    Folders are purely organizational—they don't change how you reference prompts, they're just part of the name.
  </Step>
</Steps>

# Organization Patterns

<AccordionGroup>
  <Accordion title="Team-Based Organization" icon="people-group">
    Separate prompts by team ownership to clarify responsibility and prevent conflicts.

    **Folder Structure:**

    ```text theme={null}
    📁 marketing/
      📄 email-campaign-welcome
      📄 email-campaign-renewal
      📄 social-media-post-generator
    📁 engineering/
      📄 code-review-assistant
      📄 documentation-generator
    📁 customer-support/
      📄 ticket-classifier
      📄 response-assistant
    📁 sales/
      📄 lead-qualifier
      📄 proposal-generator
    ```

    **Benefits:**

    * Clear ownership: Each team manages their own prompts
    * No naming conflicts: `marketing/email-campaign` vs. `sales/email-campaign`
    * Access control: Assign team-specific permissions (if RBAC allows)
  </Accordion>

  <Accordion title="Environment-Based Organization" icon="layer-group">
    Separate prompts by deployment environment to prevent production prompts from mixing with experiments.

    **Folder Structure:**

    ```text theme={null}
    📁 production/
      📄 customer-support-agent
      📄 billing-assistant
    📁 staging/
      📄 customer-support-agent-v2
      📄 new-feature-test
    📁 experiments/
      📄 gpt4-vs-claude-test
      📄 prompt-engineering-trial
    📁 deprecated/
      📄 old-chatbot-v1
      📄 legacy-classifier
    ```

    **Benefits:**

    * Environment isolation: Production prompts clearly separated
    * Safe experimentation: Test prompts isolated from production
    * Historical record: Archive deprecated prompts instead of deleting

    **Note:** This pattern complements (but doesn't replace) ABV's built-in labels (`production`, `staging`). Folders provide organizational structure; labels provide deployment control.
  </Accordion>

  <Accordion title="Feature-Based Organization" icon="puzzle-piece">
    Group prompts by product feature or user-facing functionality.

    **Folder Structure:**

    ```text theme={null}
    📁 onboarding/
      📄 welcome-message
      📄 tutorial-guide
      📄 feature-tour
    📁 billing/
      📄 invoice-generator
      📄 payment-reminder
      📄 refund-processor
    📁 notifications/
      📄 email-digest
      📄 push-notification
      📄 sms-alert
    📁 recommendations/
      📄 product-recommender
      📄 content-suggester
    ```

    **Benefits:**

    * Feature clarity: All prompts for a feature in one place
    * Easier refactoring: Update all onboarding prompts together
    * Discoverability: New team members quickly find relevant prompts
  </Accordion>

  <Accordion title="Multi-Product Organization" icon="boxes-stacked">
    Separate prompts by product line when managing multiple products in one ABV account.

    **Folder Structure:**

    ```text theme={null}
    📁 product-a/
      📁 customer-support/
        📄 chat-agent
        📄 email-responder
      📁 marketing/
        📄 campaign-generator
    📁 product-b/
      📁 customer-support/
        📄 chat-agent
        📄 email-responder
      📁 analytics/
        📄 report-generator
    📁 shared/
      📄 safety-guidelines
      📄 brand-voice
    ```

    **Benefits:**

    * Product isolation: Each product's prompts clearly separated
    * Shared components: Common prompts in `shared/` folder
    * Independent evolution: Update product-a prompts without affecting product-b
  </Accordion>

  <Accordion title="Nested Folder Hierarchies" icon="diagram-nested">
    Combine organizational strategies with nested folders for complex prompt libraries.

    **Folder Structure:**

    ```text theme={null}
    📁 customer-support/
      📁 tier-1/
        📁 billing/
          📄 payment-issues
          📄 refund-requests
        📁 technical/
          📄 password-reset
          📄 login-issues
      📁 tier-2/
        📁 escalations/
          📄 complex-billing
          📄 technical-escalation
      📁 shared/
        📄 greeting-template
        📄 closing-template
    📁 experiments/
      📁 2024-q1/
        📄 new-greeting-test
        📄 tone-experiment
      📁 2024-q2/
        📄 multilingual-test
    ```

    **Best Practice:** Limit folder depth to 2-3 levels. Deeper hierarchies become difficult to navigate and reference.
  </Accordion>
</AccordionGroup>

# Implementation Examples

<AccordionGroup>
  <Accordion title="Create Prompts in Folders via UI" icon="browser">
    1. Navigate to **Prompt Management** in ABV dashboard
    2. Click **Create Prompt**
    3. In the **Name** field, enter the full folder path with slashes:
       ```
       customer-support/billing/refund-policy
       ```
    4. Configure the prompt (type, content, labels, etc.)
    5. Click **Save**

    The UI automatically:

    * Creates the folder structure (`customer-support/` → `billing/`)
    * Displays the prompt under the nested folders
    * Allows you to expand/collapse folders for navigation

    **Viewing folders:**

    * Expand `customer-support/` folder
    * Expand `billing/` subfolder
    * See `refund-policy` prompt listed
  </Accordion>

  <Accordion title="Create Prompts in Folders via Python SDK" icon="python">
    **Install ABV SDK:**

    ```bash theme={null}
    pip install abvdev
    ```

    **Create prompts with folder paths:**

    ```python theme={null}
    from abvdev import ABV

    abv = ABV(
        api_key="sk-abv-...",
        host="https://app.abv.dev"
    )

    # Create shared components
    abv.create_prompt(
        name="shared/safety-guidelines",
        type="text",
        prompt="Never provide medical, legal, or financial advice.",
        labels=["production"]
    )

    # Create customer support prompts
    abv.create_prompt(
        name="customer-support/billing/refund-policy",
        type="text",
        prompt="""@@@abvdevPrompt:name=shared/safety-guidelines|label=production@@@

    Process refund requests according to the following policy: {{refund_policy_text}}

    Customer request: {{customer_request}}""",
        labels=["production"]
    )

    abv.create_prompt(
        name="customer-support/technical/password-reset",
        type="text",
        prompt="Guide the customer through password reset: {{issue_details}}",
        labels=["production"]
    )

    # Create marketing prompts
    abv.create_prompt(
        name="marketing/email-campaigns/welcome",
        type="text",
        prompt="Generate a welcome email for: {{user_name}}",
        labels=["production"]
    )
    ```

    **Fetch prompts from folders:**

    ```python theme={null}
    # Fetch by full path (including folders)
    refund_prompt = abv.get_prompt("customer-support/billing/refund-policy")
    welcome_email = abv.get_prompt("marketing/email-campaigns/welcome")

    # Compile and use
    compiled = refund_prompt.compile(
        refund_policy_text="30-day money-back guarantee",
        customer_request="I want to return my order from last week"
    )
    ```
  </Accordion>

  <Accordion title="Create Prompts in Folders via JavaScript/TypeScript SDK" icon="js">
    **Install ABV SDK:**

    ```bash theme={null}
    npm install @abvdev/client
    ```

    **Create prompts with folder paths:**

    ```typescript theme={null}
    import { ABVClient } from "@abvdev/client";
    import dotenv from "dotenv";
    dotenv.config();

    const abv = new ABVClient({
        apiKey: process.env.ABV_API_KEY,
        baseUrl: "https://app.abv.dev"
    });

    async function createOrganizedPrompts() {
        // Create shared components
        await abv.prompt.create({
            name: "shared/safety-guidelines",
            type: "text",
            prompt: "Never provide medical, legal, or financial advice.",
            labels: ["production"]
        });

        // Create customer support prompts
        await abv.prompt.create({
            name: "customer-support/billing/refund-policy",
            type: "text",
            prompt: `@@@abvdevPrompt:name=shared/safety-guidelines|label=production@@@

    Process refund requests according to the following policy: {{refund_policy_text}}

    Customer request: {{customer_request}}`,
            labels: ["production"]
        });

        await abv.prompt.create({
            name: "customer-support/technical/password-reset",
            type: "text",
            prompt: "Guide the customer through password reset: {{issue_details}}",
            labels: ["production"]
        });

        // Create marketing prompts
        await abv.prompt.create({
            name: "marketing/email-campaigns/welcome",
            type: "text",
            prompt: "Generate a welcome email for: {{user_name}}",
            labels: ["production"]
        });
    }

    createOrganizedPrompts();
    ```

    **Fetch prompts from folders:**

    ```typescript theme={null}
    async function useOrganizedPrompts() {
        // Fetch by full path
        const refundPrompt = await abv.prompt.get(
            "customer-support/billing/refund-policy",
            { type: "text" }
        );

        const compiled = refundPrompt.compile({
            refund_policy_text: "30-day money-back guarantee",
            customer_request: "I want to return my order from last week"
        });

        console.log(compiled);
    }

    useOrganizedPrompts();
    ```
  </Accordion>

  <Accordion title="Organize Existing Prompts into Folders" icon="folder-tree">
    If you have existing prompts without folder structure, reorganize them by creating new prompts with folder paths.

    **Migration approach:**

    ```python theme={null}
    # Get list of all existing prompts
    existing_prompts = [
        "billing-refund-policy",
        "billing-payment-issues",
        "technical-password-reset",
        "marketing-welcome-email"
    ]

    # Define folder mapping
    folder_mapping = {
        "billing-refund-policy": "customer-support/billing/refund-policy",
        "billing-payment-issues": "customer-support/billing/payment-issues",
        "technical-password-reset": "customer-support/technical/password-reset",
        "marketing-welcome-email": "marketing/email-campaigns/welcome"
    }

    # Migrate each prompt
    for old_name, new_path in folder_mapping.items():
        # Fetch existing prompt
        old_prompt = abv.get_prompt(old_name)

        # Create new prompt with folder path
        abv.create_prompt(
            name=new_path,
            type=old_prompt.type,
            prompt=old_prompt.prompt,
            config=old_prompt.config,
            labels=old_prompt.labels,
            tags=old_prompt.tags
        )

        print(f"Migrated {old_name} → {new_path}")

    # Update application code to use new paths
    # Then archive or delete old prompts
    ```

    **Important:** Update all code references to use the new folder paths before removing old prompts.
  </Accordion>
</AccordionGroup>

# Next Steps

<CardGroup cols={2}>
  <Card title="Get Started with Prompt Management" icon="rocket" href="/developer/prompt-management/get-started">
    Complete quickstart guide for creating, versioning, and deploying prompts
  </Card>

  <Card title="Prompt Composability" icon="puzzle-piece" href="/developer/prompt-management/composability">
    Build modular prompts by referencing reusable components
  </Card>

  <Card title="Version Control" icon="code-branch" href="/developer/prompt-management/version-control">
    Deploy and rollback prompts safely using labels and versions
  </Card>

  <Card title="Prompt Data Model" icon="database" href="/developer/prompt-management/prompts-data-model">
    Deep dive into prompt structure, fields, and versioning
  </Card>
</CardGroup>
