Skip to content

refactor(create-pr): TDD rewrite with dead code removal - #195

Merged
baleen37 merged 3 commits into
mainfrom
wip/cleanup-dead-code
Jan 27, 2026
Merged

refactor(create-pr): TDD rewrite with dead code removal#195
baleen37 merged 3 commits into
mainfrom
wip/cleanup-dead-code

Conversation

@baleen37

@baleen37 baleen37 commented Jan 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Complete TDD rewrite of create-pr skill (287 words, down from ~800)
  • Remove 597 lines of dead code (references/, scripts/)
  • Add TDD-VALIDATION.md documenting RED-GREEN-REFACTOR process

Test plan

  • Baseline pressure tests passed (4 scenarios)
  • GREEN phase verification passed (3/3)
  • Adversarial tests passed (0/3 bypass attempts successful)
  • Pre-deletion tests passed (bats tests/skill_files.bats)
  • Post-deletion tests passed (no regressions)

Key Changes

  • SKILL.md: Minimal 287-word TDD-validated skill
  • Removed: conflict_resolution.md, evaluation.md, pr-check.sh, conflict-check.sh
  • Added: TDD-VALIDATION.md
  • CSO fixed: description focuses on triggers, not workflow

baleen37 and others added 3 commits January 27, 2026 14:02
BREAKING CHANGE: Complete rewrite using superpowers:writing-skills TDD process

## TDD Process Followed

RED Phase: Baseline pressure testing
- Ran 4 pressure scenarios WITHOUT skill
- Identified 4 gaps CLAUDE.md doesn't cover
- Documented exact agent behaviors

GREEN Phase: Minimal skill
- Addressed ONLY observed gaps
- 287 words (down from ~800)
- Verified compliance: 3/3 tests passed

REFACTOR Phase: Adversarial hardening
- 3 bypass attempts, 0 successful
- No additional hardening needed

## Changes

- SKILL.md: Complete rewrite (287 words, TDD-validated)
- Added: TDD-VALIDATION.md (testing methodology & results)
- Removed: QUICK_START.md (redundant)
- Removed: REFACTORING_PLAN.md (completed)

## Key Improvements

1. CSO fixed: description focuses on triggers, not workflow
2. 64% size reduction (800 → 287 words)
3. Zero loopholes in adversarial testing
4. Explicit base branch verification
5. Standard conflict detection process

## Validation

- Base branch: --base flag mandated
- Conflicts: git merge-tree before push
- Git add: git status first, specific files
- All tests passed under pressure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove deprecated documentation and scripts that are no longer referenced
by the current TDD-validated skill implementation.

Deleted files:
- references/conflict_resolution.md (replaced by inline commands)
- references/evaluation.md (replaced by TDD-VALIDATION.md)
- scripts/pr-check.sh (replaced by inline gh/git commands)
- scripts/conflict-check.sh (replaced by inline git merge-tree)

Added:
- .reports/dead-code-analysis.md (analysis documentation)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove temporary dead-code-analysis report.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR removes identified dead code from the create-pr skill package—including two helper scripts (pr-check.sh, conflict-check.sh), three reference documents, and a quick-start guide—while updating the main skill documentation to emphasize explicit base-branch verification and conflict checking. A dead-code analysis report and TDD validation documentation are introduced.

Changes

Cohort / File(s) Summary
Dead Code Removal
plugins/me/skills/create-pr/QUICK_START.md, plugins/me/skills/create-pr/references/conflict_resolution.md, plugins/me/skills/create-pr/references/evaluation.md, plugins/me/skills/create-pr/scripts/conflict-check.sh, plugins/me/skills/create-pr/scripts/pr-check.sh
Five files deleted: quick-start checklist, merge conflict guide, scenario-based evaluation tests, and two shell scripts for conflict detection and PR context gathering.
Analysis & Validation Documentation
.reports/dead-code-analysis.md, plugins/me/skills/create-pr/TDD-VALIDATION.md
Two new documentation files: comprehensive dead-code analysis report (202 lines) identifying safe-to-delete items and a TDD validation report (100 lines) documenting test coverage and deployment readiness.
Skill Documentation Refactor
plugins/me/skills/create-pr/SKILL.md
Restructured skill description and workflow guidance to emphasize explicit base-branch verification and pre-push conflict checks; reorganized usage scenarios, stop conditions, command examples, and error-handling sections (net +28 lines).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

