Analyzes and verifies semantic equivalence between two functions, classes, or modules by examining control flow, data flow, and observable behavior. Use when comparing code implementations (refactored vs original, different implementations of same functionality, migration verification), determining if two code artifacts produce identical behavior, identifying behavioral differences between code versions, or validating that code changes preserve semantics. Supports formal reasoning and symbolic execution approaches.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill semantic-equivalence-verifier
This skill enables rigorous analysis of semantic equivalence between two code artifacts (functions, classes, or modules). It systematically compares control flow, data flow, and observable behavior to determine if implementations are functionally identical, and provides actionable guidance for achieving equivalence when differences exist.
Clearly identify the two code artifacts to compare:
Artifact A: [function/class/module name and location]
Artifact B: [function/class/module name and location]
Specify the equivalence scope:
Perform systematic static analysis on both artifacts:
Control Flow Analysis:
Data Flow Analysis:
x*2 vs x+x)Signature Analysis:
Analyze runtime behavior and observable effects:
Input-Output Mapping:
Side Effects:
Performance Characteristics:
For rigorous verification, apply formal methods:
Symbolic Execution:
Formal Proof:
Equivalence Checking:
Generate a comprehensive equivalence report using the template in assets/equivalence_report_template.md:
If Equivalent:
If Not Equivalent:
Different languages require adapted analysis approaches:
Statically Typed (Java, C++, Rust):
Dynamically Typed (Python, JavaScript):
Functional (Haskell, OCaml):
Refactoring Patterns:
temp=x; return temp ≡ return xOptimization Patterns:
x*0 ≡ 0Algorithm Substitution:
pow(x,2) ≡ x*xExample 1: Simple Function Comparison
# Artifact A
def sum_squares(n):
total = 0
for i in range(1, n+1):
total += i * i
return total
# Artifact B
def sum_squares(n):
return n * (n + 1) * (2*n + 1) // 6
Analysis: Mathematically equivalent for all non-negative integers. Different algorithms, same result.
Example 2: Class Refactoring
// Artifact A
class Calculator {
int add(int a, int b) { return a + b; }
int multiply(int a, int b) { return a * b; }
}
// Artifact B
class Calculator {
int add(int a, int b) { return a + b; }
int multiply(int a, int b) {
int result = 0;
for(int i = 0; i < b; i++) result += a;
return result;
}
}
Analysis: Not strictly equivalent - Artifact B fails for negative b. Partial equivalence for b >= 0.
For detailed guidance on specific analysis techniques:
references/formal_verification.mdreferences/symbolic_execution.mdreferences/language_patterns.mdExecute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
Comprehensive GitHub code review with AI-powered swarm coordination
Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line.
GitHub CLI - manage repositories, issues, pull requests, actions, releases, and more from the command line.
You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.
You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti
Take arabelatso/semantic-equivalence-verifier from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.