AI Skill Report Card

Generated Skill

B-70·Jan 11, 2026

Strategic Codebase Analysis & Refactoring

This skill enables AI to analyze large codebases with the precision of an S-tier engineer, identifying strategic refactoring opportunities that improve code quality through interface-based design, eliminate redundant testing, and enhance developer experience. The focus is on demonstrable improvements to the baseline, not cosmetic changes.

1. Codebase Assessment Phase

  • Map the Architecture: Identify core domains, boundaries, and coupling patterns
  • Interface Discovery: Catalog existing abstractions and their usage patterns
  • Dependency Analysis: Trace data flow and identify tight coupling hotspots
  • Test Coverage Audit: Map tests to functionality and identify tautological patterns

2. Strategic Opportunity Identification

  • Interface Extraction Candidates: Look for repeated patterns that could benefit from abstraction
  • Boundary Clarification: Identify unclear responsibilities between modules/classes
  • DX Pain Points: Find areas where developers struggle with cognitive load
  • Performance Bottlenecks: Spot architectural decisions that impact performance

3. Refactoring Prioritization

  • Impact vs Effort Matrix: Rank opportunities by value delivered
  • Risk Assessment: Identify changes that could break existing functionality
  • Dependency Order: Sequence refactors to minimize intermediate broken states
  • Rollback Strategy: Plan reversible changes for high-risk modifications

4. Implementation Planning

  • Interface Design: Create clean contracts before implementation
  • Migration Path: Design incremental steps for large refactors
  • Documentation Strategy: Plan for improved inline and external documentation
  • Testing Strategy: Design tests that validate behavior, not implementation

Code Analysis

  • Start with the "user journey" through the code - how developers interact with it
  • Look for violations of SOLID principles, especially Interface Segregation
  • Identify code that makes assumptions about its callers or dependencies
  • Focus on areas with high change frequency but poor abstraction

Interface Design

  • Design interfaces that hide complexity, not just organize it
  • Prefer composition over inheritance for flexibility
  • Make interfaces discoverable through good naming and documentation
  • Ensure interfaces have single, well-defined responsibilities

Refactoring Execution

  • Always refactor with tests in place (add them first if missing)
  • Make one logical change at a time, commit frequently
  • Preserve existing behavior during structural changes
  • Validate that performance characteristics remain acceptable

Documentation & DX

  • Write documentation that explains "why" not just "what"
  • Include usage examples for non-trivial interfaces
  • Create migration guides for breaking changes
  • Design error messages that guide developers to solutions

Refactoring Proposal Template

Markdown
undefined

Current State: [Description of existing code] Problems: [Specific issues this addresses] Proposed Solution: [Interface/architectural change] Benefits: [Measurable improvements] Migration Path: [Step-by-step plan] Risks: [What could go wrong] Success Metrics: [How we'll measure improvement]


### Interface Documentation Template
```markdown

Purpose: [Single responsibility description] Usage Pattern: [When/how to use] Examples:

CODE
// Good usage // Bad usage

Implementation Notes: [Constraints/assumptions] Testing Strategy: [How to validate implementations]


### Test Cull Analysis Template
```markdown

What it tests: [Current behavior] Why it's tautological: [Logic that makes it redundant] Replace with: [Better test approach or removal justification] Coverage impact: [What we lose/gain]

Good Refactoring Outcomes

  • Before: Multiple classes duplicating validation logic

  • After: Single Validator interface with composable implementations

  • Result: 40% reduction in validation code, consistent error handling

  • Before: Tightly coupled service classes with hardcoded dependencies

  • After: Dependency injection with clear interface contracts

  • Result: Easy testing, improved modularity, faster development

Poor Refactoring Outcomes

  • Anti-pattern: Extracting interfaces that mirror concrete classes exactly

  • Problem: No abstraction value, just more code to maintain

  • Better: Extract interfaces based on client needs, not implementation structure

  • Anti-pattern: "God interface" that handles multiple concerns

  • Problem: Violates Interface Segregation, hard to implement/test

  • Better: Multiple focused interfaces that can be composed

Recommendation
Consider adding more specific examples

Analysis Mistakes

  • Don't confuse activity with progress - avoid refactoring for its own sake
  • Don't analyze code in isolation - always consider the broader system context
  • Don't ignore performance implications of architectural changes
  • Don't assume that newer patterns are automatically better

Design Anti-patterns

  • Don't create abstractions based on single use cases
  • Don't design interfaces that leak implementation details
  • Don't extract interfaces without clear client needs driving the design
  • Don't create dependencies between interfaces (interface pollution)

Implementation Pitfalls

  • Don't refactor without comprehensive tests covering existing behavior
  • Don't make multiple logical changes in a single commit
  • Don't break backward compatibility without clear migration paths
  • Don't optimize prematurely - focus on clarity first

Testing Mistakes

  • Don't keep tests that only verify internal implementation details
  • Don't write tests that duplicate the production code logic exactly
  • Don't ignore integration test coverage when refactoring interfaces
  • Don't assume existing tests are correct - validate they test the right behavior

Documentation Failures

  • Don't document obvious code behavior
  • Don't write documentation that will become stale quickly
  • Don't forget to update documentation when interfaces change
  • Don't write documentation that assumes extensive domain knowledge
0
Grade B-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
11/15
Workflow
11/15
Examples
15/20
Completeness
15/20
Format
11/15
Conciseness
11/15