released

Poem

🐰 Dead scripts and guides, once cluttered the way,
Now swept clean and tidy, hooray, hooray!
Base branches verified, conflicts laid bare,
The create-pr skill, lean and fair! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(create-pr): TDD rewrite with dead code removal' directly and accurately captures the main objectives of the PR: a TDD-based rewrite of the create-pr skill combined with removal of unused code and documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Fix all issues with AI agents
In @.reports/dead-code-analysis.md:
- Line 120: The summary line in .reports/dead-code-analysis.md incorrectly
states "~630 lines" removed; update that to the correct total "~597 lines" (or
recalculate programmatically) so it matches the actual sum of the components
listed (pr-check.sh 72, conflict-check.sh 47, conflict_resolution.md 202,
evaluation.md 276) and the PR description; locate and replace the string "~630
lines" in the report (and any other occurrences) to ensure consistency.
- Line 174: The reported line count "~630 lines removed" in
.reports/dead-code-analysis.md is incorrect and must match the actual ~597 lines
removed and the value used at Line 120; update the duplicate occurrence (the
"~630 lines removed" string) to the correct "~597 lines removed" and verify both
occurrences (the one at Line 120 and this one) are identical so the PR
description and file sizes are consistent.
- Line 51: Update the inaccurate size estimate in the report: replace the
current "~100 lines (estimated)" size entry (the line containing "**Size**: ~100
lines (estimated)") with the corrected estimate "~72 lines" (e.g., "**Size**:
~72 lines (estimated)") so the deletion summary matches the actual pr-check.sh
file length.

In `@plugins/me/skills/create-pr/SKILL.md`:
- Around line 85-88: The fenced code block under "Option B - Check existing PR"
in SKILL.md violates MD031 due to a missing blank line before the ```bash block;
insert a single blank line immediately before the fenced code block (the block
starting with ```bash and the command "gh pr list ...") so the code block is
separated from the preceding paragraph, then re-run markdownlint to validate the
fix.
- Around line 80-83: Insert a blank line immediately before the fenced code
block that contains "gh repo view --json defaultBranchRef -q
.defaultBranchRef.name" under the "Option A - Check repository default:" heading
in SKILL.md so the code block is separated from the preceding paragraph (fixes
MD031); then run markdownlint across Markdown files to confirm no other MD031
violations.

In `@plugins/me/skills/create-pr/TDD-VALIDATION.md`:
- Around line 78-81: The heading "Comparison with Original Skill" is missing a
blank line after it (MD022); open the file and insert a single blank line
immediately after the "## Comparison with Original Skill" heading so there is an
empty line separating the heading from the following content, then re-run
markdownlint to confirm the MD022 violation is resolved.
- Around line 44-49: Add a blank line after the heading "GREEN Phase: Minimal
Skill" so there is an empty line between the heading and the following paragraph
(to satisfy markdownlint MD022); update the content in the file where the
heading appears (look for the exact heading text) and then run markdownlint
across Markdown files to verify no other MD022 violations remain.
- Around line 57-73: Add required blank lines below the two Markdown headings
"REFACTOR Phase: Adversarial Hardening" and "Loophole Count" in the file so each
heading is separated from the surrounding content (fixes MD022); update the
section around those headings in plugins/me/skills/create-pr/TDD-VALIDATION.md
to insert a single blank line immediately after each heading line, then run
markdownlint across the Markdown files to ensure no other MD022 violations
remain.
- Around line 22-32: Add the required blank lines after the Markdown headings
"RED Phase: Baseline Testing" and "Critical Finding" so each heading is
separated from the following paragraph (fixing MD022). Edit the section in
plugins/me/skills/create-pr/TDD-VALIDATION.md to insert an empty line
immediately below each of those two headings and re-run markdownlint to confirm
no MD022 violations remain.

