a11y-ally
Use when running comprehensive WCAG accessibility audits with axe-core + pa11y + Lighthouse, generating context-aware…
Apply safe refactoring patterns to improve code structure without changing behavior. Use when cleaning up code, reducing technical debt, or improving maintainability.
Claude Code
$ npx -y skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns --agent claude-code
Codex
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a codex -y
Cursor
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a cursor -y
Gemini CLI
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a gemini-cli -y
GitHub Copilot
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a github-copilot -y
OpenCode
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a opencode -y
Windsurf
$ npx skills add proffesor-for-testing/agentic-qe --skill refactoring-patterns -a windsurf -y
name: refactoring-patterns description: "Apply safe refactoring patterns to improve code structure without changing behavior. Use when cleaning up code, reducing technical debt, or improving maintainability." category: development-practices priority: medium tokenEstimate: 1000 agents: [qe-code-reviewer, qe-quality-analyzer, qe-test-refactorer] implementation_status: optimized optimization_version: 1.0 last_optimized: 2025-12-03 dependencies: [] quick_reference_card: true tags: [refactoring, code-quality, technical-debt, maintainability, clean-code] trust_tier: 2 validation: schema_path: schemas/output.json validator_path: scripts/validate-config.json
<default_to_action> When refactoring: 1. ENSURE tests pass (never refactor without tests) 2. MAKE small change (one refactoring at a time) 3. RUN tests (must stay green) 4. COMMIT (save progress) 5. REPEAT
**Safe Refactoring Cycle:**
npm test # Green ✅ # Make ONE small change npm test # Still green ✅ git commit -m "refactor: extract calculateTotal" # Repeat
**Code Smells → Refactoring:** | Smell | Refactoring | |-------|-------------| | Long method (>20 lines) | Extract Method | | Large class | Extract Class | | Long parameter list (>3) | Introduce Parameter Object | | Duplicated code | Extract Method/Class | | Complex conditional | Decompose Conditional | | Magic numbers | Named Constants | | Nested loops | Replace Loop with Pipeline |
**NEVER REFACTOR:**
</default_to_action>
| Pattern | Before | After | |---------|--------|-------| | **Extract Method** | 50-line function | 5 small functions | | **Extract Class** | Class doing 5 things | 5 single-purpose classes | | **Parameter Object** | `fn(a,b,c,d,e,f)` | `fn(options)` | | **Replace Conditional** | `if (type === 'a') {...}` | Polymorphism | | **Pipeline** | Nested loops | `.filter().map().reduce()` |
1. First time → Just do it 2. Second time → Wince and duplicate 3. Third time → **Refactor**
---
// Before: Long method
function processOrder(order) {
// 50 lines of validation, calculation, saving, emailing...
}
// After: Clear responsibilities
function processOrder(order) {
validateOrder(order);
const pricing = calculatePricing(order);
const saved = saveOrder(order, pricing);
sendConfirmationEmail(saved);
return saved;
}// Before
let results = [];
for (let item of items) {
if (item.inStock) {
results.push(item.name.toUpperCase());
}
}
// After
const results = items
.filter(item => item.inStock)
.map(item => item.name.toUpperCase());// Before
if (order.total > 1000 && customer.isPremium && allInStock(order)) {
return 'FREE_SHIPPING';
}
// After
function isEligibleForFreeShipping(order, customer) {
return isLargeOrder(order) &&
isPremiumCustomer(customer) &&
allInStock(order);
}---
| ❌ Anti-Pattern | Problem | ✅ Better | |-----------------|---------|-----------| | Without tests | No safety net | Write tests first | | Big bang | Rewrite everything | Small incremental steps | | For perfection | Endless tweaking | Good enough, move on | | Premature abstraction | Pattern not clear yet | Wait for Rule of Three | | During feature work | Mixed changes | Separate commits |
---
// Detect code smells
const smells = await Task("Detect Code Smells", {
source: 'src/services/',
patterns: ['long-method', 'large-class', 'duplicate-code']
}, "qe-quality-analyzer");
// Safe refactoring with test verification
await Task("Verify Refactoring", {
beforeCommit: 'abc123',
afterCommit: 'def456',
expectSameBehavior: true
}, "qe-test-executor");---
aqe/refactoring/ ├── smells/* - Detected code smells ├── suggestions/* - Refactoring recommendations ├── verifications/* - Behavior preservation checks └── history/* - Refactoring log
const refactoringFleet = await FleetManager.coordinate({
strategy: 'refactoring',
agents: [
'qe-quality-analyzer', // Identify targets
'qe-test-generator', // Add safety tests
'qe-test-executor', // Verify behavior
'qe-test-refactorer' // TDD refactor phase
],
topology: 'sequential'
});---
---
**Refactoring is NOT:**
**Refactoring IS:**
**Always have tests. Always take small steps. Always keep tests green.**
Quality engineering tools for your coding agent. Generate tests, investigate coverage gaps, analyze flaky behavior and coordinate quality checks across the software lifecycle. Keep the findings close to the code and use them to make a better quality decision.
Use when running comprehensive WCAG accessibility audits with axe-core + pa11y + Lighthouse, generating context-aware…
WCAG 2.2 compliance testing, screen reader validation, and inclusive design verification. Use when ensuring legal compliance…
Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid…
Create and train AI learning plugins with AgentDB's 9 reinforcement learning algorithms. Includes Decision Transformer,…
Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning,…
Optimize AgentDB performance with quantization (4-32x memory reduction), HNSW indexing (150x faster search), caching, and batch…
Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…
DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…