backward-compatibility-policy

Enforces zero backward compatibility for internal KHI code with a documented exception for .khi files.

2.1k|97|Updated Jan 22, 2025
One-click install
npx skills add https://github.com/GoogleCloudPlatform/khi --skill backward-compatibility-policy-googlecloudplatform
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backward-compatibility-policy
Source: https://github.com/GoogleCloudPlatform/khi/tree/main/.agents/skills/backward_compatibility_policy
Command: npx skills add https://github.com/GoogleCloudPlatform/khi --skill backward-compatibility-policy-googlecloudplatform

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When refactoring the Kubernetes History Inspector (KHI) monorepo, developers often leave behind deprecated wrappers, defensive fallbacks, and compatibility shims that pollute the codebase. This Skill defines a clear policy: internal Go/TypeScript code requires no backward compatibility, while exported .khi dump files are the single exception requiring explicit discussion. ## Core Features & Use Cases - Nine Concrete Anti-Patterns: Identifies and corrects common mistakes such as variadic arguments to avoid updating callers, nil-check fallbacks for non-nil fields, deprecated wrapper shims, dual-field synchronization, and interface V2 proliferation, each with Bad/Good Go code examples. - Task DAG Guidance: Explains how to declare required task dependencies instead of using optional task results or legacy feature flags in the KHI inspection pipeline. - .khi File Change Workflow: Provides a three-step process for Protocol Buffer schema changes, requiring explicit user approval before implementing migration or fallback decoders. - Use Case: When renaming a function or changing a struct field in KHI, use this Skill to confirm you should delete the old implementation and update all call sites rather than retaining a compatibility layer. ## Quick Start Review my planned refactor of the KHI task pipeline against the backward compatibility policy and flag any anti-patterns.

Frequently Asked Questions about backward-compatibility-policy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle backward compatibility when refactoring internal Go code?▼

Internal code in an integrated monorepo like KHI requires no backward compatibility. Delete old functions, update all call sites in the same change, and never retain deprecated wrappers, aliases, or defensive fallbacks for hypothetical legacy callers.

When should I keep backward compatibility for exported file formats?▼

Backward compatibility matters only for data formats that persist across versions, such as KHI's exported .khi inspection dump files serialized with Protocol Buffers. Even then, raise the compatibility strategy explicitly with the user during planning before implementing migration logic.

Should I use variadic arguments to avoid updating existing callers?▼

No. Adding variadic parameters solely to keep existing zero-argument callers compiling is an anti-pattern. Make the new parameter explicit and required, then update all call sites across the repository in the same change.

Can I keep a deprecated function as a wrapper after renaming it?▼

No. Retaining a deprecated function that delegates to the new implementation is an anti-pattern in a monorepo. Rename the function cleanly, delete the old one, and update every call site; version control preserves the history.

How do I add a method to a Go interface without breaking implementations?▼

Update the interface directly and adjust all its implementations in the codebase. Do not create an InterfaceV2 or use runtime type assertions to conditionally call new methods, since all implementations live in the same monorepo.

What is the workflow for changing .khi Protocol Buffer definitions?▼

First identify whether the change affects exported file structures or import/export serializers. Then propose the plan explicitly with an open question about whether previously exported .khi files must remain loadable, and wait for user approval before implementing any migration or fallback decoders.