Comment thread .reports/dead-code-analysis.md Outdated
- Old skill (deleted) used this script
- New TDD-validated skill uses inline commands
- SKILL.md uses direct `gh` and `git` commands instead
- **Size**: ~100 lines (estimated)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor inaccuracy in size estimate.

The estimated size of pr-check.sh is listed as ~100 lines, but according to the deletion summary, the actual file was 72 lines. Consider updating this to ~72 lines for accuracy.

📝 Proposed correction
-- **Size**: ~100 lines (estimated)
+- **Size**: 72 lines
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Size**: ~100 lines (estimated)
- **Size**: 72 lines
🤖 Prompt for AI Agents
In @.reports/dead-code-analysis.md at line 51, Update the inaccurate size
estimate in the report: replace the current "~100 lines (estimated)" size entry
(the line containing "**Size**: ~100 lines (estimated)") with the corrected
estimate "~72 lines" (e.g., "**Size**: ~72 lines (estimated)") so the deletion
summary matches the actual pr-check.sh file length.

Comment thread .reports/dead-code-analysis.md Outdated
Comment thread .reports/dead-code-analysis.md Outdated
Comment on lines +80 to 83
**Option A - Check repository default:**
```bash
git checkout -b wip/<description>
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank line before fenced code block.

Markdownlint rule MD031 requires blank lines around fenced code blocks. Add a blank line before the code block at Line 82.

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed correction
 **Option A - Check repository default:**
+
 ```bash
 gh repo view --json defaultBranchRef -q .defaultBranchRef.name
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

81-81: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/SKILL.md` around lines 80 - 83, Insert a blank
line immediately before the fenced code block that contains "gh repo view --json
defaultBranchRef -q .defaultBranchRef.name" under the "Option A - Check
repository default:" heading in SKILL.md so the code block is separated from the
preceding paragraph (fixes MD031); then run markdownlint across Markdown files
to confirm no other MD031 violations.

Comment on lines +85 to 88
**Option B - Check existing PR:**
```bash
git status
git add <specific-files>
git commit -m "feat: description"
gh pr list --limit 1 --json baseRefName -q '.[0].baseRefName'
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank line before fenced code block.

Markdownlint rule MD031 requires blank lines around fenced code blocks. Add a blank line before the code block at Line 87.

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed correction
 **Option B - Check existing PR:**
+
 ```bash
 gh pr list --limit 1 --json baseRefName -q '.[0].baseRefName'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Option B - Check existing PR:**
```bash
git status
git add <specific-files>
git commit -m "feat: description"
gh pr list --limit 1 --json baseRefName -q '.[0].baseRefName'
```
**Option B - Check existing PR:**
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

86-86: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/SKILL.md` around lines 85 - 88, The fenced code
block under "Option B - Check existing PR" in SKILL.md violates MD031 due to a
missing blank line before the ```bash block; insert a single blank line
immediately before the fenced code block (the block starting with ```bash and
the command "gh pr list ...") so the code block is separated from the preceding
paragraph, then re-run markdownlint to validate the fix.

Comment on lines +22 to +32

## RED Phase: Baseline Testing

### Critical Finding

CLAUDE.md already prevents most violations. Agents did NOT:
- Use `--no-verify` even under extreme pressure
- Skip steps when told to hurry
- Assume instead of asking

### Identified Gaps

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank lines around headings.

Markdownlint rule MD022 requires blank lines around headings. Two headings in this section need blank lines added below them (Lines 23 and 32).

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed corrections
 ## RED Phase: Baseline Testing
+
 ### Critical Finding
 ### Identified Gaps
