Inferensys

Prompt

Feature Flag Technical Debt Assessment Prompt

A practical prompt playbook for engineering managers and platform teams auditing feature flag hygiene. Produces a structured debt report identifying stale flags, untested combinations, missing cleanup automation, and ownership gaps.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Feature Flag Technical Debt Assessment Prompt.

This prompt is for engineering managers and platform teams who need to audit the health of a feature flag system that has been running in production for months or years. The job is to produce a structured technical debt report that identifies stale flags, untested flag combinations, missing cleanup automation, and ownership gaps. Use it when you suspect flag proliferation is slowing down development, increasing testing complexity, or creating runtime risk that no single team owns. The prompt assumes you can provide a flag inventory, recent change history, and any existing flag governance policies.

Do not use this prompt for designing a new feature flag system from scratch—that requires the Feature Flag System Design Review Prompt Template instead. Do not use it for real-time incident response where a flag is actively causing an outage; the Feature Flag Operational Runbook Prompt Template is the right tool for that scenario. This prompt is also not a replacement for runtime flag evaluation analysis or performance profiling. It focuses on the organizational and process debt that accumulates around flag management, not on the technical performance of the flag evaluation path itself.

Before running this prompt, gather your flag inventory with metadata: creation date, owner, expected removal date, current rollout percentage, and any known dependencies between flags. The prompt works best when you also provide your team's stated flag policy—even if that policy is informal or aspirational. The output will be most actionable when you can compare actual flag hygiene against your own team's standards. If you lack a flag inventory or policy, start by using this prompt to define what a healthy baseline should look like, then iterate as you collect better data.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and what you must provide before running it in production.

01

Good Fit: Flag Hygiene Audits

Use when: you have a feature flag management system (LaunchDarkly, Split, custom) with accessible metadata and you need to identify stale flags, missing owners, or cleanup candidates. Guardrail: The prompt works best when flag metadata (creation date, rollout %, last modified) is provided as structured input. Do not rely on the model to guess flag age or status from names alone.

02

Bad Fit: Runtime Performance Profiling

Avoid when: you need to measure actual runtime overhead, latency impact, or CPU/memory consumption of flag evaluation paths. Guardrail: This prompt performs a static design and metadata audit. Pair it with an APM trace analysis prompt or profiling tool for runtime overhead assessment. The model cannot observe production performance.

03

Required Input: Flag Registry Data

What to provide: a structured dump of flag metadata including flag name, creation date, status, owner, rollout percentage, last evaluated timestamp, and dependent services. Guardrail: Without this data, the assessment degrades into generic advice. Build a pre-processing step that extracts flag metadata from your feature management platform before invoking the prompt.

04

Required Input: Flag Cleanup Automation Status

What to provide: details on existing cleanup tooling, automated removal pipelines, stale flag detectors, and ownership assignment processes. Guardrail: The prompt assesses gaps in automation. If you provide no information about current automation, the output will recommend building everything from scratch rather than improving what exists.

05

Operational Risk: False Confidence in Completeness

Risk: the prompt may produce a debt report that appears comprehensive but misses flags not surfaced in the provided metadata. Guardrail: Treat the output as a starting point for investigation, not a complete inventory. Cross-reference with runtime flag evaluation logs and codebase searches for flags defined outside the management platform.

06

Operational Risk: Ownership Gap Misattribution

Risk: the model may assign ownership based on naming conventions or service associations that are outdated or incorrect. Guardrail: Validate every ownership recommendation against your team directory or service catalog. Flag ownership should be confirmed by humans, not inferred by AI from flag name patterns.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for auditing feature flag hygiene and generating a structured technical debt report.

This template is designed to be copied directly into your prompt library or AI harness. It uses square-bracket placeholders for all dynamic inputs, allowing you to adapt it to your specific codebase, flagging system, and risk tolerance without rewriting the core instructions. The prompt instructs the model to act as a release engineering auditor, systematically evaluating flag staleness, testing gaps, ownership, and automation maturity.

code
You are a release engineering auditor specializing in feature flag hygiene and delivery architecture risk. Your task is to analyze the provided feature flag inventory and produce a structured technical debt assessment report.

## INPUT DATA
[FLAG_INVENTORY]

