code-ratchets

Count and constrain deprecated pattern usage in Python codebases.

Updated Dec 31, 2025
One-click install
npx skills add https://github.com/RyanTheRobothead/skills --skill code-ratchets-ryantherobothead
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-ratchets
Source: https://github.com/RyanTheRobothead/skills/tree/main/skills/code-ratchets
Command: npx skills add https://github.com/RyanTheRobothead/skills --skill code-ratchets-ryantherobothead

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires rich, and includes scripts (resource) components.

What problem does it solve?

Codebases often accumulate deprecated patterns and anti-patterns that hinder maintainability and slow down evolution. This Skill provides a configurable, automated guardrail that counts such patterns and prevents uncontrolled growth while signaling when refactors reduce them.

Core Features & Use Cases

  • Define ratchets in a Python script to count occurrences of patterns like TODO comments or type: ignore annotations.
  • Integrate with pre-commit to fail on pattern proliferation and celebrate progress when counts drop.
  • Use the init workflow to snapshot current counts and keep a historical audit of code health over time.

Quick Start

Run the ratchet tool to initialize counts and start enforcing your project's deprecated-pattern control.

Frequently Asked Questions about code-ratchets

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent deprecated Python patterns from increasing in my codebase?

You can prevent deprecated Python patterns from increasing by applying configurable ratchets that count occurrences and block pre-commit checks when counts exceed expected thresholds, stopping uncontrolled proliferation while tracking code health.

What is a ratchet in the context of static analysis and code quality?

A ratchet in static analysis is a guardrail that snapshots the current count of deprecated patterns and enforces that the number never increases, allowing gradual refactoring without requiring an immediate full cleanup of the codebase.

How do I set up pre-commit hooks to fail when TODO comments or type ignore annotations increase?

Set up pre-commit hooks to fail when TODO comments or type ignore annotations increase by defining ratchets with pattern, expected count, and glob, then running the init workflow to snapshot current counts and enforce limits in Python projects.

Can I use code ratchets with my existing Python pre-commit hooks and static analysis tools?

Yes, code ratchets integrate with existing Python pre-commit hooks and static analysis tools by applying a Python-based counting engine with configurable pattern matching and optional verbose output to enforce code quality limits.

How do I initialize counts for deprecated patterns to match my current codebase state?

Initialize counts for deprecated patterns to match your current codebase state by running the init workflow, which snapshots existing pattern occurrences to establish a baseline for pre-commit checks and creates a historical audit of code health.