.github/skills/code-simplifier/SKILL.md
Analyzes recently modified code and creates pull requests with simplifications that improve clarity, consistency, and maintainability while preserving functionality
npx skillsauth add microsoft/ghqr code-simplifierInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for analyzing and simplifying recently modified code to improve clarity, consistency, and maintainability while preserving exact functionality.
This skill enables agents to:
Use this skill when:
Avoid over-simplification that could:
Identify files modified in the last 24 hours from all sources:
Option A: Local File Changes (filesystem-based)
# Find files modified in the last 24 hours (includes uncommitted changes)
find . -type f -mtime -1 -not -path './.git/*' -not -path './node_modules/*' -not -path './vendor/*'
# Or using git to find modified files (staged and unstaged)
git status --porcelain
# Find recently modified tracked files
git diff --name-only HEAD~10 # Adjust based on commit frequency
Option B: Git History (committed changes)
# Get yesterday's date in ISO format
YESTERDAY=$(date -d '1 day ago' '+%Y-%m-%d' 2>/dev/null || date -v-1d '+%Y-%m-%d')
# List recent commits
git log --since="24 hours ago" --pretty=format:"%H %s" --no-merges
# List files changed in recent commits
git log --since="24 hours ago" --name-only --pretty=format:"" | sort -u
Option C: GitHub PRs and Commits (remote changes)
Use GitHub tools to:
Combine all sources to get a comprehensive list of recently modified files.
From all identified sources (local changes, commits, PRs):
.go, .js, .ts, .tsx, .jsx, .py, .rb, .java, .cs, .php, .cpp, .c, .rs, etc.)# Example: Combine filesystem and git changes, filter source files
{
find . -type f -mtime -1 -not -path './.git/*' 2>/dev/null
git log --since="24 hours ago" --name-only --pretty=format:"" 2>/dev/null
git diff --name-only 2>/dev/null
} | sort -u | grep -E '\.(go|js|ts|tsx|jsx|py|rb|java|cs|php|cpp|c|rs)$'
If no files were changed in the last 24 hours (no local modifications, no commits, no merged PRs), exit gracefully:
✅ No code changes detected in the last 24 hours.
Code simplifier has nothing to process today.
If files were changed (from any source: local edits, commits, or PRs), proceed to Phase 2.
Before simplifying, review the project's coding standards:
STYLE.md, CONTRIBUTING.md, README.md)For each changed file:
Make surgical, focused changes that preserve all original behavior. Use targeted edits rather than full file rewrites.
After making simplifications, run the project's test suite:
# Common test commands (adapt to the project)
make test # If Makefile exists
npm test # For Node.js projects
pytest # For Python projects
./gradlew test # For Gradle projects
mvn test # For Maven projects
cargo test # For Rust projects
go test ./... # For Go projects
If tests fail:
Ensure code style is consistent:
# Common lint commands (adapt to the project)
make lint # If Makefile exists
npm run lint # For Node.js projects
pylint . || flake8 . # For Python projects
cargo clippy # For Rust projects
golangci-lint run # For Go projects
Fix any linting issues introduced by the simplifications.
Verify the project still builds successfully:
# Common build commands (adapt to the project)
make build # If Makefile exists
npm run build # For Node.js projects
./gradlew build # For Gradle projects
mvn package # For Maven projects
cargo build # For Rust projects
go build ./... # For Go projects
Only create a PR if:
If no improvements were made or changes broke tests, exit gracefully:
✅ Code analyzed from last 24 hours.
No simplifications needed - code already meets quality standards.
Use this structure for the PR:
## Code Simplification - [Date]
This PR simplifies recently modified code to improve clarity, consistency, and maintainability while preserving all functionality.
### Files Simplified
- `path/to/file1.ext` - [Brief description of improvements]
- `path/to/file2.ext` - [Brief description of improvements]
### Improvements Made
1. **Reduced Complexity**
- [Specific example]
2. **Enhanced Clarity**
- [Specific example]
3. **Applied Project Standards**
- [Specific example]
### Changes Based On
Recent changes from:
- #[PR_NUMBER] - [PR title]
- Commit [SHORT_SHA] - [Commit message]
### Testing
- ✅ All tests pass (or indicate if no tests exist)
- ✅ Linting passes (or indicate if no linter configured)
- ✅ Build succeeds (or indicate if no build step)
- ✅ No functional changes - behavior is identical
### Review Focus
Please verify:
- Functionality is preserved
- Simplifications improve code quality
- Changes align with project conventions
- No unintended side effects
---
*Automated by Code Simplifier Agent*
// Before
func process(data []Item) error {
if data != nil {
if len(data) > 0 {
for _, item := range data {
if item.Valid {
// process
}
}
}
}
return nil
}
// After
func process(data []Item) error {
if len(data) == 0 {
return nil
}
for _, item := range data {
if !item.Valid {
continue
}
// process
}
return nil
}
// Before
const status = isError ? 'error' : isLoading ? 'loading' : isSuccess ? 'success' : 'idle';
// After
let status;
if (isError) {
status = 'error';
} else if (isLoading) {
status = 'loading';
} else if (isSuccess) {
status = 'success';
} else {
status = 'idle';
}
# Before
def validate_user(user):
if user.name is None:
return False
if len(user.name) == 0:
return False
if user.email is None:
return False
if '@' not in user.email:
return False
return True
# After
def validate_user(user):
if not user.name:
return False
if not user.email or '@' not in user.email:
return False
return True
// Before
func calc(d []int) int {
t := 0
for _, v := range d {
t += v
}
return t
}
// After
func calculateSum(values []int) int {
total := 0
for _, value := range values {
total += value
}
return total
}
Exit gracefully without creating a PR if:
Before creating a PR, verify:
The agent MUST either:
tools
Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.