Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Coding.Make Function Private

БесплатноБез исполняемых скриптовНе проверен

Identify private or public functions in a file and rename with underscore

gpsaggeseот gpsaggese★ 158 звёзд на GitHub

Об этом скилле

Goal

For each function <FUNC> in the passed Python file <FILE>, decide if it is private or public by checking whether Python files or Jupyter notebooks outside <FILE> call it.

Plan Only (--only_plan)

  • With --only_plan, follow .claude/skills/skill.rules.md section "Create Only a Plan with --only_plan"
  • Write the plan to coding.make_function_private.<INPUT_REF>.md, then stop without executing the skill

Conventions

  • Follow ## Mark Private Functions in .claude/skills/coding.rules.md

Definitions

External Files

  • External files = any Python file or Jupyter notebook outside the target file

    • Including:
      • Sibling scripts in the same package (e.g., notes_to_pdf.py calling functions from lib_notes_to_pdf.py)
      • Parent/sibling modules that import from the target
      • CLI entry point scripts
    • Excluding:
      • Test files of the target. A function stays private even if a test calls it
  • Note: Functions in a library module's public API are PUBLIC, even if no __main__ entry point calls them. Utilities that other scripts in the package import are PUBLIC too

Private Functions

  • If <FUNC> is not called by any external file, it is private: rename it with a _ prefix

    • E.g., def function -> def _function
    • Include only internal utilities, helpers, and implementation details
  • Update all callers of <FUNC> to the new name

  • Good (only called within its own file, so renamed private)

    # lib_helper.py
    def public_function():
        _internal_helper()  # Only called within this file, so private.
    
    def _internal_helper():
        pass
    

Public Functions

  • If <FUNC> is called by external files, it is public: its name must not start with _

    • This includes functions in shared utility modules that sibling scripts call
  • Update all callers, external and internal, to the new name

  • Good (called by an external file, so it stays public)

    # lib_notes_to_pdf.py
    def preprocess_notes(file_name, prefix):  # Called by notes_to_pdf.py, so public.
        _internal_step_1(file_name)  # Private helper.
    
    def _internal_step_1(file_name):  # Only used within lib_notes_to_pdf.py, so private.
        pass
    

Workflow

Find All Functions

  • Find all functions in <FILE>

Search for External Calls

  • For each function, search the whole codebase:
    grep -r "<FUNC>" --include="*.py" --include="*.ipynb" --exclude="test_*.py"
    

Classify and Rename

  • Classify each function as public or private from its external usage
  • Rename functions and update all call sites (in both files)
  • Verify the changes

Verification

  • --only_plan (check only this item): the plan is in coding.make_function_private.<INPUT_REF>.md in the current dir, has the Generated by line, and nothing was executed
  • Grep the entire codebase to confirm all calls were renamed correctly bash grep -r "old_name\|new_name" --include="*.py" --include="*.ipynb"
  • Run pyright to verify type correctness of modified function invocations
  • Run unit tests for the modified files to ensure nothing broke
Полный SKILL.md на GitHub

Установить Coding.Make Function Private в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Coding.Make Function Private?

Identify private or public functions in a file and rename with underscore

Как установить скилл Coding.Make Function Private?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Coding.Make Function Private запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Coding.Make Function Private с