Analyze existing codebase against standards and execute refactoring through dev-cycle
Analyzes codebase against project standards and generates refactoring tasks for dev-cycle execution.
/plugin marketplace add lerianstudio/ring/plugin install ring-dev-team@ring[path]Analyze existing codebase against standards and execute refactoring through dev-cycle.
Before loading the skill, you MUST check:
Does docs/PROJECT_RULES.md exist in the target project?
├── YES → Load skill: dev-refactor
└── no → Output blocker below and STOP
If file does not exist, output this EXACT response:
## ⛔ HARD BLOCK: PROJECT_RULES.md Not Found
**Status:** BLOCKED - Cannot proceed
### Required Action
Create `docs/PROJECT_RULES.md` with your project's:
- Architecture patterns
- Code conventions
- Testing requirements
- DevOps standards
Then re-run `/dev-refactor`.
DO not:
/dev-refactor [path] [options]
| Argument | Required | Description |
|---|---|---|
path | No | Directory to analyze (default: current project root) |
| Option | Description | Example |
|---|---|---|
--standards PATH | Custom standards file | --standards docs/MY_PROJECT_RULES.md |
--analyze-only | Generate report without executing | --analyze-only |
--critical-only | Only Critical and High priority issues | --critical-only |
--dry-run | Show what would be analyzed | --dry-run |
# Analyze entire project and refactor
/dev-refactor
# Analyze specific directory
/dev-refactor src/domain
# Analysis only (no execution)
/dev-refactor --analyze-only
# Only fix critical issues
/dev-refactor --critical-only
# Use custom standards
/dev-refactor --standards docs/team-standards.md
See skill dev-refactor for the complete 13-step workflow with TodoWrite template.
The skill defines all steps including: stack detection, codebase-explorer dispatch, individual agent reports, finding mapping, and artifact generation.
| Dimension | What's Checked | Standards Reference |
|---|---|---|
| Architecture | DDD patterns, layer separation, dependency direction, directory structure | golang.md § Architecture |
| Code Quality | Naming conventions, error handling, forbidden practices, security | golang.md § Error Handling |
| Instrumentation | Service method tracing, span naming, error classification, context propagation | golang.md § Distributed Tracing |
| Testing | Coverage percentage, test patterns, naming, missing tests | golang.md § Testing |
| DevOps | Dockerfile, docker-compose, env management, Helm charts | golang.md § DevOps |
When analyzing services for instrumentation compliance, verify:
libCommons.NewTrackingFromContext(ctx) at method starttracer.Start(ctx, "layer.entity.operation") with proper namingdefer span.End() immediately after span creationHandleSpanBusinessErrorEvent (span stays OK)HandleSpanError (span marked ERROR)log.PrintfFull details and code templates: See docs/standards/golang.md § "Distributed Tracing Architecture"
Analysis Report (docs/refactor/{timestamp}/analysis-report.md):
Tasks File (docs/refactor/{timestamp}/tasks.md):
| Level | Description | Priority | Tracking |
|---|---|---|---|
| Critical | Security vulnerabilities, data loss risk | Fix immediately | MANDATORY |
| High | Architecture violations, major code smells | Fix in current sprint | MANDATORY |
| Medium | Convention violations, moderate gaps | Fix in next sprint | MANDATORY |
| Low | Style issues, minor gaps | Fix when capacity | MANDATORY |
⛔ all severities are MANDATORY to track and fix. Low ≠ Optional. Low = Lower priority, still required.
docs/PROJECT_RULES.md MUST exist - no defaults, no fallbackIf PROJECT_RULES.md does not exist: This command will output a blocker message and terminate. The project owner must create the file first.
| Command | Description |
|---|---|
/dev-cycle | Execute development cycle (used after analysis) |
/pre-dev-feature | Plan new features (use instead for greenfield) |
/codereview | Manual code review (dev-cycle includes this) |
After PROJECT_RULES.md check passes, load the skill:
Use Skill tool: dev-refactor
The skill contains the complete analysis workflow with:
codebase-explorer (not Bash/Explore)**MODE: ANALYSIS only**Pass the following context to the skill:
| Parameter | Value |
|---|---|
path | $1 (first argument, default: project root) |
--standards | If provided, custom standards file path |
--analyze-only | If provided, skip dev-cycle execution |
--critical-only | If provided, filter to Critical/High only |
--dry-run | If provided, show what would be analyzed |
Before executing dev-cycle, you MUST ask:
AskUserQuestion:
questions:
- question: "Review refactoring plan. How to proceed?"
header: "Approval"
options:
- label: "Approve all"
description: "Proceed to dev-cycle execution"
- label: "Critical only"
description: "Execute only Critical/High tasks"
- label: "Cancel"
description: "Keep analysis, skip execution"
See skill dev-refactor for full details. Key rules:
docs/refactor/{timestamp}//dev-cycle docs/refactor/{timestamp}/tasks.md