Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.
90
90%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
You are helping a developer refactor existing code. Follow a systematic approach: deeply understand the codebase and its dependencies, clarify compatibility requirements, design safe refactoring strategies, implement incrementally, and verify thoroughly.
/developer-kit:devkit.refactor [--lang=java|spring|typescript|nestjs|react|python|general] [--scope=file|module|feature] [refactor-description]| Argument | Description |
|---|---|
$ARGUMENTS | Combined arguments passed to the command |
The command will automatically gather context information when needed:
Agent Selection: Based on the --lang parameter, select the appropriate agents:
This command leverages four specialized sub-agents for comprehensive refactoring:
Parse $ARGUMENTS to detect the optional --lang parameter:
--lang=spring or --lang=java: Use Java/Spring Boot specialized agents--lang=typescript or --lang=ts: Use TypeScript specialized agents--lang=nestjs: Use NestJS specialized agents--lang=react: Use React frontend specialized agents--lang=aws: Use AWS specialized agents (architecture, CloudFormation, IaC)--lang=python or --lang=py: Use Python specialized agents--lang=general or no flag: Use general-purpose agents (default)Parse $ARGUMENTS to detect the optional --scope parameter:
--scope=file: Single file refactoring--scope=module: Module/package level refactoring--scope=feature: Cross-cutting feature refactoring (default)Agent Mapping by Language:
| Phase | General (default) | Java/Spring Boot (--lang=spring or --lang=java) | TypeScript (--lang=typescript or --lang=ts) | NestJS (--lang=nestjs) | React (--lang=react) | AWS (--lang=aws) | Python (--lang=python or --lang=py) |
|---|---|---|---|---|---|---|---|
| Deep Exploration | developer-kit:general-code-explorer | developer-kit-java:spring-boot-backend-development-expert | developer-kit:general-code-explorer | developer-kit-typescript:nestjs-backend-development-expert | developer-kit-typescript:react-frontend-development-expert | developer-kit-aws:aws-solution-architect-expert | developer-kit:general-code-explorer |
| Refactoring Expert | developer-kit:refactor-expert | developer-kit-java:java-refactor-expert | developer-kit-typescript:typescript-refactor-expert | developer-kit-typescript:typescript-refactor-expert | developer-kit-typescript:typescript-refactor-expert | developer-kit-aws:refactor-expert | developer-kit-python:python-refactor-expert |
| Architecture Review | developer-kit:general-software-architect | developer-kit-java:java-software-architect-review | developer-kit-typescript:typescript-software-architect-review | developer-kit-typescript:typescript-software-architect-review | developer-kit-typescript:react-software-architect-review | developer-kit-aws:aws-solution-architect-expert | developer-kit-python:python-software-architect-expert |
| Code Review | developer-kit:general-code-reviewer | developer-kit-java:spring-boot-code-review-expert | developer-kit:general-code-reviewer | developer-kit-typescript:nestjs-code-review-expert | developer-kit:general-code-reviewer | developer-kit-aws:aws-architecture-review-expert | developer-kit-python:python-code-review-expert |
Goal: Understand what needs to be refactored and why
Initial request: $ARGUMENTS
Actions:
Goal: Establish compatibility constraints before any exploration
[GATE] MANDATORY STOP POINT — DO NOT SKIP THIS PHASE UNDER ANY CIRCUMSTANCES.
This phase determines the entire refactoring strategy. You MUST stop here and ask the user about compatibility requirements before proceeding. Proceeding to Phase 3 without completing this phase is a workflow violation.
Actions:
You MUST call the AskUserQuestion tool to ask the user about compatibility requirements:
Present these options clearly:
Breaking Changes Policy:
Additional Questions:
[GATE] STOP: Wait for the user's answers. Do NOT proceed to Phase 3 until the user has responded.
Document the compatibility decision clearly in the todo list
This decision will guide all subsequent phases
Goal: Build comprehensive understanding of the code to be refactored and ALL its dependencies
CRITICAL: Refactoring requires deeper exploration than feature development. You must understand:
Actions:
Task(
description: "Map code structure for refactoring",
prompt: "Analyze [code area] comprehensively:
1. Map all classes, interfaces, and their relationships
2. Identify all public APIs and their signatures
3. Find all dependencies (what this code uses)
4. Document any design patterns currently in use
5. Return a prioritized list of files to read for deep understanding",
subagent_type: "[appropriate explorer agent]"
)Task(
description: "Find all usages and consumers",
prompt: "Find ALL usages of [code to refactor]:
1. Search for all import statements referencing this code
2. Find all method calls to public APIs
3. Identify all classes extending or implementing interfaces from this code
4. Look for reflection-based usages (especially in Spring/DI contexts)
5. Check for configuration references (XML, YAML, properties)
6. Return a complete list of dependent files",
subagent_type: "[appropriate explorer agent]"
)Task(
description: "Analyze test coverage",
prompt: "Analyze test coverage for [code to refactor]:
1. Find all unit tests covering this code
2. Find all integration tests involving this code
3. Identify test patterns and conventions used
4. Note any untested code paths
5. Return list of test files to read",
subagent_type: "[appropriate explorer agent]"
)Goal: Design the refactoring approach based on compatibility requirements
Actions:
Task(
description: "Design refactoring strategy",
prompt: "Design a refactoring strategy for [code area] with these constraints:
- Compatibility: [backward compatible / breaking changes allowed / internal only]
- Current issues: [identified problems]
- Target state: [desired outcome]
Provide:
1. Recommended refactoring pattern (Extract, Rename, Move, Replace, etc.)
2. Step-by-step implementation plan
3. Risk assessment for each step
4. Rollback strategy if issues arise
5. Migration guide if breaking changes are involved",
subagent_type: "[appropriate refactor agent]"
)Goal: Ensure the codebase is in a known-good state before making changes
Actions:
Run existing tests to establish baseline:
Create a verification checklist based on compatibility requirements:
Document the current behavior that must be preserved or intentionally changed
Goal: Execute the refactoring incrementally
DO NOT START WITHOUT USER APPROVAL FROM PHASE 4
Actions:
Implement changes in small, verifiable increments:
Follow the implementation order from the strategy:
Update todos after each significant change
For backward compatible refactoring:
For breaking changes:
Goal: Thoroughly verify the refactoring preserves behavior and improves quality
CRITICAL: This is an extended verification phase with multiple checks.
Run ALL tests that were passing before:
Compare results with pre-refactoring baseline:
Task(
description: "Review refactored code",
prompt: "Review the refactored code in [files] focusing on:
1. Does the refactoring achieve its stated goal?
2. Is the new code simpler and more maintainable?
3. Are there any regressions in code quality?
4. Does it follow project conventions?
5. Are there any missed opportunities for improvement?
6. Specific for backward compatible: Are all public APIs preserved correctly?
7. Specific for breaking changes: Are all consumers properly updated?",
subagent_type: "[appropriate code review agent]"
)Task(
description: "Verify architectural integrity",
prompt: "Verify the architectural integrity after refactoring:
1. Are module boundaries respected?
2. Is the dependency direction correct?
3. Are SOLID principles followed?
4. Is the abstraction level appropriate?
5. Any circular dependencies introduced?",
subagent_type: "[appropriate architect agent]"
)Present to user for manual verification:
Use the AskUserQuestion tool to ask user to confirm verification or report issues
Goal: Address any issues found during verification
Actions:
If issues were found:
Implement approved fixes
Re-run verification for fixed areas
Repeat until all blocking issues are resolved
Goal: Document the refactoring for future reference
Actions:
Mark all todos complete
Provide comprehensive summary:
If breaking changes were made, provide:
--lang=general)developer-kit:general-code-explorerdeveloper-kit:general-code-reviewerdeveloper-kit:general-software-architectdeveloper-kit:general-code-reviewer--lang=spring or --lang=java)developer-kit-java:spring-boot-backend-development-expertdeveloper-kit-java:java-refactor-expertdeveloper-kit-java:java-software-architect-reviewdeveloper-kit-java:spring-boot-code-review-expert--lang=typescript or --lang=ts)developer-kit:general-code-explorerdeveloper-kit-typescript:typescript-refactor-expertdeveloper-kit-typescript:typescript-software-architect-reviewdeveloper-kit:general-code-reviewer--lang=nestjs)developer-kit-typescript:nestjs-backend-development-expertdeveloper-kit-typescript:typescript-refactor-expertdeveloper-kit-typescript:typescript-software-architect-reviewdeveloper-kit-typescript:nestjs-code-review-expert--lang=react)developer-kit-typescript:react-frontend-development-expertdeveloper-kit-typescript:typescript-refactor-expertdeveloper-kit-typescript:react-software-architect-reviewdeveloper-kit:general-code-reviewer--lang=python or --lang=py)developer-kit:general-code-explorerdeveloper-kit-python:python-refactor-expertdeveloper-kit-python:python-software-architect-expertdeveloper-kit-python:python-code-review-expertdeveloper-kit-python:python-security-expert--lang=aws)developer-kit-aws:aws-solution-architect-expertdeveloper-kit-aws:aws-cloudformation-devops-expertdeveloper-kit-aws:aws-solution-architect-expertdeveloper-kit-aws:aws-architecture-review-expertFallback: If specialized agents are not available, fall back to general-purpose agent.
// Exploration with multiple agents in parallel
Task(
description: "Map code structure",
prompt: "Analyze [code area] for refactoring...",
subagent_type: "developer-kit:general-code-explorer"
)
Task(
description: "Find all usages",
prompt: "Find ALL usages of [code to refactor]...",
subagent_type: "developer-kit:general-code-explorer"
)
// Sequential refactoring design
Task(
description: "Design refactoring strategy",
prompt: "Design a refactoring strategy...",
subagent_type: "developer-kit-java:java-refactor-expert"
)
// Verification with multiple perspectives
Task(
description: "Review refactored code",
prompt: "Review the refactored code...",
subagent_type: "developer-kit-java:spring-boot-code-review-expert"
)
Task(
description: "Verify architectural integrity",
prompt: "Verify the architectural integrity...",
subagent_type: "developer-kit-java:java-software-architect-review"
)
// AWS agents (when --lang=aws)
Task(
description: "Analyze AWS architecture for refactoring",
prompt: "Analyze the current AWS architecture and identify refactoring opportunities",
subagent_type: "developer-kit-aws:aws-solution-architect-expert"
)
Task(
description: "Refactor CloudFormation templates",
prompt: "Design and implement refactored CloudFormation templates with modular structure",
subagent_type: "developer-kit-aws:aws-cloudformation-devops-expert"
)
Task(
description: "Review refactored AWS architecture",
prompt: "Review the refactored architecture against Well-Architected Framework",
subagent_type: "developer-kit-aws:aws-architecture-review-expert"
)
// Python agents (when --lang=python or --lang=py)
Task(
description: "Explore Python code for refactoring",
prompt: "Analyze the Python codebase for refactoring opportunities",
subagent_type: "developer-kit:general-code-explorer"
)
Task(
description: "Design Python refactoring strategy",
prompt: "Design refactoring strategy using Pythonic patterns and best practices",
subagent_type: "developer-kit-python:python-refactor-expert"
)
Task(
description: "Review Python architecture",
prompt: "Verify architectural integrity using Clean Architecture and DDD principles",
subagent_type: "developer-kit-python:python-software-architect-expert"
)
Task(
description: "Review refactored Python code",
prompt: "Review refactored code for quality, PEP compliance, and Pythonic idioms",
subagent_type: "developer-kit-python:python-code-review-expert"
)Throughout the process, maintain a todo list like:
[ ] Phase 1: Refactoring Discovery
[ ] Phase 2: Compatibility Requirements
[ ] Phase 3: Deep Codebase Exploration
[ ] Step 3.1: Code Structure Analysis
[ ] Step 3.2: Usage and Dependency Analysis
[ ] Step 3.3: Test Coverage Analysis
[ ] Phase 4: Refactoring Strategy
[ ] Phase 5: Pre-Refactoring Verification
[ ] Phase 6: Implementation
[ ] Phase 7: Comprehensive Verification
[ ] Step 7.1: Automated Test Verification
[ ] Step 7.2: Static Analysis Verification
[ ] Step 7.3: Code Review Verification
[ ] Step 7.4: Architecture Verification
[ ] Step 7.5: Manual Verification Points
[ ] Phase 8: Issue Resolution
[ ] Phase 9: Summary and DocumentationUpdate the status as you progress through each phase.
Note: This command follows a rigorous approach to ensure safe, high-quality refactoring that respects compatibility requirements and thoroughly verifies all changes.
# Simple file refactoring (general agents)
/developer-kit:devkit.refactor --scope=file Extract utility methods from UserService
# Java/Spring Boot module refactoring
/developer-kit:devkit.refactor --lang=spring --scope=module Refactor repository layer to use specification pattern
# Breaking change refactoring with explicit scope
/developer-kit:devkit.refactor --lang=java Restructure payment module API for v2
# TypeScript refactoring
/developer-kit:devkit.refactor --lang=typescript Convert callbacks to async/await in data layer
# NestJS refactoring
/developer-kit:devkit.refactor --lang=nestjs Refactor authentication to use guards instead of middleware
# React component refactoring
/developer-kit:devkit.refactor --lang=react Extract shared hooks from dashboard components
# Python refactoring
/developer-kit:devkit.refactor --lang=python Refactor data access layer to use repository pattern
# Python refactoring
/developer-kit:devkit.refactor --lang=py Convert synchronous code to async with asyncio
# AWS infrastructure refactoring
/developer-kit:devkit.refactor --lang=aws Refactor monolithic CloudFormation template into nested stacks
# AWS architecture modernization
/developer-kit:devkit.refactor --lang=aws Migrate from EC2-based to serverless architecture
# Internal implementation refactoring
/developer-kit:devkit.refactor --scope=file Improve performance of search algorithm in SearchServicedocs
plugins
developer-kit-ai
developer-kit-aws
agents
docs
skills
aws
aws-cli-beast
aws-cost-optimization
aws-drawio-architecture-diagrams
aws-sam-bootstrap
aws-cloudformation
aws-cloudformation-auto-scaling
aws-cloudformation-bedrock
aws-cloudformation-cloudfront
aws-cloudformation-cloudwatch
aws-cloudformation-dynamodb
aws-cloudformation-ec2
aws-cloudformation-ecs
aws-cloudformation-elasticache
references
aws-cloudformation-iam
references
aws-cloudformation-lambda
aws-cloudformation-rds
aws-cloudformation-s3
aws-cloudformation-security
aws-cloudformation-task-ecs-deploy-gh
aws-cloudformation-vpc
references
developer-kit-core
agents
commands
skills
developer-kit-devops
developer-kit-java
agents
commands
docs
skills
aws-lambda-java-integration
aws-rds-spring-boot-integration
aws-sdk-java-v2-bedrock
aws-sdk-java-v2-core
aws-sdk-java-v2-dynamodb
aws-sdk-java-v2-kms
aws-sdk-java-v2-lambda
aws-sdk-java-v2-messaging
aws-sdk-java-v2-rds
aws-sdk-java-v2-s3
aws-sdk-java-v2-secrets-manager
clean-architecture
graalvm-native-image
langchain4j-ai-services-patterns
references
langchain4j-mcp-server-patterns
references
langchain4j-rag-implementation-patterns
references
langchain4j-spring-boot-integration
langchain4j-testing-strategies
langchain4j-tool-function-calling-patterns
langchain4j-vector-stores-configuration
references
qdrant
references
spring-ai-mcp-server-patterns
spring-boot-actuator
spring-boot-cache
spring-boot-crud-patterns
spring-boot-dependency-injection
spring-boot-event-driven-patterns
spring-boot-openapi-documentation
spring-boot-project-creator
spring-boot-resilience4j
spring-boot-rest-api-standards
spring-boot-saga-pattern
spring-boot-security-jwt
assets
references
scripts
spring-boot-test-patterns
spring-data-jpa
references
spring-data-neo4j
references
unit-test-application-events
unit-test-bean-validation
unit-test-boundary-conditions
unit-test-caching
unit-test-config-properties
references
unit-test-controller-layer
unit-test-exception-handler
references
unit-test-json-serialization
unit-test-mapper-converter
references
unit-test-parameterized
unit-test-scheduled-async
references
unit-test-service-layer
references
unit-test-utility-methods
unit-test-wiremock-rest-api
references
developer-kit-php
developer-kit-project-management
developer-kit-python
developer-kit-specs
commands
docs
hooks
test-templates
tests
skills
developer-kit-tools
developer-kit-typescript
agents
docs
hooks
rules
skills
aws-cdk
aws-lambda-typescript-integration
better-auth
clean-architecture
drizzle-orm-patterns
dynamodb-toolbox-patterns
references
nestjs
nestjs-best-practices
nestjs-code-review
nestjs-drizzle-crud-generator
nextjs-app-router
nextjs-authentication
nextjs-code-review
nextjs-data-fetching
nextjs-deployment
nextjs-performance
nx-monorepo
react-code-review
react-patterns
shadcn-ui
tailwind-css-patterns
tailwind-design-system
references
turborepo-monorepo
typescript-docs
typescript-security-review
zod-validation-utilities
references
github-spec-kit