Skip to content
Agentmart
Submit a tool

code-smells/dispensables

Detect and remove Dispensables — pointless and unneeded code elements.

Skill by gentleman-programming

IndexedApache-2.0
Write a review

Install

Works with Claude Code. Read the repository before you give any tool access to your data.

npx agentmarket install skill/johnnystefan-code-smells-dispensables

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Detect and remove Dispensables — pointless and unneeded code elements. Trigger: When identifying Comments as deodorant, Duplicate Code, Lazy Class, Data Class, Dead Code, or Speculative Generality.

Use cases: data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/code-smells-dispensables

Tools it pre-approves 7

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read,
  • Edit,
  • Write,
  • Glob,
  • Grep,
  • Bash,
  • Task

What's inside

Skill name
code-smells/dispensables
Description
Detect and remove Dispensables — pointless and unneeded code elements. Trigger: When identifying Comments as deodorant, Duplicate Code, Lazy Class, Data Class, Dead Code, or Speculative Generality.
License
Apache-2.0
Allowed tools
Read,, Edit,, Write,, Glob,, Grep,, Bash,, Task
Metadata
author: gentleman-programming · version: 1.0 · auto_invoke: Reviewing code for unnecessary elements and duplication
Instructions
93 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Agent Skills spec issues

  • name: only lowercase letters, digits and single hyphens allowed
  • name: "code-smells/dispensables" does not match folder "dispensables"

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Skill: Detect and Refactor Dispensables

## Purpose

This skill enables the agent to identify and remove "Dispensables" — pointless and unneeded code elements whose absence makes the codebase cleaner, more efficient, and easier to understand.

## Domain Knowledge: The 6 Dispensables

1. **Comments:** A method is filled with explanatory comments. Comments often act as a "deodorant" for fishy code that should be improved instead.
2. **Duplicate Code:** Two code fragments look almost identical. Usually occurs through copy-paste programming or multiple developers working on the same feature.
3. **Lazy Class:** A class that doesn't do enough to earn the cost of its maintenance.
4. **Data Class:** A class containing only fields and basic accessors (getters/setters). These are mere containers that cannot independently operate on their data.
5. **Dead Code:** Variables, parameters, fields, methods, or classes that are no longer used.
6. **Speculative Generality:** Unused classes, methods, or parameters created "just in case" for future features that never arrived.

## Procedural Instructions

### 1. Detection Phase

- **Audit Comments:** Identify code fragments that cannot be understood without comments. If a comment explains _what_ the code does, it's a candidate for refactoring.
- **Scan for Duplication:** Look for similar logic in different methods of the same class or across different classes in the same hierarchy.
- **Evaluate Class Value:** Identify classes that have become ridiculously small after refactoring or were designed for features that don't exist.
- **Check Behavioral Encapsulation:** Identify classes that only hold data and lack methods for operating on that data.
- **Locate Dead Elements:** Use static analysis to find methods or variables that are never called or referenced.

### 2. Treatment Phase

- **For Comments:**
  - Use **Extract Variable** for complex expressions.
  - Use **Extract Method** and **Rename Method** to make the code self-explanatory.
- **For Duplicate Code:**
  - Use **Extract Method** to centralize logic.
  - Use **Pull Up Field/Method** if duplication is in subclasses.
  - Use **Substitute Algorithm** if two methods do the same thing differently.
- **For Lazy Classes & Speculative Generality:**
  - Use **Inline Class** or **Collapse Hierarchy** to merge or delete the redundant structure.
  - Use **Inline Method** or **Remove Parameter** for unused elements.
- **For Data Classes:**
  - Use **Encapsulate Field** to hide public fields.
  - Use **Move Method** and **Extract Method** to migrate functionality from the client into the Data Class itself.

## TypeScript Examples

### Comments vs. Self-Explanatory Code

```typescript
// BAD: Comment explaining a complex expression
// Check to see if the employee is eligible for full benefits
if (employee.flags & HOURLY_FLAG && employee.age > 65) {
  /* ... */
}

// GOOD: Refactored using Extract Variable
const isEligibleForFullBenefits =
  employee.flags & HOURLY_FLAG && employee.age > 65;
if (isEligibleForFullBenefits) {
  /* ... */
}
```

### Data Class to Rich Domain Object

```typescript
// BAD: A Data Class with no behavior
class Rectangle {
  constructor(
    public width: number,
    public height: number,
  ) {}
}
const rect = new Rectangle(10, 20);
const area = rect.width * rect.height; // Client does the work

// GOOD: Behavior moved into the class
class Rectangle {
  constructor(
    private width: number,
    private height: number,
  ) {}

  getArea(): number {
    return this.width * this.height;
  }
}
```

## Payoff

- **Reduced Size:** The codebase becomes slimmer and easier to navigate.
- **Lower Maintenance:** Fewer classes and methods mean less mental bandwidth required.
- **Improved Clarity:** Code becomes intuitive, making comments unnecessary and logic obvious.

From johnnystefan/test-saas-business, Apache-2.0.

More from johnnystefan/test-saas-business

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 1, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from gentleman-programming

Cite this page

code-smells/dispensables skill. Agent Mart. https://agentmart.dev/skills/johnnystefan-code-smells-dispensables (last updated 2026-10-24)