make_function_private

Rename unused Python functions and classes with leading underscores.

144|140|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/causify-ai/helpers --skill make-function-private
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: make_function_private
Source: https://github.com/causify-ai/helpers/tree/main/.claude/skills/coding.make_function_private
Command: npx skills add https://github.com/causify-ai/helpers --skill make-function-private

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps Python developers identify functions and classes that are not called externally and rename them with a leading underscore, improving code encapsulation and readability.

Core Features & Use Cases

  • Code Cleanup: Detects functions and classes that are not invoked outside their files.
  • Refactoring Assistance: Renames identified functions to follow Python's private naming convention.
  • Use Case: Developers working on large codebases can quickly streamline their code by isolating only externally-used APIs and internal helpers.

Quick Start

Use the make_function_private skill to analyze a Python file and automatically update private functions and classes.

Frequently Asked Questions about make_function_private

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

FAQPage Schema
How do I automatically privatize unused Python functions in my codebase?

Automatically privatizing unused Python functions requires static analysis of your scripts to detect call relationships. It identifies functions not invoked outside their files and renames them with a leading underscore for encapsulation.

What is the Python convention for making internal functions private?

Making internal Python functions private involves renaming them with a leading underscore. This signals they are internal helpers not invoked externally, improving code encapsulation and maintaining a clean project structure.

How do I detect unused Python classes and functions for code cleanup?

Detecting unused Python classes and functions for code cleanup involves static analysis to map call relationships in your scripts. It isolates functions not invoked outside their files, distinguishing external APIs from internal helpers.

Does static analysis work for refactoring large Python codebases?

Static analysis works for refactoring large Python codebases by scanning scripts to detect call relationships. It identifies unused functions and classes, allowing developers to streamline code by isolating externally-used APIs and internal helpers.

When should I rename Python functions with a leading underscore?

Rename Python functions with a leading underscore when static analysis confirms they are not invoked outside their files. This refactoring step enforces encapsulation, improves readability, and maintains clean project structure.