This prompt is designed for platform and security engineering teams who need to produce a step-by-step migration guide when transitioning between authentication systems. Use it when you are moving from API keys to OAuth 2.0, from opaque session tokens to JWTs, or between any two distinct auth schemes. The prompt forces the model to structure the guide around a strict before/after comparison, enumerate every breaking change, and provide explicit rollback procedures. It is not a general-purpose documentation writer. It assumes you have already decided on the target architecture and can supply concrete endpoint details, token formats, and error mappings. The output is a draft for human review, not a publishable final document.
Prompt
Auth Migration Guide Prompt Template

When to Use This Prompt
Defines the exact job, required inputs, and boundaries for the Auth Migration Guide prompt before you copy a single token.
Before using this prompt, gather the specific artifacts the model needs: the current auth scheme specification, the target auth scheme specification, a list of every affected endpoint, the exact token format changes, and the error code mappings from old to new. Without these concrete inputs, the model will generate plausible but incorrect migration steps. The prompt includes placeholders for [CURRENT_AUTH_SPEC], [TARGET_AUTH_SPEC], [AFFECTED_ENDPOINTS], [TOKEN_FORMAT_CHANGE], and [ERROR_MAPPING]. Fill every placeholder with real data. If you cannot fill a placeholder, you are not ready to use this prompt. The model will produce a structured guide with sections for overview, breaking changes, before/after code samples, client impact assessment, rollback procedures, and a migration checklist.
Do not use this prompt when you are still deciding between auth architectures, when you lack endpoint-level detail, or when you need a general security explainer. The prompt is also unsuitable for generating end-user-facing login instructions or marketing copy about auth improvements. After the model produces a draft, a security engineer must review every code sample for correctness, verify that no hardcoded secrets appear in examples, and confirm that the rollback procedure actually restores the previous state without data loss. Run the output through the companion Auth Documentation Completeness Audit prompt to catch missing error codes, stale references, or contradictory instructions before publication.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the Auth Migration Guide Prompt Template fits your current documentation task.
Good Fit: Structured Auth Transitions
Use when: You are migrating between well-defined auth schemes (API key to OAuth 2.0, session tokens to JWTs, or single-tenant to multi-tenant OIDC). The prompt excels at producing step-by-step guides with before/after code samples, breaking change enumeration, and rollback procedures. Guardrail: Provide the exact source and target auth specifications, including token formats, endpoint URLs, and scope definitions.
Bad Fit: Undocumented or Proprietary Protocols
Avoid when: The source or target auth system lacks public documentation, uses a custom non-standard protocol, or involves hardware security modules with proprietary interfaces. The model will hallucinate plausible but incorrect protocol details. Guardrail: Require human-provided protocol specifications as input; if unavailable, use this prompt only for the structural template and fill protocol details manually.
Required Inputs: Complete Auth Surface
Risk: Missing input data causes the prompt to generate migration steps that skip critical edge cases like token refresh, revocation, or concurrent session handling. Guardrail: Always supply the full source auth spec (endpoints, error codes, token lifetimes, storage mechanisms) and target auth spec. Include client impact data: which SDKs, services, and user flows are affected.
Operational Risk: Client Impact Blind Spots
Risk: The prompt may produce a technically accurate migration guide that fails to assess downstream client impact—breaking existing integrations, mobile apps, or CI/CD pipelines that depend on the old auth flow. Guardrail: Pair this prompt with a separate client inventory review. Add a mandatory 'Client Impact Assessment' section to the output schema and flag any client not explicitly addressed.
Operational Risk: Rollback Gaps
Risk: Migration guides generated by the prompt may describe forward migration in detail but under-specify rollback procedures, leaving teams stranded if the new auth system fails in production. Guardrail: Add a constraint requiring a 'Rollback Procedure' section with explicit rollback conditions, data consistency checks, and rollback communication templates. Validate that every forward step has a corresponding rollback step.
Boundary: When to Use Product Code Instead
Risk: The prompt generates documentation, not executable migration tooling. Teams may mistake a well-written guide for a complete migration solution and skip building actual migration scripts, token translators, or compatibility layers. Guardrail: Use this prompt for the documentation artifact only. Pair it with engineering work for migration tooling, integration tests, and a staged rollout plan. The prompt output should reference, not replace, those artifacts.
Copy-Ready Prompt Template
A reusable prompt template for generating step-by-step auth migration guides with before/after code samples, breaking change enumeration, and rollback procedures.
This prompt template is designed to produce a complete, actionable migration guide for transitioning between authentication systems. It forces the model to structure the output around concrete code changes, a detailed breaking change catalog, and explicit rollback steps—moving beyond vague advice to implementation-ready documentation. Use this template when you have a defined source and target auth system and need a guide that downstream engineering teams can execute against.
codeYou are a senior platform security engineer writing an internal migration guide for engineering teams. Your task is to produce a complete, step-by-step migration document that moves a service from [SOURCE_AUTH_SYSTEM] to [TARGET_AUTH_SYSTEM]. The migration guide must be structured as follows: ## 1. Executive Summary - One paragraph explaining the business and security rationale for this migration. - State the [MIGRATION_DEADLINE] and any hard cut-off dates. ## 2. Breaking Changes Catalog - Enumerate every breaking change in a table with columns: Change, Impact, Mitigation Required, and Affected Clients. - Include changes to: token formats, header names, endpoint URLs, scope strings, error response bodies, and SDK method signatures. ## 3. Before/After Code Samples - For each breaking change, provide a concrete code example in [TARGET_LANGUAGE] showing the old pattern and the new pattern. - Include complete request/response pairs where relevant. - Show error handling for the new auth flow, including token refresh and invalid credential scenarios. ## 4. Step-by-Step Migration Procedure - Provide numbered steps that an engineering team can follow in order. - Each step must include: what to change, how to verify the change, and how to roll back if it fails. - Cover: dependency updates, configuration changes, code refactoring, testing, staged rollout, and monitoring. ## 5. Rollback Plan - Provide explicit rollback procedures for each migration step. - Include criteria for triggering a rollback (e.g., elevated 401 rates, token refresh failures, scope escalation errors). - Specify how to revert configuration, code, and infrastructure changes. ## 6. Client Impact Assessment - List all internal and external client types affected by this migration. - For each client type, describe the required changes, communication timeline, and support contacts. - Include a checklist for verifying each client type has completed migration. ## 7. Testing and Validation - Provide a test plan with specific test cases covering: happy path auth, token expiry, scope validation, error responses, and concurrent sessions. - Include commands or scripts that can be run to validate the migration in a staging environment. ## Constraints - All code samples must be in [TARGET_LANGUAGE] and must compile or run without syntax errors. - Do not use placeholder credentials or hardcoded secrets in code samples. Use environment variables or config references. - Every breaking change must be documented. Do not omit changes that seem minor. - If the migration involves multiple client SDKs, address each one explicitly. - Flag any security-sensitive steps (e.g., secret rotation, token signing key changes) with a ⚠️ SECURITY marker. ## Input Context [SOURCE_AUTH_SYSTEM]: [SOURCE_DESCRIPTION] [TARGET_AUTH_SYSTEM]: [TARGET_DESCRIPTION] [TARGET_LANGUAGE]: [LANGUAGE] [MIGRATION_DEADLINE]: [DEADLINE] [ADDITIONAL_CONTEXT]: [ANY_OTHER_RELEVANT_DETAILS]
Before executing this prompt, replace every square-bracket placeholder with concrete values. The [SOURCE_DESCRIPTION] and [TARGET_DESCRIPTION] should include specifics like grant types, token formats, endpoint base URLs, and SDK versions. If the migration spans multiple services or client libraries, include that scope in [ADDITIONAL_CONTEXT]. After generating the guide, run a completeness check: verify that every breaking change in the catalog has a corresponding before/after code sample and a rollback step. For high-risk migrations involving payment systems, user data, or compliance boundaries, route the generated guide through a human security review before publication.
Prompt Variables
Inputs the prompt needs to work reliably. Validate each before execution to prevent hallucinated migration steps, missing breaking changes, or incorrect code samples.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SOURCE_AUTH_SYSTEM] | Describes the current authentication mechanism being migrated away from | API Key in custom header X-API-Key with no expiry | Must be a concrete auth method name. Reject generic terms like 'old system'. Validate against known auth patterns (API Key, Session Cookie, Basic Auth, OAuth 1.0a). |
[TARGET_AUTH_SYSTEM] | Describes the new authentication mechanism being migrated to | OAuth 2.0 Authorization Code Grant with PKCE and refresh token rotation | Must include grant type or flow name. Validate that target is more modern or has a documented security rationale. Reject if source and target are identical. |
[AFFECTED_ENDPOINTS] | List of API endpoints, SDK methods, or client surfaces that require auth changes | GET /api/v2/users, POST /api/v2/orders, DELETE /api/v2/sessions | Must be a concrete list with HTTP methods and paths. Validate each endpoint exists in the current API spec. Reject if empty or contains only wildcards without justification. |
[BREAKING_CHANGES] | Enumeration of every breaking change consumers must handle | Header name changes from X-API-Key to Authorization: Bearer, token refresh required every 3600s, scope claims now enforced per endpoint | Each entry must describe a concrete behavioral change. Validate that each breaking change maps to at least one affected endpoint. Reject vague entries like 'auth flow changes'. |
[BEFORE_CODE_SAMPLES] | Working code examples using the source auth system in at least two languages | curl -H 'X-API-Key: sk_live_abc123' https://api.example.com/v2/users | Must be syntactically valid in the claimed language. Validate that samples actually use the source auth mechanism described. Reject if samples are identical to after samples. |
[AFTER_CODE_SAMPLES] | Working code examples using the target auth system in the same languages as before samples | curl -H 'Authorization: Bearer eyJhbGciOi...' https://api.example.com/v2/users | Must be syntactically valid and use the target auth mechanism. Validate that each after sample corresponds to a before sample for the same endpoint and language. Reject if tokens are hardcoded without placeholder comments. |
[ROLLBACK_PROCEDURE] | Step-by-step instructions for reverting to the source auth system if migration fails |
| Must contain actionable steps with verification checks. Validate that rollback does not leave the system in an ambiguous state accepting both auth methods without explicit dual-support documentation. |
[CLIENT_IMPACT_ASSESSMENT] | Analysis of how this migration affects each client type and what action they must take | Mobile SDK v2.3+ auto-handles token refresh. Web clients must update fetch wrapper. IoT devices with no secure storage need firmware update for PKCE support. | Must cover every client platform in active use. Validate that no client type is omitted. Reject if assessment claims zero impact without evidence. Require explicit 'no action needed' statements only when verified. |
Implementation Harness Notes
How to wire the auth migration guide prompt into a documentation pipeline with validation, retries, and human review gates.
The Auth Migration Guide prompt is designed to be embedded in a documentation generation pipeline, not used as a one-off chat interaction. The primary integration point is a CI/CD workflow triggered by a pull request that introduces an auth system change. When the PR is labeled with auth-migration, a script extracts the diff, the old and new auth configuration schemas, and any migration notes from the PR body. These become the [SOURCE_DIFF], [OLD_AUTH_SCHEMA], [NEW_AUTH_SCHEMA], and [MIGRATION_NOTES] inputs. The prompt is then invoked via the model API, and the resulting markdown is committed to a drafts/ directory for review before publication.
The implementation must include a validation layer that checks the model's output before it reaches a human reviewer. After the prompt returns, run a structured validation script that confirms: (1) every breaking change mentioned in the source diff appears in the output's 'Breaking Changes' section, (2) all code blocks are syntactically valid for the declared [TARGET_LANGUAGE], (3) the output contains a non-empty 'Rollback Procedure' section, and (4) no placeholder tokens remain unresolved. If validation fails, retry the prompt once with the validation errors appended to the [CONSTRAINTS] field. If the second attempt also fails, route the output to a human writer queue with the validation report attached. Log every attempt, the model used, the token counts, and the validation results for auditability.
Model selection matters here. Use a model with strong instruction-following and long-context handling, such as claude-sonnet-4-20250514 or gpt-4o, because the combined source material often exceeds 8K tokens. Set the temperature to 0.2 to balance factual consistency with the slight variability needed for natural prose. Do not use a tool-calling or agentic loop for this prompt; it is a single-turn generation task. The output should be written directly to a markdown file and never automatically published. A technical writer or the PR author must approve the draft before it goes live. For high-risk migrations (e.g., changing token formats or removing grant types), add a second human review step and require sign-off from a security engineer.
Expected Output Contract
Fields, format, and validation rules for the generated auth migration guide. Use this contract to validate the model output before publishing or handing off to engineering review.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
migration_title | string | Must be a single sentence under 120 characters summarizing the auth transition (e.g., 'Migrating from API Key to OAuth 2.0 Client Credentials'). | |
target_audience | string enum | Must match one of: 'end-user developers', 'internal platform teams', 'both'. Reject if missing or ambiguous. | |
breaking_changes | array of objects | Each object must contain 'change_description' (string), 'before_example' (string), 'after_example' (string), and 'mitigation' (string). Array must not be empty for a migration guide. | |
migration_steps | array of objects | Each step must contain 'step_number' (integer, sequential), 'action' (string, imperative verb), 'code_snippet' (string or null), and 'verification' (string). Minimum 3 steps required. | |
rollback_procedure | string | Must describe a concrete rollback path. Reject if it contains only generic advice like 'revert changes' without specific commands or configuration reversals. | |
client_impact_assessment | string | Must be present and non-empty. Reject if it fails to mention at least one of: downtime window, client-side code changes, or credential rotation requirements. | |
deprecation_timeline | object | Must contain 'announcement_date' (ISO 8601 date string), 'sunset_date' (ISO 8601 date string), and 'hard_cutoff_date' (ISO 8601 date string or null). Reject if sunset_date is not after announcement_date. | |
security_considerations | array of strings | If present, each string must reference a specific threat or misconfiguration (e.g., 'token storage', 'scope escalation'). Reject generic entries like 'be secure'. |
Common Failure Modes
Auth migration guides are high-stakes documentation. When the prompt fails, it produces guides that confuse developers, hide breaking changes, or omit critical security steps. Here are the most common failure modes and how to prevent them.
Missing Breaking Change Enumeration
What to watch: The model produces a narrative migration summary but fails to extract every discrete breaking change into a scannable list. Developers miss deprecated endpoints, renamed scopes, or changed error formats. Guardrail: Require a dedicated BREAKING_CHANGES section in the output schema with a structured table (change type, before, after, migration action). Use an eval that counts breaking changes against a known list from the changelog.
Incomplete Before/After Code Samples
What to watch: The prompt generates code samples for the new auth pattern but omits the equivalent old-pattern code, leaving developers to guess what changed. Or samples show only the happy path without error handling. Guardrail: Explicitly require paired before/after code blocks for every changed operation. Add a constraint that each sample must include error handling for the most common failure mode (expired token, invalid scope, revoked credential).
Undocumented Client Impact Assessment
What to watch: The guide describes the migration mechanics but never explains which client types are affected, what the downtime window looks like, or what happens if a client doesn't migrate by the deadline. Product managers and support teams lack operational context. Guardrail: Add a required CLIENT_IMPACT section to the output schema covering affected client types, migration deadline, backward compatibility window, and consequences of non-migration. Validate presence with a schema check.
Rollback Procedure Omission
What to watch: The migration guide assumes perfect execution and provides no rollback steps. When the migration fails in production, the on-call engineer has no documented path to restore the previous auth state. Guardrail: Require a ROLLBACK_PROCEDURE section with step-by-step instructions, preconditions for safe rollback, and data integrity checks. Test the prompt by asking 'What if step 3 fails?' and verifying the output includes a recovery path.
Security Regression in Examples
What to watch: Code samples inadvertently introduce security anti-patterns—hardcoded secrets, missing PKCE parameters, token storage in localStorage, or disabled certificate validation. The guide teaches insecure patterns. Guardrail: Add a SECURITY_CONSTRAINTS block to the prompt forbidding hardcoded credentials, requiring PKCE for public clients, and mandating secure storage guidance. Run a security-focused eval that scans generated code for known anti-patterns before publication.
Scope and Permission Drift
What to watch: The new auth system uses different scope names or granularity, but the migration guide maps scopes incorrectly or omits the mapping entirely. Developers request wrong permissions, causing integration failures. Guardrail: Require a SCOPE_MAPPING_TABLE in the output that maps every old scope to its new equivalent, flags removed scopes, and notes new required scopes. Validate completeness by comparing against the source scope registry if available.
Evaluation Rubric
Score each criterion on a pass/fail basis before shipping the auth migration guide. Run these checks against the generated output to catch regressions, missing impact assessments, and unsafe guidance.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Breaking Change Enumeration | Every breaking change from the source auth method to the target auth method is listed with a before/after code sample | Missing a known breaking change; before/after samples are absent or use placeholder values | Diff the generated change list against a manually maintained breaking change inventory; confirm each entry has a compilable code snippet |
Client Impact Assessment | Each migration step includes a clear statement of which client types are affected and the expected downtime or re-deployment requirement | Steps lack client-type scoping; no mention of mobile, SPA, or server-side client impact where applicable | Parse output for client-type keywords; flag any step that describes a change without a client impact sentence |
Rollback Procedure | Every irreversible step includes an explicit rollback or recovery instruction with pre-conditions | Irreversible steps lack rollback guidance; rollback instructions reference undefined state or missing prerequisites | Search for terms like 'cannot be undone' or 'irreversible'; assert that each occurrence is followed by a rollback block within 3 paragraphs |
Code Sample Accuracy | All code samples use the target auth library version, handle errors, and avoid hardcoded secrets | Samples contain placeholder secrets, use deprecated methods, or omit error handling for token exchange | Run samples through a syntax checker for the target language; scan for hardcoded credentials with a regex pattern |
Migration Order Correctness | Steps are ordered so that no step requires a state that has not been established by a prior step | A step references a token format, endpoint, or configuration that is introduced in a later step | Topological sort of step dependencies; flag any forward reference to a not-yet-introduced concept |
Scope and Permission Mapping | Every scope or permission from the old system is mapped to an equivalent or explained replacement in the new system | Old scopes are listed without new-system equivalents; mapping table has null or 'TBD' entries | Extract all scope identifiers from the old system section; assert each appears in the mapping table with a non-null target |
Deprecation Timeline Clarity | All deprecated surfaces include a date or version when they will be removed, plus a link to the replacement | Deprecation notices lack dates; 'soon' or 'future release' used without a specific milestone | Regex for deprecation language; assert each match contains a date pattern or version number and a hyperlink to the replacement |
Security Warning Coverage | Any step that changes token storage, transmission, or validation includes a security warning with rationale | Token migration steps lack warnings about storage location changes, downgrade attacks, or mixed-mode risks | Classify each step by risk category; flag any step tagged as 'storage change' or 'transmission change' that lacks a security warning sentence |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Add a strict JSON output schema with fields for migration_steps, breaking_changes, code_samples, rollback_procedure, and client_impact. Include a validator that checks every referenced endpoint appears in the scope mapping table. Add retry logic with a repair prompt if the schema validation fails.
codeOutput must conform to [OUTPUT_SCHEMA]. For each breaking change, include: - affected_endpoint - previous_behavior - new_behavior - client_action_required (boolean) - migration_deadline (ISO 8601 or null)
Wire the output into a CI pipeline that diffs the generated guide against the previous version and flags removed sections. Log every generation with the prompt version, model, and validation pass/fail for observability.
Watch for
- Silent format drift when the model reorders sections
- Missing
client_action_requiredflags causing downstream consumers to miss mandatory changes - Rollback procedures that reference deprecated endpoints without noting the deprecation status

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us