code-refactor
- Repo stars 0
- Author updated Live
- Author repo skills-registry
- Domain
- Engineering
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- External requests
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: code-refactor
description: Refatorar código, refactoring, modernizar código legado, melhorar qualidade, atualizar padrões…
category: engineering
runtime: no special runtime
---
# code-refactor output preview
## PART A: Task fit
- Use case: Refatorar código, refactoring, modernizar código legado, melhorar qualidade, atualizar padrões, converter componente Angular para standalone, converter para signals, substituir constructor injection por inject(), corrigir TypeScript strict, melhorar código Express Node.js, padronizar validação Zod, melhorar SCSS responsivo. Use when asked to refactor, modernize, clean up, or improve any code in this project. Use when this capability is needed..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “When to Use / Priority Order / Angular Refactoring” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Refatorar código, refactoring, modernizar código legado, melhorar qualidade, atualizar padrões, converter componente Angular para standalone, converter para signals, substituir constructor injection por inject(), corrigir TypeScript strict, melhorar código Express Node.js, padronizar validação Zod, melhorar SCSS responsivo. Use when asked to refactor, modernize, clean up, or improve any code in this project. Use when this capability is needed.”.
- **02** When the source has headings, the agent prioritizes “When to Use / Priority Order / Angular Refactoring” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; may access external network resources; usually needs no extra API key.
## Running Rules
- read files, write/modify files; may access external network resources; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “When to Use / Priority Order / Angular Refactoring”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: code-refactor
description: Refatorar código, refactoring, modernizar código legado, melhorar qualidade, atualizar padrões…
category: engineering
source: tomevault-io/skills-registry
---
# code-refactor
## When to use
- Refatorar código, refactoring, modernizar código legado, melhorar qualidade, atualizar padrões, converter componente A…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “When to Use / Priority Order / Angular Refactoring” and keep inference separate from source facts.
- read files, write/modify files; may access external network resources; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "code-refactor" {
input -> user goal + target files + boundaries + acceptance criteria
context -> When to Use / Priority Order / Angular Refactoring
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files | may access external network resources
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Code Refactor — Loja Luz do Atlântico
When to Use
Activate this skill whenever the user asks to:
- Refactor, modernize, clean up, or improve existing code
- Convert legacy Angular patterns (constructor injection, NgModules,
BehaviorSubject) to current project standards - Update Express routes, add Zod validation, or reorganize backend logic
- Fix TypeScript strict-mode violations
- Improve SCSS structure or responsiveness
Priority Order
Apply changes in this order to avoid regressions:
- TypeScript types — fix implicit
any, add missing types, align withtypes.ts - Angular patterns — standalone,
inject(), signals - Backend patterns — Zod schema validation, auth middleware reuse
- SCSS — flat selectors,
clamp(), remove hardcoded breakpoints
Angular Refactoring
Full patterns in ./references/angular-patterns.md.
Top transformations
| From (legacy) | To (current) |
|---|---|
constructor(private svc: Service) |
private readonly svc = inject(Service) |
BehaviorSubject<T> + async pipe |
signal<T>() + template call value() |
NgModule declarations |
standalone: true + inline imports: [] |
this.observable$.pipe(tap(...)) side effects |
effect(() => { ... }) |
ngModel two-way binding on non-forms |
signal() + (input) event |
Checklist — Angular
- No
constructor()— all deps viainject() -
standalone: trueon every component - All mutable state is
signal<T>(); derived state iscomputed() -
protected readonlyfor signals accessed in template - Only needed Angular modules in
imports: [] - Signals called as functions in template:
{{ value() }} - No implicit
any— all signals typed explicitly
Backend Refactoring
Full patterns in ./references/backend-patterns.md.
Top transformations
| From (legacy) | To (current) |
|---|---|
Manual req.body field access without validation |
schema.parse(req.body) with Zod |
| Auth check copy-pasted into each route | Extract requireAdmin(req, res) guard |
try/catch with console.error only |
try/catch returning proper JSON { message: string } |
req.params.id used directly |
Validated/sanitized before use |
| File upload with no MIME check | Use existing upload multer config with allowedImageMimeTypes |
Checklist — Backend
- All incoming payloads validated with a Zod schema (
.parse()or.safeParse()) - Auth header validated for every admin route:
req.headers.authorization === \Bearer ${adminToken}`` - Error responses return
{ message: string }JSON, not plain text - No
req.params/req.queryvalues used unsanitized in file paths or SQL - Webhook raw body handled before
express.json()middleware
TypeScript Refactoring
- Replace all
anywith concrete types fromfrontend/src/app/types.tsor inline interfaces - Replace
||with??when the intent is nullish coalescing (not falsy) - Replace
as Xtype assertions with proper narrowing (if (x instanceof X), type guards) - Ensure
noImplicitReturnsis satisfied — every branch of a function must return
SCSS Refactoring
- Replace fixed
pxfont sizes withclamp():font-size: clamp(1rem, 3vw, 2rem) - Replace deep nesting (
.parent .child .grandchild) with flat BEM-like selectors (.card,.card-title,.card-body) - Replace
@media (max-width: 768px)breakpoints with fluid layouts using CSS Gridauto-fit/minmaxwhere possible - Remove
!important— use specificity instead
Refactoring Workflow
- Read the file(s) to be refactored in full before changing anything
- Identify which category applies (Angular / backend / TypeScript / SCSS)
- Apply the matching checklist above
- Preserve all existing business logic — only change structure, patterns, and syntax
- Verify the project compiles without TypeScript errors after Angular changes
Source: AisleiAvila/loja — distributed by TomeVault.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review