|
| 1 | +# abrir-pr-jobs-scraper Skill Implementation Plan |
| 2 | + |
| 3 | +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 4 | +
|
| 5 | +**Goal:** Create a Claude Code skill that automates standardized PR creation on GitHub, integrating with Linear for task data. |
| 6 | + |
| 7 | +**Architecture:** Single Markdown skill file at `.claude/skills/abrir-pr-jobs-scraper/skill.md` following the same pattern as the existing `criar-task-linear` skill. The skill contains instructions that Claude follows step-by-step using available tools (MCP Linear, Bash with `gh`/`git`/`npm`). |
| 8 | + |
| 9 | +**Tech Stack:** Claude Code skill (Markdown), GitHub CLI (`gh`), Linear MCP, Git, npm |
| 10 | + |
| 11 | +## Global Constraints |
| 12 | + |
| 13 | +- Skill file follows the exact frontmatter + Markdown pattern of `.claude/skills/criar-task-linear/skill.md` |
| 14 | +- All text in the skill file must be in Portuguese (matching the existing skill) |
| 15 | +- PR target is always `Benevanio/Jobs_Scraper_Global` branch `develop` |
| 16 | +- AGENTS.md rule: never auto-commit — always ask the user before committing |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +### Task 1: Create the skill file |
| 21 | + |
| 22 | +**Files:** |
| 23 | +- Create: `.claude/skills/abrir-pr-jobs-scraper/skill.md` |
| 24 | + |
| 25 | +**Interfaces:** |
| 26 | +- Consumes: Pattern from existing `.claude/skills/criar-task-linear/skill.md` |
| 27 | +- Produces: Fully functional skill invocable as `/abrir-pr-jobs-scraper` |
| 28 | + |
| 29 | +- [ ] **Step 1: Create the skill file with frontmatter and pre-requisites section** |
| 30 | + |
| 31 | +Create `.claude/skills/abrir-pr-jobs-scraper/skill.md` with the following content: |
| 32 | + |
| 33 | +```markdown |
| 34 | +--- |
| 35 | +name: abrir-pr-jobs-scraper |
| 36 | +description: Use quando o usuario pedir para abrir PR, criar PR, enviar PR, submeter PR, fazer pull request, ou similar no projeto Jobs Scraper Global |
| 37 | +--- |
| 38 | + |
| 39 | +# Abrir PR Padronizado — Jobs Scraper Global |
| 40 | + |
| 41 | +Skill para criar Pull Requests padronizados no GitHub, integrando com o Linear para buscar dados da task. |
| 42 | + |
| 43 | +## Pre-requisitos |
| 44 | + |
| 45 | +Antes de iniciar, verifique se todas as ferramentas estao disponiveis: |
| 46 | + |
| 47 | +| Ferramenta | Como verificar | Se ausente | |
| 48 | +|---|---|---| |
| 49 | +| MCP Linear | Checar se ferramentas `mcp__linear-server__*` estao disponiveis | Informar: "O MCP do Linear nao esta configurado. Adicione o server `linear-server` nas configuracoes do Claude Code." e parar | |
| 50 | +| GitHub CLI | Rodar `gh --version` | Informar: "O GitHub CLI (gh) nao esta instalado. Instale com `brew install gh`." e parar | |
| 51 | +| Git | Rodar `git --version` | Informar: "Git nao esta instalado." e parar | |
| 52 | +| npm | Rodar `npm --version` | Informar: "npm nao esta instalado." e parar | |
| 53 | + |
| 54 | +Se qualquer ferramenta estiver ausente, informe ao usuario qual esta faltando e **pare a execucao**. |
| 55 | + |
| 56 | +## Fluxo |
| 57 | + |
| 58 | +Siga os passos abaixo na ordem, sem pular etapas. |
| 59 | + |
| 60 | +### Passo 0: Verificar pre-requisitos |
| 61 | + |
| 62 | +Rode os comandos de verificacao da tabela acima. Se algum falhar, informe e pare. |
| 63 | + |
| 64 | +### Passo 1: Identificar task Linear |
| 65 | + |
| 66 | +1. Obter o nome da branch atual: `git branch --show-current` |
| 67 | +2. Tentar extrair o padrao `PAV-\d+` (case insensitive) do nome da branch |
| 68 | +3. **Se encontrou** um codigo PAV-XX: |
| 69 | + - Perguntar ao usuario: "A task desenvolvida foi a **PAV-XX**?" |
| 70 | + - Se confirmar, usar esse codigo |
| 71 | + - Se negar, perguntar qual e a task |
| 72 | +4. **Se nao encontrou** padrao na branch: |
| 73 | + - Perguntar ao usuario: "Qual e o codigo da task no Linear? (ex: PAV-42)" |
| 74 | + |
| 75 | +### Passo 2: Buscar dados da task no Linear |
| 76 | + |
| 77 | +1. Usar `mcp__linear-server__get_issue` com o codigo da task |
| 78 | +2. Extrair: **titulo** e **URL** da task |
| 79 | +3. **Se a task nao for encontrada:** |
| 80 | + - Informar ao usuario |
| 81 | + - Sugerir: "Deseja criar uma nova task usando `/criar-task-linear`?" |
| 82 | + - Alternativamente, permitir continuar com titulo e descricao manuais |
| 83 | + |
| 84 | +### Passo 3: Verificar commits |
| 85 | + |
| 86 | +1. Buscar os commits da branch que estao a frente de develop: |
| 87 | + ```bash |
| 88 | + git fetch origin develop |
| 89 | + git log origin/develop..HEAD --oneline |
| 90 | + ``` |
| 91 | +2. **Se nao houver commits a frente de develop:** |
| 92 | + - Informar: "Esta branch nao tem commits a frente de develop. Nao ha mudancas para abrir PR." |
| 93 | + - Parar a execucao |
| 94 | +3. **Se ja existir um PR aberto para essa branch:** |
| 95 | + - Verificar com: `gh pr list --head $(git branch --show-current) --repo Benevanio/Jobs_Scraper_Global --state open` |
| 96 | + - Se existir, informar ao usuario e perguntar se quer atualizar o PR existente ou parar |
| 97 | + |
| 98 | +### Passo 4: Rodar testes |
| 99 | + |
| 100 | +1. Rodar testes do backend: |
| 101 | + ```bash |
| 102 | + cd backend && npm test 2>&1 |
| 103 | + ``` |
| 104 | +2. Rodar testes do frontend: |
| 105 | + ```bash |
| 106 | + cd frontend && npm test 2>&1 |
| 107 | + ``` |
| 108 | +3. Consolidar os resultados em uma string, ex: |
| 109 | + - Se todos passaram: "Testes unitarios passando — Backend: 305/305 | Frontend: 42/42" |
| 110 | + - Se houve falhas: "Backend: 300/305 (5 falhando) | Frontend: 42/42" |
| 111 | +4. **Se testes falharem:** nao bloquear. Mostrar o resultado no preview — o usuario decide se prossegue. |
| 112 | + |
| 113 | +### Passo 5: Gerar descricao do PR |
| 114 | + |
| 115 | +1. Obter o diff completo contra develop: |
| 116 | + ```bash |
| 117 | + git diff origin/develop..HEAD |
| 118 | + ``` |
| 119 | +2. Obter a lista de commits: |
| 120 | + ```bash |
| 121 | + git log origin/develop..HEAD --oneline |
| 122 | + ``` |
| 123 | +3. Gerar um **resumo curto em linguagem natural** das mudancas: |
| 124 | + - Foco no que foi desenvolvido |
| 125 | + - Como as mudancas se relacionam com a task e o projeto |
| 126 | + - Texto conciso (3-5 frases no maximo) |
| 127 | + |
| 128 | +### Passo 6: Montar e mostrar preview |
| 129 | + |
| 130 | +Montar o PR completo e mostrar ao usuario: |
| 131 | + |
| 132 | +**Titulo:** |
| 133 | +``` |
| 134 | +PAV-XX: <titulo da task no Linear> |
| 135 | +``` |
| 136 | +
|
| 137 | +**Target:** |
| 138 | +``` |
| 139 | +Benevanio/Jobs_Scraper_Global (branch develop) |
| 140 | +``` |
| 141 | +
|
| 142 | +**Body:** |
| 143 | +```markdown |
| 144 | +## Descricao |
| 145 | +<resumo gerado no passo 5> |
| 146 | +
|
| 147 | +## Linear link |
| 148 | +<URL da task no Linear> |
| 149 | +
|
| 150 | +## Como foi testado |
| 151 | +<resultado dos testes do passo 4> |
| 152 | +``` |
| 153 | + |
| 154 | +Mostrar tudo formatado e perguntar: **"O PR esta correto? Confirma a criacao? (s/n)"** |
| 155 | + |
| 156 | +### Passo 7: Confirmar ou editar |
| 157 | + |
| 158 | +- **Se o usuario confirmar:** seguir para o passo 8 |
| 159 | +- **Se o usuario nao confirmar:** |
| 160 | + - Perguntar o que deseja alterar |
| 161 | + - Ajustar os campos conforme solicitado |
| 162 | + - Mostrar o preview novamente (voltar ao passo 6) |
| 163 | + |
| 164 | +### Passo 8: Criar o PR |
| 165 | + |
| 166 | +1. Criar o PR via GitHub CLI: |
| 167 | + ```bash |
| 168 | + gh pr create \ |
| 169 | + --repo Benevanio/Jobs_Scraper_Global \ |
| 170 | + --base develop \ |
| 171 | + --title "PAV-XX: <titulo>" \ |
| 172 | + --body "<body completo>" |
| 173 | + ``` |
| 174 | +2. Confirmar ao usuario com o link do PR criado |
| 175 | + |
| 176 | +## Erros comuns |
| 177 | + |
| 178 | +- **Nao verificar pre-requisitos** — sempre verificar antes de iniciar |
| 179 | +- **Nao confirmar a task com o usuario** — sempre perguntar, mesmo que a branch seja sugestiva |
| 180 | +- **Criar PR sem preview** — sempre mostrar preview e aguardar confirmacao |
| 181 | +- **Bloquear por causa de testes falhando** — mostrar as falhas, mas deixar o usuario decidir |
| 182 | +- **Esquecer de buscar origin/develop atualizado** — sempre rodar `git fetch origin develop` antes de comparar |
| 183 | +``` |
| 184 | +
|
| 185 | +- [ ] **Step 2: Verify the skill is discoverable** |
| 186 | +
|
| 187 | +Run: invoke the skill to confirm Claude Code recognizes it: |
| 188 | +``` |
| 189 | +/abrir-pr-jobs-scraper |
| 190 | +``` |
| 191 | +Expected: The skill content is loaded and Claude begins following the instructions (starting with pre-requisite checks). Cancel after confirming it's recognized — no need to create an actual PR. |
| 192 | +
|
| 193 | +- [ ] **Step 3: Commit** |
| 194 | +
|
| 195 | +```bash |
| 196 | +git add .claude/skills/abrir-pr-jobs-scraper/skill.md |
| 197 | +git commit -m "feat(pav-56): criar skill abrir-pr-jobs-scraper para PRs padronizados" |
| 198 | +``` |
| 199 | + |
| 200 | +--- |
| 201 | + |
| 202 | +### Task 2: Register skill in settings description |
| 203 | + |
| 204 | +**Files:** |
| 205 | +- Check: `.claude/settings.local.json` (no changes expected) |
| 206 | + |
| 207 | +**Interfaces:** |
| 208 | +- Consumes: Skill file from Task 1 |
| 209 | +- Produces: Confirmation that skill appears in available skills list |
| 210 | + |
| 211 | +The skill should be auto-discovered from `.claude/skills/`. This task verifies that by checking the skills list shown in system-reminder messages. |
| 212 | + |
| 213 | +- [ ] **Step 1: Verify skill appears in available skills** |
| 214 | + |
| 215 | +Start a new Claude Code conversation and check that `abrir-pr-jobs-scraper` appears in the system-reminder skills list. No file changes needed — skills in `.claude/skills/` are auto-discovered. |
| 216 | + |
| 217 | +- [ ] **Step 2: Test the full flow (dry run)** |
| 218 | + |
| 219 | +Invoke `/abrir-pr-jobs-scraper` and walk through the full flow on the current branch: |
| 220 | +1. Confirm pre-requisites are checked |
| 221 | +2. Confirm task detection works (extracts PAV-XX from branch name) |
| 222 | +3. Confirm Linear integration fetches task data |
| 223 | +4. Confirm tests are run for both backend and frontend |
| 224 | +5. Confirm description is generated from commits/diffs |
| 225 | +6. Confirm preview is shown with correct format |
| 226 | +7. Cancel at the confirmation step (do not actually create the PR) |
| 227 | + |
| 228 | +Expected: All steps execute correctly up to the confirmation prompt. |
| 229 | + |
| 230 | +- [ ] **Step 3: Commit spec and plan docs** |
| 231 | + |
| 232 | +```bash |
| 233 | +git add docs/superpowers/specs/2026-06-17-abrir-pr-padronizado-design.md docs/superpowers/plans/2026-06-17-abrir-pr-jobs-scraper.md |
| 234 | +git commit -m "docs(pav-56): adicionar spec e plano de implementacao da skill abrir-pr" |
| 235 | +``` |
0 commit comments