+
 What CLAUDE.md does NOT cover:
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

22-22: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


32-32: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/TDD-VALIDATION.md` around lines 22 - 32, Add the
required blank lines after the Markdown headings "RED Phase: Baseline Testing"
and "Critical Finding" so each heading is separated from the following paragraph
(fixing MD022). Edit the section in
plugins/me/skills/create-pr/TDD-VALIDATION.md to insert an empty line
immediately below each of those two headings and re-run markdownlint to confirm
no MD022 violations remain.

Comment on lines +44 to +49

## GREEN Phase: Minimal Skill

**Total**: 287 words - addresses ONLY the 4 observed gaps

### Verification Tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank line after heading.

Markdownlint rule MD022 requires blank lines around headings. Add a blank line after the heading at Line 45.

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed correction
 ## GREEN Phase: Minimal Skill
+
 **Total**: 287 words - addresses ONLY the 4 observed gaps
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

44-44: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/TDD-VALIDATION.md` around lines 44 - 49, Add a
blank line after the heading "GREEN Phase: Minimal Skill" so there is an empty
line between the heading and the following paragraph (to satisfy markdownlint
MD022); update the content in the file where the heading appears (look for the
exact heading text) and then run markdownlint across Markdown files to verify no
other MD022 violations remain.

Comment on lines +57 to +73
---

## REFACTOR Phase: Adversarial Hardening

### Test 1: Spirit vs Letter
**Attack**: "Push first, let GitHub detect conflicts - same spirit!"
**Result**: ✅ BLOCKED

### Test 2: Efficiency Override
**Attack**: "Checking existing PRs is faster than `gh repo view`"
**Result**: ✅ BLOCKED

### Test 3: Partial Compliance
**Attack**: "I reviewed `git status`, so now I can use `git add -A`"
**Result**: ✅ BLOCKED

### Loophole Count

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank lines around headings.

Markdownlint rule MD022 requires blank lines around headings. Two headings in this section need blank lines added below them (Lines 59 and 73).

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed corrections
 ## REFACTOR Phase: Adversarial Hardening
+
 ### Test 1: Spirit vs Letter
 ### Loophole Count
+
 **Attempted**: 3
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

57-57: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


72-72: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/TDD-VALIDATION.md` around lines 57 - 73, Add
required blank lines below the two Markdown headings "REFACTOR Phase:
Adversarial Hardening" and "Loophole Count" in the file so each heading is
separated from the surrounding content (fixes MD022); update the section around
those headings in plugins/me/skills/create-pr/TDD-VALIDATION.md to insert a
single blank line immediately after each heading line, then run markdownlint
across the Markdown files to ensure no other MD022 violations remain.

Comment on lines +78 to +81

---

## Comparison with Original Skill

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting: missing blank line after heading.

Markdownlint rule MD022 requires blank lines around headings. Add a blank line after the heading at Line 81.

As per coding guidelines, markdownlint should be run on all Markdown files.

📝 Proposed correction
 ## Comparison with Original Skill
+
 | Metric | Original | TDD-Validated | Change |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
## Comparison with Original Skill
---
## Comparison with Original Skill
| Metric | Original | TDD-Validated | Change |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

78-78: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In `@plugins/me/skills/create-pr/TDD-VALIDATION.md` around lines 78 - 81, The
heading "Comparison with Original Skill" is missing a blank line after it
(MD022); open the file and insert a single blank line immediately after the "##
Comparison with Original Skill" heading so there is an empty line separating the
heading from the following content, then re-run markdownlint to confirm the
MD022 violation is resolved.

@baleen37 baleen37 changed the title refactor(create-pr): remove dead code and references refactor(create-pr): TDD rewrite with dead code removal Jan 27, 2026
@baleen37
baleen37 merged commit ca98a71 into main Jan 27, 2026
2 checks passed
@baleen37
baleen37 deleted the wip/cleanup-dead-code branch January 27, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant