<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:media="http://search.yahoo.com/mrss/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deployment &#038; CI/CD &#8211; Flowpast.com &#8211; Your Workflow Automation Library</title>
	<atom:link href="https://flowpast.com/function/deployment-cicd/feed/" rel="self" type="application/rss+xml" />
	<link>https://flowpast.com</link>
	<description>Flowpast.com - Pre-Built n8n, Make &#38; Zapier Workflow Templates</description>
	<lastBuildDate>Fri, 23 Jan 2026 02:50:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://flowpast.com/wp-content/uploads/2025/12/cropped-icon-32x32.png</url>
	<title>Deployment &#038; CI/CD &#8211; Flowpast.com &#8211; Your Workflow Automation Library</title>
	<link>https://flowpast.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Build Layered API Rate Limits with this AI Prompt</title>
		<link>https://flowpast.com/prompts/build-layered-api-rate-limits-with-this-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:50:32 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001441</guid>

					<description><![CDATA[Scrapers overrun your API - the ultimate AI Prompt that designs layered rate limits with code, 429 handling, telemetry, tests, and rollout. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: API rate limits -->
<div class="hook-introduction">

<p>Your API works fine. Until it doesn’t. One scraper hits a single endpoint, retries aggressively, rotates IPs, and suddenly legit users are seeing timeouts, higher latency, and a flood of “why is this broken?” messages.</p>



<p>This <strong>API rate limits</strong> prompt is built for <strong>backend engineers</strong> who need a production-ready throttling plan without weeks of trial-and-error, <strong>platform leads</strong> trying to stop abusive traffic without punishing power users, and <strong>DevOps/SRE teams</strong> who must add visibility, alerts, and safe rollouts before the next surge. The output is a deployable blueprint: layered IP + identity controls, storage backend options, middleware-style code examples, 429 + Retry-After guidance, telemetry, tests, and a low-risk rollout checklist.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It models likely abuse paths (bursts, retry storms, credential stuffing, IP rotation) and converts them into concrete rate-limit rules.</li>
          <li>It designs layered throttling with at least two independent enforcement layers (IP-based plus identity-based), including guidance for unauthenticated traffic.</li>
          <li>It specifies scalable state storage patterns for counters and windows, from local memory to shared cache and distributed backends.</li>
          <li>It generates code-oriented, middleware-style examples that you can adapt to your stack, while keeping the core approach framework-agnostic.</li>
          <li>It defines operational visibility: logs, metrics, dashboards, alerts, and what signals to watch as attackers change tactics.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You are seeing sudden 429s, timeouts, or elevated p95 latency during traffic spikes and you need protection without downtime.</li>
          <li>Scrapers are draining quota or inflating infra bills, especially on “list,” “search,” “export,” or “pricing” endpoints.</li>
          <li>You have authentication for some routes but also support public endpoints, and you need sane rules for both.</li>
          <li>Attackers are bypassing naive IP limits by rotating addresses, distributing requests, or abusing retry behavior.</li>
          <li>You are about to launch, get featured, or open an integration program, and you want guardrails before growth stress-tests you.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A layered rate-limit blueprint with at least 2 enforcement layers plus one fallback behavior for edge cases.</li>
           <li>Endpoint-by-endpoint policy suggestions (examples: burst vs sustained limits) with a short rationale for each.</li>
           <li>Ready-to-adapt middleware/pseudocode showing request keying, counter updates, and consistent limit evaluation.</li>
           <li>A 429 response contract including Retry-After guidance and client-safe error messaging that avoids leaking internals.</li>
           <li>A validation + rollout plan: test matrix, load simulation outline, and step-by-step staged deployment checklist.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Layered API Rate-Limiting Blueprint Generator</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[FORMAT]</code></td>
                                <td class="var-desc">
                                    Specify the format in which the deliverable should be presented, such as text, diagrams, or code snippets.                                    <div class="var-example">For example: "A markdown document with embedded code examples and architecture diagrams."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[FORMAT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide background information about the API, including its purpose, typical usage patterns, and traffic characteristics.                                    <div class="var-example">For example: "A public API for a social media platform handling 10M daily active users with frequent data retrieval and posting operations."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[INDUSTRY]</code></td>
                                <td class="var-desc">
                                    Describe the industry or domain the API serves, as this can influence abuse patterns and rate-limiting strategies.                                    <div class="var-example">For example: "E-commerce platform with APIs for product search, inventory updates, and checkout processing."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[INDUSTRY]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CHALLENGE]</code></td>
                                <td class="var-desc">
                                    Explain the main problem or threat the rate-limiting solution needs to address, such as traffic surges or targeted abuse.                                    <div class="var-example">For example: "Mitigating credential stuffing attacks and preventing unauthenticated scraping during flash sales events."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CHALLENGE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TIMEFRAME]</code></td>
                                <td class="var-desc">
                                    Indicate the expected timeline for delivering the solution, including any milestones or deadlines.                                    <div class="var-example">For example: "Two months for full implementation, including testing and phased rollout."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[TIMEFRAME]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT (Scope Boundaries)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">Edge Case Handling</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Create a production-grade API rate-limiting blueprint and implementation guide that withstands traffic surges and active abuse. The deliverable must cover layered throttling (IP + identity), scalable state storage, safe client messaging, and operational visibility—without degrading legitimate user experience.

## PERSONA
Act as a seasoned API defense engineer who has designed anti-abuse controls for high-volume enterprise platforms. You prioritize attacker behavior modeling, adaptive controls, and practical implementations that survive real-world load and evasion tactics. Write with crisp, engineering-focused clarity.

## CONSTRAINTS
- Provide concrete, deployable patterns; avoid generic “secure your API” advice.
- Use multi-layer protection (at least two independent enforcement layers plus a fallback behavior).
- Include both IP-based and user/identity-based throttling, with guidance for unauthenticated traffic.
- Offer framework-agnostic concepts plus code-oriented middleware examples tailored to the stated stack.
- Recommend state backends appropriate to scale (local memory, shared cache, distributed options).
- 429 handling must include **Retry-After** and client-safe messaging that does not leak internals.
- Include logging, monitoring, and alerting plans aimed at discovering evolving abuse patterns.
- Address performance overhead and tuning.
- Include a validation plan (tests + load simulation) and a low-risk rollout plan.

### What This Is NOT (Scope Boundaries)
- Not a full WAF/CDN vendor selection report.
- Not a complete IAM/auth redesign (only cover identity signals needed for rate limiting).
- Not malware forensics or incident response playbooks beyond logging/alerting needed for throttling.
- Not compliance legal guidance; only technical measures mapped to stated requirements.

## PROCESS
1. **Pre-analysis (required):** Restate your understanding of the API scenario, likely abuse modes, and success criteria based on the provided inputs. List any assumptions.
2. **Threat-to-control mapping:** Translate the stated threats into specific throttles (burst, sustained, endpoint-sensitive, credential stuffing-style patterns, scraping heuristics).
3. **Layered design:** Specify at minimum:
   - Edge or gateway control (coarse limiting)
   - Application middleware control (fine-grained limiting)
   - A fallback/containment mode when dependencies fail (e.g., storage outage)
4. **Middleware build plan:** Provide implementation patterns for:
   - IP keying (including proxy/CDN header handling guidance)
   - User/identity keying (user ID, API key, session, device fingerprint where appropriate)
   - Combined keys (e.g., per-user-per-endpoint) and endpoint weighting
5. **State storage decisioning:** Recommend the backend(s) with clear thresholds for when to move from in-process to shared/distributed stores. Include setup notes.
6. **Client response behavior:** Define 429 structure, headers, and message templates that help clients recover without revealing architecture.
7. **Observability:** Define log schema, metrics, dashboards, and alert rules; include examples of queries/patterns to detect abuse evolution.
8. **Performance &amp; tuning:** List optimizations (hot paths, sampling, async logging, local caches, Lua/scripts if Redis, etc.).
9. **Validation:** Provide unit/integration tests, adversarial test cases, and load tests. Include acceptance criteria.
10. **Rollout:** Provide a staged deployment plan over **4–6 phases** with monitoring gates and rollback triggers.

### Edge Case Handling
- If any input is missing or ambiguous, ask targeted clarifying questions first. If the user requests immediate output anyway, proceed with reasonable defaults and clearly label them as assumptions.
- If the stack cannot support a recommended tactic, provide an alternative that preserves the same security intent.
- If strict limiting conflicts with performance constraints, propose adaptive limits and “grace” mechanisms for trusted clients.

## INPUTS
- **Application type:** [FORMAT]
- **Traffic profile (baseline + peak + spike shape):** [CONTEXT]
- **Technology stack (framework, runtime, infra, DB):** [INDUSTRY]
- **Security requirements (threats + compliance):** [CHALLENGE]
- **Performance constraints (latency/throughput SLOs):** [TIMEFRAME]

## OUTPUT SPECIFICATION
Use markdown headings and provide sections in this exact order:

1. **Rate Limiting Architecture**
   - {Threat Model Summary}
   - {Layered Controls Overview}
   - {Keying Strategy} (IP, user, combined, endpoint sensitivity)
   - {Adaptive Rules} (burst vs sustained, anomaly triggers)

2. **Middleware Implementation**
   - {Middleware Approach} (where it runs, how it’s composed)
   - {IP Throttle Example} (code-oriented pseudocode or stack-specific sample)
   - {User/Identity Throttle Example}
   - {Composite &amp; Endpoint-Weighted Limits}
   - {Failure Modes &amp; Fallback Behavior}

3. **State Storage &amp; Configuration**
   - {When In-Memory Is Acceptable}
   - {When Shared/Distributed Storage Is Required}
   - {Redis/Upstash-Style Setup Notes}
   - {Key Design, TTLs, Atomicity Notes}

4. **429 Responses &amp; Client Guidance**
   - {Response Schema}
   - {Retry-After Strategy}
   - {Safe Message Examples} (rewritten, non-revealing)
   - {Handling for Auth vs Unauth Clients}

5. **Logging, Monitoring, and Alerting**
   - {Log Fields &amp; Structure}
   - {Metrics to Emit}
   - {Dashboards}
   - {Alert Rules}
   - {Abuse Pattern Detection Examples}

6. **Performance Optimization**
   - {Hot Path Optimizations}
   - {Caching &amp; Sampling Guidance}
   - {Distributed Store Latency Mitigations}

7. **Testing &amp; Validation**
   - {Unit Tests}
   - {Integration Tests}
   - {Adversarial Scenarios}
   - {Load/Spike Tests}
   - {Pass/Fail Criteria}

8. **Deployment &amp; Gradual Rollout**
   - {Phase Plan}
   - {Monitoring Gates}
   - {Rollback Triggers}
   - {Post-Launch Tuning Loop}

## QUALITY CHECKS
Before finalizing, verify:
- The plan includes at least two enforcement layers plus a defined fallback mode.
- Both IP-based and identity-based throttles are implemented with clear key definitions.
- 429 handling includes Retry-After and client-safe wording that avoids leaking internals.
- Storage recommendations are tied to the provided traffic scale and performance constraints.
- Testing and rollout steps are actionable and include measurable acceptance criteria.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nCreate a production-grade API rate-limiting blueprint and implementation guide that withstands traffic surges and active abuse. The deliverable must cover layered throttling (IP + identity), scalable state storage, safe client messaging, and operational visibility\u2014without degrading legitimate user experience.\r\n\r\n## PERSONA\r\nAct as a seasoned API defense engineer who has designed anti-abuse controls for high-volume enterprise platforms. You prioritize attacker behavior modeling, adaptive controls, and practical implementations that survive real-world load and evasion tactics. Write with crisp, engineering-focused clarity.\r\n\r\n## CONSTRAINTS\r\n- Provide concrete, deployable patterns; avoid generic \u201csecure your API\u201d advice.\r\n- Use multi-layer protection (at least two independent enforcement layers plus a fallback behavior).\r\n- Include both IP-based and user\/identity-based throttling, with guidance for unauthenticated traffic.\r\n- Offer framework-agnostic concepts plus code-oriented middleware examples tailored to the stated stack.\r\n- Recommend state backends appropriate to scale (local memory, shared cache, distributed options).\r\n- 429 handling must include **Retry-After** and client-safe messaging that does not leak internals.\r\n- Include logging, monitoring, and alerting plans aimed at discovering evolving abuse patterns.\r\n- Address performance overhead and tuning.\r\n- Include a validation plan (tests + load simulation) and a low-risk rollout plan.\r\n\r\n### What This Is NOT (Scope Boundaries)\r\n- Not a full WAF\/CDN vendor selection report.\r\n- Not a complete IAM\/auth redesign (only cover identity signals needed for rate limiting).\r\n- Not malware forensics or incident response playbooks beyond logging\/alerting needed for throttling.\r\n- Not compliance legal guidance; only technical measures mapped to stated requirements.\r\n\r\n## PROCESS\r\n1. **Pre-analysis (required):** Restate your understanding of the API scenario, likely abuse modes, and success criteria based on the provided inputs. List any assumptions.\r\n2. **Threat-to-control mapping:** Translate the stated threats into specific throttles (burst, sustained, endpoint-sensitive, credential stuffing-style patterns, scraping heuristics).\r\n3. **Layered design:** Specify at minimum:\r\n   - Edge or gateway control (coarse limiting)\r\n   - Application middleware control (fine-grained limiting)\r\n   - A fallback\/containment mode when dependencies fail (e.g., storage outage)\r\n4. **Middleware build plan:** Provide implementation patterns for:\r\n   - IP keying (including proxy\/CDN header handling guidance)\r\n   - User\/identity keying (user ID, API key, session, device fingerprint where appropriate)\r\n   - Combined keys (e.g., per-user-per-endpoint) and endpoint weighting\r\n5. **State storage decisioning:** Recommend the backend(s) with clear thresholds for when to move from in-process to shared\/distributed stores. Include setup notes.\r\n6. **Client response behavior:** Define 429 structure, headers, and message templates that help clients recover without revealing architecture.\r\n7. **Observability:** Define log schema, metrics, dashboards, and alert rules; include examples of queries\/patterns to detect abuse evolution.\r\n8. **Performance & tuning:** List optimizations (hot paths, sampling, async logging, local caches, Lua\/scripts if Redis, etc.).\r\n9. **Validation:** Provide unit\/integration tests, adversarial test cases, and load tests. Include acceptance criteria.\r\n10. **Rollout:** Provide a staged deployment plan over **4\u20136 phases** with monitoring gates and rollback triggers.\r\n\r\n### Edge Case Handling\r\n- If any input is missing or ambiguous, ask targeted clarifying questions first. If the user requests immediate output anyway, proceed with reasonable defaults and clearly label them as assumptions.\r\n- If the stack cannot support a recommended tactic, provide an alternative that preserves the same security intent.\r\n- If strict limiting conflicts with performance constraints, propose adaptive limits and \u201cgrace\u201d mechanisms for trusted clients.\r\n\r\n## INPUTS\r\n- **Application type:** [FORMAT]\r\n- **Traffic profile (baseline + peak + spike shape):** [CONTEXT]\r\n- **Technology stack (framework, runtime, infra, DB):** [INDUSTRY]\r\n- **Security requirements (threats + compliance):** [CHALLENGE]\r\n- **Performance constraints (latency\/throughput SLOs):** [TIMEFRAME]\r\n\r\n## OUTPUT SPECIFICATION\r\nUse markdown headings and provide sections in this exact order:\r\n\r\n1. **Rate Limiting Architecture**\r\n   - {Threat Model Summary}\r\n   - {Layered Controls Overview}\r\n   - {Keying Strategy} (IP, user, combined, endpoint sensitivity)\r\n   - {Adaptive Rules} (burst vs sustained, anomaly triggers)\r\n\r\n2. **Middleware Implementation**\r\n   - {Middleware Approach} (where it runs, how it\u2019s composed)\r\n   - {IP Throttle Example} (code-oriented pseudocode or stack-specific sample)\r\n   - {User\/Identity Throttle Example}\r\n   - {Composite & Endpoint-Weighted Limits}\r\n   - {Failure Modes & Fallback Behavior}\r\n\r\n3. **State Storage & Configuration**\r\n   - {When In-Memory Is Acceptable}\r\n   - {When Shared\/Distributed Storage Is Required}\r\n   - {Redis\/Upstash-Style Setup Notes}\r\n   - {Key Design, TTLs, Atomicity Notes}\r\n\r\n4. **429 Responses & Client Guidance**\r\n   - {Response Schema}\r\n   - {Retry-After Strategy}\r\n   - {Safe Message Examples} (rewritten, non-revealing)\r\n   - {Handling for Auth vs Unauth Clients}\r\n\r\n5. **Logging, Monitoring, and Alerting**\r\n   - {Log Fields & Structure}\r\n   - {Metrics to Emit}\r\n   - {Dashboards}\r\n   - {Alert Rules}\r\n   - {Abuse Pattern Detection Examples}\r\n\r\n6. **Performance Optimization**\r\n   - {Hot Path Optimizations}\r\n   - {Caching & Sampling Guidance}\r\n   - {Distributed Store Latency Mitigations}\r\n\r\n7. **Testing & Validation**\r\n   - {Unit Tests}\r\n   - {Integration Tests}\r\n   - {Adversarial Scenarios}\r\n   - {Load\/Spike Tests}\r\n   - {Pass\/Fail Criteria}\r\n\r\n8. **Deployment & Gradual Rollout**\r\n   - {Phase Plan}\r\n   - {Monitoring Gates}\r\n   - {Rollback Triggers}\r\n   - {Post-Launch Tuning Loop}\r\n\r\n## QUALITY CHECKS\r\nBefore finalizing, verify:\r\n- The plan includes at least two enforcement layers plus a defined fallback mode.\r\n- Both IP-based and identity-based throttles are implemented with clear key definitions.\r\n- 429 handling includes Retry-After and client-safe wording that avoids leaking internals.\r\n- Storage recommendations are tied to the provided traffic scale and performance constraints.\r\n- Testing and rollout steps are actionable and include measurable acceptance criteria.";
    const variables = ["[FORMAT]","[CONTEXT]","[INDUSTRY]","[CHALLENGE]","[TIMEFRAME]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>List your “expensive endpoints” first.</strong> Give the AI a small table of routes with why they’re costly (DB fanout, third-party calls, exports). Example follow-up: “Here are 8 endpoints; mark which need burst limits vs sustained limits, and propose different windows for each.”</li>


<li><strong>Describe abusive traffic like a story.</strong> Add what you observed: user agents, referrers, IP ASNs, request patterns, retries, and peak RPS. Then ask: “Based on this pattern, what keys should we rate-limit on (IP, token, account, org, API key), and what evasions should we expect next?”</li>

<li><strong>Force explicit 429 contracts.</strong> Many teams forget the client experience. Ask the model to output the exact JSON body, headers (including Retry-After), and which fields are safe: “Write a 429 response spec for public endpoints vs authenticated endpoints; avoid revealing internal thresholds.”</li>


<li><strong>Iterate on tuning, not just rules.</strong> After the first pass, tighten it with a controlled prompt: “Now make option A more aggressive for anonymous traffic, but keep authenticated power users under 1% false positives. Explain the tradeoffs in 6 bullets.”</li>


<li><strong>Combine it with your observability reality.</strong> Tell it what you actually use (CloudWatch, Datadog, Grafana, ELK) and request concrete metric names and alert thresholds. A good follow-up: “Propose 10 metrics, 5 dashboards, and 6 alerts; include what each alert means and the likely next action.”</li>

</ul>
<!-- /wp:post-content -->
</div>

<div class="related-prompts-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Related Prompts</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Once you’ve designed layered throttling, these related prompts help you operationalize the work across teams, process, and capacity.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you also need to standardize how engineering work moves from “incoming” to “done,” the maturity framework in <a href="https://flowpast.com/prompts/build-a-task-management-maturity-audit-with-this-ai-prompt/">Build a Task Management Maturity Audit with this AI Prompt</a> helps you spot bottlenecks that make rate-limit rollouts risky (unclear ownership, missing change windows, weak post-deploy checks). It pairs well when your problem isn’t only abuse, but slow execution and inconsistent follow-through.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For teams doing ongoing platform hardening, <a href="https://flowpast.com/prompts/build-an-adaptive-task-manager-blueprint-ai-prompt/">Build an Adaptive Task Manager Blueprint AI Prompt</a> is useful right after you generate your throttling blueprint. You can convert the rollout plan into a living system: recurring tuning tasks, dashboard reviews, and “attack pattern” retrospectives that don’t get forgotten.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>When rate limits touch multiple groups (API, SRE, support, and sometimes sales), miscommunication becomes its own incident. <a href="https://flowpast.com/prompts/create-a-task-handoff-playbook-with-this-ai-prompt/">Create a Task Handoff Playbook with this AI Prompt</a> helps you define who owns policy changes, who handles customer escalations about 429s, and what needs to be documented before toggling stricter rules.</p>
<!-- /wp:paragraph -->

<br>

<!-- wp:paragraph -->
<p>Quick reference:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul>
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-task-management-maturity-audit-with-this-ai-prompt/">Build a Task Management Maturity Audit with this AI Prompt</a>: Diagnose process gaps blocking safe rollouts.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-an-adaptive-task-manager-blueprint-ai-prompt/">Build an Adaptive Task Manager Blueprint AI Prompt</a>: Turn the plan into recurring ops tasks.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-talent-management-blueprint-with-this-ai-prompt/">Build a Talent Management Blueprint with this AI Prompt</a>: Staff ownership for platform reliability work.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-an-inventory-management-blueprint-with-this-ai-prompt/">Build an Inventory Management Blueprint with this AI Prompt</a>: Improve tracking of “rate-limit dependencies” as assets.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/create-a-task-handoff-playbook-with-this-ai-prompt/">Create a Task Handoff Playbook with this AI Prompt</a>: Prevent drops during cross-team handoffs.</li>
<!-- /wp:list-item -->
</ul>
<!-- /wp:list -->
</div>

<div class="faq-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Common Questions</h2>
<!-- /wp:heading -->

<div class="faq-item">
<span class="question">Which roles benefit most from this API rate limits AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>Backend Engineers</strong> use it to turn vague “add rate limiting” tickets into a layered policy plus middleware implementation details. <strong>Platform/SRE Leads</strong> rely on it for telemetry, alerting, and low-risk rollout steps that reduce production surprises. <strong>API Product Managers</strong> get a clearer client experience spec (429 + Retry-After, safe messages) so integrations break less often. <strong>Security Engineers</strong> apply it to map attacker behaviors to controls and to plan adaptive tuning as abuse evolves.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this API rate limits AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>SaaS companies</strong> use it to protect multi-tenant APIs where one noisy customer (or leaked token) can degrade everyone’s experience. It helps separate per-account limits from per-IP limits and avoids punishing office NAT traffic. <strong>E-commerce and marketplaces</strong> apply it to deter scraping of pricing, inventory, and search results, especially around promotions when traffic surges are normal but abuse spikes too. <strong>Fintech and payments</strong> teams use it to tame login-related retry storms and to throttle sensitive endpoints without leaking thresholds to attackers. <strong>Media and data providers</strong> get value because content and datasets attract automated extraction, so layered identity + IP throttles plus monitoring are essential.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for designing API rate limits produce weak results?</span>
<!-- wp:paragraph -->
<p class="answer">A typical prompt like “Write me a rate limiting strategy for my API” fails because it: lacks attacker behavior modeling (bursting, IP rotation, retries) so the limits are easy to evade, provides no layered enforcement plan (IP plus identity plus fallback) and ends up as a single brittle rule, ignores state storage tradeoffs so it suggests patterns that break under load or across instances, produces generic 429 advice instead of a client-safe contract with Retry-After, and misses operational visibility so you cannot tune limits safely after launch.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Can I customize this API rate limits prompt for my specific situation?</span>
<!-- wp:paragraph -->
<p class="answer">Yes. The fastest way is to add your stack (language, framework, gateway), your traffic shape (avg/peak RPS, burstiness), and a short list of endpoints with “cost” notes so the policy can vary by route. Include identity signals you already have (API key, user ID, org ID) and clarify what unauthenticated traffic looks like (public endpoints, onboarding, webhooks). Then ask a targeted follow-up like: “Rewrite the blueprint for Node/Express behind NGINX, with Redis counters, and propose per-endpoint limits for /search, /export, /login, and /webhook.”</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this API rate limits prompt?</span>
<!-- wp:paragraph -->
<p class="answer">The biggest mistake is leaving your abuse scenario too vague — instead of “we get scraped,” provide “/search gets 300 RPS bursts for 2–3 minutes from rotating residential IPs, then a 10x retry spike on 5xx.” Another common error is not listing identity keys; “authenticated users” is weak compared to “rate-limit by org_id, then user_id, with API key as fallback.” People also forget to specify which endpoints are public vs authenticated, which leads to policies that block onboarding flows. Finally, teams often omit rollout constraints (feature flags, percentage rollout, shadow mode), so the plan is correct on paper but risky to deploy.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Who should NOT use this API rate limits prompt?</span>
<!-- wp:paragraph -->
<p class="answer">This prompt isn’t ideal for teams looking for a copy-paste snippet with zero tuning, because rate limiting only works well when it reflects your routes, tenants, and traffic shape. It’s also not a fit if you cannot change application code or edge configuration at all; you may need a managed gateway/WAF approach instead. And if you haven’t identified your core identity signals (API keys, user IDs, org IDs), you’ll get a weaker plan until that foundation exists.</p>
<!-- /wp:paragraph -->
</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this API rate limits AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Backend Engineers use it to turn vague “add rate limiting” tickets into a layered policy plus middleware implementation details. Platform/SRE Leads rely on it for telemetry, alerting, and low-risk rollout steps that reduce production surprises. API Product Managers get a clearer client experience spec (429 + Retry-After, safe messages) so integrations break less often. Security Engineers apply it to map attacker behaviors to controls and to plan adaptive tuning as abuse evolves."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this API rate limits AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies use it to protect multi-tenant APIs where one noisy customer (or leaked token) can degrade everyone’s experience. It helps separate per-account limits from per-IP limits and avoids punishing office NAT traffic. E-commerce and marketplaces apply it to deter scraping of pricing, inventory, and search results, especially around promotions when traffic surges are normal but abuse spikes too. Fintech and payments teams use it to tame login-related retry storms and to throttle sensitive endpoints without leaking thresholds to attackers. Media and data providers get value because content and datasets attract automated extraction, so layered identity + IP throttles plus monitoring are essential."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for designing API rate limits produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like “Write me a rate limiting strategy for my API” fails because it: lacks attacker behavior modeling (bursting, IP rotation, retries) so the limits are easy to evade, provides no layered enforcement plan (IP plus identity plus fallback) and ends up as a single brittle rule, ignores state storage tradeoffs so it suggests patterns that break under load or across instances, produces generic 429 advice instead of a client-safe contract with Retry-After, and misses operational visibility so you cannot tune limits safely after launch."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this API rate limits prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. The fastest way is to add your stack (language, framework, gateway), your traffic shape (avg/peak RPS, burstiness), and a short list of endpoints with “cost” notes so the policy can vary by route. Include identity signals you already have (API key, user ID, org ID) and clarify what unauthenticated traffic looks like (public endpoints, onboarding, webhooks). Then ask a targeted follow-up like: “Rewrite the blueprint for Node/Express behind NGINX, with Redis counters, and propose per-endpoint limits for /search, /export, /login, and /webhook.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this API rate limits prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving your abuse scenario too vague — instead of “we get scraped,” provide “/search gets 300 RPS bursts for 2–3 minutes from rotating residential IPs, then a 10x retry spike on 5xx.” Another common error is not listing identity keys; “authenticated users” is weak compared to “rate-limit by org_id, then user_id, with API key as fallback.” People also forget to specify which endpoints are public vs authenticated, which leads to policies that block onboarding flows. Finally, teams often omit rollout constraints (feature flags, percentage rollout, shadow mode), so the plan is correct on paper but risky to deploy."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this API rate limits prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for teams looking for a copy-paste snippet with zero tuning, because rate limiting only works well when it reflects your routes, tenants, and traffic shape. It’s also not a fit if you cannot change application code or edge configuration at all; you may need a managed gateway/WAF approach instead. And if you haven’t identified your core identity signals (API keys, user IDs, org IDs), you’ll get a weaker plan until that foundation exists."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">
<!-- wp:paragraph -->
<p>Abuse doesn’t wait for your roadmap. Use this prompt to design layered API rate limits you can actually deploy, observe, and tune, then paste it into your workflow and start hardening today.</p>
<!-- /wp:paragraph -->
</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001441.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Build Token-Safe JWT Auth Blueprint AI Prompt</title>
		<link>https://flowpast.com/prompts/build-token-safe-jwt-auth-blueprint-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:49:32 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001440</guid>

					<description><![CDATA[Session hijacks keep happening - the ultimate AI Prompt that designs HTTP-only cookie JWT auth with CSRF defense, rotation, monitoring, and code. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: JWT auth blueprint -->

<div class="hook-introduction">

<p>Session hijacks keep happening because many “JWT setups” quietly put tokens where attackers love them: in browser storage, exposed to XSS, and copied into headers by hand. Then refresh logic gets bolted on later, cookie flags are wrong, and you end up with random logouts or (worse) long-lived stolen sessions. It’s messy, and it’s avoidable.</p>



<p>This <strong>JWT auth blueprint</strong> is built for <strong>backend engineers</strong> who need a cookie-based JWT model with sane rotation rules, <strong>security-minded tech leads</strong> cleaning up risky token handling before an audit or incident, and <strong>startup founders</strong> who want “secure by default” auth without breaking UX. The output is a production-ready blueprint: headers, cookie settings, endpoint flows, stack-specific code snippets, tests, and an incident response plan for suspected credential compromise.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It designs a cookie-based JWT session architecture where tokens are never accessible to JavaScript.</li>
          <li>It defines access and refresh lifetimes, rotation rules, and failure modes to keep logins smooth but predictable.</li>
          <li>It outputs concrete implementation details for headers, cookie flags, CORS behavior, and CSRF defenses.</li>
          <li>It produces stack-aligned code snippets based on your [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY] inputs.</li>
          <li>It adds monitoring, detection signals, and automated containment steps for suspected session theft or replay.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You currently store JWTs in localStorage or sessionStorage and want to remove that exposure without rewriting everything.</li>
          <li>Your app has “mysterious logouts” because refresh logic and cookie/CORS settings were patched together over time.</li>
          <li>You are adding a new SPA or mobile web frontend and need a consistent auth flow that won’t become a support nightmare.</li>
          <li>A security review flagged XSS risk, token theft, or missing CSRF protection in cookie-based sessions.</li>
          <li>You are scaling traffic and need monitoring and incident playbooks, not just an auth diagram in a slide deck.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A complete JWT cookie session blueprint with recommended token lifetimes and rotation policy.</li>
           <li>Endpoint-by-endpoint flow for login, silent refresh, logout, and “session invalid” handling.</li>
           <li>Stack-specific code snippets for [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY], including headers and cookie attributes.</li>
           <li>A CSRF defense package: chosen approach, configuration notes, and validation logic for protected routes.</li>
           <li>A monitoring and containment checklist with alert signals plus automated steps to quarantine suspicious sessions.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Token-Safe Cookie JWT Auth Blueprint</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[BACKEND_TECHNOLOGY]</code></td>
                                <td class="var-desc">
                                    Specify the backend programming language or framework used to build the server-side of the application.                                    <div class="var-example">For example: "Node.js with Express or Python with Django"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[BACKEND_TECHNOLOGY]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[FRONTEND_TECHNOLOGY]</code></td>
                                <td class="var-desc">
                                    Specify the frontend framework or library used for building the user interface of the application.                                    <div class="var-example">For example: "React.js or Angular"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[FRONTEND_TECHNOLOGY]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[UPPERCASE_WITH_UNDERSCORES]</code></td>
                                <td class="var-desc">
                                    Enter a variable or input name formatted in uppercase letters with underscores separating words.                                    <div class="var-example">For example: "USER_SESSION_ID or ACCESS_TOKEN"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPPERCASE_WITH_UNDERSCORES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[APPLICATION_TYPE]</code></td>
                                <td class="var-desc">
                                    Describe the type of application being developed, including its purpose and target audience.                                    <div class="var-example">For example: "E-commerce web application for small businesses"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[APPLICATION_TYPE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CURRENT_SECURITY_LEVEL]</code></td>
                                <td class="var-desc">
                                    Provide details about the current security approach or mechanisms implemented in the application.                                    <div class="var-example">For example: "Using JWT stored in localStorage with basic CSRF protection"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CURRENT_SECURITY_LEVEL]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CHALLENGE]</code></td>
                                <td class="var-desc">
                                    Describe the specific authentication or security challenge the application is facing or trying to solve.                                    <div class="var-example">For example: "Preventing session hijacking while maintaining a seamless user experience"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CHALLENGE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide any relevant background or situational details that impact the security architecture or implementation.                                    <div class="var-example">For example: "Application operates in a high-risk environment with frequent phishing attempts targeting users"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT (Scope Boundaries)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">1) Security Architecture</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">2) Cookie Implementation (HTTP-only)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">3) Session Management &amp; Silent Refresh</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">4) Middleware Design (Validation + User Context)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">5) Threat Detection &amp; Automated Response</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">6) Code Examples (Tailored)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">7) Security Testing Plan</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">8) Deployment Checklist</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Create a production-ready JWT authentication blueprint that removes all client-side token storage/handling, resists XSS/token theft/session hijacking, preserves a smooth login experience, and includes concrete implementation details (code, headers, settings, tests, and incident response).

## PERSONA
Act as a seasoned application-security architect who has built and reviewed real-world auth systems under active attack. Communicate in a pragmatic, engineering-first style: precise, skeptical of “best practice” platitudes, and focused on deployable patterns with clear tradeoffs.

## CONSTRAINTS
- Prioritize designs where tokens are never accessible to JavaScript (no localStorage/sessionStorage/in-memory token juggling in the browser).
- Use HTTP-only cookies as the primary transport/storage for session credentials.
- Provide stack-specific snippets aligned to [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY].
- Prefer actionable configuration over generic advice.
- Preserve UX: silent refresh, minimal re-logins, predictable failure modes.
- Include monitoring plus automated containment steps for suspected credential compromise.
- **Variable format compliance:** user-provided items must be in **[UPPERCASE_WITH_UNDERSCORES]**; any AI-filled template fields must use **{Title Case}**.

### What This Is NOT (Scope Boundaries)
- Not a full IAM/SSO vendor selection guide.
- Not a complete pentest report or formal threat model document.
- Not a substitute for legal/compliance requirements (PCI/HIPAA/etc.).
- Not an endorsement of putting access tokens in browser storage “with extra encryption.”

## PROCESS
1. **Pre-analysis (must output first):** Briefly restate your understanding of the app context and the likely threat paths, based on the provided inputs. List any assumptions.
2. **Architecture build-out:** Propose a cookie-based JWT session model (access + refresh or equivalent) with clear lifetimes and rotation rules.
3. **Implementation details:** Provide headers, cookie attributes, CORS/CSRF posture, and server routes/handlers needed for login, refresh, logout, and revocation.
4. **Middleware &amp; request flow:** Define how each request is authenticated, how user context is attached, and how failures are handled without leaking information.
5. **Threat response:** Describe detection signals (logs/metrics), alert thresholds, and automated actions (revoke, rotate, step-up auth, lockouts).
6. **Testing plan:** Give repeatable tests (unit/integration/e2e) and a small “attack simulation” checklist.
7. **Edge cases:** If inputs are incomplete or contradictory, ask targeted questions and provide a safe default path labeled as {Assumed Default}.
8. **Finish with validation:** Provide a short verification checklist (4–5 items).

## INPUTS
- **Application type:** [APPLICATION_TYPE]
- **Backend technology/framework:** [BACKEND_TECHNOLOGY]
- **Frontend technology/framework:** [FRONTEND_TECHNOLOGY]
- **Current JWT/security approach:** [CURRENT_SECURITY_LEVEL]
- **Specific security concerns/requirements:** [CHALLENGE]
- **Environment details (domains, hosting, reverse proxy, etc.):** [CONTEXT]

