refactor-file-module

refactor-file-module is a command for Cursor from CiscoDevNet/essentials. It costs 0 tokens per session (380 once invoked), scanned A, original, Apache-2.0.

A refactoring command that turns one source file into a same-named module directory. It moves classes into separate files, constants into a configuration file, and exports them through the module's init file.

In plain words
What is it for?
Use it to split a file such as commands.py into a commands directory containing class files, config.py, and an __init__.py export list.
Why use it?
It reduces the number of unrelated definitions in one file while preserving the module's public exports. The prescribed layout also keeps imports and constants organized during the change.

Command for Cursor

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 commands/ciscodevnet/essentials/refactor-file-module
Clone the repo
git clone --depth 1 https://github.com/CiscoDevNet/essentials

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-file-module

README.md
[![agentmods](https://agentmods.dev/badge/commands/ciscodevnet/essentials/refactor-file-module.svg)](https://agentmods.dev/commands/ciscodevnet/essentials/refactor-file-module)
Your own site
<a href="https://agentmods.dev/commands/ciscodevnet/essentials/refactor-file-module"><img src="https://agentmods.dev/badge/commands/ciscodevnet/essentials/refactor-file-module.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 380 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.00000 $0.00380
Opus 5 $0.00000 $0.00190
Sonnet 5 $0.00000 $0.00076
Haiku 4.5 $0.00000 $0.00038

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

Security

Grade A, and why

refactor-file-module 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 today.

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.

.cursor/commands/refactor-file-module.md · 65 lines

What it actually says

Refactor the given file into a module of the same name.

Example

Take the following commands.py file as an example.

CONSTANT_1 = "Constant 1"
CONSTANT_2 = "Constant 2"

class MyCommand:
    pass

class MyOtherCommand:
    pass

class YetAnotherCommand:
    pass

Classes

  1. Create a commands directory.
  2. For each class in the original commands.py file, create a file and place the corresponding class there.

Constants

  1. Create a commands/config.py file.
  2. Move all constants into the config.py file. Update each file to import the constants from the config.py file.

init.py

  1. Create a commands/__init__.py file.
  2. Export the items in this module using __all__.

The __init__.py file should look like this:

from .config import CONSTANT_1, CONSTANT_2
from .my-command import MyCommand
from .my-other-command import MyOtherCommand
from .yet-another-command import YetAnotherCommand

__all__ = [
    "CONSTANT_1",
    "CONSTANT_2",
    "MyCommand",
    "MyOtherCommand",
    "YetAnotherCommand",
]

Final file structure

The final file structure should look like this:

commands/                   # `commands` module directory, same name as given file
- __init__.py               # Init file to expose other items within this module
- config.py                 # Config file for constants
- my-command.py             # For MyCommand
- my-other-command.py       # For MyOtherCommand
- yet-another-command.py    # For YetAnotherCommand
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. today First seen · 65 lines · 0 tokens per session scan A 1ffaa8860033

Subscribe to this mod's changes

refactor-file-module is a command published in the GitHub repository CiscoDevNet/essentials (7 stars, last pushed 16d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 380 tokens. 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-09-04.