| name | description |
|---|---|
polish-pr |
Polish implementation before PR submission. Invoke after completing a task to clean comments, run formatting/linting, and ensure tests pass. |
Execute the following steps in order. Do not proceed to the next step until the current step completes successfully.
- Run
git diff --name-only HEAD~1orgit statusto identify files modified for this task - Focus only on files that are part of the current implementation
For each modified source file:
- Read the file content
- Preserve:
- Docstrings (triple-quoted strings for modules, classes, functions)
- TODO/FIXME comments with ticket references
- Comments explaining non-obvious logic or workarounds
- Remove:
- Commented-out code
- Redundant comments that restate what the code does (e.g.,
# increment counterbeforecounter += 1) - Debug print statements or logging left from development
- Placeholder comments like
# do something here
- Write the cleaned file
- Read the
Makefile(ormakefile) in the repository root - Identify targets for:
- Formatting (look for:
format,fmt,black,prettier,style) - Linting (look for:
lint,check,flake8,eslint,ruff,mypy) - Testing (look for:
test,tests,pytest,unittest)
- Formatting (look for:
- If no Makefile exists, check
package.jsonscripts orpyproject.tomlfor equivalent commands
- Execute the formatting command (e.g.,
make format) - If formatting modifies files, that's expected—no action needed
- Execute the linting command (e.g.,
make lint) - If linting fails:
- Parse the error output to identify file, line, and issue
- Fix each issue in the source files
- Re-run linting
- Repeat until linting passes with no errors
- Execute the test command (e.g.,
make test) - If tests fail:
- Parse test output to identify failing tests and error messages
- Determine if the failure is in test code or implementation code
- Apply minimal fixes to resolve the failure
- Re-run tests
- Repeat until all tests pass
- Run formatting again to ensure fixes didn't introduce style issues
- Run linting again to confirm clean state
- Report summary: files cleaned, lint issues fixed, tests passing
- Do not modify test assertions unless they are clearly incorrect
- Do not change public API signatures without explicit approval
- If a lint rule seems wrong, flag it rather than disabling the rule
- Limit fix iterations to 5 attempts per step; if still failing, report the issue and stop
How to use this skill?
Claude Code
Run:
Copy the contents of the file and paste it in the SKILL.md file we created. Start a fresh claude session and the polish-pr skill should be available.
Codex CLI
Run:
Copy the contents of the file and paste it in the SKILL.md file we created. Start a fresh codex session and the polish-pr skill should be available.