ワンクリックで
code-quality-engineer
Ensures code quality through reviews, refactoring, technical debt management, and clean code practices
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Ensures code quality through reviews, refactoring, technical debt management, and clean code practices
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.
Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
This skill should be used when containerizing applications with Docker, creating Dockerfiles, docker-compose configurations, or deploying containers to various platforms. Ideal for Next.js, React, Node.js applications requiring containerization for development, production, or CI/CD pipelines. Use this skill when users need Docker configurations, multi-stage builds, container orchestration, or deployment to Kubernetes, ECS, Cloud Run, etc.
Comprehensive Rust development guidelines based on 6 months of code reviews. Use when writing Rust code, debugging Rust issues, or reviewing Rust PRs. Covers error handling, file I/O safety, type safety patterns, performance optimization, common footguns, and fundamental best practices. Perfect for both new and experienced Rust developers working on CLI tools, hooks, or production code.
Acquire expert Rust developer specialisation in rust systems programming, memory safety, and zero-cost abstractions. Masters ownership patterns, async programming, and performance optimisation for mission-critical applications.
| name | Code Quality Engineer |
| description | Ensures code quality through reviews, refactoring, technical debt management, and clean code practices |
| when_to_use | when reviewing code, refactoring, managing technical debt, or enforcing coding standards |
| version | 1.0.0 |
| swecom_area | 3. Software Construction |
The Code Quality Engineer ensures code is maintainable, readable, and follows best practices. This skill provides systematic approaches to code review, refactoring, and technical debt management.
elapsedTimeInDays not d)calculateTotal() not total())UserRepository not Data)accountList if it's not a ListDefinition: A class should have one, and only one, reason to change.
Bad:
class User {
save() { /* database logic */ }
sendEmail() { /* email logic */ }
generateReport() { /* reporting logic */ }
}
Good:
class User {
// Only user data and behavior
}
class UserRepository {
save(user: User) { /* database logic */ }
}
class EmailService {
sendWelcomeEmail(user: User) { /* email logic */ }
}
Definition: Open for extension, closed for modification.
Bad:
class PaymentProcessor {
process(type: string) {
if (type === 'credit') { /* credit card logic */ }
else if (type === 'paypal') { /* paypal logic */ }
// Adding new type requires modifying this class
}
}
Good:
interface PaymentMethod {
process(amount: Money): void;
}
class CreditCardPayment implements PaymentMethod {
process(amount: Money) { /* credit card logic */ }
}
class PayPalPayment implements PaymentMethod {
process(amount: Money) { /* paypal logic */ }
}
class PaymentProcessor {
process(method: PaymentMethod, amount: Money) {
method.process(amount);
// New payment types don't require changes here
}
}
Definition: Subtypes must be substitutable for their base types.
Violation:
class Rectangle {
setWidth(w: number) { this.width = w; }
setHeight(h: number) { this.height = h; }
}
class Square extends Rectangle {
setWidth(w: number) {
this.width = w;
this.height = w; // Breaks LSP - unexpected side effect
}
}
Definition: Many specific interfaces are better than one general interface.
Bad:
interface Worker {
work(): void;
eat(): void;
sleep(): void;
}
class Robot implements Worker {
work() { /* ... */ }
eat() { /* Robots don't eat! */ }
sleep() { /* Robots don't sleep! */ }
}
Good:
interface Workable {
work(): void;
}
interface Eatable {
eat(): void;
}
class Human implements Workable, Eatable {
work() { /* ... */ }
eat() { /* ... */ }
}
class Robot implements Workable {
work() { /* ... */ }
}
Definition: Depend on abstractions, not concretions.
Bad:
class OrderService {
private db = new MySQLDatabase(); // Tight coupling
saveOrder(order: Order) {
this.db.save(order);
}
}
Good:
interface Database {
save(entity: any): void;
}
class OrderService {
constructor(private db: Database) {} // Depend on abstraction
saveOrder(order: Order) {
this.db.save(order);
}
}
Before requesting review:
Good Feedback:
Poor Feedback:
Refactor when you see:
Before:
function printInvoice(invoice: Invoice) {
console.log("Invoice Details:");
console.log(`Customer: ${invoice.customer.name}`);
console.log(`Total: $${invoice.total}`);
// Calculate tax
let tax = 0;
for (const item of invoice.items) {
tax += item.price * 0.1;
}
console.log(`Tax: $${tax}`);
}
After:
function printInvoice(invoice: Invoice) {
printHeader(invoice);
printTax(invoice);
}
function printHeader(invoice: Invoice) {
console.log("Invoice Details:");
console.log(`Customer: ${invoice.customer.name}`);
console.log(`Total: $${invoice.total}`);
}
function printTax(invoice: Invoice) {
const tax = calculateTax(invoice);
console.log(`Tax: $${tax}`);
}
function calculateTax(invoice: Invoice): number {
return invoice.items.reduce((sum, item) => sum + item.price * 0.1, 0);
}
Before:
function getSpeed(vehicle: Vehicle): number {
switch (vehicle.type) {
case 'car': return vehicle.enginePower * 2;
case 'bike': return vehicle.pedalPower * 3;
case 'boat': return vehicle.motorPower * 1.5;
}
}
After:
abstract class Vehicle {
abstract getSpeed(): number;
}
class Car extends Vehicle {
getSpeed() { return this.enginePower * 2; }
}
class Bike extends Vehicle {
getSpeed() { return this.pedalPower * 3; }
}
class Boat extends Vehicle {
getSpeed() { return this.motorPower * 1.5; }
}
Before:
function createOrder(
customerId: string,
customerName: string,
customerEmail: string,
shippingAddress: string,
shippingCity: string,
shippingZip: string
) {
// Too many parameters!
}
After:
interface OrderParams {
customer: Customer;
shipping: Address;
}
function createOrder(params: OrderParams) {
// Much cleaner
}
Definition: The implied cost of additional rework caused by choosing an easy (limited) solution now instead of a better approach that would take longer.
Types:
In Code:
// TODO(DEBT): This violates SRP - extract authentication logic
// Impact: Medium | Effort: 2 days | Priority: High
class UserController {
// ...
}
In Issues/Tickets:
## Technical Debt: Extract Authentication Logic
**Location**: `controllers/UserController.ts`
**Impact**: Medium (makes testing difficult, violates SRP)
**Effort**: 2 days
**Priority**: High
**Related to**: Feature XYZ (created this debt for deadline)
### Proposed Solution
Extract authentication to AuthService, inject via DI
Matrix:
| Impact | Effort | Priority |
|---|---|---|
| High | Low | CRITICAL - Do now |
| High | High | Important - Schedule |
| Low | Low | Quick win - Do when free |
| Low | High | Defer - Reconsider later |
Definition: Number of linearly independent paths through code Threshold:
Definition: Percentage of code executed by tests Thresholds:
Note: Coverage is necessary but not sufficient - must test the right things
Definition: Percentage of duplicated code Threshold: <3% duplication (stricter than general standards)
Definition: Composite metric (0-100) based on complexity, lines of code, and Halstead volume Thresholds:
TypeScript/JavaScript:
Python:
Configuration Example (ESLint):
{
"rules": {
"complexity": ["error", 10],
"max-lines-per-function": ["warn", 50],
"max-params": ["error", 3],
"no-console": "error"
}
}
After code review or refactoring session:
# Code Quality Review: [Feature/File Name]
## Summary
- Files reviewed: 5
- Issues found: 12 (3 critical, 5 moderate, 4 minor)
- Refactoring opportunities: 3
## Critical Issues
### 1. Authentication logic in UserController (SRP violation)
**File**: `controllers/UserController.ts:45-89`
**Issue**: Controller handles both HTTP and authentication logic
**Impact**: High - makes unit testing impossible, tight coupling
**Solution**: Extract to AuthService, inject via DI
**Effort**: 2 days
**Priority**: Critical
## Moderate Issues
### 2. Duplicate validation logic
**Files**: `UserService.ts:23`, `OrderService.ts:67`, `ProductService.ts:34`
**Issue**: Same email validation in 3 places
**Impact**: Medium - inconsistent behavior, hard to change
**Solution**: Extract to `EmailValidator` utility
**Effort**: 2 hours
**Priority**: Medium
## Minor Issues
### 3. Magic numbers
**File**: `PaymentService.ts:56`
**Issue**: Hardcoded `0.1` for tax rate
**Solution**: Extract to `TAX_RATE` constant
**Effort**: 5 minutes
**Priority**: Low
## Refactoring Recommendations
### 1. Extract Method - `calculateOrderTotal()`
**File**: `OrderService.ts:123-178`
**Reason**: 55-line function doing 3 things (validation, calculation, tax)
**Suggestion**: Extract `validateOrder()`, `calculateSubtotal()`, `calculateTax()`
## Code Metrics
| Metric | Before | After | Target |
|--------|--------|-------|--------|
| Cyclomatic Complexity | 23 | 12 | <10 |
| Code Coverage | 67% | 85% | >80% |
| Duplication | 8% | 2% | <3% |
| Maintainability Index | 45 | 72 | >60 |
## Technical Debt Tracking
New debt items added to backlog:
- DEBT-123: Extract authentication logic (Priority: Critical)
- DEBT-124: Centralize validation (Priority: Medium)
## Next Steps
- [ ] Author addresses critical issues
- [ ] Re-review after changes
- [ ] Merge if all critical issues resolved
This skill does NOT:
This skill DOES:
/Users/brooke/.config/superpowers/skills/skills/testing/test-driven-development/SKILL.md) - Write tests before refactoring/Users/brooke/.config/superpowers/skills/skills/debugging/systematic-debugging/SKILL.md) - Debug code quality issues~/.claude/skills/lifecycle/design/architecture/SKILL.md) - Provides architectural guidance