## CONTEXT
- Flagging system: [FLAG_SYSTEM_NAME]
- Codebase language and repository structure: [REPO_CONTEXT]
- Current release cadence: [RELEASE_CADENCE]
- Known incident history related to flags: [INCIDENT_HISTORY]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "summary": {
    "total_flags": <number>,
    "stale_flags": <number>,
    "flags_without_owners": <number>,
    "untested_flag_combinations_risk": "low|medium|high|critical",
    "overall_debt_score": "low|medium|high|critical"
  },
  "stale_flags": [
    {
      "flag_name": "<string>",
      "created_date": "<ISO date>",
      "last_modified_date": "<ISO date>",
      "current_rollout_percentage": <number>,
      "estimated_removal_effort": "low|medium|high",
      "blockers_to_removal": ["<string>"]
    }
  ],
  "ownership_gaps": [
    {
      "flag_name": "<string>",
      "current_owner": "<string or null>",
      "last_known_team": "<string or null>",
      "risk": "<string>"
    }
  ],
  "testing_gaps": [
    {
      "flag_name": "<string>",
      "has_unit_tests": <boolean>,
      "has_integration_tests": <boolean>,
      "tested_states": ["<string>"],
      "untested_combinations_risk": "<string>"
    }
  ],
  "automation_gaps": [
    {
      "gap_type": "missing_cleanup_automation|missing_deprecation_policy|missing_ownership_enforcement",
      "description": "<string>",
      "affected_flag_count": <number>,
      "recommended_action": "<string>"
    }
  ],
  "runtime_risk_assessment": {
    "flag_evaluation_overhead_ms": <number or null>,
    "flag_dependency_conflicts": ["<string>"],
    "proliferation_risk": "low|medium|high|critical",
    "notes": "<string>"
  },
  "recommendations": [
    {
      "priority": <number>,
      "category": "removal|ownership|testing|automation|runtime",
      "action": "<string>",
      "effort_estimate": "low|medium|high",
      "risk_reduction": "low|medium|high|critical"
    }
  ]
}

## CONSTRAINTS
- Flag a flag as "stale" if it has been at 100% rollout for more than [STALE_THRESHOLD_DAYS] days without a removal ticket, or if it was created more than [MAX_FLAG_AGE_DAYS] days ago and is still below 100%.
- Treat any flag without a documented owner as a high-severity ownership gap.
- For testing gaps, consider any flag with more than [MAX_FLAG_STATES] boolean states that lacks integration tests for all combinations as high risk.
- If runtime overhead data is not available, note it as null and flag it as a monitoring gap in recommendations.
- Do not invent flag names, dates, or metrics. Only use data present in [FLAG_INVENTORY].
- If the inventory is empty or unparseable, return a JSON object with an error field explaining the issue.

## EVALUATION CRITERIA
- Completeness: Every flag in the inventory must appear in at least one relevant section if it has debt.
- Actionability: Every recommendation must include a concrete next step, not a vague suggestion.
- Severity calibration: Do not mark low-risk items as critical. Use the defined enums consistently.

To adapt this template, replace each square-bracket placeholder with data from your flag management system. The [FLAG_INVENTORY] should contain a structured list of flags with their metadata—export this from LaunchDarkly, Split, Flagsmith, or your internal system. Adjust [STALE_THRESHOLD_DAYS] and [MAX_FLAG_AGE_DAYS] to match your team's flag lifecycle policies. If your organization uses a different severity scale, modify the enum values in the output schema, but keep the structure consistent so downstream tooling can parse the report reliably.

Before deploying this prompt into an automated pipeline, validate the output against the JSON schema. A common failure mode is the model returning a markdown-wrapped JSON block instead of raw JSON—use a post-processing step to strip fences. For high-risk flag inventories where removal could cause production incidents, route the generated report through a human review step before any automated cleanup actions are triggered. Pair this prompt with the Feature Flag Operational Runbook Prompt Template for incident response workflows.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Feature Flag Technical Debt Assessment Prompt needs to produce a reliable debt report. Validate each input before execution to prevent false debt signals or missed stale flags.

PlaceholderPurposeExampleValidation Notes

[FLAG_INVENTORY]

