Pular para o conteúdo
Skillpedia
Segurança8,0 mil · #12688

implement-patch

O que ela faz

Orienta a correção de um único bug confirmado em uma base de código local, da regra quebrada até os testes e um commit. É para desenvolvedores e revisores que já sabem que o bug é real.

Quando usar

  • ✓Quando um bug confirmado em um projeto local precisa de uma correção adequada.
  • ✓Quando um desenvolvedor precisa encontrar outros pontos que quebram a mesma regra.
  • ✓Quando uma equipe quer um commit único com um teste de regressão para um bug confirmado.

Link da skill

https://github.com/trailofbits/skills/blob/main/plugins/patching-bugs/skills/implement-patch/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/trailofbits/skills/blob/main/plugins/patching-bugs/skills/implement-patch/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Este bug está confirmado. Corrija a regra subjacente, adicione um teste de regressão e faça um commit.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A skill verifica primeiro o achado salvo, depois identifica a regra quebrada e encontra todas as instâncias do mesmo problema. Escreve um teste que falha antes da correção, faz a menor alteração revisável possível e roda a suíte novamente.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

Implement Patch

When to Use

Use after independent validation confirms one claim. Read the record contract. Before target commands, follow its project guidance.

When NOT to Use

Do not use for speculative bug hunting, proof of a completed patch, or a change that cannot be exercised by the local compiler or runtime.

Procedure

  1. Before editing, run uv run --no-project <script> check --before-repair <run-dir> with the record validator. If this check fails, stop and return its errors for an INCONCLUSIVE report. The gate requires finding.repair_scope with a usable case plan and a consistent attempt count. Use the declared scope as the repair brief. Identify the broken invariant and search within its boundary for every instance of the same violation. Read the threat model only to preserve intended behavior; it is not a gate.

  2. Run the project's existing suite and record its results. Write a regression test that fails on the baseline for the named bug and any fixed variant. Observe the failure. Fix the invariant within the repair brief with the smallest reviewable change.

  3. Run the regression test and full existing suite again. Compare before and after failures. Fix new failures or explain a pre-existing one from receipts.

  4. Record every variant as fixed or not_fixed with a reason. Produce exactly one local commit. Never push or open a PR. From the baseline, write fix.patch for production changes and tests.patch for test changes in patch/attempt-N/.

  5. Write patch.json with the two commit SHAs, changed-file and line counts, variants, suite results, and your agent identity. If the attempt produced no commit, record patch_commit: null and return it as failed. Manifest the entire attempt directory, including both patch files and the record, using uv run --no-project <script> manifest <patch-attempt-dir>. Check it with the record validator.

    Patch record schema:

{
  "schema_version": 1,
  "attempt": 1,
  "baseline_commit": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "patch_commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  "files_changed": 2,
  "lines_added": 3,
  "lines_removed": 1,
  "variants": [],
  "suite_before": {"command": "pytest", "passed": 9, "failed": 1, "skipped": 0},
  "suite_after": {"command": "pytest", "passed": 10, "failed": 0, "skipped": 0},
  "agent": "patcher-1"
}

Rationalizations to Reject

Shortcut Required action
Only the reported line matters. Search for the same invariant violation.
Minimal means the fewest lines. Make the smallest reviewable invariant-level fix.
Tests pass after the patch. Show the regression test failed before it.
Perguntas frequentes

Ela pode corrigir um bug que eu só suspeito?

Não. É para bugs que já foram confirmados de forma independente.

Ela compara resultados de testes antes e depois?

Sim. Registra os resultados antes e depois da correção para pegar novas falhas.

Ela escreve o commit?

Sim. Faz um único commit local para a correção.

Detalhes

Descrição original do autor

Use when a confirmed local bug needs an invariant-level fix, variant search, tests, and one local commit.

repo: trailofbits/skills

Popularidade

Estrelas no GitHub
8,0 mil
Posição no ranking
#12688
Licença
CC-BY-SA-4.0
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas