Agent skill

Refactor Crawler

by opensanctions in opensanctions/opensanctions

Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices.

MITAuto-check: notesData & Analytics

Install Refactor Crawler

skills CLI
$ npx skills add opensanctions/opensanctions --skill refactor-crawler -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install opensanctions/opensanctions refactor-crawler --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/opensanctions/opensanctions.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/refactor-crawler .claude/skills/refactor-crawler && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactor-crawler
GitHub stars
831
Token cost
~1.1k tokens
SKILL.md length
452 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices.

  • Works in 5 steps: Read the crawler and its .yml. Note the… → Capture a baseline: run zavod crawl on… → Read the docs for the areas the crawler… → …
  • The user asks to clean up
  • SKILL.md covers Golden rule: every output…, Prime directive: strict…, The docs and Workflow, plus 1 more section
  • Calls ruff and mypy

What it does

Refactor Crawler is an agent skill from opensanctions/opensanctions. Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices. Use when the user asks to clean up, refactor, tidy, or "make production-ready" a crawler, or to bring code in line with best practices.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Data & Analytics, covering Web scraping and Refactoring. The repository describes itself as: An open database of international sanctions data, persons of interest and politically exposed persons. The licence is MIT.

When your agent uses it

  • The user asks to clean up
  • Make production-ready a crawler
  • Bring code in line with best practices

Example prompts

  • “make production-ready”
  • “/refactor-crawler”

Requirements

  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Read the crawler and its .yml. Note the data source shape (HTML/CSV/XLSX/JSON/API)
  2. Capture a baseline: run zavod crawl on the unmodified crawler and keep the
  3. Read the docs for the areas the crawler touches and apply them, most impactful
  4. Verify (below).
  5. Summarise: which best-practice areas changed, every output change and its

What it can do on your machine

Read from SKILL.md and the folder at commit 4499adf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • ruff
    • mypy

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactor Crawler loads about 1.1k tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 452 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Edit, Write, Glob, Grep, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from opensanctions/opensanctions at commit 4499adf, republished under its MIT licence (© opensanctions). 452 words, ~1,071 tokens.

