deja-code

Detect duplicated code patterns as ESLint errors in JavaScript/TypeScript projects.

409|75|Updated Dec 12, 2023
One-click install
npx skills add https://github.com/breadboard-ai/breadboard --skill deja-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: deja-code
Source: https://github.com/breadboard-ai/breadboard/tree/main/.agent/skills/deja-code
Command: npx skills add https://github.com/breadboard-ai/breadboard --skill deja-code

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detect when you're writing code that already exists as a shared utility and surface it in real-time via ESLint errors, helping you avoid duplicating logic and reduce cognitive load.

Core Features & Use Cases

  • Surface existing utilities in real-time as ESLint errors with clear guidance to the file path.
  • Encourage consistent usage of shared helpers by surfacing matches across files and modules.
  • Use case: When you draft a multi-file utility, you get an immediate error pointing to the existing implementation and its location.

Quick Start

Run the deja-code system on your project to surface existing utilities as you type.

Frequently Asked Questions about deja-code

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

FAQPage Schema
How do I detect duplicate code patterns that already exist as shared utilities in real-time?

You can detect duplicate code patterns in real-time by implementing custom ESLint rules that flag matching logic during development, immediately surfacing existing shared utilities and their file paths to prevent codebase duplication.

How do I create a custom ESLint rule to enforce consistent utility usage across a multi-file JavaScript project?

To create a custom ESLint rule for a multi-file JavaScript project, implement the rule named deja-code-<name>, wire it into your local lint configuration, and update the utility catalog with the new rule entry to enforce consistent shared helper usage.

Does this pattern detection approach work with both JavaScript and TypeScript codebases?

Yes, this pattern detection approach works with both JavaScript and TypeScript codebases, specifically targeting multi-file projects that reuse utilities to ensure consistent usage and reduce cognitive load across the codebase.

What is the best way to surface existing utilities to developers as they type?

The best way to surface existing utilities is through real-time ESLint errors that provide clear guidance to the file path of the existing implementation, immediately alerting developers when they draft code that duplicates shared logic.

Why should I use ESLint errors for code analysis instead of relying on manual code reviews to find duplicated logic?

ESLint errors provide real-time code analysis that catches duplicated logic as you type, directly pointing to existing implementations, whereas manual code reviews occur later and often miss subtle shared utility matches across multiple files.

What do I need to set up before wiring custom lint rules into my local config for code analysis?

Before wiring custom lint rules into your local config, you need a multi-file JavaScript or TypeScript project with shared utilities, an existing ESLint setup, and a catalog to update with the new rule definitions for accurate pattern detection.