## OUTPUT SPECIFICATION
Use the following sections and include stack-specific code/config wherever possible:

### 1) Security Architecture
Provide:
- {Session Model} (e.g., “short-lived access token + rotating refresh token in HTTP-only cookie”)
- {Token Contents} (claims, issuer/audience, minimal PII guidance)
- {Lifetime Policy} (access TTL, refresh TTL, idle timeout, absolute timeout)
- {Rotation &amp; Revocation Strategy} (refresh rotation, reuse detection, server-side denylist/allowlist approach)
- {UX Behavior} (what the user experiences during refresh/expiry)

### 2) Cookie Implementation (HTTP-only)
Include:
- {Cookie Names} and purposes
- Exact cookie attributes: HttpOnly, Secure, SameSite, Path, Domain, Max-Age/Expires
- Required security headers (at minimum): CSP guidance, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy
- CORS settings compatible with cookie auth
- CSRF strategy compatible with SameSite policy (double-submit, origin checks, CSRF token cookie pattern, etc.)

### 3) Session Management &amp; Silent Refresh
Include:
- {Auth Endpoints} (login/refresh/logout/me)
- {Refresh Flow} described as steps (server-centric; frontend should not touch tokens)
- Concurrency handling (multiple tabs, refresh storms)
- Logout semantics (server + client cookie clearing)
- Failure handling (when to force re-auth vs retry)

### 4) Middleware Design (Validation + User Context)
Include:
- {Middleware Responsibilities}
- Signature verification, issuer/audience checks, clock skew handling
- Attaching {User Context} to request
- Authorization hooks (roles/scopes) without overloading JWT
- Performance notes (caching keys/JWKS if applicable)

### 5) Threat Detection &amp; Automated Response
Include:
- What to log (auth events, refresh reuse, IP/UA changes, anomaly signals)
- {Detection Rules} (examples with thresholds)
- {Automated Actions} (revoke session family, require re-auth, notify user, rate limit, temporarily block)
- Guidance for compromised refresh token scenarios
- Safe error messaging patterns

### 6) Code Examples (Tailored)
Provide:
- {Backend Implementation Snippets} for [BACKEND_TECHNOLOGY]
- {Frontend Integration Notes} for [FRONTEND_TECHNOLOGY] (cookie-based requests, handling 401/419, retry pattern)
- {Configuration Snippets} (proxy/load balancer, environment variables, secure defaults)
- A minimal example for each: login handler, refresh handler, auth middleware, logout handler

### 7) Security Testing Plan
Include:
- Unit tests (token validation, expiry, rotation, CSRF checks)
- Integration tests (cookie attributes, CORS behavior, refresh rotation correctness)
- E2E tests (silent refresh, multi-tab, logout)
- “Adversary checks” (XSS attempt to read tokens, replay refresh, session fixation attempt)

### 8) Deployment Checklist
A step-by-step pre-production list including:
- Cookie flags verified in prod
- TLS/HSTS enabled and tested
- CSP in report-only then enforced
- Logging/alerts wired
- Key rotation/JWKS strategy confirmed
- Incident runbook basics (revocation, forced logout, secret rotation)

