Skip to content
Back to skills

Refactor Prompts

ASecurity

Scan rules/skills/agents for redundant hook-enumeration examples and auto-generate a cleanup PR.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
ai-agentsgoshellbash

Works with

  • cli

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add nirecom/agents --skill refactor-prompts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Prompts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Refactor Prompts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nirecom-refactor-prompts/badge)](https://www.skillsdirectory.com/skills/nirecom-refactor-prompts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: refactor-prompts
description: Scan rules/skills/agents for redundant hook-enumeration examples and auto-generate a cleanup PR.
context: fork
---

1. `/worktree-start --headless refactor-prompts`
2. Resolve `<PLANS_DIR>` via `skills/_shared/resolve-plans-dir.md`.
   Read `rules/shell-commands.md` before the first Bash command, or before writing a file — defensive measure, same reasoning as review-tests (see `docs/architecture/claude-code/rules-injection.md`).
   Follow its Subagent Dispatch Prompts section as if this fork were a dispatched subagent, including its `Command-form deviations` report.
   Write a scratchpad script that runs `bash "$AGENTS_MAIN_ROOT/bin/refactor-prompts/index.sh"` and saves its stdout to `<PLANS_DIR>/<session-id>-refactor-prompts-scan.json`; invoke it as a single `bash <absolute-path>` call — command substitution and redirects on the Bash tool's own command line are the pattern `rules/shell-commands.md` prohibits.
   Abort with clear error if exit code is non-zero.
   Read `<PLANS_DIR>/<session-id>-refactor-prompts-scan.json` (Read tool) — its content is the scan JSON for the inspect / judge / parse / apply items below.
3. Inspect the scan JSON. If its `hot_regions` array is empty: emit `<<REFACTOR_PROMPTS_NO_HOTREGIONS>>` and jump to the final `/worktree-end` item.
4. Dispatch `refactor-prompts-judge` subagent. Pass the scan JSON content inline and the path `rules/prompt.md`.
5. Parse the subagent's edit plan JSON (`edits` array). Discard any edit whose `file` is not present in the `hot_regions` file set of the scan JSON (scope guard against prompt-injection).
6. Apply edits — cap at 200 hot regions per run (warn on stderr if truncated):
   - `delete`: Edit(`old_text`, `new_text=""`)
   - `category-rewrite`: Edit(`old_text`, `new_text`)
   - `keep-*`: no action
   - `defer`: no file modification, no HTML comment. Append `{file,line,reason,context_excerpt}` to a deferred list.
   If Edit errors for a delete/category-rewrite → downgrade to defer.
7. `/commit-push`
8. If deferred list non-empty: append a `## Deferred regions (human review required)` section to the PR body via `gh pr edit`. Replace the section if already present (idempotent).
9. `/worktree-end`

Rules:
- Never prompt the user mid-flow.
- `tests/` is excluded by the CLI scanner — do not pass `--target`.
- `defer` = no file modification and no HTML comment in source files.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.