class-refactoring

class-refactoring is a skill for Claude Code, Codex from pekral/cursor-rules. It costs 22 tokens per session (5,257 once invoked), scanned A, original, MIT.

A method for reorganising PHP classes while keeping their behaviour the same. It focuses on clearer structure, separated responsibilities, easier testing, and easier maintenance.

In plain words
What is it for?
Use it to refactor PHP classes, improve their structure and readability, and identify refactoring opportunities during a code review.
Why use it?
It reduces tangled class design and makes future changes safer without intentionally changing what the code does.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it to refactor PHP classes, improve their structure and readability, and identify refactoring opportunities during a code review.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pekral/cursor-rules/class-refactoring
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.

Any agent
npx skills add pekral/cursor-rules --skill class-refactoring
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules

Made for: Claude Code, Codex.

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 class-refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/pekral/cursor-rules/class-refactoring/github.svg)](https://agentmods.dev/skills/pekral/cursor-rules/class-refactoring)
Your own site
<a href="https://agentmods.dev/skills/pekral/cursor-rules/class-refactoring"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/class-refactoring/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for class-refactoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/pekral/cursor-rules/class-refactoring"><img src="https://agentmods.dev/badge/skills/pekral/cursor-rules/class-refactoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,257 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00022 $0.05257
Opus 5.5 $0.00009 $0.02103
Sonnet 5.5 $0.00004 $0.01051
Haiku 4.5 $0.00002 $0.00526

Measured 1mo ago against content hash 6c508f3eaeea, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

class-refactoring 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 1mo ago.

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/class-refactoring/SKILL.md · 168 lines

How it starts

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

Class Refactoring

Purpose

Improve code structure and quality without changing behavior.

Focus on:

  • clarity
  • separation of concerns
  • testability
  • maintainability

Modes

This skill runs in one of two modes, selected by the caller via MODE (default apply):

  • apply (default) — full refactoring: modify code, author the pre-refactor coverage commit, run fixers / checkers, and chain the After Completion review. Every step below behaves as written unless it is explicitly flagged for MODE=cr.

  • cr (read-only lens — invoked by @skills/code-review/SKILL.md, code-review-github, code-review-jira, code-review-bugsnag) — never modify code, never author tests, never stage / commit / push, never run fixers or checkers, and never chain any After Completion review. Scope the analysis to the lines added or modified by the PR diff and return the refactoring opportunities as markdown only, for the CR to fold into its Refactoring (DRY / tech debt) and Refactoring proposals sections. Every "apply / extract / split / consolidate" instruction below is emitted as a written proposal, not applied to code; the Test Coverage Gate becomes a read-only audit (report coverage gaps as findings, do not author tests).

    Completeness contract (MODE=cr). The lens walks the complete guideline set of this skill against the diff — every bullet of Refactoring Guidelines, every bullet of Laravel Context, and the behavior-preservation clauses of the Execution section — not only the DRY / oversized-method subset the caller happens to name in its invocation line. A caller's summary of the lens ("surface DRY duplication and oversized methods") is a description of the common case, never a restriction of the walk. Each matched guideline produces one item, and the caller must render every returned item in the published report — the CR routes it, it never drops it. The routing and de-duplication contract lives in @rules/code-review/general.mdc Refactoring & Tech Debt (DRY) Analysis — diff-scoped detail.

Read the full file on GitHub · 168 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. 1mo ago First seen · 168 lines · 22 tokens per session scan A 6c508f3eaeea

Subscribe to this mod's changes

class-refactoring is a skill published in the GitHub repository pekral/cursor-rules (11 stars, last pushed 19d ago), licensed MIT. It adds 22 tokens to every session and 5,257 once invoked, about $0.0001 per session on Opus 5.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

create-powergrid-plugin

Create a complete PowerGrid plugin from scratch, including PHP class, Column macro, Blade view, Alpine.js component, and registration.

Power-Components/livewire-powergrid · 31 tokens

Laravel Dusk Testing

Expert-level Laravel Dusk browser testing skill for PHP/Laravel applications. Covers Chrome-based E2E testing, browser assertions, Page Objects, component testing, authentication helpers, and database integration.

PramodDutta/qaskills · 44 tokens

laravel

Use when building or extending a Laravel 11/12 app — Eloquent models, migrations and relationships, routing with controllers and Form Requests, queues and background jobs, framework-native security (validation, mass-assignment, policies, signed URLs, rate limiting), and Pest/PHPUnit feature tests. NOT pure PHP…

ericrisco/rsc-harness · 76 tokens

owl-admin-devtools-generator

A development guide for Owl Admin, a Laravel-based administration system, covering its code generator, API templates, relationships, and visual pages.

slowlyo/owl-admin · 82 tokens

php-expert

Expert-level PHP development with PHP 8+, Laravel, Composer, and modern best practices. Use when the user mentions Laravel, Composer, Symfony, PHPUnit, or PSR standards, or when the task involves PHP 8+ Features, Object-Oriented PHP, Modern PHP, or Constructor Property Promotion.

personamanagmentlayer/pcl · 64 tokens

electrik-slate

Build Laravel Blade UI with Electrik Slate 3.x and optional slate-blocks. Use when writing x-slate or x-slate-block components, Livewire forms, tokens, toasts, blocks, or when the user mentions Slate, electrik/slate, electrik/slate-blocks, or slate.electrik.dev.

electrikhq/slate · 72 tokens