Download SKILL.mdSave it as .claude/skills/refactor-crawler/SKILL.md (or your agent's skills folder).
name
refactor-crawler
description
Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices. Use when the user asks to clean up, refactor, tidy, or "make production-ready" a crawler, or to bring code in line with best practices.
allowed-tools
Read, Edit, Write, Glob, Grep, Bash
argument-hint
[crawler.py path]

Refactor crawler

Bring an existing crawler in line with current best practices. Typical input is a first-draft or AI-generated crawler that works but is verbose, brittle, or non-idiomatic. Target path: $ARGUMENTS

The rules live in zavod/docs/best_practices/ — this skill is only the procedure for applying them. When a rule is unclear, read the doc; do not invent a convention.

Golden rule: every output change must be deliberate

Output may change when the refactor brings a methodological gain — e.g. moving to h.apply_date (warnings + original_value), h.make_address composition, a type.address lookup dropping placeholders, a tightened selector excluding junk. Name each such change in your summary and tie it to the method that caused it. Never silently alter emitted values. Leave name cleaning as it is: changing it means the sequenced, multi-PR migration to the review system in zavod/docs/extract/names.md, out of scope for a refactor pass.

Prime directive: strict interpretation

zavod/docs/best_practices/strict_interpretation.md — every source value within the crawler's scope is handled, explicitly ignored, or raises a signal. A refactored crawler must be more likely to fail loudly than the draft it replaces, never less: when you remove a branch, replace it with a guard, not with silence.

The docs

  • best_practices/strict_interpretation.md — the prime directive: destructive parsing, audit_data, assertions, categorical coverage
  • best_practices/patterns.md — structure, naming, helpers, constants, logging, pagination, text hygiene
  • best_practices/xpath_and_html.md — typed HTML helpers, selector quality
  • best_practices/entity_id.md — make_id vs make_slug, which fields, key=
  • best_practices/datapatch_lookups.md — replacing inline conditionals with YAML lookups
  • best_practices/dates_meta.md — apply_date and dataset-level date formats
  • best_practices/addresses.md — make_address + copy_address
  • best_practices/http_operations.md — context.fetch_*, headers, Zyte
  • best_practices/caching.md — what not to cache
  • best_practices/priorities.md — which properties are worth the effort
  • best_practices/merge_checklist.md — the pre-merge review checklist

For pure type-annotation errors, defer to the /typechecker-fixes skill.

Show full SKILL.md (181 more words)Show less

Workflow

  1. Read the crawler and its .yml. Note the data source shape (HTML/CSV/XLSX/JSON/API) and the existing lookups:, dates:, and http: sections.
  2. Capture a baseline: run zavod crawl on the unmodified crawler and keep the statement counts and a few sample entities to diff against later.
  3. Read the docs for the areas the crawler touches and apply them, most impactful first: structure → selectors/parsing → IDs → dates/addresses → lookups → HTTP/caching → logging/assertions → style nits.
  4. Verify (below).
  5. Summarise: which best-practice areas changed, every output change and its methodological justification, and anything deliberately left alone.

Verification

From the repo root:

bash
ruff check --fix --select I <path/to/crawler.py>   # import order
cd zavod && mypy --strict <path/to/crawler.py>     # enforced by the mypy-datasets hook
zavod crawl <path/to/dataset.yml>                  # from the repo root

Then confirm:

  • New strict-interpretation guards are welcome — but when one fires on today's data, add the missing lookup mapping rather than handing the warning off. The facility for many warnings stays in the code; issues.log is clean (transient network errors excepted).
  • Diff the output against the baseline run (statement counts, spot-check entities) and account for every difference — each must trace to a named methodological gain.
  • The crawler still satisfies its assertions: in the .yml.
  • Walk the merge_checklist.md items relevant to what you touched.

© opensanctions, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/refactor-crawler of opensanctions/opensanctions.

Open the folder on GitHubat commit 4499adf

Compare with similar skills

Refactor Crawler next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactor Crawler compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactor Crawler this skillopensanctions/opensanctions831—~1.1kAutomated safety check: NotesMIT
Tmuxtrpc-group/trpc-agent-go1.8k23 repos~868Automated safety check: PassApache-2.0
Ketch1broseidon/ketch6961 repos~3.9kAutomated safety check: PassMIT
Crawl4AI Web Scrapingsmallnest/goclaw5981 repos~2.5kAutomated safety check: PassMIT
Boss Zhipin Scrapereatmoreduck/boss-zhipin-scraper1.5k—~2.6kAutomated safety check: PassMIT
Axyusukebe/ax7191 repos~918Automated safety check: PassMIT

Similar skills

  • Tmux

    trpc-group/trpc-agent-go

    Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.

    1.8k GitHub starsUsed in 23 repos~868 tokens
    Data & AnalyticsAuto-check passed
  • Ketch

    1broseidon/ketch

    Research skill for ketch — a fast stateless CLI for web search, OSS code search, curated library docs, page scraping, and site crawling; an optional MCP server exists for operators who want it, but…

    696 GitHub starsUsed in 1 repo~3.9k tokens
    Data & AnalyticsAuto-check passed
  • Crawl4AI Web Scraping

    smallnest/goclaw

    Scrapes sites, handles JavaScript-heavy pages and extracts structured data with Crawl4AI, through its crwl CLI or Python SDK, including schema-based extraction without an LLM.

    598 GitHub starsUsed in 1 repo~2.5k tokens
    Data & AnalyticsAuto-check passed
  • Boss Zhipin Scraper

    eatmoreduck/boss-zhipin-scraper

    Scrape BOSS直聘 (job listing site) via Chrome CDP. An agent skill from eatmoreduck/boss-zhipin-scraper.

    1.5k GitHub stars~2.6k tokensUpdated 8 days ago
    Data & AnalyticsAuto-check passed
  • Ax

    yusukebe/ax

    Use the ax CLI instead of curl + throwaway parsing scripts whenever you fetch a URL, explore an unknown web page, or extract structured data from HTML.

    719 GitHub starsUsed in 1 repo~918 tokens
    Data & AnalyticsAuto-check passed
  • Anakinscraper

    Anakin-Inc/anakin

    Scrape any website into clean markdown or structured JSON. An agent skill from Anakin-Inc/anakin.

    4.5k GitHub stars~859 tokensUpdated 1 mo ago
    Data & AnalyticsAuto-check passed

More from opensanctions/opensanctions

All 11 skills in this repo
  • Crawler Pep

    opensanctions/opensanctions

    Scaffold a new PEP (Politically Exposed Persons) crawler — members of a parliament, legislature, senate, chamber of deputies, cabinet, judiciary, or an asset-declaration register — from a source URL…

    831 GitHub stars~1.9k tokensUpdated today
    Auto-check: notes
  • Crawler Constants To Yml

    opensanctions/opensanctions

    Move hardcoded lookup/config constants (gender maps, header dicts, value translations, column-label maps, date formats) out of a crawler and into the dataset .yml — as datapatch lookups wherever…

    831 GitHub stars~1.4k tokensUpdated today
    Auto-check: notes
  • Dataset Metadata

    opensanctions/opensanctions

    Bring a dataset .yml's metadata in line with house conventions (title, summary, description, coverage, publisher, maintainer comments).

    831 GitHub stars~604 tokensUpdated today
    Auto-check: notes
  • Legislature Metadata

    opensanctions/opensanctions

    Refactor the title, description and coverage frequency of a legislature/parliament PEP dataset .yml into the house style.

    831 GitHub stars~953 tokensUpdated today
    Auto-check passed
  • Name Framework Migration First Step

    opensanctions/opensanctions

    Migrate ad-hoc name cleaning in a crawler to h.reviewnames (Step 1 of the name framework migration).

    831 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Release Datasets

    opensanctions/opensanctions

    Release one or more datasets by adding them to a topical collection, bumping coverage.start, and verifying.

    831 GitHub stars~566 tokensUpdated today
    Auto-check passed

Questions about Refactor Crawler

What does Refactor Crawler do?

Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices. Refactor Crawler is an agent skill from opensanctions/opensanctions. Rewrite messy or AI-generated crawler code into clean, production-ready style that follows the zavod best practices.

When should I use Refactor Crawler?

Refactor Crawler fits situations like: the user asks to clean up; make production-ready a crawler; bring code in line with best practices.

How do I install Refactor Crawler in Claude Code?

Run `npx skills add opensanctions/opensanctions --skill refactor-crawler -a claude-code`. Or copy the skill folder (.claude/skills/refactor-crawler in opensanctions/opensanctions) into .claude/skills/refactor-crawler in your project. Claude Code loads it when a task matches its description.

How do I install Refactor Crawler in Codex?

Run `npx skills add opensanctions/opensanctions --skill refactor-crawler -a codex`. Or copy the skill folder (.claude/skills/refactor-crawler in opensanctions/opensanctions) into .agents/skills/refactor-crawler in your project. Codex loads it when a task matches its description.

Can I use Refactor Crawler in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add opensanctions/opensanctions --skill refactor-crawler -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactor-crawler, .gemini/skills/refactor-crawler, .github/skills/refactor-crawler and .opencode/skills/refactor-crawler in your project.

What does Refactor Crawler need to run?

Going by SKILL.md and its folder, Refactor Crawler needs the command-line tools its instructions call (ruff and mypy). Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash.

Does Refactor Crawler access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Refactor Crawler safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Refactor Crawler use?

Refactor Crawler is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactor Crawler use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Refactor Crawler?

Skills that share tags, products or a category with Refactor Crawler: Tmux (trpc-group/trpc-agent-go, 1.8k stars), Ketch (1broseidon/ketch, 696 stars), Crawl4AI Web Scraping (smallnest/goclaw, 598 stars) and Boss Zhipin Scraper (eatmoreduck/boss-zhipin-scraper, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactor Crawler?

opensanctions (a GitHub organization) maintains it in opensanctions/opensanctions, which has 831 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 7, 2026.

Source: opensanctions/opensanctions on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.