/agent-skills:simplify [pending changes | last commit | <anything>]from agent-skills
Quality-only pass over recently changed code: simplify, reuse, and tidy within diff scope, then apply the improvements. Not a bug hunt; use the review-pr skill for correctness. With no argument, reviews the current branch's open PR (or the branch vs the default branch). Accepts 'pending changes', 'last commit', or a free-form description of what to review (paths, commits, ranges).
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Review recently changed code and apply quality improvements: simplification, reuse, efficiency, and altitude. This is a quality pass, not a bug hunt. For a correctness review, use the review-pr skill or another dedicated review; note defects and leave them alone.
In Claude Code the built-in /simplify owns the bare name, so invoke this skill as /agent-skills:simplify. In pi, invoke it as /skill:simplify.
When this skill says "ask", use the ask_user_question / AskUserQuestion tool if available. If no question tool is available or the session is non-interactive, follow the Non-interactive rules at each point where a question would be asked.
Normalize the argument: trim, lowercase, and ignore fillers such as "the" and "my". Then match the whole argument:
pending changes: pending targetlast commit: last-commit targetPartial matches are free-form: last commit in src/auth is not the last commit phrase.
The scope script resolves the target, lists the changed files, and computes their changed line ranges. Resolve its path as scripts/scope.sh relative to this skill's own directory, and invoke it with bash (do not rely on the executable bit):
bash <skill-dir>/scripts/scope.sh <mode> [--path P]...
Pick the mode from step 1; "Free-form arguments" below covers the rest:
defaultpendinglast-commitdiff BASE [END], where omitting END means the working treefiles PATH...Add --path <p> (repeatable) to filter a diff target. The script expands whole-file paths itself, resolving them from the current directory (so a relative path still works from a subdirectory); the paths it prints are repository-root relative. Paths outside the repository are rejected (exit 5).
The script prints the scope list: one Target: line and one bullet per file. Substitute the whole list for <scope list> in step 3, and show the Target: line to the user as the resolved target. When PR detection fails, that line says the default branch was used; pass that on. A branch with no PR is not a failure and gets no note.
Exit codes to handle:
0: the scope was printed.2: usage error. Re-check the invocation against the modes above.3: not a git repository, or a detached HEAD for the default target. Stop and tell the user.4: the base or default branch could not be resolved. Stop and tell the user what failed.5: a named path does not exist, matches nothing, or lies outside the repository. Stop and tell the user.6: a whole-file target matches more than 10 files. The script lists the matches on stderr. Ask whether to include them all, then rerun with --allow-many. Non-interactive: stop and list the matches.7: the scope is empty (deleted files are not listed, so a diff that only deletes files is empty). Tell the user there are no changes to simplify for the resolved target and stop.For anything that is neither empty, pending changes, nor last commit, interpret the argument and call the script in one of two modes:
diff BASE [END], plus --path filters. The scope is the target's changed lines, filtered to the paths.files PATH.... Every line of every matched file is in scope.Rules:
pending changes, last commit, or a description of paths or commits.With the scope list substituted below, follow this prompt exactly:
Review the following recently changed files and apply simplification improvements.
review-pr covers pull requests).// increment i above i++. Avoid nested ternary operators: prefer switch statements or if/else chains for multiple conditions.For every in-scope change, check four angles:
<scope list from step 2>
Changed line numbers refer to the current file contents. Lines listed above are in scope; everything else is out of scope. You may read out-of-scope code for context. For added files and whole-file targets, every line is in scope.
An out-of-scope finding is related only if it is tied to the in-scope changes: code the changes made dead or redundant, comments the changes made stale, or code whose simplification would directly simplify the changed lines. Never act on or suggest unrelated out-of-scope improvements, however worthwhile.
Report each finding as path:line, a one-line summary, and the concrete cost (tokens, allocations, I/O, indirection, or lines). Deduplicate findings that share a mechanism: keep one entry and note the other sites. Record every finding you skip, with the reason.
package.json scripts, a *.sln, a Makefile, or the equivalent build file. Run it and record any failures that already exist. If no test command is found, skip the test steps and say so; do not guess.git stash create is not enough on its own: it misses untracked files, which are in scope as added files.git checkout, git restore, git reset, git stash (push or pop), or git clean on the user's files: they would discard uncommitted work that is not yours. Run the configured formatter or linter over the changed files only; keep its edits inside the in-scope ranges and route any formatting churn outside the scope to the confirmed batch (step 5).path:line references and ask once which to apply. Apply only the approved ones, then run the tests again, and undo any approved edit that causes a new failure from its snapshot the same way. Skip this step if there are no findings or every line is in scope. Non-interactive: do not apply them; list them in the summary as suggestions.When a subagent or Task tool is available (built into Claude Code; in pi only when an extension provides one) and the scope list covers more than 10 files, dispatch one subagent per checklist angle (simplification, reuse, efficiency, altitude). Each subagent reads the in-scope files and returns findings in the format above; it edits nothing. Merge the results, deduplicate by mechanism, then apply as in the process above. With no subagent tool, or a smaller scope, run the single pass.
Do NOT add new features or change public APIs.
What SKILL.md sets; muted values are Claude Code's defaults
20 skills in this plugin
/address-pr-commentsInteractively walk through and address PR review comments one at a time, asking the user what to do for each, committing after each code change, and optionally replying on GitHub. Accepts an optional PR number argument; defaults to the current branch's PR./add-todoCreate or append tasks to TODO.md in the current working directory. Not appropriate for reading, viewing, checking off, removing, or reorganizing TODO.md./chezmoi-diffHelp resolve differences between chezmoi-managed dotfiles and local files, including which direction changes should flow and what the chezmoi file naming conventions (dot_, executable_, .tmpl, symlink_, etc.) mean.npx claudepluginhub lucaspimentel/agent-skills --plugin agent-skills