Skip to content

Commit a89bfc4

Browse files
Add /techdebt claude skill (#10515)
* feat(ai): Add techdebt claude skill * feat(ai): Remove unnecessary examples * feat(ai): Simplify the skill to be more focused * feat(ai): Add skill metadata * fix(ai): Fix diff to compute merge base first
1 parent 9c3d035 commit a89bfc4

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.claude/skills/techdebt/SKILL.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: techdebt
3+
description: Analyze branch changes for technical debt, code duplication, and unnecessary complexity
4+
user-invocable: true
5+
context: fork
6+
allowed-tools:
7+
- Bash
8+
- Read
9+
- Grep
10+
- Glob
11+
---
12+
13+
# Techdebt Cleanup Skill
14+
15+
Analyze changes on the current branch to identify and fix technical debt, code duplication, and unnecessary complexity.
16+
17+
## Instructions
18+
19+
### Step 1: Get Branch Changes
20+
21+
Find the merge-base (where this branch diverged from master) and compare against it:
22+
23+
```bash
24+
# Find upstream (DataDog org repo)
25+
UPSTREAM=$(git remote -v | grep -E 'DataDog/[^/]+(.git)?\s' | head -1 | awk '{print $1}')
26+
if [ -z "$UPSTREAM" ]; then
27+
echo "No DataDog upstream found, using origin"
28+
UPSTREAM="origin"
29+
fi
30+
31+
# Find the merge-base (commit where this branch diverged from master)
32+
MERGE_BASE=$(git merge-base HEAD ${UPSTREAM}/master)
33+
echo "Comparing changes introduced on this branch since diverging from master using base commit: $MERGE_BASE"
34+
35+
git diff $MERGE_BASE --stat
36+
git diff $MERGE_BASE --name-status
37+
```
38+
39+
If no changes exist, inform the user and stop.
40+
41+
If changes exist, read the diff and the full content of modified source files (not test files) to understand context.
42+
43+
### Step 2: Analyze for Issues
44+
45+
Look for:
46+
47+
**Code Duplication**
48+
- Similar code blocks that should be extracted into shared functions
49+
- Copy-pasted logic with minor variations
50+
51+
**Unnecessary Complexity**
52+
- Over-engineered solutions (abstractions used only once)
53+
- Excessive indirection or layers
54+
- Backward compatibility shims that aren't needed
55+
56+
**Redundant Code**
57+
- Dead code paths
58+
- Overly defensive checks for impossible scenarios
59+
60+
### Step 3: Report and Fix
61+
62+
Present a concise summary of issues found with file:line references.
63+
64+
Then ask the user if they want you to fix the issues. When fixing:
65+
- Make one logical change at a time
66+
- Do NOT change behavior, only refactor
67+
- Skip trivial or stylistic issues

0 commit comments

Comments
 (0)