Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions examples/ai-slop-remover.claude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
model: opus
_base: "{{ _base | default: 'main' }}"
---

# Remove AI Code Slop

Identify and remove AI-generated code artifacts introduced in this branch.

## Diff Analysis

Analyzing changes against `{{ _base }}`:

```
Files changed:
!git diff {{ _base }}...HEAD --stat

Actual diff:
!git diff {{ _base }}...HEAD
```
Comment on lines +14 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifier to git diff command block.

The fenced code block is missing a language identifier. Since it contains a shell command with template variable substitution, use bash as the language identifier for consistency with the validation section below (line 125) and to satisfy markdown linting requirements.

-```
+```bash
 Files changed:
 !git diff {{ _base }}...HEAD --stat
 
 Actual diff:
 !git diff {{ _base }}...HEAD
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

14-14: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In examples/ai-slop-remover.claude.md around lines 14 to 20, the fenced code
block containing git diff commands lacks a language identifier; update the
opening fence to include "bash" (i.e., replace the leading ``` with ```bash) so
the block is properly marked as shell code and consistent with the validation
section.


## Slop Detection

Look for and remove:

### 1. Excessive Comments
- Comments that explain obvious code
- Block comments that restate code
- Multiple comments on consecutive lines
- Comments inconsistent with file style
- "TODO" or "FIXME" left by AI

Example to remove:
```typescript
// Check if user is valid
if (!user) {
return null;
}

// Loop through items
items.forEach(item => {
// Process the item
process(item);
});
```

Better:
```typescript
if (!user) return null;

items.forEach(item => process(item));
```
Comment on lines +34 to +52
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Specify language for TypeScript examples.

All TypeScript code examples should have language identifiers.

 Example to remove:
-```typescript
+```typescript
 // Check if user is valid
 if (!user) {
   return null;
 }

 // Loop through items
 items.forEach(item => {
   // Process the item
   process(item);
 });
-```
+```typescript

 Better:
-```typescript
+```typescript
 if (!user) return null;

 items.forEach(item => process(item));
-```
+```typescript
🤖 Prompt for AI Agents
examples/ai-slop-remover.claude.md lines 34-52: the TypeScript code fences are
inconsistent and missing proper language identifiers and closing fences; update
every code block to begin with "```typescript" and end with "```" (remove the
stray standalone "typescript" words and any duplicated or mismatched fence
markers) so both the original and "Better" examples are correctly fenced as
TypeScript.


### 2. Defensive Checks
- Extra null/undefined checks on validated inputs
- Redundant type guards after type narrowing
- Try/catch blocks for functions that don't throw
- Validation in code paths already validated upstream

Example to remove:
```typescript
// After already checking user exists
if (user) {
if (user.id) {
try {
const result = processUser(user);
} catch (error) {
// This function never throws
console.error(error);
}
}
}
```

### 3. Type Casts (`any`)
- `as any` to bypass type errors
- `// @ts-ignore` comments
- `any` typed parameters that should be specific

Example to remove:
```typescript
const data = response.data as any; // Instead of properly typing
if ((error as any).statusCode === 404) {} // Instead of type guard
```
Comment on lines +81 to +84
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Specify language for type cast examples.

Add typescript identifier to the code block.

 Example to remove:
-```typescript
+```typescript
 const data = response.data as any; // Instead of properly typing
 if ((error as any).statusCode === 404) {} // Instead of type guard
-```
+```typescript
🤖 Prompt for AI Agents
In examples/ai-slop-remover.claude.md around lines 81 to 84, the fenced code
block showing type-cast examples lacks the TypeScript language identifier;
update the opening and closing fences so the block is fenced as ```typescript
(and keep the closing ```), ensuring the code block is labeled for syntax
highlighting and matches the intent of the examples.


### 4. Inconsistent Style
- Logging inconsistent with the file
- Error handling that doesn't match patterns
- Variable naming that diverges from conventions
- Formatting different from surrounding code
- Excessive whitespace or empty lines

Example to remove:
```typescript
// If file never logs debug info:
console.debug("Processing item", item);

// If file uses throw, not console.error:
console.error("Failed");
```
Comment on lines +94 to +100
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Specify language for inconsistent style examples.

Add typescript identifier to the code block.

 Example to remove:
-```typescript
+```typescript
 // If file never logs debug info:
 console.debug("Processing item", item);

 // If file uses throw, not console.error:
 console.error("Failed");
-```
+```typescript
🤖 Prompt for AI Agents
In examples/ai-slop-remover.claude.md around lines 94 to 100 the fenced code
block is missing a language identifier: update the opening and closing fences to
include the TypeScript language tag so the block reads as a TypeScript code
block (i.e., change the triple backtick fences to specify "typescript" on the
opening fence and ensure the block is closed correctly).


## Instructions

For each file with changes:

1. Review the actual code changes
2. Identify obvious AI slop (unnecessary comments, defensive checks, casts)
3. Remove it while preserving functionality
4. Ensure remaining code matches file style
5. Run: `npm test` to verify no breakage

Generate a clean, minimal diff that removes only the slop.

## Modified Files

```
!git diff {{ _base }}...HEAD --name-only
```
Comment on lines +116 to +118
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifier to git diff command block.

The fenced code block is missing a language identifier. Specify bash to enable proper syntax highlighting and align with the validation section (line 125).

-```
+```bash
 !git diff {{ _base }}...HEAD --name-only
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

116-116: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In examples/ai-slop-remover.claude.md around lines 116 to 118, the fenced code
block containing the git diff command lacks a language identifier; update the
opening fence to include "bash" (i.e., replace the triple backticks with
```bash) so the block becomes ```bash followed by the command and closing ``` to
enable proper syntax highlighting and match the validation expectation.


For each file above, review and clean.

## Validation

After cleanup:
```bash
npm test
npm run lint
git diff {{ _base }}...HEAD
```

Ensure diff is minimal and removes only slop, not functionality.

---

**Output**: Show the cleaned diff with brief explanation of what was removed.