Refactor Code
Purpose
Restructure existing code to improve maintainability, readability, and performance without changing its external behavior, using GitHub and Jira.
This skill provides operational guidance for Refactor Code, including tool usage patterns, workflows, and quality expectations aligned with Syncolab skill standards.
When to Use
- Use when the user needs help with Refactor Code.
- When integrations for this domain are available and the task matches the workflows below.
When NOT to Use
- When the task is unrelated to Refactor Code or covered by a more specific skill.
- When required integrations or credentials are unavailable.
Expected Outcome
- Correct use of domain tools with verified results (not fabricated).
- Clear summary of actions taken, data returned, and recommended next steps.
- Errors and missing permissions reported explicitly.
Inputs to Gather
- User goal, constraints, and any identifiers (URLs, IDs, project keys).
- Available tool sets and connection status.
- Relevant context from related systems before destructive writes.
Workflow
- Confirm the request maps to Refactor Code and required tools are available.
- Gather identifiers and scope (project, channel, repo, date range, etc.).
- Follow the domain guidance below; prefer list/search before get/update when applicable.
- Execute tool calls using schemas from the integration; never invent tool output.
- Summarize results and offer logical follow-ups.
Skill: Refactor Code
Description
Restructure existing code to improve maintainability, readability, and performance without changing its external behavior, using GitHub and Jira.
Purpose
This skill ensures that the codebase remains clean, scalable, and efficient over time. It focuses on improving internal structure, reducing technical debt, and optimizing performance while preserving functional correctness.
Responsibilities
- Analyze existing code for maintainability and performance issues
- Refactor code to improve clarity, structure, and efficiency
- Preserve existing behavior and contracts
- Align refactored code with architecture and conventions
- Minimize risk by making safe, incremental improvements
- Clearly document changes and rationale in Jira
Workflow
1. Understand the Context (Jira + GitHub)
- Review the Jira ticket for:
- Refactor goals (e.g., readability, performance, modularity)
- Constraints and scope
- Identify:
- Critical paths and impacted areas
- Existing issues (duplication, complexity, bottlenecks)
- Ensure clarity on what must not change (external behavior, APIs, outputs)
2. Analyze the Codebase (GitHub)
- Read the relevant code thoroughly
- Identify:
- Code smells (duplication, long methods, unclear naming)
- Tight coupling and poor separation of concerns
- Performance inefficiencies
- Dead or unused code
- Look for existing patterns to align with
3. Define Refactor Strategy
- Plan changes before coding:
- Break refactor into small, safe steps
- Identify dependencies and order of changes
- Decide:
- What to simplify, extract, rename, or reorganize
- What to optimize (only if measurable or clearly beneficial)
- Avoid mixing refactor with feature changes
4. Execute Incremental Refactor
- Apply changes in small, controlled steps:
- Extract functions or classes where needed
- Improve naming for clarity and intent
- Reduce duplication by consolidating logic
- Simplify complex conditionals or flows
- Maintain:
- Existing interfaces and contracts
- Backward compatibility
5. Improve Structure and Design
- Enforce:
- Clear separation of concerns
- Logical module boundaries
- Consistent abstraction levels
- Ensure:
- Code is easier to navigate and reason about
- Dependencies are minimized and explicit
6. Optimize Performance (When Applicable)
- Focus only on meaningful improvements:
- Remove redundant computations
- Improve inefficient loops or queries
- Reduce unnecessary memory or I/O usage
- Do not sacrifice readability for micro-optimizations
7. Validate Behavior Preservation
- Ensure that:
- Existing functionality remains unchanged
- No regressions are introduced
- If tests exist:
- Use them as validation signals
- If gaps are found:
- Note them in Jira (do not silently ignore risk)
8. Clean Up
- Remove:
- Dead code
- Unused imports
- Obsolete comments
- Ensure formatting and style consistency
9. Update Jira
- Provide a clear summary including:
- What was refactored
- Why it was necessary
- Key improvements (readability, performance, structure)
- Any risks or follow-ups
- Mark the task appropriately (e.g., ready for review)
GitHub Usage Guidelines
- Make focused, incremental changes
- Avoid large, sweeping refactors unless explicitly required
- Keep diffs readable and reviewable
- Preserve commit clarity (each change should have a clear purpose)
- Always understand existing code before modifying it
Jira Usage Guidelines
- Document:
- Refactor intent and scope
- Key decisions made
- Any identified risks or technical debt remaining
- Keep Jira aligned with actual changes performed
Best Practices
- Refactor for humans first, machines second
- Prefer simplicity and clarity over cleverness
- Keep functions small and focused
- Use meaningful names that reflect intent
- Make implicit logic explicit
- Align with existing architecture and patterns
Anti-Patterns to Avoid
- Changing functionality during refactor
- Over-refactoring without clear value
- Introducing new patterns unnecessarily
- Optimizing prematurely without evidence
- Making large, risky changes in one step
- Ignoring existing conventions
Output Expectations
- Cleaner, more maintainable code
- Improved structure and readability
- Preserved functionality and behavior
- Reduced technical debt
- Clear Jira summary explaining changes and impact
- Code ready for testing and review
Tool Availability Rules
| Access |
Behavior |
| Full tool access |
Execute workflows, verify outputs, report errors. |
| Read-only |
Inspect and plan; provide exact commands or dispatch request for writes. |
| No integration |
State limitation; do not fabricate API results. |
Related tool sets
Review / Decision / Execution Criteria
- Prefer smallest safe change; confirm destructive actions with the user.
- Use evidence from tool responses; cite IDs and links when present.
- Match integration-specific conventions (JQL, RFC3339, A1 notation, etc.).
Output Format
Report:
- What was requested and what was done.
- Key results (tables or bullets).
- Errors, blockers, or missing permissions.
- Suggested next steps.
Quality Bar
- Specific, actionable, and grounded in tool output.
- Concise unless the user asked for detail.
- Respect rate limits, pagination, and API semantics.
Safety and Boundaries
- Do not commit secrets, tokens, or PII into skills or user-visible logs.
- Do not fabricate validation, send, or write confirmations.
- Confirm destructive operations (delete, destroy, mass update) when appropriate.
Escalation / Dispatch Rules
- If the task spans multiple domains, use or suggest related skills via
relationships.skills.
- If write access is required but unavailable, dispatch or ask the user to enable tools.
References
- Legacy content migrated from
skills/old_skills.json (refactor-code).
skills/skill.instruction.md, skills/meta.instructions.md
1---2name: refactor-code3description: Restructure existing code to improve maintainability, readability, and performance without changing its external behavior, using GitHub and Jira.4---56# Refactor Code78## Purpose910Restructure existing code to improve maintainability, readability, and performance without changing its external behavior, using GitHub and Jira.1112This skill provides operational guidance for Refactor Code, including tool usage patterns, workflows, and quality expectations aligned with Syncolab skill standards.1314## When to Use1516- Use when the user needs help with Refactor Code.17- When integrations for this domain are available and the task matches the workflows below.1819## When NOT to Use2021- When the task is unrelated to Refactor Code or covered by a more specific skill.22- When required integrations or credentials are unavailable.2324## Expected Outcome2526- Correct use of domain tools with verified results (not fabricated).27- Clear summary of actions taken, data returned, and recommended next steps.28- Errors and missing permissions reported explicitly.2930## Inputs to Gather3132- User goal, constraints, and any identifiers (URLs, IDs, project keys).33- Available tool sets and connection status.34- Relevant context from related systems before destructive writes.3536## Workflow37381. Confirm the request maps to Refactor Code and required tools are available.392. Gather identifiers and scope (project, channel, repo, date range, etc.).403. Follow the domain guidance below; prefer list/search before get/update when applicable.414. Execute tool calls using schemas from the integration; never invent tool output.425. Summarize results and offer logical follow-ups.4344# Skill: Refactor Code4546## Description47Restructure existing code to improve maintainability, readability, and performance without changing its external behavior, using GitHub and Jira.4849---5051## Purpose52This skill ensures that the codebase remains clean, scalable, and efficient over time. It focuses on improving internal structure, reducing technical debt, and optimizing performance while preserving functional correctness.5354---5556## Responsibilities5758- Analyze existing code for maintainability and performance issues59- Refactor code to improve clarity, structure, and efficiency60- Preserve existing behavior and contracts61- Align refactored code with architecture and conventions62- Minimize risk by making safe, incremental improvements63- Clearly document changes and rationale in Jira6465---6667## Workflow6869### 1. Understand the Context (Jira + GitHub)70- Review the Jira ticket for:71 - Refactor goals (e.g., readability, performance, modularity)72 - Constraints and scope73- Identify:74 - Critical paths and impacted areas75 - Existing issues (duplication, complexity, bottlenecks)76- Ensure clarity on what must **not** change (external behavior, APIs, outputs)7778---7980### 2. Analyze the Codebase (GitHub)81- Read the relevant code thoroughly82- Identify:83 - Code smells (duplication, long methods, unclear naming)84 - Tight coupling and poor separation of concerns85 - Performance inefficiencies86 - Dead or unused code87- Look for existing patterns to align with8889---9091### 3. Define Refactor Strategy92- Plan changes before coding:93 - Break refactor into small, safe steps94 - Identify dependencies and order of changes95- Decide:96 - What to simplify, extract, rename, or reorganize97 - What to optimize (only if measurable or clearly beneficial)98- Avoid mixing refactor with feature changes99100---101102### 4. Execute Incremental Refactor103- Apply changes in small, controlled steps:104 - Extract functions or classes where needed105 - Improve naming for clarity and intent106 - Reduce duplication by consolidating logic107 - Simplify complex conditionals or flows108- Maintain:109 - Existing interfaces and contracts110 - Backward compatibility111112---113114### 5. Improve Structure and Design115- Enforce:116 - Clear separation of concerns117 - Logical module boundaries118 - Consistent abstraction levels119- Ensure:120 - Code is easier to navigate and reason about121 - Dependencies are minimized and explicit122123---124125### 6. Optimize Performance (When Applicable)126- Focus only on meaningful improvements:127 - Remove redundant computations128 - Improve inefficient loops or queries129 - Reduce unnecessary memory or I/O usage130- Do not sacrifice readability for micro-optimizations131132---133134### 7. Validate Behavior Preservation135- Ensure that:136 - Existing functionality remains unchanged137 - No regressions are introduced138- If tests exist:139 - Use them as validation signals140- If gaps are found:141 - Note them in Jira (do not silently ignore risk)142143---144145### 8. Clean Up146- Remove:147 - Dead code148 - Unused imports149 - Obsolete comments150- Ensure formatting and style consistency151152---153154### 9. Update Jira155- Provide a clear summary including:156 - What was refactored157 - Why it was necessary158 - Key improvements (readability, performance, structure)159 - Any risks or follow-ups160- Mark the task appropriately (e.g., ready for review)161162---163164## GitHub Usage Guidelines165166- Make focused, incremental changes167- Avoid large, sweeping refactors unless explicitly required168- Keep diffs readable and reviewable169- Preserve commit clarity (each change should have a clear purpose)170- Always understand existing code before modifying it171172---173174## Jira Usage Guidelines175176- Document:177 - Refactor intent and scope178 - Key decisions made179 - Any identified risks or technical debt remaining180- Keep Jira aligned with actual changes performed181182---183184## Best Practices185186- Refactor for humans first, machines second187- Prefer simplicity and clarity over cleverness188- Keep functions small and focused189- Use meaningful names that reflect intent190- Make implicit logic explicit191- Align with existing architecture and patterns192193---194195## Anti-Patterns to Avoid196197- Changing functionality during refactor198- Over-refactoring without clear value199- Introducing new patterns unnecessarily200- Optimizing prematurely without evidence201- Making large, risky changes in one step202- Ignoring existing conventions203204---205206## Output Expectations207208- Cleaner, more maintainable code209- Improved structure and readability210- Preserved functionality and behavior211- Reduced technical debt212- Clear Jira summary explaining changes and impact213- Code ready for testing and review214215## Tool Availability Rules216217| Access | Behavior |218|--------|----------|219| Full tool access | Execute workflows, verify outputs, report errors. |220| Read-only | Inspect and plan; provide exact commands or dispatch request for writes. |221| No integration | State limitation; do not fabricate API results. |222223### Related tool sets224225- `vscode`226- `github`227228229230## Review / Decision / Execution Criteria231232- Prefer smallest safe change; confirm destructive actions with the user.233- Use evidence from tool responses; cite IDs and links when present.234- Match integration-specific conventions (JQL, RFC3339, A1 notation, etc.).235236## Output Format237238Report:2392401. What was requested and what was done.2412. Key results (tables or bullets).2423. Errors, blockers, or missing permissions.2434. Suggested next steps.244245## Quality Bar246247- Specific, actionable, and grounded in tool output.248- Concise unless the user asked for detail.249- Respect rate limits, pagination, and API semantics.250251## Safety and Boundaries252253- Do not commit secrets, tokens, or PII into skills or user-visible logs.254- Do not fabricate validation, send, or write confirmations.255- Confirm destructive operations (delete, destroy, mass update) when appropriate.256257## Escalation / Dispatch Rules258259- If the task spans multiple domains, use or suggest related skills via `relationships.skills`.260- If write access is required but unavailable, dispatch or ask the user to enable tools.261262## References263264- Legacy content migrated from `skills/old_skills.json` (`refactor-code`).265- `skills/skill.instruction.md`, `skills/meta.instructions.md`