一键导入
refactoring
// Use when the user asks to "refactor", restructure, clean up, simplify, deduplicate, extract, or reorganize code. Enforces the Martin Fowler discipline defined in src/.coding_rules.md and .cursor/08-testing-and-deployment.mdc.
// Use when the user asks to "refactor", restructure, clean up, simplify, deduplicate, extract, or reorganize code. Enforces the Martin Fowler discipline defined in src/.coding_rules.md and .cursor/08-testing-and-deployment.mdc.
| name | refactoring |
| description | Use when the user asks to "refactor", restructure, clean up, simplify, deduplicate, extract, or reorganize code. Enforces the Martin Fowler discipline defined in src/.coding_rules.md and .cursor/08-testing-and-deployment.mdc. |
"Refactor" = the Martin Fowler definition. The canonical guides are
src/.coding_rules.md (long-form) and .cursor/08-testing-and-deployment.mdc §Working Style for Refactoring (the 5-step procedure). Read those first;
this skill only sequences the work.
For every refactor request, follow the 5 steps from .cursor/08:
Run uv run pytest -q between chunks for non-trivial sequences. Behavior
must stay identical — see src/.coding_rules.md §1.1.
The full table lives in .cursor/05-code-style-and-structure §Code Smells
and src/.coding_rules.md §2. The few I reach for most often:
| Smell | Refactoring |
|---|---|
| Long route handler | Extract Method into the matching back/objects/ class |
Legacy service.py | Move Function + delete service.py once empty |
| Repeated try/except → JSON envelope | Extract Function or rely on the global handler |
| Long parameter list / data clump | Introduce Parameter Object (Pydantic / @dataclass) |
| Magic strings/codes | Replace Magic Number with Symbolic Constant in constants.py |
| God service | Extract Class by domain + Move Function |
| Module-level functions sharing state | Convert to a class (one public class per file, PascalCase) |
__init__.py (.cursor/07 §__init__.py Conventions).changelog skill).Use when adding a new subpackage under back/core/, back/objects/, or agents/ — e.g. a new graph DB engine, W3C parser, industry importer, reasoning module, or domain class. Enforces the checklist defined in .cursor/07-project-conventions.mdc.
Use after any code change (feature, fix, refactor, review fixup) to update /changelogs/YYYY-MM-DD.log and run the test suite. Mandatory post-change routine — see .cursorrules.
Use when the user asks for a code review, asks to "review the code", or requests review of a feature/PR/branch. Runs the OntoBricks review checklist defined in .cursorrules.
Use when the user asks to deploy, ship, release, or push OntoBricks to Databricks. Wraps the Databricks Asset Bundle deploy for the FastAPI app and the MCP server, with the bootstrap-perms safety net described in README.md.