Complete list of feature flags with metadata

JSON array: [{flag_key: 'checkout_v2', created_date: '2023-01-15', owner_team: 'payments', status: 'active', rollout_pct: 100, last_modified: '2024-06-01'}]

Schema check: required fields present. Date format ISO 8601. Status enum: active, ramping, deprecated, removed. Null rollout_pct allowed for non-percentage flags.

[CODEBASE_REFERENCES]

Map of flag keys to code locations where flags are evaluated

JSON object: {checkout_v2: ['src/checkout/service.ts:142', 'src/checkout/ui.ts:89'], legacy_search: ['src/search/engine.py:56']}

Parse check: valid paths. Cross-reference with FLAG_INVENTORY to detect flags with zero references or references to non-existent flags.

[DEPLOYMENT_HISTORY]

Recent deployment records with flag change events

JSON array: [{deploy_id: 'd-891', timestamp: '2024-07-10T14:30:00Z', flags_touched: ['checkout_v2'], change_type: 'rollout_100'}]

Timestamp parse check. change_type enum: created, ramped, rollout_100, deprecated, removed. Null flags_touched allowed for deploys with no flag changes.

[FLAG_CLEANUP_AUTOMATION]

Description of existing automated flag removal processes

String or null: 'Jenkins job flag-cleanup runs weekly, removes flags with rollout_pct=100 and last_modified > 90 days'

Null allowed if no automation exists. If non-null, parse for trigger schedule, eligibility criteria, and execution action. Flag null as debt signal.

[OWNERSHIP_MAP]

Mapping of teams to flag ownership responsibilities

JSON object: {payments: ['checkout_v2', 'payment_retry'], search: ['legacy_search', 'relevance_v3'], unowned: ['dark_mode_experiment']}

Schema check: team names as keys, flag key arrays as values. unowned key required if any flags lack ownership. Cross-reference with FLAG_INVENTORY owner_team field for consistency.

[TEST_COVERAGE_REPORT]

Flag combination test coverage data

JSON object: {tested_combinations: [['checkout_v2', 'payment_retry']], untested_flags: ['dark_mode_experiment'], total_possible_pairs: 15, tested_pairs: 3}

Parse check: arrays contain valid flag keys. total_possible_pairs and tested_pairs must be non-negative integers. Null allowed if no test coverage data exists; flag as high-risk debt.

[RUNTIME_METRICS]

Performance impact data for flag evaluation at runtime

JSON object: {avg_eval_time_ms: {checkout_v2: 0.3, legacy_search: 1.8}, total_flags_per_request_p99: 12, flagged_endpoints: ['/api/search', '/api/checkout']}

Parse check: numeric values non-negative. Null allowed if no runtime metrics collected; flag as observability debt. avg_eval_time_ms > 1.0 per flag signals runtime overhead concern.

[FLAG_POLICY]

Organizational policy for flag lifecycle management

String: 'Flags must be removed within 30 days of 100% rollout. All flags require owner_team assignment. Kill switches require SRE approval.'

Parse check: extract policy rules as strings. Null allowed if no formal policy exists; flag as governance debt. Use policy rules to calibrate staleness thresholds and ownership gap severity.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Feature Flag Technical Debt Assessment Prompt into an application or workflow.

This prompt is designed to be integrated into a scheduled audit pipeline, not a real-time chat interface. The primary integration point is a CI/CD system (like GitHub Actions or Jenkins) or a cron-based platform service that runs weekly. The application harness should fetch the current state of the feature flag system via an internal API or configuration repository, serialize that state into the [FLAG_MANIFEST] input, and inject it into the prompt. The model's structured output is then parsed and written to a persistent audit log, such as a JSON file in a dedicated feature-flag-audit repository or a database table, enabling trend analysis over time.

The harness must enforce a strict output contract. Before the model call, define the expected JSON schema for the debt report. After receiving the response, validate it against that schema. If validation fails, implement a single retry with a repair prompt that includes the raw output and the schema error. If the retry also fails, log the failure and raise a non-blocking alert to the platform team. For high-risk flags identified in the report (e.g., flags with risk_level: critical), the harness should automatically create a ticket in the team's project management tool (like Jira or Linear) and assign it to the flag's owner, using the recommended_action from the model's output as the ticket description.