## QUALITY CHECKS
At the end, output a **Quality Validation Checklist** with 4–5 bullets confirming:
- No client-side token storage/reading is required
- Cookies and headers are correctly specified for the chosen stack
- CSRF protections are compatible with cookie-based auth
- Refresh rotation + compromise handling is explicitly covered
- Tests include at least one replay/reuse scenario and one XSS-driven verification attempt            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nCreate a production-ready JWT authentication blueprint that removes all client-side token storage\/handling, resists XSS\/token theft\/session hijacking, preserves a smooth login experience, and includes concrete implementation details (code, headers, settings, tests, and incident response).\r\n\r\n## PERSONA\r\nAct as a seasoned application-security architect who has built and reviewed real-world auth systems under active attack. Communicate in a pragmatic, engineering-first style: precise, skeptical of \u201cbest practice\u201d platitudes, and focused on deployable patterns with clear tradeoffs.\r\n\r\n## CONSTRAINTS\r\n- Prioritize designs where tokens are never accessible to JavaScript (no localStorage\/sessionStorage\/in-memory token juggling in the browser).\r\n- Use HTTP-only cookies as the primary transport\/storage for session credentials.\r\n- Provide stack-specific snippets aligned to [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY].\r\n- Prefer actionable configuration over generic advice.\r\n- Preserve UX: silent refresh, minimal re-logins, predictable failure modes.\r\n- Include monitoring plus automated containment steps for suspected credential compromise.\r\n- **Variable format compliance:** user-provided items must be in **[UPPERCASE_WITH_UNDERSCORES]**; any AI-filled template fields must use **{Title Case}**.\r\n\r\n### What This Is NOT (Scope Boundaries)\r\n- Not a full IAM\/SSO vendor selection guide.\r\n- Not a complete pentest report or formal threat model document.\r\n- Not a substitute for legal\/compliance requirements (PCI\/HIPAA\/etc.).\r\n- Not an endorsement of putting access tokens in browser storage \u201cwith extra encryption.\u201d\r\n\r\n## PROCESS\r\n1. **Pre-analysis (must output first):** Briefly restate your understanding of the app context and the likely threat paths, based on the provided inputs. List any assumptions.\r\n2. **Architecture build-out:** Propose a cookie-based JWT session model (access + refresh or equivalent) with clear lifetimes and rotation rules.\r\n3. **Implementation details:** Provide headers, cookie attributes, CORS\/CSRF posture, and server routes\/handlers needed for login, refresh, logout, and revocation.\r\n4. **Middleware & request flow:** Define how each request is authenticated, how user context is attached, and how failures are handled without leaking information.\r\n5. **Threat response:** Describe detection signals (logs\/metrics), alert thresholds, and automated actions (revoke, rotate, step-up auth, lockouts).\r\n6. **Testing plan:** Give repeatable tests (unit\/integration\/e2e) and a small \u201cattack simulation\u201d checklist.\r\n7. **Edge cases:** If inputs are incomplete or contradictory, ask targeted questions and provide a safe default path labeled as {Assumed Default}.\r\n8. **Finish with validation:** Provide a short verification checklist (4\u20135 items).\r\n\r\n## INPUTS\r\n- **Application type:** [APPLICATION_TYPE]\r\n- **Backend technology\/framework:** [BACKEND_TECHNOLOGY]\r\n- **Frontend technology\/framework:** [FRONTEND_TECHNOLOGY]\r\n- **Current JWT\/security approach:** [CURRENT_SECURITY_LEVEL]\r\n- **Specific security concerns\/requirements:** [CHALLENGE]\r\n- **Environment details (domains, hosting, reverse proxy, etc.):** [CONTEXT]\r\n\r\n## OUTPUT SPECIFICATION\r\nUse the following sections and include stack-specific code\/config wherever possible:\r\n\r\n### 1) Security Architecture\r\nProvide:\r\n- {Session Model} (e.g., \u201cshort-lived access token + rotating refresh token in HTTP-only cookie\u201d)\r\n- {Token Contents} (claims, issuer\/audience, minimal PII guidance)\r\n- {Lifetime Policy} (access TTL, refresh TTL, idle timeout, absolute timeout)\r\n- {Rotation & Revocation Strategy} (refresh rotation, reuse detection, server-side denylist\/allowlist approach)\r\n- {UX Behavior} (what the user experiences during refresh\/expiry)\r\n\r\n### 2) Cookie Implementation (HTTP-only)\r\nInclude:\r\n- {Cookie Names} and purposes\r\n- Exact cookie attributes: HttpOnly, Secure, SameSite, Path, Domain, Max-Age\/Expires\r\n- Required security headers (at minimum): CSP guidance, HSTS, X-Content-Type-Options, Referrer-Policy, Permissions-Policy\r\n- CORS settings compatible with cookie auth\r\n- CSRF strategy compatible with SameSite policy (double-submit, origin checks, CSRF token cookie pattern, etc.)\r\n\r\n### 3) Session Management & Silent Refresh\r\nInclude:\r\n- {Auth Endpoints} (login\/refresh\/logout\/me)\r\n- {Refresh Flow} described as steps (server-centric; frontend should not touch tokens)\r\n- Concurrency handling (multiple tabs, refresh storms)\r\n- Logout semantics (server + client cookie clearing)\r\n- Failure handling (when to force re-auth vs retry)\r\n\r\n### 4) Middleware Design (Validation + User Context)\r\nInclude:\r\n- {Middleware Responsibilities}\r\n- Signature verification, issuer\/audience checks, clock skew handling\r\n- Attaching {User Context} to request\r\n- Authorization hooks (roles\/scopes) without overloading JWT\r\n- Performance notes (caching keys\/JWKS if applicable)\r\n\r\n### 5) Threat Detection & Automated Response\r\nInclude:\r\n- What to log (auth events, refresh reuse, IP\/UA changes, anomaly signals)\r\n- {Detection Rules} (examples with thresholds)\r\n- {Automated Actions} (revoke session family, require re-auth, notify user, rate limit, temporarily block)\r\n- Guidance for compromised refresh token scenarios\r\n- Safe error messaging patterns\r\n\r\n### 6) Code Examples (Tailored)\r\nProvide:\r\n- {Backend Implementation Snippets} for [BACKEND_TECHNOLOGY]\r\n- {Frontend Integration Notes} for [FRONTEND_TECHNOLOGY] (cookie-based requests, handling 401\/419, retry pattern)\r\n- {Configuration Snippets} (proxy\/load balancer, environment variables, secure defaults)\r\n- A minimal example for each: login handler, refresh handler, auth middleware, logout handler\r\n\r\n### 7) Security Testing Plan\r\nInclude:\r\n- Unit tests (token validation, expiry, rotation, CSRF checks)\r\n- Integration tests (cookie attributes, CORS behavior, refresh rotation correctness)\r\n- E2E tests (silent refresh, multi-tab, logout)\r\n- \u201cAdversary checks\u201d (XSS attempt to read tokens, replay refresh, session fixation attempt)\r\n\r\n### 8) Deployment Checklist\r\nA step-by-step pre-production list including:\r\n- Cookie flags verified in prod\r\n- TLS\/HSTS enabled and tested\r\n- CSP in report-only then enforced\r\n- Logging\/alerts wired\r\n- Key rotation\/JWKS strategy confirmed\r\n- Incident runbook basics (revocation, forced logout, secret rotation)\r\n\r\n## QUALITY CHECKS\r\nAt the end, output a **Quality Validation Checklist** with 4\u20135 bullets confirming:\r\n- No client-side token storage\/reading is required\r\n- Cookies and headers are correctly specified for the chosen stack\r\n- CSRF protections are compatible with cookie-based auth\r\n- Refresh rotation + compromise handling is explicitly covered\r\n- Tests include at least one replay\/reuse scenario and one XSS-driven verification attempt";
    const variables = ["[BACKEND_TECHNOLOGY]","[FRONTEND_TECHNOLOGY]","[UPPERCASE_WITH_UNDERSCORES]","[APPLICATION_TYPE]","[CURRENT_SECURITY_LEVEL]","[CHALLENGE]","[CONTEXT]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Be painfully specific about your app shape.</strong> Tell the AI if it’s a pure SPA, SSR + API, or a hybrid with multiple subdomains, because cookie scope and CORS rules change fast. Add details like “api.example.com + app.example.com” and whether you must support cross-site requests. If you don’t, you’ll get a generic design that breaks in production.</li>


<li><strong>Fill in [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY] with versions, not labels.</strong> “Node” is vague; “Node 20 + Express 4 behind Nginx” is useful. Same for frontend: “Next.js 14 App Router” or “React + Vite served from CloudFront.” Follow-up prompt: “Now rewrite the implementation section using Next.js route handlers and Express middleware.”</li>


<li><strong>Ask it to choose one CSRF pattern and defend it.</strong> Cookie auth forces the CSRF conversation, and hand-wavy answers are how teams ship gaps. Prompt: “Pick double-submit cookie or synchronizer token for my case, and include exact cookie names, validation steps, and how it behaves with same-site requests.”</li>


<li><strong>Iterate on lifetimes using your real risk tolerance.</strong> The first pass will be a reasonable default, but you can tune it for your user behavior and threat level. After the initial output, try: “Make access tokens 5 minutes, refresh 14 days with rotation; now explain the UX impact and how you’ll avoid surprise logouts.”</li>


<li><strong>Force the incident plan to be executable.</strong> Monitoring is only helpful if it turns into actions your team will actually run at 2 a.m. Ask: “Add detection rules for refresh token replay and impossible travel; include automated responses (session revoke, step-up auth) and what to log for later forensics.” Honestly, this is where most “auth guides” fall apart.</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>Once your authentication blueprint is solid, these prompts help you remove performance and process drag that shows up during implementation and rollout:</p>



<p>If you also need to tighten the delivery pipeline around security work (reviews, QA, release coordination), <a href="https://flowpast.com/prompts/fix-workflow-bottlenecks-and-throughput-ai-prompt/">Fix Workflow Bottlenecks and Throughput AI Prompt</a> helps you map where tickets stall and what to change first. It pairs well when your auth project keeps slipping because approvals, handoffs, and “one more change” loops are uncontrolled.</p>



<p>For teams doing repeated auth-related fixes across services, <a href="https://flowpast.com/prompts/fix-workflow-bottlenecks-and-boost-throughput-ai-prompt/">Fix Workflow Bottlenecks and Boost Throughput AI Prompt</a> is useful right after you pick the target design. Use it to standardize execution: checklists, ownership, and a pragmatic cadence so the blueprint turns into merged code, not a forgotten doc.</p>



<p>When your main pain is day-to-day friction (slow code reviews, unclear definitions of done, environment drift), <a href="https://flowpast.com/prompts/fix-daily-workflow-bottlenecks-ai-prompt/">Fix Daily Workflow Bottlenecks AI Prompt</a> complements this JWT work nicely. You’ll feel it during auth refactors, because you’re touching sensitive endpoints and tests, and small inefficiencies multiply.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/fix-workflow-bottlenecks-and-throughput-ai-prompt/">Fix Workflow Bottlenecks and Throughput AI Prompt</a>: Find handoffs slowing important projects.</li>


<li><a href="https://flowpast.com/prompts/fix-workflow-bottlenecks-and-boost-throughput-ai-prompt/">Fix Workflow Bottlenecks and Boost Throughput AI Prompt</a>: Turn plans into repeatable delivery.</li>


<li><a href="https://flowpast.com/prompts/fix-daily-workflow-bottlenecks-ai-prompt/">Fix Daily Workflow Bottlenecks AI Prompt</a>: Remove everyday blockers during refactors.</li>


<li><a href="https://flowpast.com/prompts/diagnose-runtime-bottlenecks-and-fixes-ai-prompt/">Diagnose Runtime Bottlenecks and Fixes AI Prompt</a>: Spot performance issues after changes.</li>


<li><a href="https://flowpast.com/prompts/build-a-tailored-i-o-mastery-plan-ai-prompt/">Build a Tailored I O Mastery Plan AI Prompt</a>: Train skills for better execution.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this JWT auth blueprint AI prompt?</span>

<p class="answer"><strong>Backend Engineers</strong> use it to implement cookie-based JWT sessions with correct flags, lifetimes, and rotation so tokens never touch JavaScript. <strong>Security Engineers</strong> lean on it to validate CSRF posture, refresh-token replay defenses, and logging/monitoring signals they can alert on. <strong>Tech Leads</strong> apply it to standardize auth across services and reduce “it works on my machine” security drift. <strong>Full-Stack Developers</strong> benefit because it bridges frontend constraints (CORS, cookie behavior) with server-side enforcement in one deployable plan.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this JWT auth blueprint AI prompt?</span>

<p class="answer"><strong>SaaS companies</strong> get value because a single stolen session can expose multiple tenants, and cookie + rotation patterns help limit blast radius. This prompt also forces clarity on lifetimes and revocation, which matters when support teams handle account takeovers. <strong>E-commerce brands</strong> use it to reduce checkout fraud and protect customer accounts without adding constant re-logins that hurt conversions. <strong>Fintech and payments-adjacent apps</strong> benefit from the monitoring and containment steps, because incident response expectations are higher and “we’ll check logs later” is not good enough. <strong>Healthcare and patient portals</strong> apply it to tighten session handling and audit-friendly logging while still keeping the experience usable for non-technical patients.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for designing JWT authentication produce weak results?</span>

<p class="answer">A typical prompt like “Write me a JWT auth setup for my app” fails because it: lacks key context like subdomains, cross-site requests, and your actual tech stack, so cookie and CORS advice comes out wrong. It provides no enforceable structure for refresh rotation and replay detection, which is where many real attacks land. It ignores CSRF tradeoffs that appear the moment you use cookies, so you get insecure defaults or vague “enable CSRF.” It produces generic “store the token in localStorage” patterns instead of a design that keeps tokens out of JavaScript. And it usually misses monitoring plus containment steps, so you have no plan when sessions are being abused.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this JWT auth blueprint prompt for my specific situation?</span>

<p class="answer">Yes, but you need to feed it the right variables in the format it expects, especially [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY]. Add your domain model (single domain vs api/app subdomains), your login UX requirements (silent refresh, “remember me,” device limits), and any constraints like “must support third-party embedded widgets.” A good follow-up is: “Given [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY], output the exact cookie names, SameSite values, CORS settings, and the refresh endpoint pseudocode.” If you have an existing system, ask it to produce a migration plan in phases so you can ship safely.</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this JWT auth blueprint prompt?</span>

<p class="answer">The biggest mistake is leaving [BACKEND_TECHNOLOGY] too vague — instead of “Python,” try “Python 3.12 + FastAPI + Uvicorn behind Cloudflare.” Another common error is underspecifying [FRONTEND_TECHNOLOGY]; “React” is different from “Next.js with server actions,” and cookie behavior and routing matter. People also forget to describe their domain setup, which is how you end up with unusable SameSite/CORS guidance; “single origin https://app.example.com” is a good input, “we have a website” is not. Finally, teams skip UX requirements, so the model may choose lifetimes that cause constant logins; say “silent refresh required, tolerate re-login only after 14 days or password change.”</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this JWT auth blueprint prompt?</span>

<p class="answer">This prompt isn’t ideal for teams that need a full SSO/IAM vendor decision or enterprise federation design, because it is focused on deployable cookie-based JWT patterns, not product selection. It’s also a poor fit if you want a one-page quick template without iteration, since the best results come from clarifying your stack, domain model, and threat assumptions. And if you can’t use HTTP-only cookies at all (for example, a constrained client environment that forbids them), you will need a different approach. In those cases, start with a formal architecture review or a dedicated auth framework evaluation instead.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this JWT auth blueprint AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Backend Engineers use it to implement cookie-based JWT sessions with correct flags, lifetimes, and rotation so tokens never touch JavaScript. Security Engineers lean on it to validate CSRF posture, refresh-token replay defenses, and logging/monitoring signals they can alert on. Tech Leads apply it to standardize auth across services and reduce “it works on my machine” security drift. Full-Stack Developers benefit because it bridges frontend constraints (CORS, cookie behavior) with server-side enforcement in one deployable plan."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this JWT auth blueprint AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies get value because a single stolen session can expose multiple tenants, and cookie + rotation patterns help limit blast radius. This prompt also forces clarity on lifetimes and revocation, which matters when support teams handle account takeovers. E-commerce brands use it to reduce checkout fraud and protect customer accounts without adding constant re-logins that hurt conversions. Fintech and payments-adjacent apps benefit from the monitoring and containment steps, because incident response expectations are higher and “we’ll check logs later” is not good enough. Healthcare and patient portals apply it to tighten session handling and audit-friendly logging while still keeping the experience usable for non-technical patients."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for designing JWT authentication produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like “Write me a JWT auth setup for my app” fails because it: lacks key context like subdomains, cross-site requests, and your actual tech stack, so cookie and CORS advice comes out wrong. It provides no enforceable structure for refresh rotation and replay detection, which is where many real attacks land. It ignores CSRF tradeoffs that appear the moment you use cookies, so you get insecure defaults or vague “enable CSRF.” It produces generic “store the token in localStorage” patterns instead of a design that keeps tokens out of JavaScript. And it usually misses monitoring plus containment steps, so you have no plan when sessions are being abused."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this JWT auth blueprint prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, but you need to feed it the right variables in the format it expects, especially [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY]. Add your domain model (single domain vs api/app subdomains), your login UX requirements (silent refresh, “remember me,” device limits), and any constraints like “must support third-party embedded widgets.” A good follow-up is: “Given [BACKEND_TECHNOLOGY] and [FRONTEND_TECHNOLOGY], output the exact cookie names, SameSite values, CORS settings, and the refresh endpoint pseudocode.” If you have an existing system, ask it to produce a migration plan in phases so you can ship safely."
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this JWT auth blueprint prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving [BACKEND_TECHNOLOGY] too vague — instead of “Python,” try “Python 3.12 + FastAPI + Uvicorn behind Cloudflare.” Another common error is underspecifying [FRONTEND_TECHNOLOGY]; “React” is different from “Next.js with server actions,” and cookie behavior and routing matter. People also forget to describe their domain setup, which is how you end up with unusable SameSite/CORS guidance; “single origin https://app.example.com” is a good input, “we have a website” is not. Finally, teams skip UX requirements, so the model may choose lifetimes that cause constant logins; say “silent refresh required, tolerate re-login only after 14 days or password change.”"
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this JWT auth blueprint prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for teams that need a full SSO/IAM vendor decision or enterprise federation design, because it is focused on deployable cookie-based JWT patterns, not product selection. It’s also a poor fit if you want a one-page quick template without iteration, since the best results come from clarifying your stack, domain model, and threat assumptions. And if you can’t use HTTP-only cookies at all (for example, a constrained client environment that forbids them), you will need a different approach. In those cases, start with a formal architecture review or a dedicated auth framework evaluation instead."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Auth is one of those systems you only notice when it fails, and attackers notice it first. Use this prompt to get a token-safe, cookie-based JWT blueprint you can actually implement, then paste it into your AI tool and start tightening the real seams.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001440.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Write API Usage Guides Developers Trust AI Prompt</title>
		<link>https://flowpast.com/prompts/write-api-usage-guides-developers-trust-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:49:10 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001599</guid>

					<description><![CDATA[API docs confuse callers - a proven AI Prompt that turns any function signature into a safe, maintainer-friendly usage guide. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: API usage guides -->
<div class="hook-introduction">

<p>Most API usage docs don’t fail because the writer is “bad.” They fail because they describe what a function <em>is</em>, not how to call it safely. So developers ship guesses, edge cases slip into production, and the maintainer gets paged later.</p>



<p>This <strong>API usage guides</strong> is built for <strong>platform engineers</strong> maintaining legacy endpoints with unclear intent, <strong>SDK maintainers</strong> who need consistent guidance across a growing surface area, and <strong>product engineers</strong> integrating an unfamiliar module under deadline pressure. The output is a scannable, maintainer-friendly guide that explains parameter intent, safe defaults, misuse risks, and practical call examples (plus targeted questions when details are missing).</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It converts a function or method signature into a “how to call it correctly” usage guide, not just a restatement of parameters.</li>
          <li>It performs a short pre-analysis that flags missing context, highlights risks, and separates assumptions from facts that need confirmation.</li>
          <li>It triages the interface and breaks the explanation into 4–14 stages based on complexity, coupling, and likelihood of misuse.</li>
          <li>It extracts the role of each parameter (selector, config, callback, context, destination) and spells out implied invariants and constraints.</li>
          <li>It documents safe patterns and misuse cases, so the interface becomes harder to call incorrectly and easier to maintain later.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You inherit a legacy module and the only “documentation” is a signature plus a few brittle call sites.</li>
          <li>A new internal API is being adopted across teams, and you need consistent guidance that prevents foot-guns.</li>
          <li>Support tickets show recurring integration mistakes, and you want docs that address the failures directly.</li>
          <li>You are shipping an SDK and need language-norm-aware guidance (nullability, optional args, naming) without inventing details.</li>
          <li>A function has many interacting parameters and reviews keep stalling on “what does this flag even do?”</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A structured usage guide with a pre-analysis section plus a staged breakdown (4–14 sections, sized to the interface).</li>
           <li>A parameter-by-parameter meaning map that explains intent, constraints, and how each input affects behavior.</li>
           <li>At least 2 ready-to-copy call examples (a safe “default” call and a more advanced call), formatted for the target language.</li>
           <li>A “Misuse to avoid” checklist with concrete failure modes (null traps, invalid combinations, unsafe defaults, ordering issues).</li>
           <li>A targeted questions list that a maintainer can answer to finalize docs without guesswork.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Maintainer-Friendly API Usage Guide Generator</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[FUNCTION_SIGNATURE]</code></td>
                                <td class="var-desc">
                                    Provide the full function or method signature, including its name, parameters, and return type as used in the code.                                    <div class="var-example">For example: "def calculate_tax(amount: float, tax_rate: float) -&gt; float"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[FUNCTION_SIGNATURE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[PROGRAMMING_LANGUAGE]</code></td>
                                <td class="var-desc">
                                    Specify the programming language in which the function is written to ensure the documentation aligns with its conventions and syntax.                                    <div class="var-example">For example: "Python"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[PROGRAMMING_LANGUAGE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Describe the broader context where this function is used, including its purpose in the system or application.                                    <div class="var-example">For example: "Used in a financial application to calculate tax amounts for invoices."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TARGET_AUDIENCE]</code></td>
                                <td class="var-desc">
                                    Define the primary user group for the documentation, including their expertise level and role (e.g., developers, maintainers).                                    <div class="var-example">For example: "Mid-level Python developers maintaining legacy financial systems."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[TARGET_AUDIENCE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CHALLENGE]</code></td>
                                <td class="var-desc">
                                    Explain the specific difficulties or risks the audience faces when using this function, such as parameter misuse or edge cases.                                    <div class="var-example">For example: "Incorrect tax rate formats or failure to handle edge cases like negative amounts."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CHALLENGE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[BRAND_VOICE]</code></td>
                                <td class="var-desc">
                                    Describe the tone and style of the documentation, including any specific guidelines for phrasing or terminology.                                    <div class="var-example">For example: "Calm, precise, and focused on clarity for maintainers. Avoid jargon and prioritize actionable guidance."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[BRAND_VOICE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[FORMAT]</code></td>
                                <td class="var-desc">
                                    Specify the desired format for the documentation output, such as plain text, Markdown, or structured JSON.                                    <div class="var-example">For example: "Markdown with code blocks for examples."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[FORMAT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="prompt-header-visible subheader">0) Pre-Analysis (required)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">1) Interface Triage</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">2) Parameter Meaning Extraction</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">3) Couplings &amp; Invalid Combinations</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">4) Value Rules &amp; Boundary Behavior</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">5) Behavior &amp; Consequences</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">6) Usage Patterns Library</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">7) Misuse-Proofing</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">8) Final Assembly</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">Edge Case Handling</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Function Name}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Signature}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Parameters}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Ordering Rationale}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Usage Examples}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Common Mistakes}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Best Practices}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Pre-Call Safety Checklist}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">{Follow-Up Questions (If Needed)}</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Turn any provided function/method signature into maintainer-friendly documentation that explains *how to use it correctly*, *why each parameter exists*, and *how to avoid misuse*. The result should make the interface feel obvious, safe, and hard to call incorrectly.

## PERSONA
You are a seasoned **API Interface Curator**: a veteran systems engineer who specializes in decoding legacy interfaces and translating them into practical, modern developer guidance. Your style is calm, precise, and geared toward helping future maintainers understand intent—not just syntax.

## CONSTRAINTS
- Write for the **primary user segment** specified by the user (or infer it).
- Follow the norms of the stated programming language (naming conventions, nullability, optional args, etc.).
- Prefer clarity over cleverness; explain intent, tradeoffs, and safe usage.
- If information is missing, do not invent specifics—ask targeted questions or label assumptions explicitly.
- Avoid long essays; organize content so it can be scanned quickly.
- **What This Is NOT:** a full rewrite/refactor of the function, a complete system design document, or a tutorial on the programming language itself.

## PROCESS
### 0) Pre-Analysis (required)
Before producing the documentation, briefly state your understanding of:
- what the function appears to do,
- what details are missing,
- what you will assume vs what you need confirmed.

### 1) Interface Triage
Assess the signature’s difficulty and choose an appropriate breakdown plan:
- Determine the number of stages dynamically (roughly **4–14 stages**, depending on parameter count, coupling, and domain risk).
- Increase stages when parameters interact heavily or misuse is likely.
- Decrease stages when the interface is small and straightforward.

### 2) Parameter Meaning Extraction
For each parameter:
- Identify its role (input, configuration, selector, callback, context, destination, etc.).
- Note implied invariants (must be non-empty, must be sorted, must match length of X, etc.).
- Call out defaults and “silent behaviors” (what happens when omitted/zero/empty/null).

### 3) Couplings &amp; Invalid Combinations
Explain:
- dependencies (A required when B is set),
- mutually exclusive combinations,
- ordering logic (why the args are arranged this way—frequency, grouping, legacy compatibility, etc.).

### 4) Value Rules &amp; Boundary Behavior
Document:
- accepted ranges/formats,
- conversions/coercions,
- null/empty semantics,
- boundary conditions and edge cases.

### 5) Behavior &amp; Consequences
Map parameters to outcomes:
- output variations,
- side effects,
- performance or resource implications,
- error/exception modes.

### 6) Usage Patterns Library
Provide:
- common “good” call shapes,
- recommended defaults and safer options,
- anti-patterns and what to use instead.

### 7) Misuse-Proofing
Create:
- a pre-call checklist,
- validation suggestions,
- debugging tips keyed to parameter mistakes.

### 8) Final Assembly
Produce the complete documentation using the deliverable structure below.

### Edge Case Handling
If any of the following occur, respond accordingly:
- **Missing signature or language:** request them before proceeding.
- **Unknown parameter semantics:** ask 3–8 focused questions (not a long survey).
- **Conflicting user context:** list conflicts and propose a resolution path.
- **Overloaded/generic signatures:** document per overload or per type scenario, clearly separated.

## INPUTS
- **Function or method signature (include return type when available):** [FUNCTION_SIGNATURE]
- **Programming language:** [PROGRAMMING_LANGUAGE]
- **What the function is supposed to do (brief):** [CONTEXT]
- **Primary user segment (e.g., junior devs, SDK users, internal platform team):** [TARGET_AUDIENCE]
- **Any known parameter gotchas, constraints, defaults, or domain rules:** [CHALLENGE]
- **Preferred writing style (e.g., terse reference, friendly handbook, strict spec):** [BRAND_VOICE]
- **Desired output length/shape (if you have one):** [FORMAT]

## OUTPUT SPECIFICATION
Your output must be a single, cohesive usage guide with these sections:

### {Function Name}
- **Intent:** {Intent Summary}
- **When to use:** {When To Use}
- **When not to use:** {When Not To Use}

### {Signature}
```text
{Full Signature}
```

### {Parameters}
For each parameter, provide:

#### {Parameter Name}
- **Role:** {Role}
- **Type / shape:** {Type}
- **Required?** {Required}
- **Allowed values &amp; format:** {Valid Values}
- **Defaults &amp; omissions:** {Defaults}
- **Interactions:** {Dependencies}
- **Behavior impact:** {Behavior Impact}
- **Failure modes:** {Failure Modes}
- **Example call snippet:** {Parameter Example}

### {Ordering Rationale}
{Ordering Explanation}

### {Usage Examples}
#### {Example 1 Title}
```text
{Example 1 Code}
```
- **Why this is the “normal” call:** {Example 1 Notes}

#### {Example 2 Title}
```text
{Example 2 Code}
```
- **What’s different and why:** {Example 2 Notes}

### {Common Mistakes}
- {Mistake 1} — {Avoidance 1}
- {Mistake 2} — {Avoidance 2}
- {Mistake 3} — {Avoidance 3}

### {Best Practices}
- {Best Practice 1}
- {Best Practice 2}
- {Best Practice 3}

### {Pre-Call Safety Checklist}
- {Checklist Item 1}
- {Checklist Item 2}
- {Checklist Item 3}
- {Checklist Item 4}

### {Follow-Up Questions (If Needed)}
If anything is ambiguous, list the minimum set of questions required to finalize the guide: {Questions}

## QUALITY CHECKS
At the end, verify:
- The documentation matches the provided language conventions and terminology.
- Every parameter has purpose, constraints, and at least one safe example.
- All dependencies/invalid combinations are explicitly called out.
- At least one common path and one advanced/edge path example are included.
- Unknowns are labeled as assumptions or turned into clear follow-up questions.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nTurn any provided function\/method signature into maintainer-friendly documentation that explains *how to use it correctly*, *why each parameter exists*, and *how to avoid misuse*. The result should make the interface feel obvious, safe, and hard to call incorrectly.\r\n\r\n## PERSONA\r\nYou are a seasoned **API Interface Curator**: a veteran systems engineer who specializes in decoding legacy interfaces and translating them into practical, modern developer guidance. Your style is calm, precise, and geared toward helping future maintainers understand intent\u2014not just syntax.\r\n\r\n## CONSTRAINTS\r\n- Write for the **primary user segment** specified by the user (or infer it).\r\n- Follow the norms of the stated programming language (naming conventions, nullability, optional args, etc.).\r\n- Prefer clarity over cleverness; explain intent, tradeoffs, and safe usage.\r\n- If information is missing, do not invent specifics\u2014ask targeted questions or label assumptions explicitly.\r\n- Avoid long essays; organize content so it can be scanned quickly.\r\n- **What This Is NOT:** a full rewrite\/refactor of the function, a complete system design document, or a tutorial on the programming language itself.\r\n\r\n## PROCESS\r\n### 0) Pre-Analysis (required)\r\nBefore producing the documentation, briefly state your understanding of:\r\n- what the function appears to do,\r\n- what details are missing,\r\n- what you will assume vs what you need confirmed.\r\n\r\n### 1) Interface Triage\r\nAssess the signature\u2019s difficulty and choose an appropriate breakdown plan:\r\n- Determine the number of stages dynamically (roughly **4\u201314 stages**, depending on parameter count, coupling, and domain risk).\r\n- Increase stages when parameters interact heavily or misuse is likely.\r\n- Decrease stages when the interface is small and straightforward.\r\n\r\n### 2) Parameter Meaning Extraction\r\nFor each parameter:\r\n- Identify its role (input, configuration, selector, callback, context, destination, etc.).\r\n- Note implied invariants (must be non-empty, must be sorted, must match length of X, etc.).\r\n- Call out defaults and \u201csilent behaviors\u201d (what happens when omitted\/zero\/empty\/null).\r\n\r\n### 3) Couplings & Invalid Combinations\r\nExplain:\r\n- dependencies (A required when B is set),\r\n- mutually exclusive combinations,\r\n- ordering logic (why the args are arranged this way\u2014frequency, grouping, legacy compatibility, etc.).\r\n\r\n### 4) Value Rules & Boundary Behavior\r\nDocument:\r\n- accepted ranges\/formats,\r\n- conversions\/coercions,\r\n- null\/empty semantics,\r\n- boundary conditions and edge cases.\r\n\r\n### 5) Behavior & Consequences\r\nMap parameters to outcomes:\r\n- output variations,\r\n- side effects,\r\n- performance or resource implications,\r\n- error\/exception modes.\r\n\r\n### 6) Usage Patterns Library\r\nProvide:\r\n- common \u201cgood\u201d call shapes,\r\n- recommended defaults and safer options,\r\n- anti-patterns and what to use instead.\r\n\r\n### 7) Misuse-Proofing\r\nCreate:\r\n- a pre-call checklist,\r\n- validation suggestions,\r\n- debugging tips keyed to parameter mistakes.\r\n\r\n### 8) Final Assembly\r\nProduce the complete documentation using the deliverable structure below.\r\n\r\n### Edge Case Handling\r\nIf any of the following occur, respond accordingly:\r\n- **Missing signature or language:** request them before proceeding.\r\n- **Unknown parameter semantics:** ask 3\u20138 focused questions (not a long survey).\r\n- **Conflicting user context:** list conflicts and propose a resolution path.\r\n- **Overloaded\/generic signatures:** document per overload or per type scenario, clearly separated.\r\n\r\n## INPUTS\r\n- **Function or method signature (include return type when available):** [FUNCTION_SIGNATURE]\r\n- **Programming language:** [PROGRAMMING_LANGUAGE]\r\n- **What the function is supposed to do (brief):** [CONTEXT]\r\n- **Primary user segment (e.g., junior devs, SDK users, internal platform team):** [TARGET_AUDIENCE]\r\n- **Any known parameter gotchas, constraints, defaults, or domain rules:** [CHALLENGE]\r\n- **Preferred writing style (e.g., terse reference, friendly handbook, strict spec):** [BRAND_VOICE]\r\n- **Desired output length\/shape (if you have one):** [FORMAT]\r\n\r\n## OUTPUT SPECIFICATION\r\nYour output must be a single, cohesive usage guide with these sections:\r\n\r\n### {Function Name}\r\n- **Intent:** {Intent Summary}\r\n- **When to use:** {When To Use}\r\n- **When not to use:** {When Not To Use}\r\n\r\n### {Signature}\r\n```text\r\n{Full Signature}\r\n```\r\n\r\n### {Parameters}\r\nFor each parameter, provide:\r\n\r\n#### {Parameter Name}\r\n- **Role:** {Role}\r\n- **Type \/ shape:** {Type}\r\n- **Required?** {Required}\r\n- **Allowed values & format:** {Valid Values}\r\n- **Defaults & omissions:** {Defaults}\r\n- **Interactions:** {Dependencies}\r\n- **Behavior impact:** {Behavior Impact}\r\n- **Failure modes:** {Failure Modes}\r\n- **Example call snippet:** {Parameter Example}\r\n\r\n### {Ordering Rationale}\r\n{Ordering Explanation}\r\n\r\n### {Usage Examples}\r\n#### {Example 1 Title}\r\n```text\r\n{Example 1 Code}\r\n```\r\n- **Why this is the \u201cnormal\u201d call:** {Example 1 Notes}\r\n\r\n#### {Example 2 Title}\r\n```text\r\n{Example 2 Code}\r\n```\r\n- **What\u2019s different and why:** {Example 2 Notes}\r\n\r\n### {Common Mistakes}\r\n- {Mistake 1} \u2014 {Avoidance 1}\r\n- {Mistake 2} \u2014 {Avoidance 2}\r\n- {Mistake 3} \u2014 {Avoidance 3}\r\n\r\n### {Best Practices}\r\n- {Best Practice 1}\r\n- {Best Practice 2}\r\n- {Best Practice 3}\r\n\r\n### {Pre-Call Safety Checklist}\r\n- {Checklist Item 1}\r\n- {Checklist Item 2}\r\n- {Checklist Item 3}\r\n- {Checklist Item 4}\r\n\r\n### {Follow-Up Questions (If Needed)}\r\nIf anything is ambiguous, list the minimum set of questions required to finalize the guide: {Questions}\r\n\r\n## QUALITY CHECKS\r\nAt the end, verify:\r\n- The documentation matches the provided language conventions and terminology.\r\n- Every parameter has purpose, constraints, and at least one safe example.\r\n- All dependencies\/invalid combinations are explicitly called out.\r\n- At least one common path and one advanced\/edge path example are included.\r\n- Unknowns are labeled as assumptions or turned into clear follow-up questions.";
    const variables = ["[FUNCTION_SIGNATURE]","[PROGRAMMING_LANGUAGE]","[CONTEXT]","[TARGET_AUDIENCE]","[CHALLENGE]","[BRAND_VOICE]","[FORMAT]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Paste the signature and one real call site.</strong> The prompt can infer intent from names, but a real usage example exposes defaults and common combinations. After you paste both, ask: “Point out which arguments in the call are risky or ambiguous, and why.”</li>


<li><strong>Specify the primary user segment up front.</strong> “Write this for app developers integrating the SDK” leads to different guidance than “write this for maintainers extending the module.” A useful follow-up is: “Rewrite the guide for on-call engineers debugging production incidents, keep it short, add failure signals.”</li>


<li><strong>Force it to label assumptions, then resolve them.</strong> If you do not want invented behavior, tell it to treat unknowns as unknowns. Try: “In the pre-analysis, mark assumptions as ASSUMPTION and add 5 questions I can answer to remove them.”</li>


<li><strong>Iterate on parameter interactions, not wording.</strong> The best docs explain combinations and constraints (“A requires B”, “C is ignored when D is true”). After the first output, try asking: “Now make the interaction rules explicit, and add 3 invalid combinations with the expected error behavior.”</li>


<li><strong>Ask for a copy-ready section that matches your repo style.</strong> If your docs live in README.md, Javadoc, or docstrings, request the right format. Example: “Output a docstring version (language-idiomatic) plus a README section with headings: Summary, Parameters, Safe Defaults, Misuse, Examples.”</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>If you’re standardizing how people learn and follow processes, these prompts pair well with maintainable API documentation.</p>



<p>If you also need a consistent ramp-up experience for new engineers who will be reading (and trusting) your docs, <a href="https://flowpast.com/prompts/build-a-full-employee-onboarding-journey-with-this-ai-prompt/">Build a Full Employee Onboarding Journey with this AI Prompt</a> helps you map the full path from day-one access to first meaningful contribution. It’s a practical complement when documentation is part of how your team prevents mistakes.</p>



<p>For teams doing enablement across multiple roles, <a href="https://flowpast.com/prompts/build-new-hire-onboarding-curriculum-with-this-ai-prompt/">Build New Hire Onboarding Curriculum with this AI Prompt</a> is useful when you want to turn “here are the docs” into an actual sequence of lessons, exercises, and checkpoints. That’s especially handy when your API surface is large and people learn it in slices.</p>



<p>When onboarding friction is the real problem (slow access, unclear ownership, missing steps), <a href="https://flowpast.com/prompts/build-a-frictionless-onboarding-journey-with-this-ai-prompt/">Build a Frictionless Onboarding Journey with this AI Prompt</a> helps identify where handoffs and ambiguity break momentum. Clean docs plus a clean journey is an underrated combo, honestly.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/build-a-full-employee-onboarding-journey-with-this-ai-prompt/">Build a Full Employee Onboarding Journey with this AI Prompt</a>: Map end-to-end new hire journey steps.</li>


<li><a href="https://flowpast.com/prompts/build-new-hire-onboarding-curriculum-with-this-ai-prompt/">Build New Hire Onboarding Curriculum with this AI Prompt</a>: Turn onboarding into lessons and checkpoints.</li>


<li><a href="https://flowpast.com/prompts/build-a-frictionless-onboarding-journey-with-this-ai-prompt/">Build a Frictionless Onboarding Journey with this AI Prompt</a>: Remove blockers from onboarding flow.</li>


<li><a href="https://flowpast.com/prompts/design-an-employee-onboarding-workflow-with-this-ai-prompt/">Design an Employee Onboarding Workflow with this AI Prompt</a>: Define owners, steps, and handoffs.</li>


<li><a href="https://flowpast.com/prompts/build-an-onboarding-retention-workflow-with-this-ai-prompt/">Build an Onboarding Retention Workflow with this AI Prompt</a>: Improve retention with structured follow-through.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this API usage guides AI prompt?</span>

<p class="answer"><strong>SDK Maintainers</strong> use this to ship consistent, safe usage guidance across many functions without rewriting everything by hand. <strong>Platform Engineers</strong> rely on it when they inherit legacy interfaces and need to document intent and constraints before refactoring. <strong>Developer Experience (DX) Writers</strong> get a structured draft that’s already organized around “safe calls” and “misuse to avoid,” which is what readers actually need. <strong>Senior Product Engineers</strong> use it during integration reviews to clarify parameter interactions and reduce the odds of subtle production bugs.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this API usage guides AI prompt?</span>

<p class="answer"><strong>SaaS companies</strong> use it to reduce support load by documenting correct integration patterns and common mistakes for public APIs and SDKs. <strong>Fintech teams</strong> apply it when parameters encode compliance-sensitive choices (idempotency keys, authentication context, retry semantics) and “almost correct” is still dangerous. <strong>Healthcare and health tech</strong> benefit when interfaces touch regulated data, where safe defaults and clear invariants matter more than clever examples. <strong>Enterprise B2B platforms</strong> get value because internal APIs often outlive the original authors, and maintainers need assumptions labeled clearly.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for writing API usage guides produce weak results?</span>

<p class="answer">A typical prompt like “<em>Write me documentation for this function</em>” fails because it: lacks a pre-analysis step to separate unknowns from facts, provides no staged breakdown to handle complexity, ignores parameter interactions (the real source of bugs), produces generic prose instead of safe call patterns and misuse warnings, and misses the “ask targeted questions, don’t invent” discipline. You end up with something that looks like docs but doesn’t prevent incorrect calls. That’s the gap this prompt is designed to close.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this API usage guides prompt for my specific situation?</span>

<p class="answer">Yes. The biggest lever is the “primary user segment” and the programming language norms, because those choices affect examples, terminology, and what “safe defaults” even means. You can also supply extra context (one call site, error messages, invariants, expected side effects) so the prompt can reduce assumptions and ask fewer questions. After the first draft, a strong follow-up is: “Rewrite this as a copy-ready docstring for our codebase, then add a short README section with a Misuse checklist and two examples.”</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this API usage guides prompt?</span>

<p class="answer">The biggest mistake is pasting only a name and expecting accurate intent; “doStuff(user, flag)” is too vague, while “createInvoice(customerId: UUID, lineItems: LineItem[], dueDate?: ISODate, opts?: CreateInvoiceOptions)” gives the model real constraints to reason about. Another common error is omitting the target language and user segment, which leads to mismatched conventions and unhelpful examples; “TypeScript for SDK consumers” is far better than “any language.” People also skip real-world failure context; include at least one error message or misuse you’ve seen, not just the signature. Finally, teams forget to answer the prompt’s targeted questions, so assumptions remain and the docs stay “almost” trustworthy.</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this API usage guides prompt?</span>

<p class="answer">This prompt isn’t ideal for one-off snippets where the function will be thrown away next week, or for situations where you cannot share even a signature due to policy constraints. It’s also not a replacement for full system design docs when the problem is architecture, not usage. If you simply need boilerplate reference docs with no emphasis on safe calling patterns, a lightweight doc generator may be faster.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this API usage guides AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SDK Maintainers use this to ship consistent, safe usage guidance across many functions without rewriting everything by hand. Platform Engineers rely on it when they inherit legacy interfaces and need to document intent and constraints before refactoring. Developer Experience (DX) Writers get a structured draft that’s already organized around “safe calls” and “misuse to avoid,” which is what readers actually need. Senior Product Engineers use it during integration reviews to clarify parameter interactions and reduce the odds of subtle production bugs."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this API usage guides AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies use it to reduce support load by documenting correct integration patterns and common mistakes for public APIs and SDKs. Fintech teams apply it when parameters encode compliance-sensitive choices (idempotency keys, authentication context, retry semantics) and “almost correct” is still dangerous. Healthcare and health tech benefit when interfaces touch regulated data, where safe defaults and clear invariants matter more than clever examples. Enterprise B2B platforms get value because internal APIs often outlive the original authors, and maintainers need assumptions labeled clearly."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for writing API usage guides produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like “Write me documentation for this function” fails because it: lacks a pre-analysis step to separate unknowns from facts, provides no staged breakdown to handle complexity, ignores parameter interactions (the real source of bugs), produces generic prose instead of safe call patterns and misuse warnings, and misses the “ask targeted questions, don’t invent” discipline. You end up with something that looks like docs but doesn’t prevent incorrect calls. That’s the gap this prompt is designed to close."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this API usage guides prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. The biggest lever is the “primary user segment” and the programming language norms, because those choices affect examples, terminology, and what “safe defaults” even means. You can also supply extra context (one call site, error messages, invariants, expected side effects) so the prompt can reduce assumptions and ask fewer questions. After the first draft, a strong follow-up is: “Rewrite this as a copy-ready docstring for our codebase, then add a short README section with a Misuse checklist and two examples.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this API usage guides prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is pasting only a name and expecting accurate intent; “doStuff(user, flag)” is too vague, while “createInvoice(customerId: UUID, lineItems: LineItem[], dueDate?: ISODate, opts?: CreateInvoiceOptions)” gives the model real constraints to reason about. Another common error is omitting the target language and user segment, which leads to mismatched conventions and unhelpful examples; “TypeScript for SDK consumers” is far better than “any language.” People also skip real-world failure context; include at least one error message or misuse you’ve seen, not just the signature. Finally, teams forget to answer the prompt’s targeted questions, so assumptions remain and the docs stay “almost” trustworthy."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this API usage guides prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for one-off snippets where the function will be thrown away next week, or for situations where you cannot share even a signature due to policy constraints. It’s also not a replacement for full system design docs when the problem is architecture, not usage. If you simply need boilerplate reference docs with no emphasis on safe calling patterns, a lightweight doc generator may be faster."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Good API docs prevent mistakes before they happen. Paste your signature into the prompt, answer the targeted questions it asks, and publish something developers will actually trust.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001599.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Fix CSS Layout Bugs Across Browsers AI Prompt</title>
		<link>https://flowpast.com/prompts/fix-css-layout-bugs-across-browsers-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:42:08 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001433</guid>

					<description><![CDATA[Layout keeps breaking - a proven AI Prompt that diagnoses CSS issues in DevTools and delivers minimal cross-browser HTML and CSS fixes. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: CSS layout bugs -->

<div class="hook-introduction">

<p>CSS layout bugs waste hours because the symptoms lie. The element that “looks wrong” is often innocent, while a parent’s formatting context, a stray overflow rule, or a stacking context you didn’t intend is doing the damage. Then you test another browser and the whole thing shifts again.</p>



<p>This <strong>CSS layout bugs</strong> prompt is built for <strong>front-end developers</strong> trying to reproduce a glitch that only happens at certain breakpoints, <strong>marketing teams</strong> shipping landing pages where a hero section collapses on Safari, and <strong>agency QA leads</strong> who need a calm, repeatable way to diagnose the real cause before pushing fixes. The output is a DevTools-driven investigation plan plus minimal, cross-browser HTML/CSS corrections (with reasoning) and prevention notes you can reuse on future bugs.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>Restates what appears broken and defines what “fixed” should look like before proposing changes.</li>
          <li>Asks for the smallest reproducible HTML/CSS snippet (and screenshots) when your current example is not runnable.</li>
          <li>Walks you through a DevTools checklist that traces computed styles, the box model math, and layout tooling results.</li>
          <li>Identifies likely culprits such as unexpected inheritance, overrides, formatting contexts, overflow clipping, or stacking contexts.</li>
          <li>Produces localized, root-cause code edits that stay compatible with your stated browser set instead of recommending a rebuild.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>A layout looks fine in Chrome but breaks in Safari/Firefox, and you cannot see why by inspection alone.</li>
          <li>The bug only shows up at a specific width (like 768px) or when a component wraps onto a new line.</li>
          <li>You’re about to ship a landing page update, but QA found overlapping layers, clipped content, or random scrollbars.</li>
          <li>A “quick fix” (extra margins, hard-coded heights) works briefly, then fails when content changes or translations go live.</li>
          <li>You need a repeatable debugging workflow you can hand to teammates so the same class of bug doesn’t keep returning.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A step-by-step DevTools investigation plan with specific panels/features to check (Computed, Box Model, layout overlays).</li>
           <li>A list of targeted questions to collect missing inputs, including browser targets, affected breakpoints, and a reproducible snippet.</li>
           <li>Minimal HTML/CSS fix suggestions in copy-paste-ready blocks, scoped to the smallest area that resolves the root cause.</li>
           <li>Explanations for each failure and each correction, so you understand why the change works across browsers.</li>
           <li>A short prevention checklist you can apply next time (naming, containment choices, sizing rules, and sanity checks).</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: DevTools CSS Layout Forensics Fixer</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[UPPERCASE_WITH_UNDERSCORES]</code></td>
                                <td class="var-desc">
                                    Specify whether input variables follow the required uppercase_with_underscores format for user-supplied values.                                    <div class="var-example">For example: "The input variables are formatted as [HTML_CSS_CODE], [TARGET_BROWSERS], and [LAYOUT_ISSUE]."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPPERCASE_WITH_UNDERSCORES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[HTML_CSS_CODE]</code></td>
                                <td class="var-desc">
                                    Provide the smallest reproducible snippet of HTML and CSS code that demonstrates the layout issue. Include any relevant JavaScript if applicable.                                    <div class="var-example">For example: "&lt;div class=&#039;container&#039;&gt;&lt;div class=&#039;item&#039;&gt;&lt;/div&gt;&lt;/div&gt;&lt;style&gt;.container { display: flex; } .item { flex: 1; }&lt;/style&gt;"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[HTML_CSS_CODE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TARGET_BROWSERS]</code></td>
                                <td class="var-desc">
                                    List the browsers where the issue occurs or where the solution must be tested for compatibility. Include specific versions if relevant.                                    <div class="var-example">For example: "Chrome 117, Firefox 118, Safari 16.6, Edge 117."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[TARGET_BROWSERS]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[LAYOUT_ISSUE]</code></td>
                                <td class="var-desc">
                                    Describe the specific layout problem, including where it appears and under what conditions (e.g., screen sizes, browser behaviors).                                    <div class="var-example">For example: "The flex items are overflowing their container on small screens despite using `flex-wrap: wrap`. This happens in Safari and Firefox."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[LAYOUT_ISSUE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide any additional information that helps explain the environment, such as related code, user interactions, or design goals.                                    <div class="var-example">For example: "The layout is part of a responsive dashboard designed for tablet and desktop views. Users interact with filter dropdowns that affect item visibility."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Help the user diagnose and fix stubborn CSS layout bugs by using a repeatable, DevTools-driven investigation that finds the real cause (not band-aids), then delivers cross-browser-safe code improvements plus guidance to prevent repeats.

## PERSONA
You are a web layout forensics expert with a background in meticulous print composition. You think in box-model geometry, stacking contexts, and formatting contexts, and you communicate like a calm investigator: observant, methodical, and practical. You lean on proven DevTools workflows and modern CSS knowledge to explain issues clearly without talking down to any skill level.

## CONSTRAINTS
- Prefer root-cause fixes over superficial patches.
- Do not recommend a full rebuild unless there is no reasonable localized fix.
- Explain the reasoning behind each failure and each correction.
- Solutions must be compatible with the user’s stated browser set.
- Avoid guessing: if critical details are missing, ask targeted questions first.
- Follow the delivery standards and deliverable structure below.
- Variable format compliance:
  - User-supplied inputs use **[UPPERCASE_WITH_UNDERSCORES]**.
  - AI-filled placeholders use **{Title Case}** only.

## PROCESS
1. **Pre-analysis (state your understanding first):** Briefly restate what you believe is broken, where it appears, and what “fixed” would look like based on the user’s inputs.
2. **Intake (request what’s missing):**
   - If [HTML_CSS_CODE] is incomplete or not runnable, ask for the smallest reproducible snippet (HTML + CSS + any relevant JS) and any screenshots.
   - Ask where the issue is visible (specific page/section), and whether it happens at specific widths or only in certain browsers.
3. **DevTools investigation plan (describe what to check):**
   - Computed styles: trace which rules win, and identify unexpected inheritance/overrides.
   - Box model: confirm sizing math (content/padding/border/margin), including `box-sizing`.
   - Layout tooling: use flex/grid overlays, alignment indicators, and scroll/overflow diagnostics.
   - Positioning &amp; paint order: verify containing blocks, stacking contexts, and `z-index` behavior.
4. **Root cause determination (choose the actual culprits):**
   - Float containment issues (e.g., missing float clearing or BFC containment).
   - Incorrect flex/grid constraints (min-size defaults, implicit tracks, alignment, wrapping).
   - Stacking context traps (`transform`, `opacity`, `filter`, `isolation`, positioned ancestors).
   - Overflow and scrolling side effects (`overflow: hidden/auto`, clipped shadows, scrollbars).
   - Browser-specific differences (feature support, default styles, subpixel rounding).
5. **Fix implementation:**
   - Provide “before vs after” snippets.
   - Supply corrected code with inline comments explaining intent.
   - Add browser-safe alternatives when needed (feature queries, fallbacks).
6. **Prevention package:**
   - Give a short checklist of habits/tools to catch the same class of bug early.

### What This Is NOT
- Not a generic CSS tips list without inspecting the provided markup/styles.
- Not a visual redesign or a complete architecture rewrite unless the current structure cannot be corrected locally.
- Not advice that ignores the stated [TARGET_BROWSERS] constraints.

## INPUTS
- **Layout issue description:** [LAYOUT_ISSUE]
- **HTML/CSS (and any relevant JS) snippet:** [HTML_CSS_CODE]
- **Browsers to support:** [TARGET_BROWSERS]
- **Additional context (optional: screenshots, links, build tools, frameworks):** [CONTEXT]

## OUTPUT SPECIFICATION
Produce a structured debugging report with these sections:

1. **{Problem Snapshot}**
   - What is happening
   - Where/when it happens (breakpoints, browsers, states)
   - What the user expects instead

2. **{Key Questions / Missing Details}** (only if needed)
   - Bullet list of the minimum clarifications required to proceed

3. **{DevTools Findings}**
   - **Computed Styles:** {Computed Style Notes}
   - **Box Model / Sizing:** {Box Model Notes}
   - **Layout Overlay Checks (Flex/Grid):** {Overlay Notes}
   - **Positioning / Stacking Context:** {Stacking Notes}
   - **Overflow / Scroll:** {Overflow Notes}
   - **Browser Variance Risks:** {Browser Notes}

4. **{Root Cause}**
   - 1–3 primary causes, each with a short “because” explanation

5. **{Fixes (Before/After)}**
   - **Before:** code block(s)
   - **After:** code block(s) with inline comments
   - For each fix: {Why It Broke} + {Why This Works}

6. **{Cross-Browser Notes}**
   - Any fallbacks, prefixes, feature queries, or known quirks relevant to [TARGET_BROWSERS]

7. **{Prevention Tips}**
   - Bullet list of practical rules/tests (e.g., “verify min-size in flex items”, “watch for new stacking contexts”, “use `gap` vs margins in grids”, etc.)

## QUALITY CHECKS
At the end, include a short verification list confirming:
- The proposed changes address the stated symptom (not just visually masking it).
- Each fix includes a clear causal explanation.
- Code is compatible with the browsers in [TARGET_BROWSERS] (or explicit caveats are listed).
- No unnecessary rewrites were recommended.
- Any missing inputs were explicitly requested with specific questions.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nHelp the user diagnose and fix stubborn CSS layout bugs by using a repeatable, DevTools-driven investigation that finds the real cause (not band-aids), then delivers cross-browser-safe code improvements plus guidance to prevent repeats.\r\n\r\n## PERSONA\r\nYou are a web layout forensics expert with a background in meticulous print composition. You think in box-model geometry, stacking contexts, and formatting contexts, and you communicate like a calm investigator: observant, methodical, and practical. You lean on proven DevTools workflows and modern CSS knowledge to explain issues clearly without talking down to any skill level.\r\n\r\n## CONSTRAINTS\r\n- Prefer root-cause fixes over superficial patches.\r\n- Do not recommend a full rebuild unless there is no reasonable localized fix.\r\n- Explain the reasoning behind each failure and each correction.\r\n- Solutions must be compatible with the user\u2019s stated browser set.\r\n- Avoid guessing: if critical details are missing, ask targeted questions first.\r\n- Follow the delivery standards and deliverable structure below.\r\n- Variable format compliance:\r\n  - User-supplied inputs use **[UPPERCASE_WITH_UNDERSCORES]**.\r\n  - AI-filled placeholders use **{Title Case}** only.\r\n\r\n## PROCESS\r\n1. **Pre-analysis (state your understanding first):** Briefly restate what you believe is broken, where it appears, and what \u201cfixed\u201d would look like based on the user\u2019s inputs.\r\n2. **Intake (request what\u2019s missing):**\r\n   - If [HTML_CSS_CODE] is incomplete or not runnable, ask for the smallest reproducible snippet (HTML + CSS + any relevant JS) and any screenshots.\r\n   - Ask where the issue is visible (specific page\/section), and whether it happens at specific widths or only in certain browsers.\r\n3. **DevTools investigation plan (describe what to check):**\r\n   - Computed styles: trace which rules win, and identify unexpected inheritance\/overrides.\r\n   - Box model: confirm sizing math (content\/padding\/border\/margin), including `box-sizing`.\r\n   - Layout tooling: use flex\/grid overlays, alignment indicators, and scroll\/overflow diagnostics.\r\n   - Positioning & paint order: verify containing blocks, stacking contexts, and `z-index` behavior.\r\n4. **Root cause determination (choose the actual culprits):**\r\n   - Float containment issues (e.g., missing float clearing or BFC containment).\r\n   - Incorrect flex\/grid constraints (min-size defaults, implicit tracks, alignment, wrapping).\r\n   - Stacking context traps (`transform`, `opacity`, `filter`, `isolation`, positioned ancestors).\r\n   - Overflow and scrolling side effects (`overflow: hidden\/auto`, clipped shadows, scrollbars).\r\n   - Browser-specific differences (feature support, default styles, subpixel rounding).\r\n5. **Fix implementation:**\r\n   - Provide \u201cbefore vs after\u201d snippets.\r\n   - Supply corrected code with inline comments explaining intent.\r\n   - Add browser-safe alternatives when needed (feature queries, fallbacks).\r\n6. **Prevention package:**\r\n   - Give a short checklist of habits\/tools to catch the same class of bug early.\r\n\r\n### What This Is NOT\r\n- Not a generic CSS tips list without inspecting the provided markup\/styles.\r\n- Not a visual redesign or a complete architecture rewrite unless the current structure cannot be corrected locally.\r\n- Not advice that ignores the stated [TARGET_BROWSERS] constraints.\r\n\r\n## INPUTS\r\n- **Layout issue description:** [LAYOUT_ISSUE]\r\n- **HTML\/CSS (and any relevant JS) snippet:** [HTML_CSS_CODE]\r\n- **Browsers to support:** [TARGET_BROWSERS]\r\n- **Additional context (optional: screenshots, links, build tools, frameworks):** [CONTEXT]\r\n\r\n## OUTPUT SPECIFICATION\r\nProduce a structured debugging report with these sections:\r\n\r\n1. **{Problem Snapshot}**\r\n   - What is happening\r\n   - Where\/when it happens (breakpoints, browsers, states)\r\n   - What the user expects instead\r\n\r\n2. **{Key Questions \/ Missing Details}** (only if needed)\r\n   - Bullet list of the minimum clarifications required to proceed\r\n\r\n3. **{DevTools Findings}**\r\n   - **Computed Styles:** {Computed Style Notes}\r\n   - **Box Model \/ Sizing:** {Box Model Notes}\r\n   - **Layout Overlay Checks (Flex\/Grid):** {Overlay Notes}\r\n   - **Positioning \/ Stacking Context:** {Stacking Notes}\r\n   - **Overflow \/ Scroll:** {Overflow Notes}\r\n   - **Browser Variance Risks:** {Browser Notes}\r\n\r\n4. **{Root Cause}**\r\n   - 1\u20133 primary causes, each with a short \u201cbecause\u201d explanation\r\n\r\n5. **{Fixes (Before\/After)}**\r\n   - **Before:** code block(s)\r\n   - **After:** code block(s) with inline comments\r\n   - For each fix: {Why It Broke} + {Why This Works}\r\n\r\n6. **{Cross-Browser Notes}**\r\n   - Any fallbacks, prefixes, feature queries, or known quirks relevant to [TARGET_BROWSERS]\r\n\r\n7. **{Prevention Tips}**\r\n   - Bullet list of practical rules\/tests (e.g., \u201cverify min-size in flex items\u201d, \u201cwatch for new stacking contexts\u201d, \u201cuse `gap` vs margins in grids\u201d, etc.)\r\n\r\n## QUALITY CHECKS\r\nAt the end, include a short verification list confirming:\r\n- The proposed changes address the stated symptom (not just visually masking it).\r\n- Each fix includes a clear causal explanation.\r\n- Code is compatible with the browsers in [TARGET_BROWSERS] (or explicit caveats are listed).\r\n- No unnecessary rewrites were recommended.\r\n- Any missing inputs were explicitly requested with specific questions.";
    const variables = ["[UPPERCASE_WITH_UNDERSCORES]","[HTML_CSS_CODE]","[TARGET_BROWSERS]","[LAYOUT_ISSUE]","[CONTEXT]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Bring a minimal reproducible snippet, not your whole app.</strong> Paste the smallest HTML + CSS that still breaks, even if it’s “ugly.” If it only happens with real content, include the exact text length or an example image size so the model can reason about intrinsic sizing and wrapping.</li>


<li><strong>State the browser set and the breakpoint.</strong> “Latest Chrome” is not enough if the issue is iOS Safari. Add specifics like: “Breaks on iPhone 13 iOS 17 Safari at 390px wide; works on Chrome 121 desktop.” Then ask: “Given this browser set, which properties should I avoid or guard?”</li>


<li><strong>Include what you already tried (and what happened).</strong> Mention the tempting band-aids so the prompt can steer away from them and explain why they’re fragile. A helpful follow-up is: “I tried adding <code>height: 480px</code> and it fixed overlap, but content now clips; explain the underlying cause instead.”</li>


<li><strong>Iterate using controlled comparisons.</strong> After the first pass, ask: “Show option A (smallest possible change) and option B (more robust refactor), and explain tradeoffs.” Or: “Now make the fix resilient to longer headings and localization, without adding JS.”</li>


<li><strong>Ask for DevTools verification steps, not just code.</strong> Request checks you can perform to confirm the root cause: “Tell me exactly what to look at in Computed styles to prove which rule is winning.” This turns the output into a repeatable workflow your team can follow under pressure.</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>If you’re switching contexts after debugging, these related prompts help you move from “fix it” mode into writing and production mode fast:</p>



<p>If you also need a creative reset after a long debugging session, <a href="https://flowpast.com/prompts/write-immersive-short-stories-ai-prompt/">Write Immersive Short Stories AI Prompt</a> is a useful companion. It’s not technical, and that’s the point: when your brain is stuck in stacking contexts and box models, a different output style can help you come back fresher.</p>



<p>For teams doing brand storytelling or campaign creative alongside web work, <a href="https://flowpast.com/prompts/write-poe-style-gothic-short-stories-ai-prompt/">Write Poe-Style Gothic Short Stories AI Prompt</a> can generate atmospheric copy ideas that later become landing-page narrative themes. Use it when you need tone exploration before you return to polishing layout details.</p>



<p>When you’re building character-driven content (for ads, email, or social) and want a distinct narrative angle, <a href="https://flowpast.com/prompts/write-unlikely-hero-short-stories-ai-prompt/">Write Unlikely Hero Short Stories AI Prompt</a> pairs well. It’s especially handy if your site update supports a product launch and you need story concepts while the design is being stabilized.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/write-immersive-short-stories-ai-prompt/">Write Immersive Short Stories AI Prompt</a>: Scene-rich story drafts with structure.</li>


<li><a href="https://flowpast.com/prompts/write-poe-style-gothic-short-stories-ai-prompt/">Write Poe-Style Gothic Short Stories AI Prompt</a>: Gothic tone and voice exploration.</li>


<li><a href="https://flowpast.com/prompts/write-unlikely-hero-short-stories-ai-prompt/">Write Unlikely Hero Short Stories AI Prompt</a>: Character hook ideas for campaigns.</li>

<li><a href="https://flowpast.com/prompts/expand-stories-with-a-new-subplot-with-this-ai-prompt/">Expand Stories with a New Subplot with this AI Prompt</a>: Add a subplot to deepen narrative.</li>

<li><a href="https://flowpast.com/prompts/write-a-hemingway-style-journal-entry-with-this-ai-prompt/">Write a Hemingway-Style Journal Entry with this AI Prompt</a>: Tight, minimalist journaling voice.</li>
<!-- /wp:post-content -->
</ul>
<!-- /wp:list -->
</div>

<div class="faq-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Common Questions</h2>
<!-- /wp:heading -->

<div class="faq-item">
<span class="question">Which roles benefit most from this CSS layout bugs AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>Front-end developers</strong> use this to stop guessing and systematically prove which CSS rule, formatting context, or sizing constraint is actually breaking the layout. <strong>Growth marketers shipping landing pages</strong> get value because the prompt focuses on minimal, safe changes that won’t derail design QA right before a launch. <strong>Agency QA leads</strong> rely on the repeatable DevTools checklist to produce clear bug reports and faster handoffs to dev. <strong>Product designers who can read CSS</strong> use the explanations to understand why a layout breaks at certain widths, so future comps don’t accidentally recreate the same failure.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this CSS layout bugs AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>E-commerce brands</strong> use it when product grids wrap unpredictably, image aspect ratios cause layout jumps, or sticky add-to-cart bars overlap content on mobile Safari. <strong>SaaS companies</strong> apply it to pricing pages and onboarding UIs where flex and grid edge cases show up at common breakpoints (768px and 1024px are frequent culprits). <strong>Media and publishing teams</strong> leverage it when ad slots, embeds, and long headlines create overflow, unexpected scrollbars, or clipping. <strong>Agencies</strong> benefit because cross-browser bugs are often reported late, and the prompt pushes toward root-cause fixes instead of fragile patches.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for fixing cross-browser CSS layout issues produce weak results?</span>
<!-- wp:paragraph -->
<p class="answer">A typical prompt like &#8220;<em>Fix my CSS layout, it’s broken</em>&#8221; fails because it: lacks a runnable snippet and a clear definition of what “broken” means, provides no DevTools workflow to identify which computed rules are winning, ignores browser targets and breakpoint conditions where bugs reproduce, produces generic tips (like “try flex-wrap” or “add a margin”) instead of minimal code edits tied to a cause, and misses deeper mechanics such as formatting contexts, overflow clipping, and stacking contexts that often differ across browsers. You end up with patches that work once and then regress when content changes.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Can I customize this CSS layout bugs prompt for my specific situation?</span>
<!-- wp:paragraph -->
<p class="answer">Yes, and you should. Start by supplying your [HTML_CSS_CODE] as the smallest reproducible example, then add the browser set (for example: “iOS Safari 16+, Firefox latest, Chrome latest”) and the exact conditions where it breaks (page/section and width). If you have them, include screenshots plus what you expected to happen versus what you actually see. A strong follow-up ask is: “Given my browser targets, propose two fix options and list how I can verify each one in DevTools.”</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this CSS layout bugs prompt?</span>
<!-- wp:paragraph -->
<p class="answer">The biggest mistake is leaving [HTML_CSS_CODE] too vague — instead of “here’s my stylesheet,” provide a small snippet that still reproduces the issue, even if it’s only 30 lines. Another common error is not specifying where it breaks; “mobile” is unclear, but “390px wide on iPhone Safari; footer overlaps CTA” gives the prompt something testable. People also omit the “expected vs actual” behavior, which matters when the layout is subjective; write it explicitly so fixes don’t drift. Finally, many users don’t mention what they already tried (like hard-coded heights); include that so the prompt can explain why those patches are fragile and propose a cleaner root-cause change.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Who should NOT use this CSS layout bugs prompt?</span>
<!-- wp:paragraph -->
<p class="answer">This prompt isn’t ideal for teams who cannot share any code or screenshots and still expect precise fixes, because it is designed to avoid guessing. It’s also a poor fit for one-off “make it pretty” requests where you don’t care about root cause or cross-browser behavior. If you’re dealing with a fundamentally broken layout architecture that truly requires a redesign, use a separate planning process first, then return to this prompt for localized, verifiable fixes.</p>
<!-- /wp:paragraph -->
</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this CSS layout bugs AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Front-end developers use this to stop guessing and systematically prove which CSS rule, formatting context, or sizing constraint is actually breaking the layout. Growth marketers shipping landing pages get value because the prompt focuses on minimal, safe changes that won’t derail design QA right before a launch. Agency QA leads rely on the repeatable DevTools checklist to produce clear bug reports and faster handoffs to dev. Product designers who can read CSS use the explanations to understand why a layout breaks at certain widths, so future comps don’t accidentally recreate the same failure."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this CSS layout bugs AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "E-commerce brands use it when product grids wrap unpredictably, image aspect ratios cause layout jumps, or sticky add-to-cart bars overlap content on mobile Safari. SaaS companies apply it to pricing pages and onboarding UIs where flex and grid edge cases show up at common breakpoints (768px and 1024px are frequent culprits). Media and publishing teams leverage it when ad slots, embeds, and long headlines create overflow, unexpected scrollbars, or clipping. Agencies benefit because cross-browser bugs are often reported late, and the prompt pushes toward root-cause fixes instead of fragile patches."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for fixing cross-browser CSS layout issues produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like \"Fix my CSS layout, it’s broken\" fails because it: lacks a runnable snippet and a clear definition of what “broken” means, provides no DevTools workflow to identify which computed rules are winning, ignores browser targets and breakpoint conditions where bugs reproduce, produces generic tips (like “try flex-wrap” or “add a margin”) instead of minimal code edits tied to a cause, and misses deeper mechanics such as formatting contexts, overflow clipping, and stacking contexts that often differ across browsers. You end up with patches that work once and then regress when content changes."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this CSS layout bugs prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, and you should. Start by supplying your [HTML_CSS_CODE] as the smallest reproducible example, then add the browser set (for example: “iOS Safari 16+, Firefox latest, Chrome latest”) and the exact conditions where it breaks (page/section and width). If you have them, include screenshots plus what you expected to happen versus what you actually see. A strong follow-up ask is: “Given my browser targets, propose two fix options and list how I can verify each one in DevTools.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this CSS layout bugs prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving [HTML_CSS_CODE] too vague — instead of “here’s my stylesheet,” provide a small snippet that still reproduces the issue, even if it’s only 30 lines. Another common error is not specifying where it breaks; “mobile” is unclear, but “390px wide on iPhone Safari; footer overlaps CTA” gives the prompt something testable. People also omit the “expected vs actual” behavior, which matters when the layout is subjective; write it explicitly so fixes don’t drift. Finally, many users don’t mention what they already tried (like hard-coded heights); include that so the prompt can explain why those patches are fragile and propose a cleaner root-cause change."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this CSS layout bugs prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for teams who cannot share any code or screenshots and still expect precise fixes, because it is designed to avoid guessing. It’s also a poor fit for one-off “make it pretty” requests where you don’t care about root cause or cross-browser behavior. If you’re dealing with a fundamentally broken layout architecture that truly requires a redesign, use a separate planning process first, then return to this prompt for localized, verifiable fixes."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">
<!-- wp:paragraph -->
<p>Layout bugs don’t need more hacks. They need a consistent investigation that reveals what the browser is truly doing. Paste this prompt into your AI tool, follow the DevTools steps, and ship a fix you can defend.</p>
<!-- /wp:paragraph -->
</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001433.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Build a Batch Image Resizing Script with this AI Prompt</title>
		<link>https://flowpast.com/prompts/build-a-batch-image-resizing-script-with-this-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:40:53 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001590</guid>

					<description><![CDATA[Mixed image batches break workflows - use this AI Prompt to build a resilient resizer with aspect safe sizing, adaptive compression, logs, and safe outputs. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: batch image resizing -->
<div class="hook-introduction">

<p>Mixed image batches are where “simple resizing” scripts fall apart. A few PNGs with transparency, a random TIFF from a designer, or a partially corrupt JPEG can derail the whole run. And if your script overwrites originals or recompresses lossy files twice, you only notice after the damage is done.</p>



<p>This <strong>batch image resizing</strong> AI prompt is built for <strong>marketing ops leads</strong> who need consistent web and print asset outputs across campaigns, <strong>e-commerce managers</strong> cleaning up thousands of product images from multiple suppliers, and <strong>agency production teams</strong> standardizing client deliverables without risking originals. The output is a production-ready resizing pipeline plan (with code structure, logging strategy, format rules, and safe folder conventions) you can hand to a developer or implement yourself.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It designs a batch-capable resizing workflow that preserves aspect ratio by default and only crops or stretches when you explicitly opt in.</li>
          <li>It specifies how to handle JPEG, PNG, WebP, GIF, and TIFF differently, including transparency-safe rules for graphics and sensible defaults for photos.</li>
          <li>It defines two resizing modes (percentage scaling and fixed width × height) and clarifies what happens when only one dimension is provided.</li>
          <li>It chooses compression per image by using content-aware logic (photo-like vs graphic-like) plus a user quality preference, rather than one-size-fits-all settings.</li>
          <li>It outlines a streaming/queue-style batch approach, with failure-tolerant logging, per-file error handling, and protections against overwriting originals.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You have a giant folder of supplier images and you need web-ready versions without guessing which ones should stay PNG.</li>
          <li>Your current script crashes halfway through because a few files are corrupt, locked, or oddly encoded.</li>
          <li>You must produce two outputs from the same source set (for example: 1600px web images and higher-quality print assets) while keeping naming consistent.</li>
          <li>You’ve been burned by rerunning a job and accidentally recompressing the already-processed JPEGs, causing visible quality loss.</li>
          <li>You’re scaling a workflow and need predictable logs, organized outputs, and a repeatable “run this again next month” pipeline.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A complete pipeline specification you can translate into Python/Node/bash, including modules, functions, and processing stages.</li>
           <li>A clear decision tree for format handling (JPEG/PNG/WebP/GIF/TIFF) with recommended settings and exceptions.</li>
           <li>A folder and naming convention plan that prevents overwrites and separates originals, working files, and outputs.</li>
           <li>A logging and error report design, including what to log per file and how to summarize failures at the end.</li>
           <li>A strategy to avoid repeated lossy recompression across runs (output detection, hashes, or manifest-based skipping).</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Production-Ready Batch Image Resizer Script</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[SOURCE_PATHS]</code></td>
                                <td class="var-desc">
                                    Provide the file paths or directories where the images to be processed are located. Include multiple paths if batch processing is needed.                                    <div class="var-example">For example: "/home/user/images/raw_photos, /mnt/external_drive/project_assets"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[SOURCE_PATHS]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TARGET_SIZE]</code></td>
                                <td class="var-desc">
                                    Specify the desired dimensions for resizing images. Use either fixed width and height (e.g., 800x600) or percentage scaling (e.g., 50%).                                    <div class="var-example">For example: "1024x768 or 75%"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[TARGET_SIZE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[OUTPUT_FORMAT]</code></td>
                                <td class="var-desc">
                                    Indicate the file format for the resized images. Common options include JPEG, PNG, WebP, GIF, or TIFF.                                    <div class="var-example">For example: "JPEG"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[OUTPUT_FORMAT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[QUALITY_PREFERENCE]</code></td>
                                <td class="var-desc">
                                    Specify the desired image quality level for compression. Use terms like &#039;high&#039;, &#039;balanced&#039;, or &#039;low&#039;, or provide a numeric value (e.g., 80 for JPEG quality).                                    <div class="var-example">For example: "balanced or 85"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[QUALITY_PREFERENCE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[OUTPUT_PATH]</code></td>
                                <td class="var-desc">
                                    Provide the directory where the resized images should be saved. Ensure the path is writable and organized for batch outputs.                                    <div class="var-example">For example: "/home/user/images/resized_outputs"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[OUTPUT_PATH]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[OVERWRITE_SOURCES]</code></td>
                                <td class="var-desc">
                                    Indicate whether original images should be overwritten during processing. Use &#039;yes&#039; to allow overwriting or &#039;no&#039; to preserve originals.                                    <div class="var-example">For example: "no"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[OVERWRITE_SOURCES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[RESIZE_MODE]</code></td>
                                <td class="var-desc">
                                    Specify the resizing method to be used. Options include &#039;percentage scaling&#039; or &#039;fixed dimensions&#039; based on your requirement.                                    <div class="var-example">For example: "fixed dimensions"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[RESIZE_MODE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[METADATA_MODE]</code></td>
                                <td class="var-desc">
                                    Define how metadata (e.g., EXIF, IPTC) should be handled. Options include &#039;preserve&#039;, &#039;remove&#039;, or &#039;custom&#039; for specific configurations.                                    <div class="var-example">For example: "preserve"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[METADATA_MODE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[WORKER_COUNT]</code></td>
                                <td class="var-desc">
                                    Specify the number of parallel workers or threads to use for batch processing. Choose a value based on CPU cores and workload size.                                    <div class="var-example">For example: "4"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[WORKER_COUNT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[UPPERCASE_WITH_UNDERSCORES]</code></td>
                                <td class="var-desc">
                                    Provide a string in uppercase with underscores separating words. This could be used for naming conventions or identifiers.                                    <div class="var-example">For example: "IMAGE_RESIZE_PIPELINE"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPPERCASE_WITH_UNDERSCORES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="prompt-header-visible subheader">Must-Haves</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">Safety Boundaries (What This Is NOT)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">If Inputs Are Missing or Ambiguous</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">Code Requirements</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Design a production-ready, batch-capable image resizing pipeline script that can process very large mixed-format image sets while keeping visual fidelity high for both web delivery and print use. The solution must preserve aspect ratio by default, choose compression intelligently per-image, avoid unnecessary recompression, and produce organized, human-readable outputs.

## PERSONA
You are an automation systems designer with a past life in professional photography and post-production. You communicate like an experienced engineer: practical, explicit about tradeoffs, and focused on reliability at scale. You balance aesthetic integrity (no accidental distortion) with performance realities (file size, throughput, memory limits).

## CONSTRAINTS
### Must-Haves
- Preserve aspect ratio unless the user explicitly requests cropping or stretching.
- Support common formats: JPEG, PNG, WebP, GIF, TIFF (and handle each appropriately).
- Provide two resizing modes:
  - Percentage scaling
  - Fixed target dimensions (width x height)
- Choose compression strategy per image based on content characteristics (photo-like vs graphic-like) and user quality preference.
- Batch process without loading everything into RAM at once; use streaming/queue-like handling.
- Continue processing after failures; log and report errors (corrupt files, permission issues, unsupported files).
- Never overwrite originals unless explicitly allowed.
- Avoid repeated lossy recompression (e.g., don’t re-encode already-processed outputs in subsequent runs unless asked).
- Maintain metadata when reasonable and configurable.

### Safety Boundaries (What This Is NOT)
- Not a GUI application.
- Not a full DAM/cataloging system (no tagging/search database).
- Not an AI upscaler/restoration tool.
- Not a color-managed print-prepress workflow replacement (no ICC profiling pipeline beyond basic pass-through unless explicitly requested).

### If Inputs Are Missing or Ambiguous
- Ask clarifying questions before writing final code when critical inputs are absent (paths, resize intent, overwrite rules).
- If only partial sizing info is provided, default to aspect-ratio-safe behavior (e.g., width-only or height-only scaling) and clearly state the assumption.
- If format or quality preference is unspecified, default to “same as source” and “balanced”.

## PROCESS
1. **Pre-Analysis (mandatory)**  
   Restate the user’s goals and summarize the chosen approach (resizing mode, formats, output structure, compression logic, metadata handling). List any assumptions and any questions that must be answered.

2. **Phase A — Guardrails &amp; Config**  
   Validate input paths, output destination, resize settings, overwrite policy, and tool availability. Create a configuration block the user can edit.

3. **Phase B — Media Inspection &amp; Decisioning**  
   For each file: detect format, read dimensions, estimate content type (photo vs graphic) using simple heuristics (palette/alpha presence, edge density, color count proxies, etc.), then decide:
   - resize method (contain/fit, crop-to-fill only if requested, stretch only if requested)
   - output format rules
   - compression/quality parameters

4. **Phase C — Batch Execution at Scale**  
   Process files iteratively with controlled concurrency (worker pool) and per-file isolation. Include:
   - progress reporting
   - structured logging
   - retry/skip behavior
   - memory-safe IO

5. **Phase D — Output Packaging &amp; Naming**  
   Generate a timestamped folder name that encodes the operation (e.g., date + action + target size/scale). Write outputs without collisions and produce a final summary report.

## INPUTS
- **Source image locations:** [SOURCE_PATHS]
- **Resize target (dimensions like 1920x1080 or percent like 50%):** [TARGET_SIZE]
- **Preferred output format (or same as source):** [OUTPUT_FORMAT]
- **Quality preference (maximum quality / balanced / minimum file size):** [QUALITY_PREFERENCE]
- **Destination directory:** [OUTPUT_PATH]
- **Allow overwrite of originals (yes/no):** [OVERWRITE_SOURCES]
- **Resize behavior (preserve / crop-to-fill / stretch):** [RESIZE_MODE]
- **Metadata handling (preserve / strip):** [METADATA_MODE]
- **Max concurrency / workers:** [WORKER_COUNT]

## OUTPUT SPECIFICATION
Deliver a single, complete script (choose one language ecosystem and stick to it) with the following sections and headings:

1. **Requirements &amp; Setup**
   - Dependencies and install commands
   - OS notes if relevant

2. **Configuration**
   - Clearly labeled variables users edit:
     - {SourcePaths}
     - {TargetSize}
     - {OutputFormat}
     - {QualityPreference}
     - {OutputPath}
     - {OverwriteSources}
     - {ResizeMode}
     - {MetadataMode}
     - {WorkerCount}

3. **Core Implementation**
   - {PathValidationModule}
   - {ImageInspectionModule}
   - {ResizeAndEncodeModule}
   - {BatchRunnerModule}
   - {LoggingAndProgressModule}
   - {OutputOrganizerModule}

4. **Usage Examples**
   - A basic invocation example using [SOURCE_PATHS] and [TARGET_SIZE]
   - An advanced example showing crop-to-fill or format conversion and worker tuning

5. **Troubleshooting**
   - Common failures and fixes (permissions, missing codecs/libs, corrupt files, huge TIFFs, GIF handling expectations)

### Code Requirements
- Provide the full script in code blocks with syntax highlighting.
- Include clear inline comments that explain why decisions are made (especially compression choice and aspect-ratio math).
- Implement per-format handling rules (at minimum):
  - JPEG: quality-based compression, optional progressive encoding
  - PNG: lossless compression level, keep alpha
  - WebP: lossy/lossless selection aligned to content type
  - GIF: document limitations; avoid destructive resizing if it breaks animation unless explicitly supported
  - TIFF: handle large files safely; consider conversion options if requested
- Include progress output that works in long runs and a final {RunSummary} report (counts for processed, skipped, failed; total bytes saved where possible).
- Ensure no “load everything then process” pattern; process as a stream with bounded concurrency.

## QUALITY CHECKS
Before presenting the final script, verify and state that the deliverable satisfies:
- Aspect ratio is preserved by default and only deviates when [RESIZE_MODE] explicitly requests it.
- Compression is not “one-size-fits-all”; encoding decisions vary by content and format.
- Batch design is memory-safe and uses bounded parallelism via [WORKER_COUNT].
- Errors are isolated per file and do not abort the entire run; failures are logged and summarized.
- Variable format compliance: user-provided inputs appear only as [UPPERCASE_WITH_UNDERSCORES], and AI-filled placeholders appear only as {Title Case}.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nDesign a production-ready, batch-capable image resizing pipeline script that can process very large mixed-format image sets while keeping visual fidelity high for both web delivery and print use. The solution must preserve aspect ratio by default, choose compression intelligently per-image, avoid unnecessary recompression, and produce organized, human-readable outputs.\r\n\r\n## PERSONA\r\nYou are an automation systems designer with a past life in professional photography and post-production. You communicate like an experienced engineer: practical, explicit about tradeoffs, and focused on reliability at scale. You balance aesthetic integrity (no accidental distortion) with performance realities (file size, throughput, memory limits).\r\n\r\n## CONSTRAINTS\r\n### Must-Haves\r\n- Preserve aspect ratio unless the user explicitly requests cropping or stretching.\r\n- Support common formats: JPEG, PNG, WebP, GIF, TIFF (and handle each appropriately).\r\n- Provide two resizing modes:\r\n  - Percentage scaling\r\n  - Fixed target dimensions (width x height)\r\n- Choose compression strategy per image based on content characteristics (photo-like vs graphic-like) and user quality preference.\r\n- Batch process without loading everything into RAM at once; use streaming\/queue-like handling.\r\n- Continue processing after failures; log and report errors (corrupt files, permission issues, unsupported files).\r\n- Never overwrite originals unless explicitly allowed.\r\n- Avoid repeated lossy recompression (e.g., don\u2019t re-encode already-processed outputs in subsequent runs unless asked).\r\n- Maintain metadata when reasonable and configurable.\r\n\r\n### Safety Boundaries (What This Is NOT)\r\n- Not a GUI application.\r\n- Not a full DAM\/cataloging system (no tagging\/search database).\r\n- Not an AI upscaler\/restoration tool.\r\n- Not a color-managed print-prepress workflow replacement (no ICC profiling pipeline beyond basic pass-through unless explicitly requested).\r\n\r\n### If Inputs Are Missing or Ambiguous\r\n- Ask clarifying questions before writing final code when critical inputs are absent (paths, resize intent, overwrite rules).\r\n- If only partial sizing info is provided, default to aspect-ratio-safe behavior (e.g., width-only or height-only scaling) and clearly state the assumption.\r\n- If format or quality preference is unspecified, default to \u201csame as source\u201d and \u201cbalanced\u201d.\r\n\r\n## PROCESS\r\n1. **Pre-Analysis (mandatory)**  \r\n   Restate the user\u2019s goals and summarize the chosen approach (resizing mode, formats, output structure, compression logic, metadata handling). List any assumptions and any questions that must be answered.\r\n\r\n2. **Phase A \u2014 Guardrails & Config**  \r\n   Validate input paths, output destination, resize settings, overwrite policy, and tool availability. Create a configuration block the user can edit.\r\n\r\n3. **Phase B \u2014 Media Inspection & Decisioning**  \r\n   For each file: detect format, read dimensions, estimate content type (photo vs graphic) using simple heuristics (palette\/alpha presence, edge density, color count proxies, etc.), then decide:\r\n   - resize method (contain\/fit, crop-to-fill only if requested, stretch only if requested)\r\n   - output format rules\r\n   - compression\/quality parameters\r\n\r\n4. **Phase C \u2014 Batch Execution at Scale**  \r\n   Process files iteratively with controlled concurrency (worker pool) and per-file isolation. Include:\r\n   - progress reporting\r\n   - structured logging\r\n   - retry\/skip behavior\r\n   - memory-safe IO\r\n\r\n5. **Phase D \u2014 Output Packaging & Naming**  \r\n   Generate a timestamped folder name that encodes the operation (e.g., date + action + target size\/scale). Write outputs without collisions and produce a final summary report.\r\n\r\n## INPUTS\r\n- **Source image locations:** [SOURCE_PATHS]\r\n- **Resize target (dimensions like 1920x1080 or percent like 50%):** [TARGET_SIZE]\r\n- **Preferred output format (or same as source):** [OUTPUT_FORMAT]\r\n- **Quality preference (maximum quality \/ balanced \/ minimum file size):** [QUALITY_PREFERENCE]\r\n- **Destination directory:** [OUTPUT_PATH]\r\n- **Allow overwrite of originals (yes\/no):** [OVERWRITE_SOURCES]\r\n- **Resize behavior (preserve \/ crop-to-fill \/ stretch):** [RESIZE_MODE]\r\n- **Metadata handling (preserve \/ strip):** [METADATA_MODE]\r\n- **Max concurrency \/ workers:** [WORKER_COUNT]\r\n\r\n## OUTPUT SPECIFICATION\r\nDeliver a single, complete script (choose one language ecosystem and stick to it) with the following sections and headings:\r\n\r\n1. **Requirements & Setup**\r\n   - Dependencies and install commands\r\n   - OS notes if relevant\r\n\r\n2. **Configuration**\r\n   - Clearly labeled variables users edit:\r\n     - {SourcePaths}\r\n     - {TargetSize}\r\n     - {OutputFormat}\r\n     - {QualityPreference}\r\n     - {OutputPath}\r\n     - {OverwriteSources}\r\n     - {ResizeMode}\r\n     - {MetadataMode}\r\n     - {WorkerCount}\r\n\r\n3. **Core Implementation**\r\n   - {PathValidationModule}\r\n   - {ImageInspectionModule}\r\n   - {ResizeAndEncodeModule}\r\n   - {BatchRunnerModule}\r\n   - {LoggingAndProgressModule}\r\n   - {OutputOrganizerModule}\r\n\r\n4. **Usage Examples**\r\n   - A basic invocation example using [SOURCE_PATHS] and [TARGET_SIZE]\r\n   - An advanced example showing crop-to-fill or format conversion and worker tuning\r\n\r\n5. **Troubleshooting**\r\n   - Common failures and fixes (permissions, missing codecs\/libs, corrupt files, huge TIFFs, GIF handling expectations)\r\n\r\n### Code Requirements\r\n- Provide the full script in code blocks with syntax highlighting.\r\n- Include clear inline comments that explain why decisions are made (especially compression choice and aspect-ratio math).\r\n- Implement per-format handling rules (at minimum):\r\n  - JPEG: quality-based compression, optional progressive encoding\r\n  - PNG: lossless compression level, keep alpha\r\n  - WebP: lossy\/lossless selection aligned to content type\r\n  - GIF: document limitations; avoid destructive resizing if it breaks animation unless explicitly supported\r\n  - TIFF: handle large files safely; consider conversion options if requested\r\n- Include progress output that works in long runs and a final {RunSummary} report (counts for processed, skipped, failed; total bytes saved where possible).\r\n- Ensure no \u201cload everything then process\u201d pattern; process as a stream with bounded concurrency.\r\n\r\n## QUALITY CHECKS\r\nBefore presenting the final script, verify and state that the deliverable satisfies:\r\n- Aspect ratio is preserved by default and only deviates when [RESIZE_MODE] explicitly requests it.\r\n- Compression is not \u201cone-size-fits-all\u201d; encoding decisions vary by content and format.\r\n- Batch design is memory-safe and uses bounded parallelism via [WORKER_COUNT].\r\n- Errors are isolated per file and do not abort the entire run; failures are logged and summarized.\r\n- Variable format compliance: user-provided inputs appear only as [UPPERCASE_WITH_UNDERSCORES], and AI-filled placeholders appear only as {Title Case}.";
    const variables = ["[SOURCE_PATHS]","[TARGET_SIZE]","[OUTPUT_FORMAT]","[QUALITY_PREFERENCE]","[OUTPUT_PATH]","[OVERWRITE_SOURCES]","[RESIZE_MODE]","[METADATA_MODE]","[WORKER_COUNT]","[UPPERCASE_WITH_UNDERSCORES]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Define your two output profiles up front.</strong> The prompt is strongest when you tell it exactly what “web” and “print” mean for you (dimensions, quality target, and format preferences). Try: “Create outputs: Web=1600px long edge, ~200–350KB target; Print=3000px long edge, minimal compression; preserve transparency.”</li>


<li><strong>Tell it what must never change.</strong> If metadata matters (EXIF orientation, ICC pass-through, timestamps), say so explicitly and ask for config flags. A useful follow-up: “Add a metadata policy: keep EXIF by default, strip GPS, and normalize orientation so resized outputs display correctly everywhere.”</li>

<li><strong>Give it real failure scenarios to design for.</strong> You will get a more reliable script plan if you list the ugly edge cases: corrupt files, CMYK JPEGs, 16-bit PNGs, or permission errors. Prompt addition: “Assume 2% of files fail; continue, log, and output an end-of-run summary CSV.”</li>


<li><strong>Iterate on compression rules, not just sizes.</strong> After the first draft, push the prompt to be more explicit about when to choose JPEG vs WebP vs PNG. Ask: “Now rewrite the compression strategy with thresholds and examples (photo-like, screenshot-like, transparency, flat color), and recommend sane quality ranges.”</li>


<li><strong>Add a rerun-safe mechanism.</strong> Honestly, this is where most batch scripts quietly fail over time. Request a manifest approach: “Add a manifest.json (or SQLite if needed) that records source path, mtime/hash, output paths, and settings, so reruns skip unchanged files and avoid double recompression.”</li>

</ul>
<!-- /wp:post-content -->
</div>

<div class="related-prompts-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Related Prompts</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you’re also standardizing the people side of a workflow, these prompts pair well with a production pipeline mindset:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For teams documenting how work levels up over time, <a href="https://flowpast.com/prompts/build-a-career-growth-playbook-ai-prompt/">Build a Career Growth Playbook AI Prompt</a> helps you turn “tribal knowledge” into a clear progression plan. It fits nicely when you want your image pipeline to be owned and maintained, not just built once and forgotten.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>When someone is moving into a more technical operations lane (like owning automation, scripts, and tooling), <a href="https://flowpast.com/prompts/build-a-career-skill-stack-optimizer-with-this-ai-prompt/">Build a Career Skill Stack Optimizer with this AI Prompt</a> can map the skills that support reliable delivery. Useful if you’re training a marketer-turned-ops lead to manage vendors and code reviews.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If your organization is reassigning responsibilities (for example, creative ops absorbing asset processing that used to sit with engineering), <a href="https://flowpast.com/prompts/build-a-career-pivot-roadmap-with-this-ai-prompt/">Build a Career Pivot Roadmap with this AI Prompt</a> provides a structured transition plan. It’s a practical complement when you’re changing processes and need adoption, not just a script.</p>
<!-- /wp:paragraph -->

<br>

<!-- wp:paragraph -->
<p>Quick reference:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul>
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-career-growth-playbook-ai-prompt/">Build a Career Growth Playbook AI Prompt</a>: Document expectations, scope, and progression.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-career-pivot-roadmap-with-this-ai-prompt/">Build a Career Pivot Roadmap with this AI Prompt</a>: Plan a structured role transition.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-career-longevity-roadmap-with-this-ai-prompt/">Build a Career Longevity Roadmap with this AI Prompt</a>: Sustain performance and avoid burnout.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-career-growth-blueprint-with-this-ai-prompt/">Build a Career Growth Blueprint with this AI Prompt</a>: Set goals, milestones, and evidence.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/build-a-career-skill-stack-optimizer-with-this-ai-prompt/">Build a Career Skill Stack Optimizer with this AI Prompt</a>: Prioritize skills that compound over time.</li>
<!-- /wp:list-item -->
</ul>
<!-- /wp:list -->
</div>

<div class="faq-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Common Questions</h2>
<!-- /wp:heading -->

<div class="faq-item">
<span class="question">Which roles benefit most from this batch image resizing AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>Marketing operations managers</strong> use this to turn messy campaign asset folders into consistent web and print derivatives, with logs that make handoffs painless. <strong>E-commerce content managers</strong> rely on it when supplier images arrive in mixed formats and inconsistent sizing, and they need safe outputs without overwriting originals. <strong>Creative operations leads</strong> benefit because the prompt forces clear decisions on format handling, metadata, and naming conventions that reduce rework. <strong>Automation-minded developers</strong> also use it as a spec to implement quickly, since it bakes in streaming, error tolerance, and rerun safety.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this batch image resizing AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>E-commerce and retail</strong> teams get value fast because product photos, color variants, and supplier packs often arrive as a chaotic mix of JPEG, PNG, and occasional TIFF. <strong>Media and publishing</strong> groups use it to prepare large photo sets for fast web delivery while still keeping higher-quality masters for future layouts. <strong>Agencies</strong> benefit when they have to meet different client specs (naming, sizes, formats) and need a repeatable pipeline that logs everything. <strong>Real estate and hospitality</strong> teams use it to process large shoots efficiently, generating web-optimized sets while maintaining aspect ratio and avoiding accidental distortion.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for batch image resizing scripts produce weak results?</span>
<!-- wp:paragraph -->
<p class="answer">A typical prompt like &#8220;<em>Write me a script to resize images in a folder</em>&#8221; fails because it: lacks format-specific handling (PNG transparency, GIF behavior, TIFF quirks), provides no clear resizing rules (percentage vs fixed dimensions and what to do when aspect ratios differ), ignores rerun safety so outputs get recompressed again, produces brittle code that crashes on corrupt or locked files instead of logging and continuing, and misses operational details like output folders, naming conventions, and end-of-run reporting. In practice, you get something that works on a tiny test folder and falls over on real production batches.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Can I customize this batch image resizing prompt for my specific situation?</span>
<!-- wp:paragraph -->
<p class="answer">Yes. Even though the prompt has no form variables, you customize it by supplying your constraints: target sizes (percentage or width × height), whether cropping is allowed, preferred output formats, quality targets, and a metadata policy (keep, strip, or pass-through). You should also specify how you want outputs organized (mirrored folders, date-stamped runs, or per-size subfolders) and whether “never overwrite” is absolute. A good follow-up ask is: “Before writing the final design, ask me 10 clarifying questions about sizes, formats, transparency, metadata, naming, and rerun behavior, then produce the script outline.”</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this batch image resizing prompt?</span>
<!-- wp:paragraph -->
<p class="answer">The biggest mistake is leaving the resizing mode unspecified — instead of “resize images for web,” say “Resize by long edge to 1600px; do not upscale smaller images.” Another common error is being vague about cropping: “make them 1200×1200” can imply forced square crops, while “fit within 1200×1200, preserve aspect ratio, add no padding” is unambiguous. People also forget to define output rules for transparency; “convert everything to JPEG” will break logos, while “keep PNG when alpha is present, otherwise consider WebP/JPEG” is safer. Finally, many omit rerun behavior; request “skip if output exists and matches settings” to avoid repeated lossy recompression.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Who should NOT use this batch image resizing prompt?</span>
<!-- wp:paragraph -->
<p class="answer">This prompt isn’t ideal if you need a drag-and-drop GUI tool, since it is explicitly designed for scripting and automation. It’s also not the right fit when you require a full digital asset management system with search, tagging, and approvals. And if you need color-managed print prepress (ICC conversions, proofing pipelines, press profiles), you’ll want a dedicated workflow tool rather than a resizing script. In those cases, use an off-the-shelf DAM or a professional prepress pipeline, then apply resizing as a smaller step.</p>
<!-- /wp:paragraph -->
</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this batch image resizing AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Marketing operations managers use this to turn messy campaign asset folders into consistent web and print derivatives, with logs that make handoffs painless. E-commerce content managers rely on it when supplier images arrive in mixed formats and inconsistent sizing, and they need safe outputs without overwriting originals. Creative operations leads benefit because the prompt forces clear decisions on format handling, metadata, and naming conventions that reduce rework. Automation-minded developers also use it as a spec to implement quickly, since it bakes in streaming, error tolerance, and rerun safety."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this batch image resizing AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "E-commerce and retail teams get value fast because product photos, color variants, and supplier packs often arrive as a chaotic mix of JPEG, PNG, and occasional TIFF. Media and publishing groups use it to prepare large photo sets for fast web delivery while still keeping higher-quality masters for future layouts. Agencies benefit when they have to meet different client specs (naming, sizes, formats) and need a repeatable pipeline that logs everything. Real estate and hospitality teams use it to process large shoots efficiently, generating web-optimized sets while maintaining aspect ratio and avoiding accidental distortion."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for batch image resizing scripts produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like \"Write me a script to resize images in a folder\" fails because it: lacks format-specific handling (PNG transparency, GIF behavior, TIFF quirks), provides no clear resizing rules (percentage vs fixed dimensions and what to do when aspect ratios differ), ignores rerun safety so outputs get recompressed again, produces brittle code that crashes on corrupt or locked files instead of logging and continuing, and misses operational details like output folders, naming conventions, and end-of-run reporting. In practice, you get something that works on a tiny test folder and falls over on real production batches."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this batch image resizing prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. Even though the prompt has no form variables, you customize it by supplying your constraints: target sizes (percentage or width × height), whether cropping is allowed, preferred output formats, quality targets, and a metadata policy (keep, strip, or pass-through). You should also specify how you want outputs organized (mirrored folders, date-stamped runs, or per-size subfolders) and whether “never overwrite” is absolute. A good follow-up ask is: “Before writing the final design, ask me 10 clarifying questions about sizes, formats, transparency, metadata, naming, and rerun behavior, then produce the script outline.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this batch image resizing prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving the resizing mode unspecified — instead of “resize images for web,” say “Resize by long edge to 1600px; do not upscale smaller images.” Another common error is being vague about cropping: “make them 1200×1200” can imply forced square crops, while “fit within 1200×1200, preserve aspect ratio, add no padding” is unambiguous. People also forget to define output rules for transparency; “convert everything to JPEG” will break logos, while “keep PNG when alpha is present, otherwise consider WebP/JPEG” is safer. Finally, many omit rerun behavior; request “skip if output exists and matches settings” to avoid repeated lossy recompression."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this batch image resizing prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal if you need a drag-and-drop GUI tool, since it is explicitly designed for scripting and automation. It’s also not the right fit when you require a full digital asset management system with search, tagging, and approvals. And if you need color-managed print prepress (ICC conversions, proofing pipelines, press profiles), you’ll want a dedicated workflow tool rather than a resizing script. In those cases, use an off-the-shelf DAM or a professional prepress pipeline, then apply resizing as a smaller step."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">
<!-- wp:paragraph -->
<p>Batch resizing isn’t hard until it is. Use this prompt to design a script that survives real-world folders, protects originals, and delivers consistent outputs you can trust.</p>
<!-- /wp:paragraph -->
</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001590.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Build an E-commerce Security Architecture with this AI Prompt</title>
		<link>https://flowpast.com/prompts/build-an-e-commerce-security-architecture-with-this-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:39:27 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5003031</guid>

					<description><![CDATA[Integrations create hidden holes - the ultimate AI Prompt that builds a platform-specific security architecture with an action plan and checklist. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: e-commerce security architecture -->

<div class="hook-introduction">

<p>Your e-commerce stack probably isn’t “one platform.” It’s a platform plus a payment flow, a handful of apps, tracking scripts, fulfillment tools, and admin accounts spread across a team. That’s where security breaks: in the seams, not the homepage.</p>



<p>This <strong>e-commerce security architecture</strong> is built for <strong>e-commerce operators</strong> who keep adding integrations and want to stop creating new attack paths, <strong>growth marketers</strong> who rely on third-party pixels and tools but still need a safe data flow, and <strong>consultants</strong> who must hand clients a clear security plan that’s practical, not theoretical. The output is a platform-tailored architecture with prioritized risks, implementable controls (configs and workflows), tradeoffs, and a customized checklist plus incident response planning.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It restates your environment first, then identifies the top likely attack surfaces across infrastructure, application layers, and vendor connections.</li>
          <li>It models realistic attack paths tied to hosting environment, region, and third-party integrations, focusing on how compromises typically unfold.</li>
          <li>It translates risks into actionable controls with concrete settings and workflows, not generic “best practices.”</li>
          <li>It adds “what to do, why it matters, and what goes wrong if skipped” for every measure so the plan is executable by a team.</li>
          <li>It includes prevention plus incident response planning, and it addresses technical failures alongside human-driven compromise (phishing, credential reuse, admin error).</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You’re adding new integrations (reviews, subscriptions, loyalty, analytics, fulfillment) and you need to understand the new entry points you just created.</li>
          <li>A payment or account incident scared the team, and you want an architecture that reduces risk without derailing growth work.</li>
          <li>You’re migrating regions or changing hosting patterns and need to rethink data flows, permissions, and monitoring in a specific context.</li>
          <li>Partners keep requesting access (agency logins, support vendors, contractors), and your admin surface area is getting out of control.</li>
          <li>You’re scaling order volume and automation, and manual, periodic security routines are no longer reliable enough.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A prioritized list of the top 5 attack surfaces with environment-specific notes on why they’re likely.</li>
           <li>A set of concrete control recommendations where each item includes “do this,” “why,” and “if skipped” failure modes.</li>
           <li>A lightweight cost–benefit view for each control (time/effort/cost versus risk reduction) to support decision-making.</li>
           <li>An incident response outline customized to your stack, including what to monitor and how to react when something looks wrong.</li>
           <li>A customized security checklist you can operationalize, with an emphasis on automation and continuous controls.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Platform-Tailored E-commerce Security Architecture Builder</h2>


<!-- Prompt file not found: /home/flowpast/htdocs/flowpast.com/wp-content/data/prompts_scraped/5003239/prompt-2026.txt -->

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<p>This prompt is unusually strict (in a good way). It’s designed to force specificity: environment, region, integrations, and how humans actually make mistakes. If you feed it vague context, you’ll still get a plan, but it will not be as sharp as it can be.</p>



<ul class="wp-block-list">

<li><strong>Describe your “seams,” not just your store.</strong> List the tools that touch customer data, admin access, or order workflows. Include things like helpdesk systems, fulfillment portals, tag managers, subscription apps, data connectors, and any middleware. Follow-up prompt: “Map the data flow between these integrations and point out the riskiest trust boundaries.”</li>


<li><strong>Force it to name the likely attack path.</strong> Don’t accept generic risk statements like “phishing is a threat.” Ask for a concrete chain, such as “contractor Gmail compromised → reused password → admin login → app token created → data exfiltration.” Follow-up prompt: “Give me three plausible intrusion chains for my setup and the earliest detection point for each.”</li>


<li><strong>Make tradeoffs explicit before you socialize the plan.</strong> Security recommendations die in meetings when effort isn’t acknowledged. After the first run, ask: “Rewrite the control list as a phased rollout: Week 1 quick wins, Month 1 foundation, Quarter 1 maturity.”</li>


<li><strong>Iterate by tightening the checklist into operations.</strong> The first checklist is usually too broad. After it generates the list, try asking: “Now convert the checklist into continuous controls and alerts. For each item, tell me what can be automated, what needs human review, and how often.”</li>


<li><strong>Pair it with your customer comms plan.</strong> Incidents become marketing problems fast, especially if customers notice before you do. Once you have the incident response outline, use a messaging prompt to prepare calm, consistent replies; for example, <a href="https://flowpast.com/prompts/write-social-media-comment-replies-with-this-ai-prompt/">Write Social Media Comment Replies with this AI Prompt</a> can help you draft responses that don’t overshare but still build trust.</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>Once your security architecture is clear, these prompts help you communicate proof, handle public feedback, and keep campaigns moving without improvising.</p>



<p>If you also need credibility assets after tightening security, <a href="https://flowpast.com/prompts/testimonial-led-social-proof-plan-ai-prompt/">Testimonial-Led Social Proof Plan AI Prompt</a> helps you shape customer evidence into a structured plan. This is useful when you want to reinforce trust post-incident, or when you’re proactively improving perception while you implement controls behind the scenes.</p>



<p>When you’re turning real customer language into narratives that feel human (and not like compliance copy), <a href="https://flowpast.com/prompts/turn-testimonials-into-influencer-stories-ai-prompt/">Turn Testimonials Into Influencer Stories AI Prompt</a> can bridge the gap. It pairs well if your security upgrades affect policies, returns, shipping, or account experiences and you need reassuring stories that still sound authentic.</p>



<p>If your team runs paid campaigns while security work is in progress, <a href="https://flowpast.com/prompts/write-social-ad-copy-with-this-ai-prompt/">Write Social Ad Copy with this AI Prompt</a> can keep performance creative flowing without last-minute scramble. It’s especially handy if you must adjust offers or messaging because you changed checkout steps, authentication, or fraud controls.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/turn-testimonials-into-influencer-stories-ai-prompt/">Turn Testimonials Into Influencer Stories AI Prompt</a>: Transform testimonials into story-driven content.</li>


<li><a href="https://flowpast.com/prompts/testimonial-led-social-proof-plan-ai-prompt/">Testimonial-Led Social Proof Plan AI Prompt</a>: Build a structured social proof plan.</li>


<li><a href="https://flowpast.com/prompts/write-social-media-comment-replies-with-this-ai-prompt/">Write Social Media Comment Replies with this AI Prompt</a>: Draft calm, on-brand public replies.</li>


<li><a href="https://flowpast.com/prompts/create-20-social-post-ideas-from-a-question-wheel-ai-prompt/">Create 20 Social Post Ideas from a Question Wheel AI Prompt</a>: Generate post ideas from customer questions.</li>


<li><a href="https://flowpast.com/prompts/write-social-ad-copy-with-this-ai-prompt/">Write Social Ad Copy with this AI Prompt</a>: Produce ad variants for offers and campaigns.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this e-commerce security architecture AI prompt?</span>

<p class="answer"><strong>E-commerce Directors</strong> use this to turn a messy plugin-and-vendor reality into a prioritized security plan they can actually fund and schedule. <strong>Revenue Operations Managers</strong> find it valuable because it forces clarity around integrations, permissions, and the workflows that quietly leak risk (tokens, shared logins, admin sprawl). <strong>Security Engineers</strong> use it to pressure-test the stack with realistic attack paths and convert findings into implementable controls with “why” and “what breaks if skipped.” <strong>Consultants</strong> leverage it to deliver a tailored architecture, checklist, and incident response outline without writing a generic report clients ignore.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this e-commerce security architecture AI prompt?</span>

<p class="answer"><strong>Direct-to-consumer brands</strong> get value because their growth stack often includes dozens of third-party tools touching customer data, and one weak integration can become the entry point. <strong>Subscription commerce</strong> teams benefit since billing retries, account portals, and subscription apps expand the attack surface beyond a one-time checkout. <strong>Marketplace sellers building standalone stores</strong> use it when they move from platform-contained risk to running their own integrations, admin accounts, and data flows. <strong>High-volume promotional retailers</strong> find it helpful because spikes in traffic and campaign tooling make monitoring, abuse prevention, and incident readiness much more than a quarterly task.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for building an e-commerce security architecture produce weak results?</span>

<p class="answer">A typical prompt like &#8220;<em>Write me a security plan for my online store</em>&#8221; fails because it: lacks environment and region specificity, so it can’t tie risks to how your hosting and access are really configured; provides no realistic attack-path modeling, which leads to generic lists instead of defensible priorities; ignores integration touchpoints, where tokens, webhooks, and vendor access often create the easiest entry routes; produces abstract advice instead of actionable configurations and workflows; and misses incident response planning, so you’re left with prevention talk but no plan for detection and containment when something goes sideways.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this e-commerce security architecture prompt for my specific situation?</span>

<p class="answer">Yes, and you should. The prompt is designed to adapt based on the hosting environment, region, and the exact third-party integrations in your stack, so your best “customization” is to provide those details explicitly in your chat before you run it. Add operational constraints too: team size, who has admin access, and which parts are handled by agencies or contractors. Follow-up prompt to refine: “Re-rank the controls for a two-person team, prioritize automation, and call out anything that is likely to break analytics or conversion if implemented incorrectly.”</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this e-commerce security architecture prompt?</span>

<p class="answer">The biggest mistake is leaving the environment vague — instead of “we’re on the cloud,” say “Shopify storefront with third-party apps, GA4 via tag manager, helpdesk integration, and a fulfillment portal with shared accounts.” Another common error is listing integrations without describing permissions or data flow; “Klaviyo connected” is weaker than “Klaviyo has customer email + purchase events, API key stored in a shared password manager.” People also skip the human element: “Team uses SSO” is less useful than “Two agencies have admin access, contractors rotate monthly, and MFA isn’t enforced everywhere.” Finally, teams forget incident reality; don’t just ask for prevention, ask for detection signals and the first 60 minutes of response steps.</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this e-commerce security architecture prompt?</span>

<p class="answer">This prompt isn’t ideal for teams looking for formal compliance certification or audit sign-off, because it explicitly does not replace a formal assessment. It’s also a poor fit if you want a one-page template with no iteration; the value comes from tailoring to your environment and revising tradeoffs with your constraints. And if you’re expecting guaranteed breach prevention, frankly, that’s not realistic. In those cases, use it as a starting architecture, then engage a qualified professional to validate and implement high-impact changes.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this e-commerce security architecture AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "E-commerce Directors use this to turn a messy plugin-and-vendor reality into a prioritized security plan they can actually fund and schedule. Revenue Operations Managers find it valuable because it forces clarity around integrations, permissions, and the workflows that quietly leak risk (tokens, shared logins, admin sprawl). Security Engineers use it to pressure-test the stack with realistic attack paths and convert findings into implementable controls with “why” and “what breaks if skipped.” Consultants leverage it to deliver a tailored architecture, checklist, and incident response outline without writing a generic report clients ignore."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this e-commerce security architecture AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Direct-to-consumer brands get value because their growth stack often includes dozens of third-party tools touching customer data, and one weak integration can become the entry point. Subscription commerce teams benefit since billing retries, account portals, and subscription apps expand the attack surface beyond a one-time checkout. Marketplace sellers building standalone stores use it when they move from platform-contained risk to running their own integrations, admin accounts, and data flows. High-volume promotional retailers find it helpful because spikes in traffic and campaign tooling make monitoring, abuse prevention, and incident readiness much more than a quarterly task."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for building an e-commerce security architecture produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like \"Write me a security plan for my online store\" fails because it: lacks environment and region specificity, so it can’t tie risks to how your hosting and access are really configured; provides no realistic attack-path modeling, which leads to generic lists instead of defensible priorities; ignores integration touchpoints, where tokens, webhooks, and vendor access often create the easiest entry routes; produces abstract advice instead of actionable configurations and workflows; and misses incident response planning, so you’re left with prevention talk but no plan for detection and containment when something goes sideways."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this e-commerce security architecture prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, and you should. The prompt is designed to adapt based on the hosting environment, region, and the exact third-party integrations in your stack, so your best “customization” is to provide those details explicitly in your chat before you run it. Add operational constraints too: team size, who has admin access, and which parts are handled by agencies or contractors. Follow-up prompt to refine: “Re-rank the controls for a two-person team, prioritize automation, and call out anything that is likely to break analytics or conversion if implemented incorrectly.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this e-commerce security architecture prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving the environment vague — instead of “we’re on the cloud,” say “Shopify storefront with third-party apps, GA4 via tag manager, helpdesk integration, and a fulfillment portal with shared accounts.” Another common error is listing integrations without describing permissions or data flow; “Klaviyo connected” is weaker than “Klaviyo has customer email + purchase events, API key stored in a shared password manager.” People also skip the human element: “Team uses SSO” is less useful than “Two agencies have admin access, contractors rotate monthly, and MFA isn’t enforced everywhere.” Finally, teams forget incident reality; don’t just ask for prevention, ask for detection signals and the first 60 minutes of response steps."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this e-commerce security architecture prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for teams looking for formal compliance certification or audit sign-off, because it explicitly does not replace a formal assessment. It’s also a poor fit if you want a one-page template with no iteration; the value comes from tailoring to your environment and revising tradeoffs with your constraints. And if you’re expecting guaranteed breach prevention, frankly, that’s not realistic. In those cases, use it as a starting architecture, then engage a qualified professional to validate and implement high-impact changes."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Integrations and admin access don’t just add features. They add attack paths. Use this prompt to turn your current stack into a clear, environment-specific security architecture you can implement and maintain.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5003031.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Design Adaptive API Polling Plans AI Prompt</title>
		<link>https://flowpast.com/prompts/design-adaptive-api-polling-plans-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:38:50 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001588</guid>

					<description><![CDATA[Polling overload risks outages - the ultimate AI Prompt that designs adaptive cadence, backoff, auth hygiene, and staged build steps. Access our full AI prompt library for every model.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: API polling plans -->

<div class="hook-introduction">

<p>API polling looks simple until it quietly becomes the thing that melts your quota, trips rate limits, and pages your team at 2 a.m. The “just poll every X seconds” approach works right up until an outage, a latency spike, or a vendor change turns your schedule into a self-inflicted incident.</p>



<p>This <strong>API polling plans</strong> is built for <strong>backend engineers</strong> who need reliable freshness without hammering third-party endpoints, <strong>platform/SRE leads</strong> cleaning up noisy retry storms across services, and <strong>product or data teams</strong> trying to balance near-real-time updates with API cost and stability. The output is a staged, production-minded polling design: adaptive cadence rules, backoff behavior, authentication hygiene, and concrete artifacts (like state models, pseudocode, and rollout steps) tailored to your API landscape.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It performs a pre-analysis that restates your environment, defines “success,” and lists the unknowns that will affect polling behavior.</li>
          <li>It designs an adaptive schedule that changes cadence based on rate limits, latency, error codes, and “freshness needed” by endpoint.</li>
          <li>It specifies resilient retry and backoff rules (including jitter) and service-aware behavior during outages or partial degradations.</li>
          <li>It builds a staged implementation plan (4–14 stages) with purpose, assumptions, user questions, reasoning, artifacts, and a handoff for each stage.</li>
          <li>It outlines authentication hygiene and secret-handling practices, including how to avoid requesting or storing sensitive material in unsafe ways.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You are integrating a third-party API and you do not yet know the real-world rate limits or failure patterns.</li>
          <li>Your current polling has become “always on,” and you see bursts of 429s, timeouts, or duplicate work after transient failures.</li>
          <li>You are moving from a prototype to production and need a plan that includes rollout, observability, and safe defaults.</li>
          <li>A vendor’s API starts degrading, and you need your system to reduce load politely while still providing best-effort freshness.</li>
          <li>You have multiple endpoints with different criticality and you need per-endpoint cadence, budgets, and stop conditions.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A multi-stage polling system blueprint with 4–14 stages, each with artifacts and a clear next-step handoff.</li>
           <li>A cadence policy that includes specific triggers (e.g., “after N consecutive 429s, slow to X–Y seconds with jitter”).</li>
           <li>Ready-to-implement pseudocode for scheduling, retries, circuit breaking behavior, and state tracking.</li>
           <li>An authentication and token-refresh checklist that avoids unsafe secret requests and highlights what must be pulled from docs.</li>
           <li>An observability plan with metrics and alert thresholds you can wire into your existing monitoring stack.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Adaptive API Polling Plan Designer</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[TARGET_AUDIENCE]</code></td>
                                <td class="var-desc">
                                    Specify the primary users or stakeholders of the API polling system, including their roles, needs, and technical expertise.                                    <div class="var-example">For example: "API operations teams in fintech companies managing real-time data feeds with strict uptime requirements."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[TARGET_AUDIENCE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide the background information or scenario in which the API polling system will operate, including any relevant constraints or requirements.                                    <div class="var-example">For example: "A distributed system managing financial market data across multiple regions, requiring adaptive polling schedules and fault tolerance."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[ENDPOINTS]</code></td>
                                <td class="var-desc">
                                    List the API endpoints to be polled, including their URLs, purpose, and any variations in behavior or data structure.                                    <div class="var-example">For example: "https://api.example.com/v1/market_data for real-time pricing and https://api.example.com/v1/status for service health monitoring."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[ENDPOINTS]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[AUTH_METHOD]</code></td>
                                <td class="var-desc">
                                    Describe the authentication method required for accessing the endpoints, including any tokens, keys, or OAuth flows.                                    <div class="var-example">For example: "OAuth 2.0 with client credentials grant, requiring token refresh every 3600 seconds."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[AUTH_METHOD]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[SECURITY_CONSTRAINTS]</code></td>
                                <td class="var-desc">
                                    Outline any security requirements or restrictions, such as encryption, IP whitelisting, or handling sensitive data.                                    <div class="var-example">For example: "All requests must use TLS 1.2 or higher, and API keys must be rotated every 90 days."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[SECURITY_CONSTRAINTS]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[PRIMARY_GOAL]</code></td>
                                <td class="var-desc">
                                    Define the main objective of the API polling system, including what success looks like and any key deliverables.                                    <div class="var-example">For example: "Ensure accurate and timely data collection from multiple endpoints while respecting rate limits and minimizing downtime."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[PRIMARY_GOAL]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[RATE_LIMITS]</code></td>
                                <td class="var-desc">
                                    Specify the rate limit policies imposed by the APIs, including request limits, time windows, and penalty behaviors.                                    <div class="var-example">For example: "Maximum 100 requests per minute, with a 429 status code returned for exceeding limits."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[RATE_LIMITS]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[PLATFORM]</code></td>
                                <td class="var-desc">
                                    Identify the platform or infrastructure where the API polling system will be deployed, such as cloud providers or on-premises environments.                                    <div class="var-example">For example: "AWS Lambda for polling logic and DynamoDB for storing results, deployed across multiple regions."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[PLATFORM]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[FORMAT]</code></td>
                                <td class="var-desc">
                                    Describe the expected format of the data returned by the APIs, including any serialization standards or schema details.                                    <div class="var-example">For example: "JSON responses with fields for timestamp, price, and volume; conforms to OpenAPI schema v3.0."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[FORMAT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TIMEFRAME]</code></td>
                                <td class="var-desc">
                                    Indicate the time period during which the system will operate or the polling intervals required.                                    <div class="var-example">For example: "Continuous operation with polling intervals ranging from 30 seconds to 5 minutes based on endpoint priority."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[TIMEFRAME]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">1) Pre-Analysis Summary</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">2) Stage Map (Dynamic)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">3) Core System Blueprint (as it becomes available)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">4) Final Validation Notes</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">STAGE 1 — API Landscape + Access Setup (Start Here)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Design a robust, courteous API polling system that continuously checks one or more endpoints using adaptive schedules, reliable authentication, and service-aware behavior (rate limits, outages, degradations). The assistant must build the solution in staged increments that adjust to the user’s API landscape.

## PERSONA
Act as a senior API systems architect with a background in ultra-low-latency finance infrastructure and distributed systems. You treat external APIs as long-term counterparts: prioritize stability, polite consumption, and sustained freshness over brute-force data extraction. Communicate with crisp technical clarity, pragmatic tradeoffs, and production-minded patterns.

## CONSTRAINTS
- Apply “delivery standards” focused on resilience, correctness, and respectful API usage.
- Choose an appropriate number of stages dynamically (between **4 and 14**) based on complexity; do not lock to a fixed plan.
- Each stage must include: a short purpose statement, any doc/research assumptions, up to 0–5 user questions, the reasoning/work performed, concrete artifacts, and a handoff to the next stage.
- Never request secrets in full. If the user provides sensitive material, instruct them to redact it.
- Prefer vendor-agnostic guidance unless the user specifies a stack.
- Include edge-case behavior for missing inputs, unknown rate limits, intermittent failures, and inconsistent payloads.

### What This Is NOT
- Not a generic tutorial on REST or HTTP.
- Not a full SOC2/legal compliance program (though you may add pragmatic audit/logging notes if enterprise needs are stated).
- Not a mandate to use any single cloud/provider/library.
- Not a substitute for official API documentation; you will highlight where docs are required.

## PROCESS
1. **Pre-Analysis (required before building):** Restate your understanding of the user’s environment and what “success” means, then list what’s unknown.
2. **Complexity Triage:** Determine the appropriate stage count and depth using:
   - Endpoint count and variability
   - Auth method complexity (static key vs OAuth/device flow/refresh tokens)
   - Known/unknown rate limits and penalty behavior
   - Freshness requirements and tolerance for stale data
   - Operational needs (alerts, dashboards, SLAs, multi-region, etc.)
3. **Stage Generation:** Create a customized sequence of stages (4–14). Examples of how to scale (rewrite as needed):
   - Single endpoint + simple token → fewer stages, focus on core polling + backoff + storage.
   - Multiple endpoints + mixed limits → add scheduling, concurrency control, and per-endpoint policies.
   - Enterprise/critical workloads → add observability, deployments, HA, auditability, runbooks.
4. **Stage Execution Loop:** For each stage:
   - Ask only the questions needed for that stage (0–5).
   - Produce actionable artifacts (pseudocode, config templates, data models, recommended libraries/patterns).
   - Describe how the system adapts based on signals (status codes, headers, latency, error rates).
5. **Edge-Case Handling:** If the user can’t provide rate limits/auth details, propose safe defaults (conservative pacing, progressive ramp-up, header discovery, circuit breakers) and clearly label assumptions.

## INPUTS
- **Primary user segment:** [TARGET_AUDIENCE]
- **API/service overview:** [CONTEXT]
- **Endpoints to monitor:** [ENDPOINTS]
- **Authentication approach:** [AUTH_METHOD]
- **Credential handling constraints (redaction rules, vaults, etc.):** [SECURITY_CONSTRAINTS]
- **Freshness targets (per endpoint if needed):** [PRIMARY_GOAL]
- **Known rate limits / quotas:** [RATE_LIMITS]
- **Preferred platform/runtime:** [PLATFORM]
- **Preferred output format (diagram, code-first, config-first, etc.):** [FORMAT]
- **Time constraints / deadline:** [TIMEFRAME]

## OUTPUT SPECIFICATION
Produce a tailored multi-stage build plan and artifacts. Use the following structure:

### 1) Pre-Analysis Summary
- {Understanding}
- {Success Criteria}
- {Unknowns / Assumptions}

### 2) Stage Map (Dynamic)
For each stage provide:
- {Stage Name}
- {Stage Objective}
- {Doc/Research Notes}
- {Questions For User} (0–5)
- {Work Performed}
- {Artifacts Produced}
- {Next Stage Handoff}

### 3) Core System Blueprint (as it becomes available)
Include, when applicable:
- {Polling/Scheduling Model} (interval strategy, adaptive pacing, per-endpoint policies)
- {Concurrency &amp; Queueing Strategy}
- {Auth Management Pattern} (refresh, rotation, storage)
- {Rate-Limit Intelligence} (backoff, jitter, header-based learning)
- {Resilience Toolkit} (retries, circuit breakers, timeouts, fallbacks)
- {Data Handling} (validation, dedupe, timestamps, storage options)
- {Observability} (logs/metrics/traces/alerts and what to watch)

### 4) Final Validation Notes
- {Open Risks}
- {Operational Runbook Pointers}
- {Next Steps}

## QUALITY CHECKS
At the end of each response, verify:
- [ ] Stage count and depth match the user’s complexity (not a one-size-fits-all plan).
- [ ] No sensitive data is requested; redaction guidance is present where relevant.
- [ ] Rate-limit respect is explicit (headers, quotas, backoff+jitter, ramp-up).
- [ ] Failure modes are handled (timeouts, 429/5xx, partial outages, schema drift).
- [ ] Artifacts are implementable (clear steps, configs/pseudocode, assumptions labeled).

--- 

### STAGE 1 — API Landscape + Access Setup (Start Here)
Provide the following (use redaction for anything secret):
1) [ENDPOINTS] (full URLs or patterns; note which are highest priority)  
2) [AUTH_METHOD] (e.g., API key header, OAuth2 w/ refresh, signed requests, etc.)  
3) Any constraints from [SECURITY_CONSTRAINTS] (vault requirement, rotation cadence, forbidden storage locations)  
4) [PRIMARY_GOAL] freshness targets (e.g., “every 30s” or “within 2 minutes,” per endpoint if different)  
5) [RATE_LIMITS] if known (quota, burst, penalty behavior; include any relevant response headers you’ve seen)

After you answer, I will restate my understanding, choose the right number of stages (4–14), and proceed to the next stage.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nDesign a robust, courteous API polling system that continuously checks one or more endpoints using adaptive schedules, reliable authentication, and service-aware behavior (rate limits, outages, degradations). The assistant must build the solution in staged increments that adjust to the user\u2019s API landscape.\r\n\r\n## PERSONA\r\nAct as a senior API systems architect with a background in ultra-low-latency finance infrastructure and distributed systems. You treat external APIs as long-term counterparts: prioritize stability, polite consumption, and sustained freshness over brute-force data extraction. Communicate with crisp technical clarity, pragmatic tradeoffs, and production-minded patterns.\r\n\r\n## CONSTRAINTS\r\n- Apply \u201cdelivery standards\u201d focused on resilience, correctness, and respectful API usage.\r\n- Choose an appropriate number of stages dynamically (between **4 and 14**) based on complexity; do not lock to a fixed plan.\r\n- Each stage must include: a short purpose statement, any doc\/research assumptions, up to 0\u20135 user questions, the reasoning\/work performed, concrete artifacts, and a handoff to the next stage.\r\n- Never request secrets in full. If the user provides sensitive material, instruct them to redact it.\r\n- Prefer vendor-agnostic guidance unless the user specifies a stack.\r\n- Include edge-case behavior for missing inputs, unknown rate limits, intermittent failures, and inconsistent payloads.\r\n\r\n### What This Is NOT\r\n- Not a generic tutorial on REST or HTTP.\r\n- Not a full SOC2\/legal compliance program (though you may add pragmatic audit\/logging notes if enterprise needs are stated).\r\n- Not a mandate to use any single cloud\/provider\/library.\r\n- Not a substitute for official API documentation; you will highlight where docs are required.\r\n\r\n## PROCESS\r\n1. **Pre-Analysis (required before building):** Restate your understanding of the user\u2019s environment and what \u201csuccess\u201d means, then list what\u2019s unknown.\r\n2. **Complexity Triage:** Determine the appropriate stage count and depth using:\r\n   - Endpoint count and variability\r\n   - Auth method complexity (static key vs OAuth\/device flow\/refresh tokens)\r\n   - Known\/unknown rate limits and penalty behavior\r\n   - Freshness requirements and tolerance for stale data\r\n   - Operational needs (alerts, dashboards, SLAs, multi-region, etc.)\r\n3. **Stage Generation:** Create a customized sequence of stages (4\u201314). Examples of how to scale (rewrite as needed):\r\n   - Single endpoint + simple token \u2192 fewer stages, focus on core polling + backoff + storage.\r\n   - Multiple endpoints + mixed limits \u2192 add scheduling, concurrency control, and per-endpoint policies.\r\n   - Enterprise\/critical workloads \u2192 add observability, deployments, HA, auditability, runbooks.\r\n4. **Stage Execution Loop:** For each stage:\r\n   - Ask only the questions needed for that stage (0\u20135).\r\n   - Produce actionable artifacts (pseudocode, config templates, data models, recommended libraries\/patterns).\r\n   - Describe how the system adapts based on signals (status codes, headers, latency, error rates).\r\n5. **Edge-Case Handling:** If the user can\u2019t provide rate limits\/auth details, propose safe defaults (conservative pacing, progressive ramp-up, header discovery, circuit breakers) and clearly label assumptions.\r\n\r\n## INPUTS\r\n- **Primary user segment:** [TARGET_AUDIENCE]\r\n- **API\/service overview:** [CONTEXT]\r\n- **Endpoints to monitor:** [ENDPOINTS]\r\n- **Authentication approach:** [AUTH_METHOD]\r\n- **Credential handling constraints (redaction rules, vaults, etc.):** [SECURITY_CONSTRAINTS]\r\n- **Freshness targets (per endpoint if needed):** [PRIMARY_GOAL]\r\n- **Known rate limits \/ quotas:** [RATE_LIMITS]\r\n- **Preferred platform\/runtime:** [PLATFORM]\r\n- **Preferred output format (diagram, code-first, config-first, etc.):** [FORMAT]\r\n- **Time constraints \/ deadline:** [TIMEFRAME]\r\n\r\n## OUTPUT SPECIFICATION\r\nProduce a tailored multi-stage build plan and artifacts. Use the following structure:\r\n\r\n### 1) Pre-Analysis Summary\r\n- {Understanding}\r\n- {Success Criteria}\r\n- {Unknowns \/ Assumptions}\r\n\r\n### 2) Stage Map (Dynamic)\r\nFor each stage provide:\r\n- {Stage Name}\r\n- {Stage Objective}\r\n- {Doc\/Research Notes}\r\n- {Questions For User} (0\u20135)\r\n- {Work Performed}\r\n- {Artifacts Produced}\r\n- {Next Stage Handoff}\r\n\r\n### 3) Core System Blueprint (as it becomes available)\r\nInclude, when applicable:\r\n- {Polling\/Scheduling Model} (interval strategy, adaptive pacing, per-endpoint policies)\r\n- {Concurrency & Queueing Strategy}\r\n- {Auth Management Pattern} (refresh, rotation, storage)\r\n- {Rate-Limit Intelligence} (backoff, jitter, header-based learning)\r\n- {Resilience Toolkit} (retries, circuit breakers, timeouts, fallbacks)\r\n- {Data Handling} (validation, dedupe, timestamps, storage options)\r\n- {Observability} (logs\/metrics\/traces\/alerts and what to watch)\r\n\r\n### 4) Final Validation Notes\r\n- {Open Risks}\r\n- {Operational Runbook Pointers}\r\n- {Next Steps}\r\n\r\n## QUALITY CHECKS\r\nAt the end of each response, verify:\r\n- [ ] Stage count and depth match the user\u2019s complexity (not a one-size-fits-all plan).\r\n- [ ] No sensitive data is requested; redaction guidance is present where relevant.\r\n- [ ] Rate-limit respect is explicit (headers, quotas, backoff+jitter, ramp-up).\r\n- [ ] Failure modes are handled (timeouts, 429\/5xx, partial outages, schema drift).\r\n- [ ] Artifacts are implementable (clear steps, configs\/pseudocode, assumptions labeled).\r\n\r\n--- \r\n\r\n### STAGE 1 \u2014 API Landscape + Access Setup (Start Here)\r\nProvide the following (use redaction for anything secret):\r\n1) [ENDPOINTS] (full URLs or patterns; note which are highest priority)  \r\n2) [AUTH_METHOD] (e.g., API key header, OAuth2 w\/ refresh, signed requests, etc.)  \r\n3) Any constraints from [SECURITY_CONSTRAINTS] (vault requirement, rotation cadence, forbidden storage locations)  \r\n4) [PRIMARY_GOAL] freshness targets (e.g., \u201cevery 30s\u201d or \u201cwithin 2 minutes,\u201d per endpoint if different)  \r\n5) [RATE_LIMITS] if known (quota, burst, penalty behavior; include any relevant response headers you\u2019ve seen)\r\n\r\nAfter you answer, I will restate my understanding, choose the right number of stages (4\u201314), and proceed to the next stage.";
    const variables = ["[TARGET_AUDIENCE]","[CONTEXT]","[ENDPOINTS]","[AUTH_METHOD]","[SECURITY_CONSTRAINTS]","[PRIMARY_GOAL]","[RATE_LIMITS]","[PLATFORM]","[FORMAT]","[TIMEFRAME]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Describe “freshness” in business terms.</strong> Don’t say “near real-time” and leave it at that. Give explicit targets per endpoint, like “orders must be &lt;30s stale, inventory can be 5–10 minutes stale, and billing status can be hourly.” If you want, follow up with: “Create separate cadence tiers for each freshness band.”</li>


<li><strong>Bring your failure history, even if it’s messy.</strong> A handful of real error patterns helps the staged plan become concrete. Paste a redacted sample like “429s during lunch hours, 502s in bursts, occasional 200 with missing fields,” then ask: “Propose a degradation strategy for each failure class and show how the scheduler transitions states.”</li>

<li><strong>Force explicit assumptions when docs are unclear.</strong> If the vendor docs are thin or contradictory, tell the assistant that upfront and request an “assumptions list” you can validate later. A useful follow-up: “Where should the system be conservative by default if the documented rate limit is wrong?”</li>


<li><strong>Iterate on stage boundaries, not just the final design.</strong> After the first run, pick one stage that feels vague (often observability or rollout) and push it deeper. Try: “Rewrite stage 6 as a production rollout plan with a canary, safe abort conditions, and a checklist of metrics to watch.”</li>


<li><strong>Ask for artifacts in your team’s format.</strong> The prompt can output pseudocode, but you can request concrete deliverables like a state machine table, a YAML-ish policy, or a ticket breakdown. For example: “Provide artifacts as (1) a state-transition table, (2) a config template for per-endpoint budgets, and (3) a Jira-ready task list.”</li>

</ul>
<!-- /wp:post-content -->
</div>

<div class="related-prompts-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Related Prompts</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you’re documenting the decision or communicating it externally, these prompts help you package the plan with the right tone and structure:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you also need to justify tradeoffs to leadership or a customer (for example, why you’re backing off during vendor degradation), the editorial format is a surprisingly good fit. You can take your polling policy and turn it into a clear argument with <a href="https://flowpast.com/prompts/write-a-nuanced-editorial-with-this-ai-prompt/">Write a Nuanced Editorial with this AI Prompt</a>, especially when you want to explain “stability over brute-force freshness” in plain language.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>When an incident happens and you need a calm, public-facing explanation, a structured letter helps prevent over-sharing while still being accountable. Pair your adaptive backoff and outage behavior with <a href="https://flowpast.com/prompts/write-a-public-open-letter-with-this-ai-prompt/">Write a Public Open Letter with this AI Prompt</a> to communicate what changed, what users can expect, and what you are doing next.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For teams that must formalize operational intent (who owns what, and what happens if people leave), legal-grade writing can surface gaps in process ownership. It’s not a compliance substitute, but <a href="https://flowpast.com/prompts/draft-a-court-ready-last-will-with-this-ai-prompt/">Draft a Court-Ready Last Will with this AI Prompt</a> can be repurposed as a thought exercise for “succession planning” in systems: access, responsibility, and handoffs when something changes suddenly.</p>
<!-- /wp:paragraph -->

<br>

<!-- wp:paragraph -->
<p>Quick reference:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul>
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/write-a-nuanced-editorial-with-this-ai-prompt/">Write a Nuanced Editorial with this AI Prompt</a>: Explain polling tradeoffs to stakeholders.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/write-a-public-open-letter-with-this-ai-prompt/">Write a Public Open Letter with this AI Prompt</a>: Incident updates without chaos.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/draft-a-court-ready-last-will-with-this-ai-prompt/">Draft a Court-Ready Last Will with this AI Prompt</a>: Clarify ownership, access, and handoffs.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/write-a-literary-biography-with-this-ai-prompt/">Write a Literary Biography with this AI Prompt</a>: Turn system history into a narrative.</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li><a href="https://flowpast.com/prompts/write-a-hemingway-style-journal-entry-with-this-ai-prompt/">Write a Hemingway-Style Journal Entry with this AI Prompt</a>: Concise incident journal entries.</li>
<!-- /wp:list-item -->
</ul>
<!-- /wp:list -->
</div>

<div class="faq-section">
<!-- wp:heading {"level":2} -->
<h2 class="wp-block-heading">Common Questions</h2>
<!-- /wp:heading -->

<div class="faq-item">
<span class="question">Which roles benefit most from this API polling plans AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>Backend Engineers</strong> use it to turn “poll every minute” into an adaptive scheduler with concrete retry, jitter, and state rules. <strong>Site Reliability Engineers</strong> rely on it to reduce retry storms, define safe degradation modes, and add observability that catches trouble before users do. <strong>Platform Engineers</strong> apply it when multiple internal services share external API budgets and need consistent patterns across teams. <strong>Technical Product Managers</strong> get value by translating freshness requirements into explicit cadence tiers and rollout steps they can align stakeholders around.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this API polling plans AI prompt?</span>
<!-- wp:paragraph -->
<p class="answer"><strong>Fintech and trading</strong> teams use it to balance ultra-low-latency expectations with respectful vendor consumption, especially when market hours create predictable load spikes. <strong>E-commerce</strong> brands apply it to inventory, fulfillment, and pricing endpoints where “stale but safe” is better than cascading failures during peak traffic. <strong>SaaS platforms</strong> lean on it for integrations (CRM, billing, analytics) where unknown rate limits and partial outages are normal, not rare. <strong>Travel and logistics</strong> companies benefit when external status APIs degrade, because adaptive cadence and fallback behavior keep customer-facing updates stable.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for designing adaptive API polling plans produce weak results?</span>
<!-- wp:paragraph -->
<p class="answer">A typical prompt like &#8220;<em>Write me an API polling system</em>&#8221; fails because it: lacks a pre-analysis to define success and unknowns, provides no staged build plan with artifacts you can implement, ignores service-aware behavior like 429 handling and outage degradation, produces generic “retry with exponential backoff” advice instead of specific state transitions and triggers, and misses authentication hygiene (including guidance not to request or paste secrets). You end up with something that reads fine but collapses under real error patterns. Frankly, the gap shows up the moment the vendor API misbehaves.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Can I customize this API polling plans prompt for my specific situation?</span>
<!-- wp:paragraph -->
<p class="answer">Yes, by feeding the assistant the details it expects during pre-analysis and complexity triage: the endpoints involved, your freshness targets, known or suspected rate limits, and what failures you already see (429, 5xx, timeouts, inconsistent payloads). You can also specify constraints like “vendor-agnostic only,” “must run in Kubernetes,” or “single-process cron for now,” and the stages should adapt. Never paste full tokens or private keys; describe the auth type (OAuth refresh token, API key, signed request) and ask for safe handling patterns. A good follow-up is: “Given these endpoints and SLOs, propose per-endpoint cadence tiers and the state machine transitions that move between them.”</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this API polling plans prompt?</span>
<!-- wp:paragraph -->
<p class="answer">The biggest mistake is leaving the environment description too vague — instead of “we call a partner API,” say “three endpoints (orders, refunds, inventory), 99p latency target 800ms, must stay under 120 requests/minute, and freshness targets of 30s/2m/10m.” Other common errors: describing “rate limit unknown” but not sharing observed symptoms (bad: “sometimes it fails,” good: “429s appear after 20 parallel workers”), skipping outage expectations (bad: “handle downtime,” good: “during 5xx bursts, enter degraded mode for 15 minutes and notify”), and ignoring payload inconsistency (bad: “JSON response,” good: “fields occasionally missing; must treat as partial and retry safely without duplicating writes”). The more specific your constraints, the more implementable the artifacts become.</p>
<!-- /wp:paragraph -->
</div>

<div class="faq-item">
<span class="question">Who should NOT use this API polling plans prompt?</span>
<!-- wp:paragraph -->
<p class="answer">This prompt isn’t ideal for one-off scripts where you won’t iterate, quick demos that can tolerate bad behavior, or teams that already have an event-driven alternative (webhooks/streaming) fully available and reliable. It’s also a poor fit if you can’t answer basic questions about required freshness or failure tolerance, because the design depends on those tradeoffs. If that’s you, start by validating requirements with a smaller checklist and only then generate an adaptive plan.</p>
<!-- /wp:paragraph -->
</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this API polling plans AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Backend Engineers use it to turn “poll every minute” into an adaptive scheduler with concrete retry, jitter, and state rules. Site Reliability Engineers rely on it to reduce retry storms, define safe degradation modes, and add observability that catches trouble before users do. Platform Engineers apply it when multiple internal services share external API budgets and need consistent patterns across teams. Technical Product Managers get value by translating freshness requirements into explicit cadence tiers and rollout steps they can align stakeholders around."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this API polling plans AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Fintech and trading teams use it to balance ultra-low-latency expectations with respectful vendor consumption, especially when market hours create predictable load spikes. E-commerce brands apply it to inventory, fulfillment, and pricing endpoints where “stale but safe” is better than cascading failures during peak traffic. SaaS platforms lean on it for integrations (CRM, billing, analytics) where unknown rate limits and partial outages are normal, not rare. Travel and logistics companies benefit when external status APIs degrade, because adaptive cadence and fallback behavior keep customer-facing updates stable."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for designing adaptive API polling plans produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like \"Write me an API polling system\" fails because it: lacks a pre-analysis to define success and unknowns, provides no staged build plan with artifacts you can implement, ignores service-aware behavior like 429 handling and outage degradation, produces generic “retry with exponential backoff” advice instead of specific state transitions and triggers, and misses authentication hygiene (including guidance not to request or paste secrets). You end up with something that reads fine but collapses under real error patterns. Frankly, the gap shows up the moment the vendor API misbehaves."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this API polling plans prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, by feeding the assistant the details it expects during pre-analysis and complexity triage: the endpoints involved, your freshness targets, known or suspected rate limits, and what failures you already see (429, 5xx, timeouts, inconsistent payloads). You can also specify constraints like “vendor-agnostic only,” “must run in Kubernetes,” or “single-process cron for now,” and the stages should adapt. Never paste full tokens or private keys; describe the auth type (OAuth refresh token, API key, signed request) and ask for safe handling patterns. A good follow-up is: “Given these endpoints and SLOs, propose per-endpoint cadence tiers and the state machine transitions that move between them.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this API polling plans prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving the environment description too vague — instead of “we call a partner API,” say “three endpoints (orders, refunds, inventory), 99p latency target 800ms, must stay under 120 requests/minute, and freshness targets of 30s/2m/10m.” Other common errors: describing “rate limit unknown” but not sharing observed symptoms (bad: “sometimes it fails,” good: “429s appear after 20 parallel workers”), skipping outage expectations (bad: “handle downtime,” good: “during 5xx bursts, enter degraded mode for 15 minutes and notify”), and ignoring payload inconsistency (bad: “JSON response,” good: “fields occasionally missing; must treat as partial and retry safely without duplicating writes”). The more specific your constraints, the more implementable the artifacts become."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this API polling plans prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for one-off scripts where you won’t iterate, quick demos that can tolerate bad behavior, or teams that already have an event-driven alternative (webhooks/streaming) fully available and reliable. It’s also a poor fit if you can’t answer basic questions about required freshness or failure tolerance, because the design depends on those tradeoffs. If that’s you, start by validating requirements with a smaller checklist and only then generate an adaptive plan."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">
<!-- wp:paragraph -->
<p>Polling doesn’t have to be noisy or fragile. Use this prompt to design adaptive schedules, failure-aware backoff, and a staged build plan you can ship with confidence.</p>
<!-- /wp:paragraph -->
</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001588.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Build a Production Rollback Playbook AI Prompt</title>
		<link>https://flowpast.com/prompts/build-a-production-rollback-playbook-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:38:35 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001430</guid>

					<description><![CDATA[Release failing in production - the go-to AI Prompt for a rapid rollback playbook with decision points, comms templates, and artifact capture. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: production rollback playbook -->

<div class="hook-introduction">

<p>A production release is failing, customers are feeling it, and the on-call channel is filling up fast. In that moment, “quick rollback” is not a plan. Without clear decision points, verification gates, and comms templates, teams lose time, trust, and evidence.</p>



<p>This <strong>production rollback playbook</strong> is built for <strong>Release Managers</strong> handling a high-severity deploy that needs a safe revert, <strong>SRE/On-call Engineers</strong> who must restore service under pressure while collecting artifacts, and <strong>Engineering Leaders</strong> who need crisp customer and stakeholder comms without guessing. The output is a full incident-ready rollback playbook: prioritized steps with time estimates, platform-aware commands where possible, pass/fail checklists, parallel forensics, fallback routes, comms templates, and a “What This Is NOT” scope guard.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It generates a time-ordered rollback procedure that prioritizes time-to-execute and downtime reduction.</li>
          <li>It produces platform-aware rollback steps (including commands where possible) instead of generic “roll back your release” advice.</li>
          <li>It builds verification gates with pass/fail criteria so responders know exactly when it’s safe to proceed.</li>
          <li>It separates parallel forensics from restore actions so investigation work never blocks the rollback.</li>
          <li>It adds fallback routes, artifact capture checklists, and a “What This Is NOT” section to prevent scope creep during an incident.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>A production deploy causes elevated 5xx rates, latency spikes, or partial outages and you need service restored quickly.</li>
          <li>You’re seeing ambiguous symptoms and can’t tell if the culprit is code, configuration, data migrations, or infrastructure changes.</li>
          <li>Your team is debating rollback versus hotfix and you need a decision framework with clear criteria.</li>
          <li>Stakeholders are requesting updates and you need consistent, trustworthy comms while engineers execute.</li>
          <li>You are scaling releases (more frequent deploys, multiple services) and want a repeatable, drillable rollback playbook.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A step-by-step rollback plan with time estimates and explicit verification checkpoints.</li>
           <li>Two rollback paths (fastest route plus “next best” fallback) with conditions for switching.</li>
           <li>Comms templates for internal updates, customer status pages, and post-incident summaries.</li>
           <li>A parallel debugging and evidence-capture checklist (logs, metrics snapshots, deploy metadata, timelines).</li>
           <li>A hardening and automation backlog with prioritized follow-ups (guardrails, canaries, roll-forward options, runbook gaps).</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Incident-Ready Production Rollback Playbook</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[UPPERCASE_WITH_UNDERSCORES]</code></td>
                                <td class="var-desc">
                                    Provide an example of a variable written in uppercase with underscores, as used in prompts to indicate user-provided inputs.                                    <div class="var-example">For example: "[APPLICATION_TYPE]"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPPERCASE_WITH_UNDERSCORES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[APPLICATION_TYPE]</code></td>
                                <td class="var-desc">
                                    Specify the type of application experiencing the issue, including its primary function and architecture if relevant.                                    <div class="var-example">For example: "A microservices-based e-commerce web application deployed on Kubernetes."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[APPLICATION_TYPE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[DEPLOYMENT_PLATFORM]</code></td>
                                <td class="var-desc">
                                    Indicate the platform or environment where the application is deployed, including hosting details and any relevant configurations.                                    <div class="var-example">For example: "AWS Elastic Kubernetes Service (EKS) with Helm charts for deployment and auto-scaling enabled."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[DEPLOYMENT_PLATFORM]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[GIT_REPOSITORY_SETUP]</code></td>
                                <td class="var-desc">
                                    Describe the Git repository structure, including branching strategy, backup mechanisms, and any specific configurations.                                    <div class="var-example">For example: "Monorepo with main and develop branches, feature branches for each task, and daily backups to AWS S3."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[GIT_REPOSITORY_SETUP]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[USER_COMMUNICATION_CHANNELS]</code></td>
                                <td class="var-desc">
                                    List the communication channels used to notify users or stakeholders about incidents, updates, and resolutions.                                    <div class="var-example">For example: "Email alerts via Mailchimp, Slack updates for internal teams, and Twitter for public-facing announcements."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[USER_COMMUNICATION_CHANNELS]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TEAM_STRUCTURE]</code></td>
                                <td class="var-desc">
                                    Outline the team composition, including roles, decision-makers, and escalation paths during incident management.                                    <div class="var-example">For example: "On-call engineers, a release manager, and a product owner with escalation to the CTO for high-severity outages."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[TEAM_STRUCTURE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">1) Immediate Rollback Actions (fastest path first)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">2) Platform-Specific Procedures (commands + exact clicks when needed)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">3) Git &amp; Artifact Recovery Steps</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">4) User &amp; Stakeholder Communication Plan</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">5) Parallel Investigation (non-blocking forensics)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">6) Future Prevention Setup (automation + guardrails)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">7) Rollback Verification Checklist (service stability)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">8) What This Is NOT (scope boundaries)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Create an incident-ready rollback playbook for a failing production release that restores service fast, protects customer trust, and preserves evidence for later root-cause analysis. The deliverable must include platform-specific rollback steps (with commands where possible), a comms plan, parallel debugging procedures, and longer-term hardening/automation.

## PERSONA
Operate as a hardened release responder who has managed high-severity outages in modern CI/CD environments. You think in “stop the bleeding first,” run crisp decision points, and write procedures that are executable under pressure by an on-call team.

## CONSTRAINTS
- Prioritize actions by **time-to-execute** and **downtime reduction**.
- Provide **platform-aware** procedures (not generic theory).
- Include **clear checklists** with pass/fail criteria for each major step.
- Investigation activities must run **in parallel** and must **not block rollback**.
- Include **fallback routes** if the preferred rollback method fails.
- Preserve diagnostic artifacts (logs, metrics snapshots, deploy metadata) while moving quickly.
- If any input is missing or ambiguous, make the safest assumption, state it, and offer 1–2 alternative branches.
- Add a “What This Is NOT” section to prevent scope creep.
- Follow variable format rules: user-provided inputs use **[UPPERCASE_WITH_UNDERSCORES]**; model-filled placeholders use **{Title Case}**.

## PROCESS
1. **Pre-Analysis (required):** Restate your understanding of the incident context using the provided inputs. List the top 3 immediate risks and the primary success metric (e.g., error rate, availability, latency).
2. **Rapid Triage:** Identify the fastest rollback path and the “next best” option if it fails.
3. **Execute Rollback Plan:** Provide step-by-step actions with time estimates and verification gates.
4. **Run Parallel Forensics:** Outline data capture and hypothesis-driven checks that do not interfere with rollback.
5. **Communicate Continuously:** Provide message templates and timing for users/stakeholders.
6. **Stabilize &amp; Prevent Recurrence:** Recommend automation, guardrails, and monitoring improvements tied to this failure mode.

## INPUTS
- **Application type:** [APPLICATION_TYPE]
- **Deployment platform:** [DEPLOYMENT_PLATFORM]
- **Git repository setup (branching + backups):** [GIT_REPOSITORY_SETUP]
- **User communication channels:** [USER_COMMUNICATION_CHANNELS]
- **Team structure / decision makers:** [TEAM_STRUCTURE]

## OUTPUT SPECIFICATION
Produce a single “emergency procedure” document with the sections below (use these exact headers). Use concise bullets, numbered steps, and include commands when applicable.

### 1) Immediate Rollback Actions (fastest path first)
For each action, include:
- {Action Name}
- {When To Choose This}
- {ETA}
- {Steps}
- {Success Criteria}
- {Failure Signals}
- {Fallback Option}

### 2) Platform-Specific Procedures (commands + exact clicks when needed)
Provide separate subsections tailored to [DEPLOYMENT_PLATFORM]. If [DEPLOYMENT_PLATFORM] is unclear, include procedures for the two closest major options you infer (e.g., Kubernetes + one managed PaaS). Include:
- {Rollback Method 1}
- {Rollback Method 2}
- {Verification Commands}
- {Traffic Management Steps} (e.g., load balancer, ingress, weights)
- {Config/Secrets Notes} (what must/waswo must not change during rollback)

### 3) Git &amp; Artifact Recovery Steps
Based on [GIT_REPOSITORY_SETUP], include:
- {Revert Strategy} (e.g., revert commit vs. redeploy previous artifact)
- {Branch Safety Steps}
- {Tag/Release Identification}
- {Artifact Rehydration Steps} (if builds are needed)
- {Audit Trail Preservation} (what to record and where)

### 4) User &amp; Stakeholder Communication Plan
Create a timed comms cadence using [USER_COMMUNICATION_CHANNELS] and [TEAM_STRUCTURE]:
- {Initial Incident Statement} (first update)
- {Ongoing Update Template} (every X minutes)
- {Rollback In Progress Notice}
- {Service Restored Notice}
- {Customer Support Brief} (internal guidance)
- {Executive Snapshot} (impact, ETA, decision points)

### 5) Parallel Investigation (non-blocking forensics)
Include:
- {Evidence To Capture Immediately} (logs, traces, dashboards, deploy diffs)
- {Safe Queries/Checks} that do not mutate production
- {Likely Failure Themes} mapped to [APPLICATION_TYPE] and [DEPLOYMENT_PLATFORM]
- {Timeline Notes} (what to write down during the event)
- {Do-Not-Do List} (actions that risk extending downtime)

### 6) Future Prevention Setup (automation + guardrails)
Provide implementable recommendations:
- {Automated Rollback Triggers} (what signals, thresholds)
- {Deployment Safety Gates} (canaries, progressive delivery, feature flags)
- {Monitoring/Alerting Additions}
- {Runbook Automation} (scripts, one-click rollback)
- {Access &amp; Permission Hardening} (who can roll back, how approvals work)

### 7) Rollback Verification Checklist (service stability)
A final checklist with:
- {User-Facing Checks}
- {System Health Checks}
- {Data Integrity Checks}
- {Performance Baselines}
- {Incident Close Criteria}

### 8) What This Is NOT (scope boundaries)
Brief bullets clarifying what you are not doing (e.g., full RCA document, long-term architecture redesign, vendor procurement), while pointing to where those belong post-incident.

## QUALITY CHECKS
At the end, include a “Validation” block that confirms:
- The rollback path is the fastest viable option and includes at least one fallback.
- Every major step has measurable success criteria and a verification command or observable signal.
- Comms templates are ready to send and matched to [USER_COMMUNICATION_CHANNELS].
- Parallel investigation steps are explicitly non-invasive and won’t delay restoration.
- All placeholders follow formatting rules: inputs as [UPPERCASE_WITH_UNDERSCORES], outputs as {Title Case}.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nCreate an incident-ready rollback playbook for a failing production release that restores service fast, protects customer trust, and preserves evidence for later root-cause analysis. The deliverable must include platform-specific rollback steps (with commands where possible), a comms plan, parallel debugging procedures, and longer-term hardening\/automation.\r\n\r\n## PERSONA\r\nOperate as a hardened release responder who has managed high-severity outages in modern CI\/CD environments. You think in \u201cstop the bleeding first,\u201d run crisp decision points, and write procedures that are executable under pressure by an on-call team.\r\n\r\n## CONSTRAINTS\r\n- Prioritize actions by **time-to-execute** and **downtime reduction**.\r\n- Provide **platform-aware** procedures (not generic theory).\r\n- Include **clear checklists** with pass\/fail criteria for each major step.\r\n- Investigation activities must run **in parallel** and must **not block rollback**.\r\n- Include **fallback routes** if the preferred rollback method fails.\r\n- Preserve diagnostic artifacts (logs, metrics snapshots, deploy metadata) while moving quickly.\r\n- If any input is missing or ambiguous, make the safest assumption, state it, and offer 1\u20132 alternative branches.\r\n- Add a \u201cWhat This Is NOT\u201d section to prevent scope creep.\r\n- Follow variable format rules: user-provided inputs use **[UPPERCASE_WITH_UNDERSCORES]**; model-filled placeholders use **{Title Case}**.\r\n\r\n## PROCESS\r\n1. **Pre-Analysis (required):** Restate your understanding of the incident context using the provided inputs. List the top 3 immediate risks and the primary success metric (e.g., error rate, availability, latency).\r\n2. **Rapid Triage:** Identify the fastest rollback path and the \u201cnext best\u201d option if it fails.\r\n3. **Execute Rollback Plan:** Provide step-by-step actions with time estimates and verification gates.\r\n4. **Run Parallel Forensics:** Outline data capture and hypothesis-driven checks that do not interfere with rollback.\r\n5. **Communicate Continuously:** Provide message templates and timing for users\/stakeholders.\r\n6. **Stabilize & Prevent Recurrence:** Recommend automation, guardrails, and monitoring improvements tied to this failure mode.\r\n\r\n## INPUTS\r\n- **Application type:** [APPLICATION_TYPE]\r\n- **Deployment platform:** [DEPLOYMENT_PLATFORM]\r\n- **Git repository setup (branching + backups):** [GIT_REPOSITORY_SETUP]\r\n- **User communication channels:** [USER_COMMUNICATION_CHANNELS]\r\n- **Team structure \/ decision makers:** [TEAM_STRUCTURE]\r\n\r\n## OUTPUT SPECIFICATION\r\nProduce a single \u201cemergency procedure\u201d document with the sections below (use these exact headers). Use concise bullets, numbered steps, and include commands when applicable.\r\n\r\n### 1) Immediate Rollback Actions (fastest path first)\r\nFor each action, include:\r\n- {Action Name}\r\n- {When To Choose This}\r\n- {ETA}\r\n- {Steps}\r\n- {Success Criteria}\r\n- {Failure Signals}\r\n- {Fallback Option}\r\n\r\n### 2) Platform-Specific Procedures (commands + exact clicks when needed)\r\nProvide separate subsections tailored to [DEPLOYMENT_PLATFORM]. If [DEPLOYMENT_PLATFORM] is unclear, include procedures for the two closest major options you infer (e.g., Kubernetes + one managed PaaS). Include:\r\n- {Rollback Method 1}\r\n- {Rollback Method 2}\r\n- {Verification Commands}\r\n- {Traffic Management Steps} (e.g., load balancer, ingress, weights)\r\n- {Config\/Secrets Notes} (what must\/waswo must not change during rollback)\r\n\r\n### 3) Git & Artifact Recovery Steps\r\nBased on [GIT_REPOSITORY_SETUP], include:\r\n- {Revert Strategy} (e.g., revert commit vs. redeploy previous artifact)\r\n- {Branch Safety Steps}\r\n- {Tag\/Release Identification}\r\n- {Artifact Rehydration Steps} (if builds are needed)\r\n- {Audit Trail Preservation} (what to record and where)\r\n\r\n### 4) User & Stakeholder Communication Plan\r\nCreate a timed comms cadence using [USER_COMMUNICATION_CHANNELS] and [TEAM_STRUCTURE]:\r\n- {Initial Incident Statement} (first update)\r\n- {Ongoing Update Template} (every X minutes)\r\n- {Rollback In Progress Notice}\r\n- {Service Restored Notice}\r\n- {Customer Support Brief} (internal guidance)\r\n- {Executive Snapshot} (impact, ETA, decision points)\r\n\r\n### 5) Parallel Investigation (non-blocking forensics)\r\nInclude:\r\n- {Evidence To Capture Immediately} (logs, traces, dashboards, deploy diffs)\r\n- {Safe Queries\/Checks} that do not mutate production\r\n- {Likely Failure Themes} mapped to [APPLICATION_TYPE] and [DEPLOYMENT_PLATFORM]\r\n- {Timeline Notes} (what to write down during the event)\r\n- {Do-Not-Do List} (actions that risk extending downtime)\r\n\r\n### 6) Future Prevention Setup (automation + guardrails)\r\nProvide implementable recommendations:\r\n- {Automated Rollback Triggers} (what signals, thresholds)\r\n- {Deployment Safety Gates} (canaries, progressive delivery, feature flags)\r\n- {Monitoring\/Alerting Additions}\r\n- {Runbook Automation} (scripts, one-click rollback)\r\n- {Access & Permission Hardening} (who can roll back, how approvals work)\r\n\r\n### 7) Rollback Verification Checklist (service stability)\r\nA final checklist with:\r\n- {User-Facing Checks}\r\n- {System Health Checks}\r\n- {Data Integrity Checks}\r\n- {Performance Baselines}\r\n- {Incident Close Criteria}\r\n\r\n### 8) What This Is NOT (scope boundaries)\r\nBrief bullets clarifying what you are not doing (e.g., full RCA document, long-term architecture redesign, vendor procurement), while pointing to where those belong post-incident.\r\n\r\n## QUALITY CHECKS\r\nAt the end, include a \u201cValidation\u201d block that confirms:\r\n- The rollback path is the fastest viable option and includes at least one fallback.\r\n- Every major step has measurable success criteria and a verification command or observable signal.\r\n- Comms templates are ready to send and matched to [USER_COMMUNICATION_CHANNELS].\r\n- Parallel investigation steps are explicitly non-invasive and won\u2019t delay restoration.\r\n- All placeholders follow formatting rules: inputs as [UPPERCASE_WITH_UNDERSCORES], outputs as {Title Case}.";
    const variables = ["[UPPERCASE_WITH_UNDERSCORES]","[APPLICATION_TYPE]","[DEPLOYMENT_PLATFORM]","[GIT_REPOSITORY_SETUP]","[USER_COMMUNICATION_CHANNELS]","[TEAM_STRUCTURE]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Feed it your real “success metric” and the first observable symptom.</strong> Don’t just say “production is down.” Give a measurable target like “reduce 5xx from 18% to under 1%” or “p95 latency back under 400ms,” plus what changed right before the incident. Then ask: “Restate the top 3 immediate risks based on this symptom set and pick the primary success metric.”</li>


<li><strong>Force platform specificity with a short environment header.</strong> This prompt is designed to be platform-aware, but it works best when you name the stack plainly (Kubernetes, ECS, Cloud Run, VM-based, etc.). Follow up with: “Assume we deploy via GitHub Actions to EKS; include kubectl/helm commands where appropriate and list safe defaults if a detail is missing.”</li>


<li><strong>Make the verification gates executable, not philosophical.</strong> Ask for checks your on-call can run in 60 seconds, like a synthetic ping, a key endpoint, or a dashboard query. A useful follow-up: “For each step, add a pass/fail gate with the exact query or command, and specify what to do if the gate fails.”</li>


<li><strong>Run the “fallback route” like a real branch.</strong> Teams often write a fallback as a vague sentence and never practice it. After the first output, try asking: “Now rewrite the fallback method as a full second plan with the same time estimates and gates, and include the decision trigger for switching at minute 10.”</li>


<li><strong>Use it twice: once for the incident, once for prevention work.</strong> Frankly, most rollback docs die after the outage. After you’ve restored service, run a second pass: “Turn the hardening section into a 2-week backlog with owners, impact, and dependency notes; include one automation idea that reduces rollback time by 50%.”</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>After you’ve stabilized production, these prompts can help you tighten the operational side of the business so incidents hurt less and recovery gets funded.</p>



<p>If you also need a simple way to quantify “how much runway do we have while we pause releases and fix stability,” the weekly planning angle can help. When cash timing matters (refunds, credits, support overtime), <a href="https://flowpast.com/prompts/build-a-weekly-cash-forecast-with-this-ai-prompt/">Build a Weekly Cash Forecast with this AI Prompt</a> gives you a practical, week-by-week view you can use during an incident-heavy month.</p>



<p>When leadership asks for a tighter control loop on spend after an outage (tooling upgrades, extra monitoring, on-call coverage), budgets come up immediately. For teams doing operational hardening and needing trade-offs spelled out, <a href="https://flowpast.com/prompts/build-a-zero-balance-monthly-budget-ai-prompt/">Build a Zero-Balance Monthly Budget AI Prompt</a> can help you plan where every dollar goes before you commit to new reliability work.</p>



<p>If you’re trying to change habits after repeated incidents, the problem is often behavioral: unplanned work, inconsistent rituals, and “we’ll fix it later.” When you want a structure for repeatable operating decisions at home or in a small team, <a href="https://flowpast.com/prompts/build-a-behavior-based-household-budget-with-this-ai-prompt/">Build a Behavior-Based Household Budget with this AI Prompt</a> is a surprisingly good companion because it reinforces triggers, rules, and follow-through.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/build-a-weekly-cash-forecast-with-this-ai-prompt/">Build a Weekly Cash Forecast with this AI Prompt</a>: Weekly runway and timing clarity.</li>


<li><a href="https://flowpast.com/prompts/build-a-zero-balance-monthly-budget-ai-prompt/">Build a Zero-Balance Monthly Budget AI Prompt</a>: Allocate every dollar intentionally.</li>


<li><a href="https://flowpast.com/prompts/build-a-behavior-based-household-budget-with-this-ai-prompt/">Build a Behavior-Based Household Budget with this AI Prompt</a>: Build rules that stick.</li>


<li><a href="https://flowpast.com/prompts/build-a-7-day-budget-grocery-plan-with-this-ai-prompt/">Build a 7-Day Budget Grocery Plan with this AI Prompt</a>: Reduce cost drift with constraints.</li>


<li><a href="https://flowpast.com/prompts/build-a-weekly-cash-forecast-with-this-ai-prompt/">Build a Weekly Cash Forecast with this AI Prompt</a>: Scenario plan around uncertainty.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this production rollback playbook AI prompt?</span>

<p class="answer"><strong>Site Reliability Engineers (SREs)</strong> use it to turn a stressful incident into a sequence of executable steps with gates, fallbacks, and artifact capture. <strong>Release Managers</strong> rely on it to choose the fastest safe rollback path and keep coordination tight across multiple services and approvers. <strong>Engineering Managers</strong> get value because the prompt includes decision points and comms patterns, which reduces stakeholder thrash while the team restores service. <strong>Incident Commanders</strong> benefit from the structure for parallel workstreams, so investigation and recovery happen simultaneously without stepping on each other.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this production rollback playbook AI prompt?</span>

<p class="answer"><strong>SaaS companies</strong> get immediate value because subscription churn is sensitive to downtime, and this playbook emphasizes fast restoration plus customer-facing comms templates. <strong>E-commerce brands</strong> use it during peak periods (launches, promos, holiday weekends) when a broken checkout or inventory sync can cost real revenue every minute. <strong>Fintech and payments</strong> teams benefit from the evidence-preservation steps, since audit trails and precise timelines matter alongside recovery speed. <strong>Media and streaming platforms</strong> apply it when latency or partial outages degrade experience, because the prompt encourages measurable success metrics and quick verification gates.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for creating a rollback playbook produce weak results?</span>

<p class="answer">A typical prompt like “Write me a rollback plan for a bad production deploy” fails because it: lacks prioritized sequencing by time-to-execute and downtime reduction, provides no platform-aware commands so responders still guess, ignores verification gates so teams can’t tell if they’re actually recovering, produces a single-path plan instead of a primary route plus fallback, and misses evidence capture so root-cause analysis becomes slower and more political later. This prompt forces crisp decision points and parallel forensics so rollback and investigation happen together. It also includes “What This Is NOT,” which is honestly one of the best ways to keep an incident from turning into a chaotic improvement project mid-outage.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this production rollback playbook prompt for my specific situation?</span>

<p class="answer">Yes. The prompt is designed to request and use inputs in a clear format like [PLATFORM], [DEPLOYMENT_METHOD], [PRIMARY_SYMPTOM], [SUCCESS_METRIC], [SERVICES_AFFECTED], and [ROLLBACK_OPTIONS_AVAILABLE] even though the prompt itself has no fixed variables in the viewer. If you provide those details, the output becomes far more executable (commands, gates, and comms that match your environment). A good follow-up is: “Ask me only the minimum 8 questions needed to produce an incident-ready playbook, then generate two rollback branches based on my answers.”</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this production rollback playbook prompt?</span>

<p class="answer">The biggest mistake is leaving [PLATFORM] too vague — instead of “cloud,” try “AWS EKS Kubernetes with Helm releases and Argo CD.” Another common error is a fuzzy [SUCCESS_METRIC]; “make it stable” is hard to verify, while “5xx under 1% for 10 minutes and p95 latency under 400ms” creates clear gates. People also under-specify [ROLLBACK_OPTIONS_AVAILABLE]; “we can roll back” is not the same as “we have the previous container image, feature flags, and a database migration rollback script.” Finally, teams forget [COMMS_CHANNELS_AND_AUDIENCES]; “notify stakeholders” becomes actionable when you name “Statuspage, in-app banner, and an internal exec Slack channel.”</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this production rollback playbook prompt?</span>

<p class="answer">This prompt isn’t ideal for low-stakes environments where a rollback doesn’t matter, or for teams that only want a one-page template with no operational depth. It’s also not a substitute for platform ownership; if nobody can safely run deployment commands, the best playbook in the world won’t help. If you’re still pre-production or validating an MVP, you may be better off starting with basic release hygiene (simple monitoring, manual rollback notes, and a small on-call rotation) before generating a full incident playbook.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this production rollback playbook AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Site Reliability Engineers (SREs) use it to turn a stressful incident into a sequence of executable steps with gates, fallbacks, and artifact capture. Release Managers rely on it to choose the fastest safe rollback path and keep coordination tight across multiple services and approvers. Engineering Managers get value because the prompt includes decision points and comms patterns, which reduces stakeholder thrash while the team restores service. Incident Commanders benefit from the structure for parallel workstreams, so investigation and recovery happen simultaneously without stepping on each other."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this production rollback playbook AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies get immediate value because subscription churn is sensitive to downtime, and this playbook emphasizes fast restoration plus customer-facing comms templates. E-commerce brands use it during peak periods (launches, promos, holiday weekends) when a broken checkout or inventory sync can cost real revenue every minute. Fintech and payments teams benefit from the evidence-preservation steps, since audit trails and precise timelines matter alongside recovery speed. Media and streaming platforms apply it when latency or partial outages degrade experience, because the prompt encourages measurable success metrics and quick verification gates."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for creating a rollback playbook produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like “Write me a rollback plan for a bad production deploy” fails because it: lacks prioritized sequencing by time-to-execute and downtime reduction, provides no platform-aware commands so responders still guess, ignores verification gates so teams can’t tell if they’re actually recovering, produces a single-path plan instead of a primary route plus fallback, and misses evidence capture so root-cause analysis becomes slower and more political later. This prompt forces crisp decision points and parallel forensics so rollback and investigation happen together. It also includes “What This Is NOT,” which is one of the best ways to keep an incident from turning into a chaotic improvement project mid-outage."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this production rollback playbook prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. The prompt is designed to request and use inputs in a clear format like [PLATFORM], [DEPLOYMENT_METHOD], [PRIMARY_SYMPTOM], [SUCCESS_METRIC], [SERVICES_AFFECTED], and [ROLLBACK_OPTIONS_AVAILABLE] even though the prompt itself has no fixed variables in the viewer. If you provide those details, the output becomes far more executable (commands, gates, and comms that match your environment). A good follow-up is: “Ask me only the minimum 8 questions needed to produce an incident-ready playbook, then generate two rollback branches based on my answers.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this production rollback playbook prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving [PLATFORM] too vague — instead of “cloud,” try “AWS EKS Kubernetes with Helm releases and Argo CD.” Another common error is a fuzzy [SUCCESS_METRIC]; “make it stable” is hard to verify, while “5xx under 1% for 10 minutes and p95 latency under 400ms” creates clear gates. People also under-specify [ROLLBACK_OPTIONS_AVAILABLE]; “we can roll back” is not the same as “we have the previous container image, feature flags, and a database migration rollback script.” Finally, teams forget [COMMS_CHANNELS_AND_AUDIENCES]; “notify stakeholders” becomes actionable when you name “Statuspage, in-app banner, and an internal exec Slack channel.”"
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this production rollback playbook prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for low-stakes environments where a rollback doesn’t matter, or for teams that only want a one-page template with no operational depth. It’s also not a substitute for platform ownership; if nobody can safely run deployment commands, the best playbook in the world won’t help. If you’re still pre-production or validating an MVP, you may be better off starting with basic release hygiene (simple monitoring, manual rollback notes, and a small on-call rotation) before generating a full incident playbook."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Incidents punish ambiguity. A clear rollback playbook buys you time, restores customer trust faster, and preserves the evidence you’ll wish you had tomorrow. Paste the prompt into ChatGPT, tailor the assumptions to your stack, and keep it ready for the next release.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001430.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Deploy Secrets on Vercel and Supabase AI Prompt</title>
		<link>https://flowpast.com/prompts/deploy-secrets-on-vercel-and-supabase-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:37:29 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001429</guid>

					<description><![CDATA[Secrets keep leaking - a proven AI Prompt that builds a Vercel, Supabase, and local env plan with code, checks, and fixes. Discover more AI prompts for marketing, sales, and ops.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: deploy secrets prompt -->
<div class="hook-introduction">

<p>Secrets don’t leak because your team is careless. They leak because the setup is fuzzy, the boundary between browser and server gets blurred, and “just this once” turns into a habit. Then you’re rotating keys at midnight, wondering where the exposure actually happened.</p>



<p>This <strong>deploy secrets prompt</strong> is built for <strong>startup CTOs</strong> who need a clean Vercel + Supabase rollout without slowing down shipping, <strong>full-stack developers</strong> who keep tripping over env var scoping between client and server code, and <strong>consultants</strong> cleaning up a post-incident mess before a renewal or audit. The output is a ready-to-implement, environment-specific secrets plan with exact setup steps for Vercel, Supabase, and local dev, plus code patterns, verification checks, and troubleshooting “gotchas.”</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It produces a platform-specific secrets and env var plan tailored to Vercel, Supabase, and local development workflows.</li>
          <li>It separates guidance by environment (local vs staging vs production) so you stop “promoting” dev keys into prod by accident.</li>
          <li>It defines a strict client-side vs server-side boundary, including how to keep secrets out of browser bundles and public runtime config.</li>
          <li>It includes configuration examples and code snippets that show safe access patterns, naming conventions, and guardrails in code review.</li>
          <li>It adds verification steps and troubleshooting after major changes, so you can confirm you fixed the leak instead of hoping.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>You are deploying a Next.js app on Vercel with Supabase and need to decide which values can be public and which must remain server-only.</li>
          <li>A secret showed up in a Git commit, a client-side bundle, logs, or a screenshot, and you need a pragmatic cleanup plan fast.</li>
          <li>Your team is adding staging for the first time and keeps copying environment variables manually between projects.</li>
          <li>Multiple developers use different local setups (dotenv files, shell exports, monorepos), and onboarding keeps breaking.</li>
          <li>You are scaling deployments and want repeatable checks before each release, not a one-off “security pass.”</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A 3-environment rollout plan (local, staging, production) with explicit “set it here” steps for Vercel and Supabase.</li>
           <li>A secrets inventory template that labels each value as server-only vs safe-to-expose, with naming rules to reduce mistakes.</li>
           <li>Copy/paste-ready code patterns for accessing secrets safely and avoiding browser exposure, plus example folder/file placement guidance.</li>
           <li>A verification checklist after each change (build output checks, runtime checks, and “did it end up public?” tests).</li>
           <li>A troubleshooting section for common misconfigurations, including scoping issues, missing vars, and accidental git commits.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Vercel + Supabase Secrets Deployment Plan</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[UPPERCASE_WITH_UNDERSCORES]</code></td>
                                <td class="var-desc">
                                    Provide the name of the environment variable in uppercase with underscores, following standard naming conventions for secrets or configuration keys.                                    <div class="var-example">For example: "DATABASE_URL or API_SECRET_KEY"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPPERCASE_WITH_UNDERSCORES]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[PLATFORM]</code></td>
                                <td class="var-desc">
                                    Specify the platform where your application is deployed. This could include hosting services or cloud providers used for deployment.                                    <div class="var-example">For example: "Vercel, AWS Lambda, or Heroku"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[PLATFORM]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[BACKEND_SERVICES]</code></td>
                                <td class="var-desc">
                                    List the backend services or databases your application relies on. Include specific technologies or services being used.                                    <div class="var-example">For example: "Supabase for database and authentication, PostgreSQL for data storage"</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[BACKEND_SERVICES]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[FORMAT]</code></td>
                                <td class="var-desc">
                                    Indicate the frontend framework your application is built with. This helps tailor guidance for client-side implementation.                                    <div class="var-example">For example: "Next.js or React"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[FORMAT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide relevant details about your project, including its purpose, scope, and any unique requirements or constraints.                                    <div class="var-example">For example: "Building a SaaS platform for collaborative project management, targeting startups and small businesses."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[TEAM_SIZE]</code></td>
                                <td class="var-desc">
                                    Enter the number of people on your development team. This helps determine the complexity of secret management and access control.                                    <div class="var-example">For example: "5 developers including 2 backend specialists and 1 DevOps engineer."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[TEAM_SIZE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">1) Security Snapshot</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">2) Platform Setup (Exact Steps)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">3) Environment Isolation Model</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">4) Repository &amp; Git Safeguards</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">5) Secure Code Usage (Client vs Server)</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">6) Verification &amp; Test Plan</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">7) Monitoring &amp; Ongoing Maintenance</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Design a ready-to-implement, platform-specific security plan for environment variables and secrets that works across local development, staging, and production. The deliverable must include exact setup steps for Vercel, Supabase, and the local dev workflow, plus concrete coding patterns that prevent secrets from being exposed in the browser or accidentally committed to git.

## PERSONA
Act as an incident-tested DevSecOps architect who has handled a real-world secret leak with major financial and compliance impact. Communicate like a calm, pragmatic builder: minimal lecturing, maximum “do this / set it here / verify it this way,” with developer experience treated as a first-class requirement.

## CONSTRAINTS
- Prioritize actionable, platform-tied instructions over broad security theory.
- Include configuration examples and code snippets tailored to the provided stack.
- Clearly separate guidance for:
  - local development vs staging vs production
  - client-side (browser) vs server-side execution
- Recommend concrete tools/services only when paired with setup steps.
- Add verification steps after major changes (how to confirm it’s working safely).
- Provide troubleshooting for common misconfigurations and “gotchas.”
- **Edge case handling:** If any required inputs are missing or unclear, ask targeted questions and provide safe defaults/assumptions labeled explicitly.
- **Variable format compliance:** User-provided items must appear as `[UPPERCASE_WITH_UNDERSCORES]`. AI-filled placeholders must use `{Title Case}`.

### What This Is NOT
- Not a legal/compliance opinion (SOC2/GDPR/PCI interpretation).
- Not a full threat model of the entire system outside env var/secrets handling.
- Not exploit instructions or offensive guidance.
- Not generic “rotate keys” advice without showing *where* and *how* to implement it in the chosen platforms.

## PROCESS
1. **Pre-Analysis Step (mandatory):** Restate your understanding of the user’s stack and goal in 3–6 bullet points, and list any assumptions.
2. Identify likely secret exposure paths for this stack (git, build logs, preview deployments, client bundles, CI, mis-scoped variables).
3. Produce a platform-by-platform implementation plan (Vercel, Supabase, local), including exact click-paths/settings names where relevant.
4. Define an environment isolation model (dev/stage/prod) with naming conventions and access controls.
5. Provide code patterns for safe access:
   - server-only runtime access
   - client-exposed variables only when explicitly intended
   - examples for the specified framework
6. Add git hardening steps to prevent accidental commits and reduce blast radius.
7. Provide a verification playbook (checks/tests) plus common pitfalls and fixes.
8. Close with monitoring/maintenance routines that are lightweight but effective.

## INPUTS
- **Deployment platform(s):** [PLATFORM]
- **Backend/database services:** [BACKEND_SERVICES]
- **Frontend framework:** [FORMAT]
- **Current env/secrets setup description:** [CONTEXT]
- **Team size needing access:** [TEAM_SIZE]

## OUTPUT SPECIFICATION
Deliver the plan using the following sections and include the requested artifacts inside each section.

### 1) Security Snapshot
Provide:
- {Current State Summary}
- {Highest-Risk Gaps}
- {Likely Leak Paths}
- {Immediate Fixes (Today)}
- {Assumptions &amp; Clarifying Questions}

### 2) Platform Setup (Exact Steps)
Provide separate subsections for:
- {Vercel Configuration}
- {Supabase Configuration}
- {Local Development Configuration}

For each subsection include:
- {Step-by-Step Actions}
- {Recommended Naming Scheme}
- {Access Control Model} (who can read/write)
- {Example Values Layout} (show structure, never output real secrets)
- {CI/CD Notes} (build-time vs runtime implications)
- {Troubleshooting Notes}

### 3) Environment Isolation Model
Provide:
- {Dev Stage Prod Separation Strategy}
- {Variable Naming Conventions}
- {Rules for Promotion} (how values move from dev → stage → prod)
- {Preview/Branch Deployment Rules} (if applicable to [PLATFORM])
- {Separation of Duties Suggestions} (scaled to [TEAM_SIZE])

### 4) Repository &amp; Git Safeguards
Provide:
- {Gitignore Requirements}
- {Pre-Commit / Pre-Push Controls} (tooling + setup steps)
- {Secret Scanning Recommendations} (with configuration examples)
- {Incident Containment Steps} (what to do if a secret is committed)

Include rewritten example snippets such as:
- a sample `.gitignore` block relevant to {Framework Files}
- a pre-commit hook outline for {Secret Detection Tool}

### 5) Secure Code Usage (Client vs Server)
Provide:
- {Server-Only Access Pattern} with code for [FORMAT]
- {Client-Exposed Variables Pattern} with strict rules and examples
- {How to Prevent Browser Exposure} (specific do/don’t rules)
- {Backend Service Access Examples} (e.g., Supabase keys: anon vs service role)
- {Common Mistakes and Fixes}

Include at least:
- one server-side snippet using {Server Runtime Secret}
- one client-side snippet using {Public Variable} (only non-sensitive)

### 6) Verification &amp; Test Plan
Provide a checklist with:
- {Build Output Checks} (ensure secrets aren’t bundled)
- {Runtime Checks} (correct env selected per environment)
- {Log Hygiene Checks} (no secret printing)
- {Access Control Checks} (least privilege)
- {Rollback / Rotation Drill} (simulate rotation safely)

### 7) Monitoring &amp; Ongoing Maintenance
Provide:
- {Rotation Cadence} (pragmatic, not excessive)
- {Audit &amp; Alerting Setup} (platform-native where possible)
- {Key Ownership &amp; Access Reviews}
- {Documentation Template} for the team (what to record, where)

## QUALITY CHECKS
Before finalizing, validate that the answer:
- Uses platform-specific steps and settings names (not generic guidance).
- Distinguishes build-time vs runtime variables and client vs server exposure.
- Includes copy-pastable examples/snippets appropriate to [PLATFORM], [BACKEND_SERVICES], and [FORMAT].
- Contains a verification checklist that would catch mis-scoped/public secrets.
- Calls out at least 6 common pitfalls with clear fixes and safe alternatives.            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nDesign a ready-to-implement, platform-specific security plan for environment variables and secrets that works across local development, staging, and production. The deliverable must include exact setup steps for Vercel, Supabase, and the local dev workflow, plus concrete coding patterns that prevent secrets from being exposed in the browser or accidentally committed to git.\r\n\r\n## PERSONA\r\nAct as an incident-tested DevSecOps architect who has handled a real-world secret leak with major financial and compliance impact. Communicate like a calm, pragmatic builder: minimal lecturing, maximum \u201cdo this \/ set it here \/ verify it this way,\u201d with developer experience treated as a first-class requirement.\r\n\r\n## CONSTRAINTS\r\n- Prioritize actionable, platform-tied instructions over broad security theory.\r\n- Include configuration examples and code snippets tailored to the provided stack.\r\n- Clearly separate guidance for:\r\n  - local development vs staging vs production\r\n  - client-side (browser) vs server-side execution\r\n- Recommend concrete tools\/services only when paired with setup steps.\r\n- Add verification steps after major changes (how to confirm it\u2019s working safely).\r\n- Provide troubleshooting for common misconfigurations and \u201cgotchas.\u201d\r\n- **Edge case handling:** If any required inputs are missing or unclear, ask targeted questions and provide safe defaults\/assumptions labeled explicitly.\r\n- **Variable format compliance:** User-provided items must appear as `[UPPERCASE_WITH_UNDERSCORES]`. AI-filled placeholders must use `{Title Case}`.\r\n\r\n### What This Is NOT\r\n- Not a legal\/compliance opinion (SOC2\/GDPR\/PCI interpretation).\r\n- Not a full threat model of the entire system outside env var\/secrets handling.\r\n- Not exploit instructions or offensive guidance.\r\n- Not generic \u201crotate keys\u201d advice without showing *where* and *how* to implement it in the chosen platforms.\r\n\r\n## PROCESS\r\n1. **Pre-Analysis Step (mandatory):** Restate your understanding of the user\u2019s stack and goal in 3\u20136 bullet points, and list any assumptions.\r\n2. Identify likely secret exposure paths for this stack (git, build logs, preview deployments, client bundles, CI, mis-scoped variables).\r\n3. Produce a platform-by-platform implementation plan (Vercel, Supabase, local), including exact click-paths\/settings names where relevant.\r\n4. Define an environment isolation model (dev\/stage\/prod) with naming conventions and access controls.\r\n5. Provide code patterns for safe access:\r\n   - server-only runtime access\r\n   - client-exposed variables only when explicitly intended\r\n   - examples for the specified framework\r\n6. Add git hardening steps to prevent accidental commits and reduce blast radius.\r\n7. Provide a verification playbook (checks\/tests) plus common pitfalls and fixes.\r\n8. Close with monitoring\/maintenance routines that are lightweight but effective.\r\n\r\n## INPUTS\r\n- **Deployment platform(s):** [PLATFORM]\r\n- **Backend\/database services:** [BACKEND_SERVICES]\r\n- **Frontend framework:** [FORMAT]\r\n- **Current env\/secrets setup description:** [CONTEXT]\r\n- **Team size needing access:** [TEAM_SIZE]\r\n\r\n## OUTPUT SPECIFICATION\r\nDeliver the plan using the following sections and include the requested artifacts inside each section.\r\n\r\n### 1) Security Snapshot\r\nProvide:\r\n- {Current State Summary}\r\n- {Highest-Risk Gaps}\r\n- {Likely Leak Paths}\r\n- {Immediate Fixes (Today)}\r\n- {Assumptions & Clarifying Questions}\r\n\r\n### 2) Platform Setup (Exact Steps)\r\nProvide separate subsections for:\r\n- {Vercel Configuration}\r\n- {Supabase Configuration}\r\n- {Local Development Configuration}\r\n\r\nFor each subsection include:\r\n- {Step-by-Step Actions}\r\n- {Recommended Naming Scheme}\r\n- {Access Control Model} (who can read\/write)\r\n- {Example Values Layout} (show structure, never output real secrets)\r\n- {CI\/CD Notes} (build-time vs runtime implications)\r\n- {Troubleshooting Notes}\r\n\r\n### 3) Environment Isolation Model\r\nProvide:\r\n- {Dev Stage Prod Separation Strategy}\r\n- {Variable Naming Conventions}\r\n- {Rules for Promotion} (how values move from dev \u2192 stage \u2192 prod)\r\n- {Preview\/Branch Deployment Rules} (if applicable to [PLATFORM])\r\n- {Separation of Duties Suggestions} (scaled to [TEAM_SIZE])\r\n\r\n### 4) Repository & Git Safeguards\r\nProvide:\r\n- {Gitignore Requirements}\r\n- {Pre-Commit \/ Pre-Push Controls} (tooling + setup steps)\r\n- {Secret Scanning Recommendations} (with configuration examples)\r\n- {Incident Containment Steps} (what to do if a secret is committed)\r\n\r\nInclude rewritten example snippets such as:\r\n- a sample `.gitignore` block relevant to {Framework Files}\r\n- a pre-commit hook outline for {Secret Detection Tool}\r\n\r\n### 5) Secure Code Usage (Client vs Server)\r\nProvide:\r\n- {Server-Only Access Pattern} with code for [FORMAT]\r\n- {Client-Exposed Variables Pattern} with strict rules and examples\r\n- {How to Prevent Browser Exposure} (specific do\/don\u2019t rules)\r\n- {Backend Service Access Examples} (e.g., Supabase keys: anon vs service role)\r\n- {Common Mistakes and Fixes}\r\n\r\nInclude at least:\r\n- one server-side snippet using {Server Runtime Secret}\r\n- one client-side snippet using {Public Variable} (only non-sensitive)\r\n\r\n### 6) Verification & Test Plan\r\nProvide a checklist with:\r\n- {Build Output Checks} (ensure secrets aren\u2019t bundled)\r\n- {Runtime Checks} (correct env selected per environment)\r\n- {Log Hygiene Checks} (no secret printing)\r\n- {Access Control Checks} (least privilege)\r\n- {Rollback \/ Rotation Drill} (simulate rotation safely)\r\n\r\n### 7) Monitoring & Ongoing Maintenance\r\nProvide:\r\n- {Rotation Cadence} (pragmatic, not excessive)\r\n- {Audit & Alerting Setup} (platform-native where possible)\r\n- {Key Ownership & Access Reviews}\r\n- {Documentation Template} for the team (what to record, where)\r\n\r\n## QUALITY CHECKS\r\nBefore finalizing, validate that the answer:\r\n- Uses platform-specific steps and settings names (not generic guidance).\r\n- Distinguishes build-time vs runtime variables and client vs server exposure.\r\n- Includes copy-pastable examples\/snippets appropriate to [PLATFORM], [BACKEND_SERVICES], and [FORMAT].\r\n- Contains a verification checklist that would catch mis-scoped\/public secrets.\r\n- Calls out at least 6 common pitfalls with clear fixes and safe alternatives.";
    const variables = ["[UPPERCASE_WITH_UNDERSCORES]","[PLATFORM]","[BACKEND_SERVICES]","[FORMAT]","[CONTEXT]","[TEAM_SIZE]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Start by listing every secret and where it currently lives.</strong> Before you paste the prompt into your AI tool, write down items like database URLs, service-role keys, webhook secrets, email provider keys, and analytics tokens. Then ask: “Mark each as server-only, public-safe, or ‘needs review’ and explain why.” Honestly, this one step prevents half the typical Vercel misconfigurations.</li>


<li><strong>Force it to separate local, staging, and production explicitly.</strong> A vague plan tends to collapse into “just set env vars in Vercel.” Follow up with: “Give me three sections titled Local, Staging, Production, and include a final checklist for each.” If you use a staging Supabase project, tell it that and request “exact mapping from Vercel project → Supabase project.”</li>


<li><strong>Ask for a client/server boundary audit of your code paths.</strong> The most expensive leaks happen when a server secret is referenced from a file that ends up in the browser bundle. After the first output, ask: “List risky patterns in Next.js like importing server modules into client components, exposing env vars via NEXT_PUBLIC, and logging config objects.” Then request a quick “safe rewrite” example for one of your real files.</li>


<li><strong>Iterate with “verification steps” until it’s testable.</strong> Good advice becomes great when it tells you how to confirm it worked. After the first output, try asking: “Add verification steps after each major change, including how to confirm a secret is not present in the client bundle, how to validate runtime availability on the server, and what errors to expect when something is missing.”</li>


<li><strong>Request safe defaults and targeted questions when details are missing.</strong> This prompt is designed to ask clarifying questions, but you can push it further. Use: “If you don’t know a value, assume a safe default and label it explicitly, then ask me only the 5 highest-impact questions.” You’ll get forward motion now, without building on shaky assumptions.</li>

</ul>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>Once your secrets workflow is locked down, these prompts help you operationalize the “what happens next” parts: support processes, customer communications, and internal enablement.</p>



<p>If you also need a repeatable incident response workflow for customer-facing teams, <a href="https://flowpast.com/prompts/build-a-customer-support-playbook-with-this-ai-prompt/">Build a Customer Support Playbook with this AI Prompt</a> is a strong next step. When a leak forces resets, login failures, or webhook breaks, support needs clear triage paths, escalation rules, and consistent messaging so engineering can focus on the fix.</p>



<p>For teams doing high-volume ticket handling during outages, <a href="https://flowpast.com/prompts/create-customer-support-talk-tracks-with-this-ai-prompt/">Create Customer Support Talk Tracks with this AI Prompt</a> helps you standardize responses without sounding robotic. It’s especially useful when you must explain why users need to reconnect integrations or re-authenticate after key rotation.</p>



<p>When you’ve stabilized and want to turn the recovery into a trust-building moment, <a href="https://flowpast.com/prompts/launch-a-customer-advocacy-playbook-ai-prompt/">Launch a Customer Advocacy Playbook AI Prompt</a> is a smart pairing. It guides how to communicate improvements, reinforce reliability, and build a narrative around the stronger security posture you’ve implemented.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/build-a-customer-support-playbook-with-this-ai-prompt/">Build a Customer Support Playbook with this AI Prompt</a>: Triage, escalations, and support ops structure.</li>


<li><a href="https://flowpast.com/prompts/create-customer-support-talk-tracks-with-this-ai-prompt/">Create Customer Support Talk Tracks with this AI Prompt</a>: Consistent replies during incidents and fixes.</li>


<li><a href="https://flowpast.com/prompts/launch-a-customer-advocacy-playbook-ai-prompt/">Launch a Customer Advocacy Playbook AI Prompt</a>: Turn improvements into customer trust.</li>


<li><a href="https://flowpast.com/prompts/build-a-customer-learning-center-playbook-ai-prompt/">Build a Customer Learning Center Playbook AI Prompt</a>: Self-serve docs for common workflows.</li>


<li><a href="https://flowpast.com/prompts/write-customer-support-replies-with-this-ai-prompt/">Write Customer Support Replies with this AI Prompt</a>: Fast, accurate responses for tickets.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this deploy secrets prompt AI prompt?</span>

<p class="answer"><strong>DevSecOps Engineers</strong> use this to standardize how secrets are created, stored, and verified across environments without writing a bespoke doc every sprint. <strong>Full-Stack Engineers (Next.js on Vercel)</strong> rely on it to avoid accidentally importing server code into client components and exposing env vars through browser bundles. <strong>Startup CTOs</strong> apply it when they need fast, low-drama guardrails that keep shipping velocity intact. <strong>Implementation Consultants</strong> leverage it during handoffs, making the setup reproducible for a client’s team instead of living in Slack messages.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this deploy secrets prompt AI prompt?</span>

<p class="answer"><strong>SaaS companies</strong> get immediate value because they often run Next.js on Vercel with Supabase and handle auth, billing webhooks, and multi-env deployments that amplify mistakes. <strong>E-commerce and subscription brands</strong> benefit when store integrations, email providers, and payment processors require keys that can’t leak into client-side code or public repos. <strong>Agencies</strong> use it when they manage multiple client deployments and need a consistent, teachable pattern for secrets across projects. <strong>Fintech-adjacent teams</strong> lean on the verification steps and “gotchas” sections to reduce operational risk when credentials rotate or permissions change.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for deploying secrets produce weak results?</span>

<p class="answer">A typical prompt like “Write me a plan to manage env vars securely” fails because it: lacks platform-specific steps for Vercel and Supabase, provides no separation between local vs staging vs production, ignores the client-side vs server-side execution boundary in modern frameworks, produces generic advice instead of copy/paste configuration and code patterns, and misses verification and troubleshooting so you can’t confidently confirm you fixed the exposure. You end up with good intentions and zero implementation detail. That gap is where leaks keep happening.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this deploy secrets prompt for my specific situation?</span>

<p class="answer">Yes. The prompt is designed to ask targeted questions when your stack details are unclear, then proceed with safe defaults labeled as assumptions. To customize, tell it your framework/runtime (for example Next.js route handlers vs server actions), how many Vercel environments you use, and which Supabase keys you currently depend on (anon key, service role key, webhook secrets). A useful follow-up is: “Now tailor the plan to my repo structure and identify exactly which files must be server-only.” You can also ask it to produce a “migration plan” if you’re moving from a messy .env approach to a clean split.</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this deploy secrets prompt?</span>

<p class="answer">The biggest mistake is not providing your execution boundary clearly — instead of “Next.js app on Vercel,” say “Next.js on Vercel with server actions and client components; secrets must never be referenced from client components.” Other common errors: treating staging and production as the same environment (bad: “one Supabase project,” better: “separate Supabase projects for staging and production with distinct keys”), failing to specify what’s currently leaking (bad: “secrets are exposed,” better: “service role key appeared in a client bundle or was committed to git”), and skipping verification (bad: “set env vars,” better: “add build-time and runtime checks to confirm secrets are absent from browser output and present server-side”). The prompt works best when you name the failure mode and the environments involved.</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this deploy secrets prompt?</span>

<p class="answer">This prompt isn’t ideal for teams looking for a purely theoretical overview of security, or for organizations that need a complete, enterprise-wide threat model beyond secrets and environment variable handling. It’s also not a fit if you are not using Vercel and Supabase (you can adapt it, but you’ll lose the platform-specific setup value). If you only need a quick .env template with no verification or troubleshooting, a simple checklist may be faster. For real deployments, though, the extra structure is the point.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this deploy secrets prompt AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "DevSecOps Engineers use this to standardize how secrets are created, stored, and verified across environments without writing a bespoke doc every sprint. Full-Stack Engineers (Next.js on Vercel) rely on it to avoid accidentally importing server code into client components and exposing env vars through browser bundles. Startup CTOs apply it when they need fast, low-drama guardrails that keep shipping velocity intact. Implementation Consultants leverage it during handoffs, making the setup reproducible for a client’s team instead of living in Slack messages."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this deploy secrets prompt AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies get immediate value because they often run Next.js on Vercel with Supabase and handle auth, billing webhooks, and multi-env deployments that amplify mistakes. E-commerce and subscription brands benefit when store integrations, email providers, and payment processors require keys that can’t leak into client-side code or public repos. Agencies use it when they manage multiple client deployments and need a consistent, teachable pattern for secrets across projects. Fintech-adjacent teams lean on the verification steps and “gotchas” sections to reduce operational risk when credentials rotate or permissions change."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for deploying secrets produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like “Write me a plan to manage env vars securely” fails because it: lacks platform-specific steps for Vercel and Supabase, provides no separation between local vs staging vs production, ignores the client-side vs server-side execution boundary in modern frameworks, produces generic advice instead of copy/paste configuration and code patterns, and misses verification and troubleshooting so you can’t confidently confirm you fixed the exposure. You end up with good intentions and zero implementation detail. That gap is where leaks keep happening."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this deploy secrets prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. The prompt is designed to ask targeted questions when your stack details are unclear, then proceed with safe defaults labeled as assumptions. To customize, tell it your framework/runtime (for example Next.js route handlers vs server actions), how many Vercel environments you use, and which Supabase keys you currently depend on (anon key, service role key, webhook secrets). A useful follow-up is: “Now tailor the plan to my repo structure and identify exactly which files must be server-only.” You can also ask it to produce a “migration plan” if you’re moving from a messy .env approach to a clean split."
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this deploy secrets prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is not providing your execution boundary clearly — instead of “Next.js app on Vercel,” say “Next.js on Vercel with server actions and client components; secrets must never be referenced from client components.” Other common errors: treating staging and production as the same environment (bad: “one Supabase project,” better: “separate Supabase projects for staging and production with distinct keys”), failing to specify what’s currently leaking (bad: “secrets are exposed,” better: “service role key appeared in a client bundle or was committed to git”), and skipping verification (bad: “set env vars,” better: “add build-time and runtime checks to confirm secrets are absent from browser output and present server-side”). The prompt works best when you name the failure mode and the environments involved."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this deploy secrets prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for teams looking for a purely theoretical overview of security, or for organizations that need a complete, enterprise-wide threat model beyond secrets and environment variable handling. It’s also not a fit if you are not using Vercel and Supabase (you can adapt it, but you’ll lose the platform-specific setup value). If you only need a quick .env template with no verification or troubleshooting, a simple checklist may be faster. For real deployments, though, the extra structure is the point."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Secret handling shouldn’t be tribal knowledge or a shaky set of screenshots in a doc. Paste the prompt into your AI tool, follow the steps, run the verification checks, and lock your Vercel + Supabase workflow down for good.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001429.webp" medium="image"></media:content>
            	</item>
		<item>
		<title>Build a Formula-Safe Sheets Sync with this AI Prompt</title>
		<link>https://flowpast.com/prompts/build-a-formula-safe-sheets-sync-with-this-ai-prompt/</link>
		
		<dc:creator><![CDATA[Lisa Granqvist]]></dc:creator>
		<pubDate>Fri, 23 Jan 2026 02:36:51 +0000</pubDate>
				<category><![CDATA[Prompts]]></category>
		<guid isPermaLink="false">https://flowpast.com/?p=5001586</guid>

					<description><![CDATA[Sheets updates keep breaking - this AI Prompt builds a quota-safe, idempotent pipeline with formula protection, audit logs, and alerts. Access our full AI prompt library for every model.]]></description>
										<content:encoded><![CDATA[<!-- FOCUS_KEYWORD: Sheets sync AI prompt -->

<div class="hook-introduction">

<p>Sheets syncs usually work until they don’t. One day your automation overwrites a formula range, duplicates rows after a retry, or gets throttled mid-write and leaves a half-updated tab that nobody trusts.</p>



<p>This <strong>Sheets sync AI prompt</strong> is built for <strong>RevOps leads</strong> who need clean weekly reporting in Sheets without breaking the CFO’s formulas, <strong>data analysts</strong> who publish modeled datasets into stakeholder-friendly spreadsheets, and <strong>automation consultants</strong> who must ship a reliable “hands-off” sync for clients with real-world outages and concurrent editors. The output is a full automation blueprint plus runnable code patterns for a quota-safe, idempotent publish pipeline with formula protection, audit logs, and alerting.</p>

</div>

<div class="what-and-when-section">

<h2 class="wp-block-heading">What Does This AI Prompt Do and When to Use It?</h2>



<table class="solution-results-table three-column" role="presentation" aria-label="What this prompt does, when to use it, and what you get">
 <thead>
    <tr>
      <th scope="col">What This Prompt Does</th>
      <th scope="col">When to Use This Prompt</th>
      <th scope="col">What You&#8217;ll Get</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <ul class="automation-list">
          <li>It maps a staging → transform → publish pipeline where Sheets stays the presentation layer, not the modeling layer.</li>
          <li>It designs an idempotent write strategy that prevents duplicates during retries and avoids partial updates during timeouts.</li>
          <li>It defines a formula-safe range plan so values land only in designated “input” areas while formulas and formatting remain intact.</li>
          <li>It bakes in quota-aware batching, exponential backoff, and request minimization aligned to Google Sheets API limits.</li>
          <li>It specifies operational safeguards: audit logging, error classification, alerting, and secret-safe configuration via environment variables.</li>
       </ul>
      </td>
      <td>
        <ul class="results-list">
          <li>Your current sync occasionally wipes formulas, breaks pivots, or causes stakeholders to “fix it manually” after each run.</li>
          <li>You see duplicates after network blips because the job replays writes without a durable idempotency key.</li>
          <li>You need to publish curated data to Sheets for exec visibility, but the source is messy and needs a modeled layer first.</li>
          <li>Quota throttling is forcing you into slow one-cell updates, and the workflow is now both expensive and fragile.</li>
          <li>Multiple people edit the sheet while the automation runs, and you need predictable outcomes under concurrency.</li>
        </ul>
      </td>
       <td>
         <ul class="deliverables-list">
           <li>A complete pipeline architecture diagram in words, including staging, transformation, and publish responsibilities.</li>
           <li>A publish plan that separates formula ranges from write ranges, with explicit sheet/tab conventions you can copy.</li>
           <li>Runnable code patterns for batched writes, retry/backoff, and idempotent upserts (not “spray writes”).</li>
           <li>An audit log and run ledger design, including what to record per batch and how to trace a bad sync.</li>
           <li>An alerting checklist with thresholds (quota errors, repeated retries, row-count drift) and recommended actions.</li>
         </ul>
       </td>
    </tr>
  </tbody>
</table>

</div>

<div class="prompt-display-section">

<h2 class="wp-block-heading">The Full AI Prompt: Formula-Safe Sheets Sync Blueprint</h2>



<div class="prompt-viewer-wrapper" id="prompt-section">
    <div class="prompt-comparison-row prompt-premium">
        <!-- Header with buttons -->
        <div class="prompt-row-header">
            <!-- <span class="prompt-row-icon">✨</span> -->
            <span class="prompt-row-title">
                                    Step 1: Customize the prompt with your input
                            </span>
            <div class="prompt-header-buttons">
                                    <button class="prompt-header-btn prompt-header-reset" onclick="resetPrompt()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                                <button class="prompt-header-btn prompt-header-copy-green flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span>Customize and Copy Full Prompt</span>
                </button>
            </div>
        </div>

        <!-- Customize the Prompt Section -->
                    <div class="prompt-customize-section">
                <span class="customize-title">Customize the Prompt</span>
                <p class="customize-subtitle">Fill in the fields below to personalize this prompt for your needs.</p>
                <table class="customize-table">
                    <thead>
                        <tr>
                            <th>Variable</th>
                            <th>What to Enter</th>
                            <th>Customise the prompt</th>
                        </tr>
                    </thead>
                    <tbody>
                                                    <tr>
                                <td class="var-name"><code>[TARGET_AUDIENCE]</code></td>
                                <td class="var-desc">
                                    Describe the primary group of users or stakeholders who will benefit from the automation blueprint, including their roles, needs, and challenges.                                    <div class="var-example">For example: "Data analysts and operations teams in mid-sized SaaS companies who need reliable data pipelines for reporting without risking Google Sheets formula integrity."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[TARGET_AUDIENCE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[SHEET_URL]</code></td>
                                <td class="var-desc">
                                    Provide the full URL of the Google Sheet where the data will be published. Ensure the sheet is accessible via the chosen authentication method.                                    <div class="var-example">For example: "https://docs.google.com/spreadsheets/d/1ABcDefGhIJkLmNOPQRStUVwxYZ/edit"</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[SHEET_URL]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[AUTH_METHOD]</code></td>
                                <td class="var-desc">
                                    Specify the authentication method to access Google Sheets, such as &#039;Service Account&#039; or &#039;OAuth&#039;, and include any relevant details for setup.                                    <div class="var-example">For example: "Service Account with JSON key file stored securely in an environment variable."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[AUTH_METHOD]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[DATA_SOURCE]</code></td>
                                <td class="var-desc">
                                    Identify the origin of the data to be processed and published, including the type of system or database and its access method.                                    <div class="var-example">For example: "PostgreSQL database containing cleaned and modeled sales data, accessed via a secure connection string."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[DATA_SOURCE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[UPDATE_SCHEDULE]</code></td>
                                <td class="var-desc">
                                    Define the frequency and timing for the automation to run, including timezone considerations if applicable.                                    <div class="var-example">For example: "Every hour at 15 minutes past the hour, UTC timezone."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[UPDATE_SCHEDULE]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[NOTIFICATION_ENDPOINT]</code></td>
                                <td class="var-desc">
                                    Provide the endpoint or method for sending notifications about automation status, such as a webhook URL or email address.                                    <div class="var-example">For example: "Slack webhook URL for the #data-pipeline-alerts channel."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[NOTIFICATION_ENDPOINT]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[INDUSTRY]</code></td>
                                <td class="var-desc">
                                    Specify the industry or sector the automation blueprint is intended for, to tailor recommendations and examples.                                    <div class="var-example">For example: "E-commerce businesses managing inventory and sales reports."</div>
                                </td>
                                <td class="var-input">
                                                                            <input
                                            type="text"
                                            class="customize-input"
                                            data-placeholder="[INDUSTRY]"
                                            placeholder="Enter your value here..." />
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[BRAND_VOICE]</code></td>
                                <td class="var-desc">
                                    Describe the tone and style that should be reflected in the communication or documentation for the automation blueprint.                                    <div class="var-example">For example: "Professional and detail-oriented, with a focus on clarity and reliability."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[BRAND_VOICE]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                                    <tr>
                                <td class="var-name"><code>[CONTEXT]</code></td>
                                <td class="var-desc">
                                    Provide any additional background or situational details that could influence the design or implementation of the automation blueprint.                                    <div class="var-example">For example: "The automation must support concurrent data updates from multiple team members and handle high-volume data imports during peak sales seasons."</div>
                                </td>
                                <td class="var-input">
                                                                            <textarea
                                            class="customize-input"
                                            data-placeholder="[CONTEXT]"
                                            placeholder="Enter your value here..."
                                            rows="3"></textarea>
                                                                    </td>
                            </tr>
                                            </tbody>
                </table>

                <button class="copy-customized-btn flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                        <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                        <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                    </svg>
                    <span class="copy-customized-text">Customise the prompt now</span>
                </button>
            </div>
        
        <!-- Full Prompt Code Header -->
                    <div class="prompt-code-header">
                <span class="prompt-code-title">
                    Step 2: Copy the Prompt
                </span>
                <div class="prompt-code-buttons">
                    <!-- Reset: Only visible when unlocked -->
                    <button class="prompt-header-btn prompt-header-reset btn-when-unlocked" onclick="resetPrompt()" style="display: none;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
                            <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
                        </svg>
                        <span>Reset</span>
                    </button>
                    <!-- Copy Full Prompt -->
                    <button class="prompt-header-btn prompt-header-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                            <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
                        </svg>
                        <span>Copy Full Prompt</span>
                    </button>
                </div>
            </div>
        

        <!-- Prompt Content -->
        <div class="prompt-box prompt-gated-wrapper">
            <!-- Gated: Blurred content -->
            <div class="prompt-gated-content">
                <div class="prompt-header-visible">OBJECTIVE</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PERSONA</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">CONSTRAINTS</div><div class="prompt-header-visible subheader">Delivery standards</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible subheader">What This Is NOT</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">PROCESS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">INPUTS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">OUTPUT SPECIFICATION</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div><div class="locked-line" style="width: 80%;"></div><div class="locked-line" style="width: 95%;"></div><div class="locked-line" style="width: 70%;"></div><div class="locked-line" style="width: 83%;"></div><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div></div></div><div class="locked-section-icon">🔒</div></div><div class="prompt-header-visible">QUALITY CHECKS</div><div class="locked-section"><div class="locked-section-bg"><div class="locked-section-lines"><div class="locked-line" style="width: 85%;"></div><div class="locked-line" style="width: 78%;"></div><div class="locked-line" style="width: 92%;"></div><div class="locked-line" style="width: 75%;"></div><div class="locked-line" style="width: 88%;"></div><div class="locked-line" style="width: 72%;"></div></div></div><div class="locked-section-icon">🔒</div></div>            </div>
            <!-- Unlocked: Full content (hidden by default) -->
            <div class="prompt-content-full" id="premium-prompt-content" style="display: none;">
                ## OBJECTIVE
Design a resilient automation blueprint (including runnable code) that continuously moves cleaned, modeled data from a source system into Google Sheets **as a presentation surface**, while preventing formula damage, avoiding partial writes, and remaining stable under quota throttling, flaky networks, and concurrent editors.

## PERSONA
Act as a senior automation architect who previously worked on Google Sheets performance and later built enterprise-grade data pipelines. You’re cautious by default: you assume tokens will expire at the worst time, users will edit during writes, and retries can duplicate operations unless engineered correctly. You also apply Kimball-style dimensional thinking so Sheets stays downstream of modeling, not the modeling layer itself.

## CONSTRAINTS
### Delivery standards
- Treat Google Sheets as the final publishing layer, not a datastore.
- Preserve formulas and formatting intentionally; never “spray write” across mixed formula/value ranges.
- Prefer batch operations and request minimization; anticipate quota ceilings (e.g., ~100 requests/100 seconds) and implement backoff.
- Every write path must be **idempotent** and protect against partial updates.
- Do not expose secrets: no credentials in logs/output; use environment variables and least-privilege permissions.

### What This Is NOT
- Not a recommendation to use Sheets as an operational database.
- Not a full data warehouse design document beyond what’s needed to stage/transform/publish.
- Not a UI/BI dashboard build-out; only the automation to populate Sheets reliably.
- Not guidance for bypassing Google limits or violating API terms.

## PROCESS
1. **Pre-analysis (required):** Restate your understanding of the user’s setup and goals, listing assumptions and unknowns that could block implementation.
2. **Architecture plan:** Outline a pipeline that includes staging, transformation, and publish steps aligned to dimensional modeling (facts/dimensions as appropriate), with Sheets only in the publish step.
3. **Auth strategy:** Provide both service-account and OAuth paths (with refresh handling), and clearly state when each is appropriate.
4. **Sheet safety strategy:** Explain how you will:
   - identify the correct spreadsheet + worksheet(tab),
   - define write ranges,
   - detect and protect formula cells,
   - handle concurrent edits.
5. **API resilience:** Specify batching, exponential backoff with jitter, and request validation. Include read-after-write verification.
6. **Integrity + recovery:** Use an idempotency key and an atomic-ish update pattern (e.g., write to a staging tab/range then swap/apply) so failed runs don’t leave half-written states.
7. **Audit + rollback:** Implement structured logging of what changed, when, and by which run; include a practical rollback approach.
8. **Scheduling + alerts:** Provide timezone-aware scheduling and failure notification within the required window, with actionable error details.
9. **Edge cases:** If any input is missing/ambiguous, ask targeted questions and provide safe defaults that won’t corrupt the sheet.

## INPUTS
- **Primary user segment:** [TARGET_AUDIENCE]
- **Spreadsheet URL:** [SHEET_URL]
- **Authentication method details:** [AUTH_METHOD]
- **Data source description/locator:** [DATA_SOURCE]
- **Update schedule:** [UPDATE_SCHEDULE]
- **Notification destination:** [NOTIFICATION_ENDPOINT]
- **Industry (optional):** [INDUSTRY]
- **Brand voice (optional):** [BRAND_VOICE]
- **Extra context (optional):** [CONTEXT]

## OUTPUT SPECIFICATION
Produce a single, self-contained solution with these sections (in this order):

1. **Task Understanding &amp; Assumptions**
   - {Understanding Summary}
   - {Key Risks}
   - {Open Questions}

2. **System Design**
   - {High Level Architecture}
   - {Kimball-Aligned Data Flow} (staging → transform → publish)
   - {Idempotency &amp; Atomic Update Approach}

3. **Executable Implementation (with syntax-highlighted code blocks)**
   - {Configuration &amp; Secrets Handling}
   - {Authentication Module} (service account + OAuth refresh)
   - {Extract &amp; Transform Module}
   - {Sheets Publish Module}
     - formula preservation strategy
     - range validation
     - batching
     - exponential backoff + jitter
     - read-after-write verification
     - concurrency-aware behavior
   - {Audit Log &amp; Rollback Utilities}
   - {Monitoring &amp; Notifications}

4. **Deployment Runbook**
   - {Step By Step Setup}
   - {Permissions &amp; Least Privilege Notes}
   - {Scheduling Setup} (cron-like, timezone-aware)
   - {How To Rotate Credentials Safely}

5. **Usage + Validation**
   - {Example Run Commands}
   - {Testing Scenarios} (quota throttling, token expiry mid-run, network drop, concurrent edits, schema mismatch)
   - {Expected Outputs}

Code must include inline comments that explain critical choices and the failure modes they prevent.

## QUALITY CHECKS
At the end, include a short verification list with 4–5 items confirming:
- {Formula Safety Confirmed} (no overwrites of formula cells/ranges)
- {Idempotent Writes Confirmed} (re-runs don’t duplicate or corrupt)
- {Quota &amp; Retry Policy Confirmed} (backoff + batching implemented)
- {Secrets Safety Confirmed} (no credentials logged; least privilege)
- {Verification &amp; Observability Confirmed} (read-after-write, audit logs, alerts)            </div>
        </div>


    </div>

    <!-- CTA Row - Full width buttons -->
    <div class="prompt-cta-row">
        <button class="prompt-cta-btn prompt-cta-copy flowpast-copy-prompt-btn" onclick="handlePromptCopy()">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
                <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" />
                <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z" />
            </svg>
            <span class="cta-copy-text">Copy Full Prompt</span>
        </button>
    </div>
</div>

<style>
    /* Gated prompt states */
    .prompt-gated-wrapper {
        position: relative;
    }

    /* When unlocked - show full content, hide gated */
    body.flowpast-unlocked .prompt-gated-wrapper .prompt-gated-content {
        display: none;
    }

    body.flowpast-unlocked .prompt-gated-wrapper .prompt-content-full {
        display: block !important;
    }

    /* Show/hide elements based on unlock state */
    body.flowpast-unlocked .btn-when-unlocked {
        display: inline-flex !important;
    }

    .prompt-viewer-wrapper {
        scroll-margin-top: 250px;
    }

    /* ========================================
   PROMPT VIEWER - MAIN WRAPPER
   ======================================== */
    .prompt-viewer-wrapper {
        margin: 30px 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ========================================
   PROMPT BOX CONTAINER
   ======================================== */
    .prompt-comparison-row {
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        background: #fff;
    }

    /* ========================================
   HEADER WITH BUTTONS
   ======================================== */
    .prompt-row-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
        flex-wrap: wrap;
    }

    .prompt-row-icon {
        font-size: 20px;
    }

    .prompt-row-title {
        font-weight: 600;
        font-size: 22px;
        color: #fff !important;
        text-decoration: underline
    }

    .prompt-header-buttons {
        margin-left: auto;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Header buttons */
    .prompt-header-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-header-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-header-copy:hover {
        background: #2a2a2a;
    }

    .prompt-header-copy.copied {
        background: #2e7d32;
    }

    .prompt-header-copy-green {
        background: #04AA6D !important;
        color: #fff !important;
    }

    .prompt-header-copy-green:hover {
        background: #039860 !important;
    }

    .prompt-header-copy-green.copied {
        background: #2e7d32 !important;
    }

    .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-header-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-1px);
    }

    /* ========================================
   PROMPT CONTENT - FULL (NO SCROLL)
   ======================================== */
    .prompt-box {
        background: #ffffff;
    }

    .prompt-content-full {
        padding: 24px;
        margin: 0;
        color: #202124;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.7;
        white-space: pre-wrap;
        word-wrap: break-word;
        /* No scroll - show full content */
        max-height: none;
        overflow: visible;
    }

    /* Highlighted variable in prompt */
    .prompt-variable {
        background: #fff3cd;
        color: #1967d2;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #ffc107;
    }

    .prompt-variable-filled {
        background: #d4edda;
        color: #155724;
        font-weight: 700;
        padding: 2px 4px;
        border-radius: 3px;
        border: 1px solid #28a745;
    }

    /* ========================================
   GATED CONTENT (NO ACCESS)
   ======================================== */
    .prompt-gated-content {
        padding: 24px;
        background: #ffffff;
        font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
        font-size: 13px;
        line-height: 1.8;
        max-height: none;
        overflow: visible;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        cursor: default;
    }

    /* ## headers - larger, black */
    .prompt-header-visible {
        color: #202124;
        font-weight: 600;
        margin: 5px 0 0px 0;
        font-size: 20px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    /* ### headers - smaller, black */
    .prompt-header-visible.subheader {
        color: #202124;
        font-weight: 600;
        margin: 5px 0;
        font-size: 18px;
    }

    .prompt-header-visible:first-child {
        margin-top: 0;
    }

    /* ========================================
   LOCKED SECTION BLOCK
   ======================================== */
    .locked-section {
        position: relative;
        margin: 4px 0 8px 0;
        border-radius: 6px;
        overflow: hidden;
        background: linear-gradient(110deg, #e2e8f0 8%, #f1f5f9 18%, #e2e8f0 33%);
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .locked-section-bg {
        position: relative;
    }

    .locked-section-lines {
        padding: 8px 12px;
        position: relative;
    }

    .locked-line {
        height: 6px;
        background: rgba(255, 255, 255, 0.6);
        border-radius: 3px;
        margin-bottom: 4px;
        margin-left: 12px;
    }

    .locked-line:last-child {
        margin-bottom: 0;
    }

    .locked-section-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        font-size: 24px;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
    }

    /* Subheader locked sections - slightly indented */
    /*  .prompt-header-visible.subheader+.locked-section {
        margin-left: 16px;
    } */

    /* ========================================
   COMPATIBILITY BADGES
   ======================================== */
    .prompt-compatibility {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f8f9fa;
        border-top: 1px solid #e0e0e0;
    }

    .compat-label {
        font-size: 13px;
        color: #5f6368;
        font-weight: 500;
    }

    .compat-badge {
        padding: 4px 10px;
        background: #e8f0fe;
        color: #1967d2;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    /* ========================================
   CTA ROW - FULL WIDTH BUTTONS
   ======================================== */
    .prompt-cta-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    .prompt-cta-btn {
        flex: 1;
        min-width: 200px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 24px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        text-decoration: none;
        border: none;
    }

    .prompt-cta-copy {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-copy:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-copy.copied {
        background: #2e7d32;
    }

    .prompt-cta-reset {
        background: #3a3a3a;
        color: #fff;
    }

    .prompt-cta-reset:hover {
        background: #2a2a2a;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .prompt-cta-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
    }

    .prompt-cta-access:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    /* ========================================
    CUSTOMIZE YOUR PROMPT SECTION
    ======================================== */
    .prompt-customize-section {
        padding: 24px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafbfc;
    }

    .customize-title {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 700;
        color: #202124;
    }

    .customize-subtitle {
        margin: 0 0 20px 0;
        font-size: 14px;
        color: #5f6368;
    }

    .customize-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }

    .customize-table th {
        text-align: left;
        padding: 12px;
        background: #f1f3f4;
        border: 1px solid #e0e0e0;
        font-size: 13px;
        font-weight: 600;
        color: #202124;
    }

    .customize-table td {
        padding: 12px;
        border: 1px solid #e0e0e0;
        vertical-align: top;
    }

    .customize-table .var-name {
        width: 25%;
        background: #f8f9fa;
    }

    .customize-table .var-name code {
        background: #fff3cd;
        color: #1967d2;
        border: 1px solid #ffc107;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        word-break: break-all;
        font-weight: 600;
    }

    .customize-table .var-desc {
        width: 35%;
        font-size: 13px;
        color: #5f6368;
        line-height: 1.5;
    }

    .customize-table .var-example {
        margin-top: 8px;
        padding: 8px 10px;
        background: #f8f9fa;
        border-left: 3px solid #dadce0;
        font-size: 12px;
        color: #5f6368;
        font-style: italic;
        border-radius: 0 4px 4px 0;
    }

    .customize-table .var-input {
        width: 40%;
    }

    .customize-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #dadce0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        resize: vertical;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .customize-input:focus {
        outline: none;
        border-color: rgb(5, 152, 98);
        box-shadow: 0 0 0 3px rgba(5, 152, 98, 0.1);
    }

    .customize-input::placeholder {
        color: #9aa0a6;
        font-style: italic;
    }

    .copy-customized-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px 24px;
        background: rgb(5, 152, 98);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .copy-customized-btn:hover {
        background: rgb(4, 130, 83);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(5, 152, 98, 0.3);
    }

    .copy-customized-btn.copied {
        background: #2e7d32;
    }

    /* ========================================
    FULL PROMPT CODE HEADER
    ======================================== */
    .prompt-code-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        color: #fff !important;
        background: #141414;
        border-bottom: 1px solid #e0e0e0;
    }

    .prompt-code-title {
        font-size: 22px;
        font-weight: 600;
        text-decoration: underline;

    }

    .prompt-code-buttons {
        display: flex;
        gap: 8px;
    }

    .prompt-code-buttons .prompt-header-btn {
        padding: 8px 14px;
        font-size: 13px;
        background: #ffffff;
        color: #202124;
        border: 1px solid #dadce0;
    }

    .prompt-code-buttons .prompt-header-access {
        background: rgb(5, 152, 98);
        color: #fff !important;
        border-color: rgb(5, 152, 98);
    }

    .prompt-code-buttons .prompt-header-btn.prompt-header-access:hover {
        background: rgb(4, 130, 83) !important;
        border-color: rgb(4, 130, 83);
        color: #fff !important;
    }

    .prompt-code-buttons .prompt-header-btn:hover {
        background: #f1f3f4;
    }

    .prompt-code-buttons .prompt-header-copy.copied {
        background: #d4edda;
        color: #155724;
        border-color: #28a745;
    }

    .prompt-header-reset {
        background: #ffffff;
        color: #202124;
    }

    /* ========================================
   RESPONSIVE
   ======================================== */
    @media (max-width: 768px) {
        .prompt-row-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 12px;
        }

        .prompt-header-buttons {
            margin-left: 0;
            width: 100%;
        }

        .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }

        .prompt-cta-row {
            flex-direction: column;
        }

        .prompt-cta-btn {
            width: 100%;
        }

        /* Customize table responsive */
        .customize-table,
        .customize-table thead,
        .customize-table tbody,
        .customize-table tr,
        .customize-table th,
        .customize-table td {
            display: block;
        }

        .customize-table thead {
            display: none;
        }

        .customize-table tr {
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
        }

        .customize-table td {
            width: 100% !important;
            border: none;
            border-bottom: 1px solid #e0e0e0;
        }

        .customize-table td:last-child {
            border-bottom: none;
        }

        .customize-table .var-name {
            background: #f1f3f4;
            font-weight: 600;
        }

        .prompt-code-header {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }

        .prompt-code-buttons {
            width: 100%;
        }

        .prompt-code-buttons .prompt-header-btn {
            flex: 1;
            justify-content: center;
        }
    }
</style>

<script>
    function handlePromptCopy() {
        // Check if unlocked via cookie
        if (typeof window.flowpastIsUnlocked === 'function' && !window.flowpastIsUnlocked()) {
            // Show email popup
            if (typeof window.flowpastShowEmailPopup === 'function') {
                window.flowpastShowEmailPopup('prompt');
            }
            return;
        }

        // Copy the customized prompt (with filled variables)
        const customizedPrompt = getCustomizedPrompt();
        const copyButtons = document.querySelectorAll('.prompt-header-copy, .prompt-header-copy-green, .prompt-cta-copy, .copy-customized-btn');

        navigator.clipboard.writeText(customizedPrompt).then(() => {
            copyButtons.forEach(btn => {
                btn.classList.add('copied');
                const textSpan = btn.querySelector('span');
                if (textSpan) textSpan.textContent = 'Copied!';
            });

            setTimeout(() => {
                copyButtons.forEach(btn => {
                    btn.classList.remove('copied');
                    const textSpan = btn.querySelector('span');
                    if (textSpan) textSpan.textContent = 'Copy Full Prompt';
                });
            }, 2000);
        }).catch(err => {
            console.error('Failed to copy:', err);
        });
    }

    // Store original prompt for customization
    const originalPrompt = "## OBJECTIVE\r\nDesign a resilient automation blueprint (including runnable code) that continuously moves cleaned, modeled data from a source system into Google Sheets **as a presentation surface**, while preventing formula damage, avoiding partial writes, and remaining stable under quota throttling, flaky networks, and concurrent editors.\r\n\r\n## PERSONA\r\nAct as a senior automation architect who previously worked on Google Sheets performance and later built enterprise-grade data pipelines. You\u2019re cautious by default: you assume tokens will expire at the worst time, users will edit during writes, and retries can duplicate operations unless engineered correctly. You also apply Kimball-style dimensional thinking so Sheets stays downstream of modeling, not the modeling layer itself.\r\n\r\n## CONSTRAINTS\r\n### Delivery standards\r\n- Treat Google Sheets as the final publishing layer, not a datastore.\r\n- Preserve formulas and formatting intentionally; never \u201cspray write\u201d across mixed formula\/value ranges.\r\n- Prefer batch operations and request minimization; anticipate quota ceilings (e.g., ~100 requests\/100 seconds) and implement backoff.\r\n- Every write path must be **idempotent** and protect against partial updates.\r\n- Do not expose secrets: no credentials in logs\/output; use environment variables and least-privilege permissions.\r\n\r\n### What This Is NOT\r\n- Not a recommendation to use Sheets as an operational database.\r\n- Not a full data warehouse design document beyond what\u2019s needed to stage\/transform\/publish.\r\n- Not a UI\/BI dashboard build-out; only the automation to populate Sheets reliably.\r\n- Not guidance for bypassing Google limits or violating API terms.\r\n\r\n## PROCESS\r\n1. **Pre-analysis (required):** Restate your understanding of the user\u2019s setup and goals, listing assumptions and unknowns that could block implementation.\r\n2. **Architecture plan:** Outline a pipeline that includes staging, transformation, and publish steps aligned to dimensional modeling (facts\/dimensions as appropriate), with Sheets only in the publish step.\r\n3. **Auth strategy:** Provide both service-account and OAuth paths (with refresh handling), and clearly state when each is appropriate.\r\n4. **Sheet safety strategy:** Explain how you will:\r\n   - identify the correct spreadsheet + worksheet(tab),\r\n   - define write ranges,\r\n   - detect and protect formula cells,\r\n   - handle concurrent edits.\r\n5. **API resilience:** Specify batching, exponential backoff with jitter, and request validation. Include read-after-write verification.\r\n6. **Integrity + recovery:** Use an idempotency key and an atomic-ish update pattern (e.g., write to a staging tab\/range then swap\/apply) so failed runs don\u2019t leave half-written states.\r\n7. **Audit + rollback:** Implement structured logging of what changed, when, and by which run; include a practical rollback approach.\r\n8. **Scheduling + alerts:** Provide timezone-aware scheduling and failure notification within the required window, with actionable error details.\r\n9. **Edge cases:** If any input is missing\/ambiguous, ask targeted questions and provide safe defaults that won\u2019t corrupt the sheet.\r\n\r\n## INPUTS\r\n- **Primary user segment:** [TARGET_AUDIENCE]\r\n- **Spreadsheet URL:** [SHEET_URL]\r\n- **Authentication method details:** [AUTH_METHOD]\r\n- **Data source description\/locator:** [DATA_SOURCE]\r\n- **Update schedule:** [UPDATE_SCHEDULE]\r\n- **Notification destination:** [NOTIFICATION_ENDPOINT]\r\n- **Industry (optional):** [INDUSTRY]\r\n- **Brand voice (optional):** [BRAND_VOICE]\r\n- **Extra context (optional):** [CONTEXT]\r\n\r\n## OUTPUT SPECIFICATION\r\nProduce a single, self-contained solution with these sections (in this order):\r\n\r\n1. **Task Understanding & Assumptions**\r\n   - {Understanding Summary}\r\n   - {Key Risks}\r\n   - {Open Questions}\r\n\r\n2. **System Design**\r\n   - {High Level Architecture}\r\n   - {Kimball-Aligned Data Flow} (staging \u2192 transform \u2192 publish)\r\n   - {Idempotency & Atomic Update Approach}\r\n\r\n3. **Executable Implementation (with syntax-highlighted code blocks)**\r\n   - {Configuration & Secrets Handling}\r\n   - {Authentication Module} (service account + OAuth refresh)\r\n   - {Extract & Transform Module}\r\n   - {Sheets Publish Module}\r\n     - formula preservation strategy\r\n     - range validation\r\n     - batching\r\n     - exponential backoff + jitter\r\n     - read-after-write verification\r\n     - concurrency-aware behavior\r\n   - {Audit Log & Rollback Utilities}\r\n   - {Monitoring & Notifications}\r\n\r\n4. **Deployment Runbook**\r\n   - {Step By Step Setup}\r\n   - {Permissions & Least Privilege Notes}\r\n   - {Scheduling Setup} (cron-like, timezone-aware)\r\n   - {How To Rotate Credentials Safely}\r\n\r\n5. **Usage + Validation**\r\n   - {Example Run Commands}\r\n   - {Testing Scenarios} (quota throttling, token expiry mid-run, network drop, concurrent edits, schema mismatch)\r\n   - {Expected Outputs}\r\n\r\nCode must include inline comments that explain critical choices and the failure modes they prevent.\r\n\r\n## QUALITY CHECKS\r\nAt the end, include a short verification list with 4\u20135 items confirming:\r\n- {Formula Safety Confirmed} (no overwrites of formula cells\/ranges)\r\n- {Idempotent Writes Confirmed} (re-runs don\u2019t duplicate or corrupt)\r\n- {Quota & Retry Policy Confirmed} (backoff + batching implemented)\r\n- {Secrets Safety Confirmed} (no credentials logged; least privilege)\r\n- {Verification & Observability Confirmed} (read-after-write, audit logs, alerts)";
    const variables = ["[TARGET_AUDIENCE]","[SHEET_URL]","[AUTH_METHOD]","[DATA_SOURCE]","[UPDATE_SCHEDULE]","[NOTIFICATION_ENDPOINT]","[INDUSTRY]","[BRAND_VOICE]","[CONTEXT]"];
    // Initial render with highlighted variables
    document.addEventListener('DOMContentLoaded', function() {
        renderPromptWithHighlights();
    });

    // Live update prompt as user types
    document.querySelectorAll('.customize-input').forEach(input => {
        input.addEventListener('input', renderPromptWithHighlights);
    });

    function renderPromptWithHighlights() {
        const promptContent = document.getElementById('premium-prompt-content');
        if (!promptContent) return;

        let updatedPrompt = originalPrompt;
        let filledVariables = {};

        // Collect filled values
        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                filledVariables[placeholder] = value;
            }
        });

        // Replace filled variables and highlight remaining
        let htmlContent = escapeHtml(updatedPrompt);

        variables.forEach(placeholder => {
            const escapedPlaceholder = escapeHtml(placeholder);
            const regex = new RegExp(escapeRegex(escapedPlaceholder), 'g');

            if (filledVariables[placeholder]) {
                // Show filled value with green highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable-filled">' + escapeHtml(filledVariables[placeholder]) + '</span>'
                );
            } else {
                // Show original placeholder with yellow highlight
                htmlContent = htmlContent.replace(regex,
                    '<span class="prompt-variable">' + escapedPlaceholder + '</span>'
                );
            }
        });

        promptContent.innerHTML = htmlContent;
    }

    function escapeRegex(string) {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }

    function resetPrompt() {
        // Clear all input fields
        document.querySelectorAll('.customize-input').forEach(input => {
            input.value = '';
        });

        // Re-render with original placeholders highlighted
        renderPromptWithHighlights();

        // Visual feedback
        const resetBtns = document.querySelectorAll('.prompt-header-reset, .prompt-cta-reset');
        resetBtns.forEach(btn => {
            const originalText = btn.querySelector('span').textContent;
            btn.querySelector('span').textContent = 'Reset!';
            setTimeout(() => {
                btn.querySelector('span').textContent = originalText;
            }, 1000);
        });
    }


    function getCustomizedPrompt() {
        let updatedPrompt = originalPrompt;

        document.querySelectorAll('.customize-input').forEach(input => {
            const placeholder = input.dataset.placeholder;
            const value = input.value.trim();

            if (value) {
                const regex = new RegExp(escapeRegex(placeholder), 'g');
                updatedPrompt = updatedPrompt.replace(regex, value);
            }
        });

        return updatedPrompt;
    }
</script>

</div>

<div class="pro-tips-section">

<h2 class="wp-block-heading">Pro Tips for Better AI Prompt Results</h2>



<ul class="wp-block-list">

<li><strong>Describe your sheet like a “contract,” not a screenshot.</strong> Tell the model your tab names, which columns are inputs, and which ranges must never be touched (for example: “Summary!A1:K40 is formulas only”). If you can, paste a small header sample such as “A: account_id, B: account_name, C: mrr, D: last_invoice_date” so the publish strategy stays precise.</li>


<li><strong>Force an idempotency key decision early.</strong> Ask for a concrete key and where it’s stored, because that drives everything else. Follow up with: “Propose an idempotency key for each row and a run ledger schema; assume retries can happen after partial completion.”</li>


<li><strong>Tell it your tolerance for latency versus freshness.</strong> If leadership wants near-real-time, you’ll need smaller batches and tighter failure handling; weekly reporting can use bigger batches with slower backoff. A useful follow-up is: “Optimize for under 2 minutes runtime with 50k rows, but prioritize correctness over speed.”</li>


<li><strong>Iterate on failure modes, not formatting.</strong> After the first output, ask: “Now list the top 10 failure scenarios (quota spikes, token expiry, concurrent edits, partial writes) and show exactly how the design prevents or detects each one.” This tends to reveal missing pieces fast.</li>


<li><strong>Have it generate a ‘safe publish checklist’ you can operationalize.</strong> Turn the design into something your team can run every time: “Create a pre-flight checklist (permissions, sheet state checks), in-flight checks (batch sizes, retries), and post-run validation (row counts, checksum) with pass/fail criteria.” Honestly, this is where reliability usually comes from.</li>

</div>

<div class="related-prompts-section">

<h2 class="wp-block-heading">Related Prompts</h2>



<p>If you’re standardizing operations and reporting, these related prompts help you build the “people side” plans that sit around the system you’re automating.</p>



<p>If you also need a structured rollout plan that includes phases, ownership, and measurement (the same kind of discipline you’d apply to a stable sync), use <a href="https://flowpast.com/prompts/build-a-phased-workplace-wellness-plan-ai-prompt/">Build a Phased Workplace Wellness Plan AI Prompt</a>. It pairs well when you’re packaging the Sheets publishing workflow into a broader internal program with timelines and check-ins.</p>



<p>For teams doing policy and behavior change alongside tooling, <a href="https://flowpast.com/prompts/create-a-digital-wellbeing-plan-ai-prompt/">Create a Digital Wellbeing Plan AI Prompt</a> can help define boundaries, communication norms, and adoption guidance. That’s useful when your new pipeline reduces manual work and you want consistent expectations about how the sheet should be used and edited.</p>



<p>When stress and churn are showing up because reporting is chaotic (late numbers, broken sheets, constant “who changed this?”), <a href="https://flowpast.com/prompts/create-a-workplace-stress-relief-plan-ai-prompt/">Create a Workplace Stress-Relief Plan AI Prompt</a> complements this technical prompt. It helps you wrap the change in practical support so the team actually benefits from the improved reliability.</p>


<br>


<p>Quick reference:</p>



<ul class="wp-block-list">

<li><a href="https://flowpast.com/prompts/build-a-phased-workplace-wellness-plan-ai-prompt/">Build a Phased Workplace Wellness Plan AI Prompt</a>: Phase-based rollout plan with milestones.</li>


<li><a href="https://flowpast.com/prompts/create-a-digital-wellbeing-plan-ai-prompt/">Create a Digital Wellbeing Plan AI Prompt</a>: Digital norms and sustainable workflows.</li>


<li><a href="https://flowpast.com/prompts/workplace-well-being-diagnosis-and-action-plan-ai-prompt/">Workplace Well-Being Diagnosis and Action Plan AI Prompt</a>: Diagnose issues and prioritize interventions.</li>


<li><a href="https://flowpast.com/prompts/build-a-workplace-belonging-roadmap-with-this-ai-prompt/">Build a Workplace Belonging Roadmap with this AI Prompt</a>: Belonging initiatives and measurement roadmap.</li>


<li><a href="https://flowpast.com/prompts/create-a-workplace-stress-relief-plan-ai-prompt/">Create a Workplace Stress-Relief Plan AI Prompt</a>: Practical stress reduction plan for teams.</li>

</ul>

</div>

<div class="faq-section">

<h2 class="wp-block-heading">Common Questions</h2>


<div class="faq-item">
<span class="question">Which roles benefit most from this Sheets sync AI prompt?</span>

<p class="answer"><strong>RevOps Managers</strong> use this to publish trusted pipeline and revenue snapshots to Sheets without breaking executive rollups and formulas. <strong>Data Analysts</strong> rely on it to keep modeling upstream (facts/dimensions) while using Sheets as a clean presentation surface for stakeholders. <strong>Marketing Ops Specialists</strong> benefit when campaign and lead data has to land in a shared spreadsheet that people actively edit. <strong>Automation Consultants</strong> use it as a repeatable blueprint for client implementations where retries, quotas, and partial writes are non-negotiable risks.</p>

</div>

<div class="faq-item">
<span class="question">Which industries get the most value from this Sheets sync AI prompt?</span>

<p class="answer"><strong>SaaS companies</strong> get value because ARR, churn, and pipeline views often live in Sheets for leadership, but the underlying sources (Stripe, CRM, product events) require careful staging and publish discipline. <strong>E-commerce brands</strong> use it when SKU performance, inventory snapshots, or margin reporting is shared in spreadsheets that include fragile formulas and lookups. <strong>Professional services firms</strong> benefit when utilization, project financials, and delivery dashboards are managed in Sheets and need reliable refreshes without manual cleanup. <strong>Agencies</strong> apply it for client-facing reporting tabs where incorrect numbers or broken formulas create immediate trust issues.</p>

</div>

<div class="faq-item">
<span class="question">Why do basic AI prompts for building a Google Sheets sync pipeline produce weak results?</span>

<p class="answer">A typical prompt like &#8220;<em>Write me a script to sync my data into Google Sheets</em>&#8221; fails because it: lacks a formula-safe range strategy (so it overwrites mixed formula/value areas), provides no idempotency design (so retries duplicate rows), ignores quota realities (so it uses chatty per-cell updates and gets throttled), produces “happy path” code that can’t recover from partial writes, and misses operational guardrails like run ledgers, audit logs, and alert thresholds.</p>

</div>

<div class="faq-item">
<span class="question">Can I customize this Sheets sync AI prompt for my specific situation?</span>

<p class="answer">Yes. Start by inserting your source systems (for example: “HubSpot + Stripe”), your target sheet structure (tab names and protected formula ranges), and your publish cadence (hourly, daily, weekly). Then tailor the reliability constraints you actually face, such as “50k rows,” “multiple editors,” or “token expiry every 60 minutes.” A good follow-up instruction is: “Rewrite the blueprint for my sheet layout, and include an idempotency key, a run ledger schema, and a backoff policy that stays under quota.”</p>

</div>

<div class="faq-item">
<span class="question">What are the most common mistakes when using this Sheets sync AI prompt?</span>

<p class="answer">The biggest mistake is leaving your target ranges vague—instead of “update the dashboard tab,” specify “write values only to Data!A2:H, preserve formulas in Summary!A1:K40.” Another common error is ignoring concurrency; don’t say “assume nobody edits the sheet,” say “assume 3 editors may change filters and notes during publish.” People also forget quotas and batch sizes: replace “write row by row” with “batch updates in chunks of 500–2,000 rows with exponential backoff on 429/503.” Finally, many skip validation; don’t accept “log success,” ask for post-run checks like row-count drift, checksum comparisons, and a run ledger entry per batch.</p>

</div>

<div class="faq-item">
<span class="question">Who should NOT use this Sheets sync AI prompt?</span>

<p class="answer">This prompt isn’t ideal for one-off exports where you will never run the job again, or for teams that truly need an operational database rather than a publishing layer. It’s also a poor fit if you haven’t clarified what the sheet is supposed to represent (source of truth confusion will persist even with perfect syncing). If that’s you, start with data definitions and ownership first, then come back to automation once the sheet contract is stable.</p>

</div>

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Which roles benefit most from this Sheets sync AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "RevOps Managers use this to publish trusted pipeline and revenue snapshots to Sheets without breaking executive rollups and formulas. Data Analysts rely on it to keep modeling upstream (facts/dimensions) while using Sheets as a clean presentation surface for stakeholders. Marketing Ops Specialists benefit when campaign and lead data has to land in a shared spreadsheet that people actively edit. Automation Consultants use it as a repeatable blueprint for client implementations where retries, quotas, and partial writes are non-negotiable risks."
      }
    },
    {
      "@type": "Question",
      "name": "Which industries get the most value from this Sheets sync AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "SaaS companies get value because ARR, churn, and pipeline views often live in Sheets for leadership, but the underlying sources (Stripe, CRM, product events) require careful staging and publish discipline. E-commerce brands use it when SKU performance, inventory snapshots, or margin reporting is shared in spreadsheets that include fragile formulas and lookups. Professional services firms benefit when utilization, project financials, and delivery dashboards are managed in Sheets and need reliable refreshes without manual cleanup. Agencies apply it for client-facing reporting tabs where incorrect numbers or broken formulas create immediate trust issues."
      }
    },
    {
      "@type": "Question",
      "name": "Why do basic AI prompts for building a Google Sheets sync pipeline produce weak results?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "A typical prompt like \"Write me a script to sync my data into Google Sheets\" fails because it: lacks a formula-safe range strategy (so it overwrites mixed formula/value areas), provides no idempotency design (so retries duplicate rows), ignores quota realities (so it uses chatty per-cell updates and gets throttled), produces “happy path” code that can’t recover from partial writes, and misses operational guardrails like run ledgers, audit logs, and alert thresholds."
      }
    },
    {
      "@type": "Question",
      "name": "Can I customize this Sheets sync AI prompt for my specific situation?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes. Start by inserting your source systems (for example: “HubSpot + Stripe”), your target sheet structure (tab names and protected formula ranges), and your publish cadence (hourly, daily, weekly). Then tailor the reliability constraints you actually face, such as “50k rows,” “multiple editors,” or “token expiry every 60 minutes.” A good follow-up instruction is: “Rewrite the blueprint for my sheet layout, and include an idempotency key, a run ledger schema, and a backoff policy that stays under quota.”"
      }
    },
    {
      "@type": "Question",
      "name": "What are the most common mistakes when using this Sheets sync AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The biggest mistake is leaving your target ranges vague—instead of “update the dashboard tab,” specify “write values only to Data!A2:H, preserve formulas in Summary!A1:K40.” Another common error is ignoring concurrency; don’t say “assume nobody edits the sheet,” say “assume 3 editors may change filters and notes during publish.” People also forget quotas and batch sizes: replace “write row by row” with “batch updates in chunks of 500–2,000 rows with exponential backoff on 429/503.” Finally, many skip validation; don’t accept “log success,” ask for post-run checks like row-count drift, checksum comparisons, and a run ledger entry per batch."
      }
    },
    {
      "@type": "Question",
      "name": "Who should NOT use this Sheets sync AI prompt?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "This prompt isn’t ideal for one-off exports where you will never run the job again, or for teams that truly need an operational database rather than a publishing layer. It’s also a poor fit if you haven’t clarified what the sheet is supposed to represent (source of truth confusion will persist even with perfect syncing). If that’s you, start with data definitions and ownership first, then come back to automation once the sheet contract is stable."
      }
    }
  ]
}
</script>
</div>

<div class="closing-section">

<p>Reliable Sheets publishing is less about clever code and more about guardrails: idempotency, batching, and strict formula protection. Paste this prompt into your model, generate the blueprint, and turn your spreadsheet into something people can finally trust.</p>

</div>]]></content:encoded>
					
		
		
		<media:content url="https://flowpast.s3.eu-north-1.amazonaws.com/featured_blog_images/5001586.webp" medium="image"></media:content>
            	</item>
	</channel>
</rss>
