spk-doctrine-semantic-compression

Reduces and deduplicates code while preserving existing behavior through semantic compression.

1.6k|156|Updated Oct 9, 2025
One-click install
npx skills add https://github.com/Priivacy-ai/spec-kitty --skill spk-doctrine-semantic-compression
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spk-doctrine-semantic-compression
Source: https://github.com/Priivacy-ai/spec-kitty/tree/main/src/charter/offering/skills/spk-doctrine-semantic-compression
Command: npx skills add https://github.com/Priivacy-ai/spec-kitty --skill spk-doctrine-semantic-compression

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Codebases accumulate duplicate logic, dead code, and competing implementations of the same behavior, making maintenance harder. This Skill guides behavior-preserving reduction so you can simplify code without breaking what already works.

Core Features & Use Cases

  • Behavioral Envelope Mapping: Identifies protected behavior before any edit so reductions never change observable outcomes.
  • Redundancy Detection: Finds exact, parameterized, structural, and semantic duplication across the codebase.
  • Canonical Consolidation: Merges competing behavioral paths behind a single canonical owner and deletes proven dead code.
  • Use Case: When a module has three near-identical validation functions, use this Skill to extract one shared implementation, verify equivalence, and report residual risk.

Quick Start

Ask the agent to reduce and deduplicate this module while preserving its current behavior, then verify equivalence before deleting anything.

Frequently Asked Questions about spk-doctrine-semantic-compression

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

FAQPage Schema
How do I refactor code without changing its behavior?

Map the behavioral envelope first to identify protected behavior, then reduce duplication one concept at a time. Verify equivalence after each change and report evidence plus residual risk before considering the reduction complete.

How to find and remove duplicate code safely?

Look for four redundancy types: exact, parameterized, structural, and semantic duplication. Extract one implementation per concept, consolidate competing paths behind a canonical owner, and only delete code proven to be dead.

When should I not delete dead code during refactoring?

Do not delete when the protected behavior is unknown or when verification evidence is unavailable for a non-trivial deletion. The Skill explicitly stops in these conditions to prevent accidental behavior changes.

What is the difference between refactoring and feature expansion?

Refactoring reduces or restructures code while preserving existing behavior, whereas feature expansion adds new behavior. This Skill stops if the request is actually feature expansion, since that falls outside behavior-preserving reduction.

How do I verify two code implementations are equivalent?

Verify equivalence by comparing observable behavior against the mapped behavioral envelope, using tests or behavioral checks as evidence. Report the evidence gathered along with any residual risk that remains unverified.