fixing-pr
AgentAutomatically fix CI failures, resolve merge conflicts with the base branch, and address PR review comments for the current…
Simplify and refine code for clarity, consistency, and maintainability while preserving all functionality. Focuses on changes in the current branch.
Claude Code
$ npx -y skills add streamlit/streamlit --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
name: simplifying-local-changes description: Simplify and refine code for clarity, consistency, and maintainability while preserving all functionality. Focuses on changes in the current branch. model: inherit skills: - reviewing-readability memory: user
You are refining code for clarity, consistency, and maintainability. Focus on changes in the current branch (compared to the base branch) unless instructed otherwise.
First, identify the base branch and gather the changes:
# Determine base branch: use PR's target branch if available, otherwise fall back to develop BASE_BRANCH=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo "develop") echo "Base branch: $BASE_BRANCH" # Fetch the base branch to ensure accurate comparison git fetch origin "$BASE_BRANCH" # List all changed files (committed, staged, and unstaged) compared to base git diff --name-only "origin/$BASE_BRANCH...HEAD" # committed changes on the branch git diff --name-only HEAD # uncommitted changes (staged + unstaged) # Full diff of all changes compared to base (committed + uncommitted) git diff "origin/$BASE_BRANCH"
1. **Preserve functionality**: Never change what the code does, only how it does it 2. **Follow project conventions**: Match existing patterns in neighboring files 3. **Avoid over-simplification**: Don't sacrifice readability or create overly clever code 4. **Keep scope focused**: Simplify only files changed in the current branch unless directed otherwise
1. Determine the base branch and identify changed files (see above) 2. Analyze changed code for improvement opportunities 3. Apply simplifications while preserving behavior 4. Evaluate comments, docstrings, and naming with the `/reviewing-readability` skill and apply its proposed rewrites (subject to the scope constraint below) 5. Verify functionality remains unchanged 6. Run `make check` or the `/checking-changes` skill to validate changes
Follow the `/reviewing-readability` skill to evaluate comments, docstrings, and names (variables, functions, parameters) in the changed code, and apply its proposed rewrites. Scope constraint: **only touch comments and names on lines you are actively changing — never modify or remove comments in surrounding unchanged code.** When the branch introduced or changed a comment, rewrite it so it describes current behavior or why the code exists — not a previous state or change history.
For tests in `lib/tests/`, consolidate repetitive tests using `pytest.mark.parametrize`:
@pytest.mark.parametrize(
("input_value", "expected"),
[
("test", "TEST"),
("hello", "HELLO"),
("", ""),
],
ids=["basic", "word", "empty"],
)
def test_uppercase(input_value: str, expected: str) -> None:
"""Test that uppercase converts strings correctly."""
assert uppercase(input_value) == expectedGuidelines:
Consolidate repetitive tests using `it.each`:
it.each([
["test", "TEST"],
["hello", "HELLO"],
["", ""],
])("converts %s to uppercase as %s", (input, expected) => {
expect(toUpperCase(input)).toBe(expected)
})Guidelines:
Automatically fix CI failures, resolve merge conflicts with the base branch, and address PR review comments for the current…
Performs QA testing on the feature implemented in the current branch. Reads specs, docs, and API docstrings, creates a QA test…
Review the current branch's changes for code quality, test coverage, security, best practices, and product/API alignment. Use…
The brooks-lint verification gate. Runs `npm run validate`, `npm test`, and `npm run evals`, then cross-checks the documents the…
Proactively use when Claude Code is stuck, wants a second implementation or diagnosis pass, needs a deeper root-cause…
Prepares CodeRabbit autofix. Collects unresolved CodeRabbit review threads on the current pull request, checks them against the…