Model choice matters for this task. Use a model with strong reasoning capabilities and a large context window, as the [FLAG_MANIFEST] can be extensive. A model like claude-sonnet-4-20250514 or gpt-4o is appropriate. To manage cost and latency, consider pre-processing the manifest to exclude flags that have been fully removed for over 90 days. The harness should also log the prompt template version, model version, and a hash of the input manifest alongside the output for full traceability. Avoid wiring this prompt directly to a flag-kill switch; the output is an assessment for human review, not an automated action.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the Feature Flag Technical Debt Assessment output. Use this contract to parse, validate, and store the report before surfacing it in a dashboard or review queue.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Must parse as valid UUID v4. Reject on mismatch.

generated_at

string (ISO 8601 UTC)

Must parse as valid ISO 8601 timestamp in UTC. Reject if missing timezone or unparseable.

assessment_scope

object

Must contain flag_count (integer >= 0) and environment_count (integer >= 1). Reject if flag_count is negative or environment_count is zero.

stale_flags

array of objects

Each object must include flag_name (string, non-empty), days_since_last_evaluation (integer >= 0), and owner_team (string or null). Reject if flag_name is empty or days_since_last_evaluation is negative.

untested_combinations

array of objects

Each object must include flag_pair (array of exactly 2 non-empty strings) and risk_level (enum: low, medium, high, critical). Reject if flag_pair length is not 2 or risk_level is outside enum.

cleanup_automation_gaps

array of objects

Each object must include gap_description (string, non-empty) and affected_flag_count (integer >= 1). Reject if gap_description is empty or affected_flag_count is zero.

ownership_gaps

array of objects

Each object must include flag_name (string, non-empty) and current_owner (string or null). Reject if flag_name is empty. Allow null for current_owner to indicate unowned flag.

runtime_overhead_risk

object

Must contain risk_score (integer 0-100) and contributing_factors (array of strings, min 1 item). Reject if risk_score is outside 0-100 range or contributing_factors is empty.

proliferation_risk

object

Must contain risk_score (integer 0-100) and growth_rate_description (string, non-empty). Reject if risk_score is outside 0-100 range or growth_rate_description is empty.

recommendations

array of objects

Each object must include priority (enum: P0, P1, P2, P3), action (string, non-empty), and target_flag_or_gap (string, non-empty). Reject if priority is outside enum or any string field is empty.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when using a Feature Flag Technical Debt Assessment Prompt and how to guard against it.

01

Stale Flag Blindness

What to watch: The model fails to identify flags that are fully rolled out but never removed, treating them as active infrastructure. This happens when the prompt lacks explicit criteria for staleness (e.g., 100% rollout for >30 days). Guardrail: Provide a strict staleness definition in [CONSTRAINTS] with a time window and rollout percentage threshold. Require the model to cite the flag's current rollout state and last modified date for every staleness claim.

02

Combinatorial Explosion Oversight

What to watch: The assessment ignores untested flag combinations, reporting each flag in isolation. In production, multiple flags interact, and the model's debt report misses the exponential risk of untested interaction paths. Guardrail: Include a specific instruction to identify flag pairs or groups that share a code path. Request a dedicated section in the output for 'Flag Interaction Risk' and flag any set of >2 flags that can be active simultaneously without explicit test coverage.

03

Ownership Gap Hallucination

What to watch: When ownership metadata is missing or stale, the model confidently assigns flags to the last committer or a default team, masking the real risk of orphaned flags. Guardrail: Instruct the model to output an explicit 'UNKNOWN' value for ownership when it cannot be determined from the provided context. Add a post-processing validation rule that flags any assigned owner not present in a pre-approved [TEAM_LIST].

04

Runtime Overhead Underestimation

What to watch: The model focuses on code cleanliness and ignores the cumulative latency cost of evaluating hundreds of flags on a critical path. The debt report looks healthy while P99 latency degrades. Guardrail: Require the prompt to request a 'Performance Impact' section. Provide a [LATENCY_BUDGET_MS] constraint and ask the model to flag any service with more than [FLAG_COUNT_THRESHOLD] flags on its request path as a performance risk, regardless of code quality.

05

Cleanup Automation Gap

What to watch: The assessment identifies flags for removal but fails to check if an automated cleanup process exists, leaving the team with a manual to-do list that never gets done. Guardrail: Add a binary check in the output schema: 'Has Automated Cleanup'. Instruct the model to look for CI/CD pipelines, scheduled jobs, or bot configurations linked to flag removal. Flag any manual-only cleanup recommendation as a process debt item.

06

Kill Switch Readiness Neglect

What to watch: The debt report treats all flags equally, failing to distinguish between a stale experiment flag and a critical operational kill switch. Recommending removal of a kill switch without an operational readiness check creates a safety gap. Guardrail: Instruct the model to classify each flag as 'Experiment', 'Release', 'Permission', or 'Operational/Kill Switch'. Add a hard constraint: any recommendation to remove an 'Operational' flag must include a verification step confirming an alternative emergency stop mechanism exists.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of the Feature Flag Technical Debt Assessment before integrating it into a dashboard or CI pipeline. Each criterion includes a concrete pass standard, a failure signal, and a test method.

CriterionPass StandardFailure SignalTest Method

Flag Identification Completeness

Report identifies all flags from [FLAG_REGISTRY] that exceed [STALENESS_THRESHOLD_DAYS] without activity

Stale flags present in the registry are missing from the report

Cross-reference report flag IDs against a query of the registry filtered by last_modified_date

Ownership Gap Detection

Every flag in the report has an owner field; flags with no owner or a departed user are explicitly flagged as 'UNOWNED'

A flag is listed with a valid owner who left the team, or the owner field is null without a warning

Parse the report for any owner field matching a regex for 'null', 'N/A', or a name from [DEPARTED_USERS_LIST] without an 'UNOWNED' tag

Untested Combination Risk Flagging

Report explicitly lists flag combinations that have zero test coverage in [TEST_COVERAGE_DATA] and estimates the blast radius

A high-risk combination of two flags with overlapping scope is not mentioned in the risk section

Inject a known untested pair into [TEST_COVERAGE_DATA] and verify it appears in the report's 'Untested Combinations' section

Cleanup Automation Status

Each stale flag is classified with a removal status: 'AUTOMATED_CLEANUP', 'MANUAL_CLEANUP_REQUIRED', or 'BLOCKED' with a reason

A flag is marked 'AUTOMATED_CLEANUP' but the referenced [CLEANUP_AUTOMATION_RULES] do not cover its removal

Validate that every 'AUTOMATED_CLEANUP' flag ID has a matching rule in the provided automation configuration

Runtime Overhead Quantification

Report provides a concrete metric for overhead (e.g., 'adds 15ms p99 latency') or states 'METRICS_UNAVAILABLE' if [PERFORMANCE_DATA] is missing

The report hallucinates a specific latency number when [PERFORMANCE_DATA] is empty or the flag has no performance instrumentation

Run the prompt with an empty [PERFORMANCE_DATA] input and assert the output contains 'METRICS_UNAVAILABLE' for the overhead field

Actionable Recommendation Quality

Every high-severity finding has a concrete, verifiable next step (e.g., 'Create Jira ticket in [PROJECT] to remove flag X')

A high-severity finding has a vague recommendation like 'consider reviewing this flag'

Use an LLM judge to score recommendations on specificity; fail if the 'actionable' score is below 0.8 on a 0-1 scale

Output Schema Validity

The report is valid JSON matching the [OUTPUT_SCHEMA] without extra or missing required fields

The JSON fails to parse or is missing the 'debt_items' array

Run a JSON schema validator against the output using the provided [OUTPUT_SCHEMA]

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a flat list of flags from a spreadsheet or config dump. Remove strict schema enforcement and let the model produce a narrative debt report first. Use a simple instruction like:

code
Analyze these feature flags for technical debt risks:
[FLAG_LIST]

Flag each concern as HIGH, MEDIUM, or LOW severity.

Focus on getting useful qualitative findings before building validation pipelines.

Watch for

  • Missing severity calibration across flags
  • Overly broad "stale flag" detection without age thresholds
  • No distinction between runtime risk and maintenance risk
  • Model inventing flag names or ownership that don't exist in input
Prasad Kumkar

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.