python-code-audit-sweep

A quick audit process for Python repositories that separates real bugs, unused code, and style issues without changing program behavior.

In plain words
What is it for?
Finding Python problems with static checks, then grouping them into bug, dead-code, and style changes.
Why use it?
It keeps potentially risky bug fixes separate from safe cleanup, making review easier and the findings clearer.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/chen3feng/agent-skills/python-code-audit-sweep
Any agent
npx skills add chen3feng/agent-skills --skill python-code-audit-sweep
Clone the repo
git clone --depth 1 https://github.com/chen3feng/agent-skills

Made for: Claude Code, Codex.

Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,532 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00033 $0.01532
Opus 5 $0.00016 $0.00766
Sonnet 5 $0.00007 $0.00306
Haiku 4.5 $0.00003 $0.00153

Measured yesterday against content hash c43a9e1f29dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-code-audit-sweep scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/python-code-audit-sweep/SKILL.md · 151 lines

How it starts

The opening of the file, as written. The whole thing — 151 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python code-audit sweep

When to use

The user says something like "check the code for improvements, no feature changes" or "do a general cleanup pass". You have a Python codebase, no specific bug report, and need to surface high-signal, low-risk findings without accidentally changing behavior.

Problem

A naive "cleanup" PR usually fails review because it mixes three very different kinds of change into one blob:

  • A real latent bug (semantics change when fixed).
  • Dead code / unused locals (safe, mechanical).
  • Spelling, wording, anti-patterns in comments (pure style).

Reviewers want to merge (2) and (3) fast and scrutinize (1) carefully. If you stuff them into one PR, the whole thing blocks on the hardest item, and the diff hides the real bug behind dozens of typo fixes.

Solution

Do the audit in two phases: find, then partition into separate PRs.

1. Find (cheap, parallel grep + pyflakes)

# Static analysis: unused imports/vars, undefined names, simple smells.
pyflakes src/ | tee /tmp/pyflakes.txt

# Common anti-patterns (extend as needed).
grep -rnE 'not [a-zA-Z_][a-zA-Z_0-9.()\[\]]* is None' src/   # should be "is not None"
grep -rnE '== None|!= None' src/                             # should be "is (not) None"
grep -rn  'type(str)\|type(int)\|type(list)\|type(dict)' src/ # type() applied to a builtin type

# Typo shortlist — curated, not exhaustive; avoids false positives.
grep -rniE '\b(seperat|writen|recieve|occured|begining|lenght|tranform|initialis|standardalone|dependancy|mutiple|visibilty|accomodate|seperately)\w*' \
    src/ doc/ tool/

# Filenames with unusual punctuation (real bugs on GitHub's Markdown renderer).
find . -name '*,md' -o -name '*.m d' -o -name '*.mdd'

2. Partition into three PRs

Label every finding as A, B, or C. One PR per label, in this order:

Tag Contents Risk Review burden
A Real bugs: broken error messages, dead-assignment-that-hides-a-branch, wrong file extensions. Behavior may change (even if tiny). Highest — maintainer must read carefully.
B Dead locals, unused imports, tuple-unpacking where half is unused. None. Low.
C Typos in comments/docs, not x is Nonex is not None, file renames with no in-repo references. None. Lowest.

Read the full file on GitHub · 151 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 151 lines · 33 tokens per session scan A c43a9e1f29dc

Subscribe to this mod's changes

python-code-audit-sweep is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 33 tokens to every session and 1,532 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

prepare-providers-documentation

Replace the manual commit-by-commit classification step in breeze release-management prepare-provider-documentation with AI-driven classification. For each provider with pending changes, analyze every PR (batched into one sub-agent per provider, not one per PR), pay special attention to potentially breaking changes by…

apache/airflow · 113 tokens

magpie-setup

Adopt and maintain the apache-magpie framework in a project repo via the snapshot-based adoption mechanism. The only framework skill committed in an adopter's repo; every other skill is a symlink the adopt sub-action wires up. Sub-actions: /magpie-setup - first-time adoption (default; main-checkout only) /magpie-setup…

apache/airflow · 243 tokens

upgrade-fab-provider

Upgrade the pinned Flask-AppBuilder (FAB) dependency in the Apache Airflow FAB provider (providers/fab/). Bumps the exact flask-appbuilder== pin and its mirror constant, regenerates uv.lock, drives the testfabalignment.py drift tripwire, reviews the vendored security-manager override.py against the new upstream FAB…

apache/airflow · 120 tokens

aip-user-stories

Generate verified recipe playbooks from AIPs with PR implementations (post mode), or speculative user stories from AIPs without implementations (pre mode). Use when the user provides an AIP URL or AIP content, optionally with PR URLs and file paths.

apache/airflow · 56 tokens

airflow-translations

Add or update translations for the Apache Airflow UI. Guides through setting up locales, scaffolding translation files, translating with locale-specific guidelines, and validating results. Use when working with i18n tasks in airflow-core/src/airflow/ui/public/i18n/locales/.

apache/airflow · 60 tokens

airflow-java-sdk

Guide for contributing to the Airflow Java SDK (AIP-108). Use this skill whenever a contributor is working in the java-sdk/ directory or on the Java coordinator in task-sdk/src/airflow/sdk/coordinators/java/ — whether they want to add a feature, write tests, fix a bug, understand the architecture, or prepare a PR.…

apache/airflow · 119 tokens