intent-based-dedup

Analyze code snippets for semantic equivalence to prevent incorrect deduplication.

Updated Jun 18, 2023
One-click install
npx skills add https://github.com/kuroweb/dotfiles --skill intent-based-dedup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: intent-based-dedup
Source: https://github.com/kuroweb/dotfiles/tree/main/agents/.cursor/skills/intent-based-dedup
Command: npx skills add https://github.com/kuroweb/dotfiles --skill intent-based-dedup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid the common pitfall of incorrectly deduplicating code that looks similar but serves different business purposes, preventing future maintenance headaches.

Core Features & Use Cases

  • Intent-Based Analysis: Differentiates between code that is literally the same and code that serves the same underlying goal.
  • DRY Principle Guidance: Assists in applying the DRY (Don't Repeat Yourself) principle correctly by identifying true code duplication.
  • Use Case: When reviewing code, if you find two functions that perform calculations using the same formula but for different domain concepts (e.g., attack points vs. crafting costs), this Skill will flag it as a dangerous duplication to avoid.

Quick Start

Use the intent-based-dedup skill to analyze two code snippets for potential duplication based on their underlying purpose.

Frequently Asked Questions about intent-based-dedup

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

FAQPage Schema
How do I identify incorrect code deduplication during a code review?

Apply the DRY principle correctly by identifying true code duplication through intent-based analysis. This differentiates between code that is literally the same and code that serves the same underlying goal, preventing dangerous refactoring of distinct business logic.

When should I not extract generic calculations during refactoring?

Do not extract generic calculations when the original code serves different domain concepts, such as attack points versus crafting costs. Extracting these shared formulas creates dangerous duplication that ignores specific business logic and future maintenance needs.

Does intent-based deduplication work with all programming languages?

Intent-based deduplication supports all programming languages by focusing on conceptual analysis rather than syntax. It evaluates semantic equivalence to guide refactoring and code review regardless of the specific tech stack.

What is the difference between literal text similarity and functional intent in code?

Use intent-based deduplication to analyze two code snippets for potential duplication based on their underlying purpose. This guides refactoring decisions by flagging dangerous similarities where functions perform calculations for different domain concepts.