# Project Structure Cleanup Logic Refinement Protocol

> A specialized skill focused on cleaning up project structure and refining logic. It emphasizes zero-impact execution, redundancy detection, complexity governance, filesystem de-cluttering, test suite rationalization, documentation governance, and a strict risk control protocol to ensure a lean, maintainable, and high-quality codebase.

- Skill: `linnene/project-structure-cleanup-logic-refinement-protocol` (Agent Skill)
- Install (CLI): `npx skillmds@latest add linnene/project-structure-cleanup-logic-refinement-protocol`
- Raw SKILL.md: https://api.skillmd.com/api/skills/linnene/project-structure-cleanup-logic-refinement-protocol/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: linnene (https://skillmd.com/u/linnene)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/linnene/project-structure-cleanup-logic-refinement-protocol

---


## Skill: Project Structure Cleanup & Logic Refinement Protocol

### 1. Core Mandate: Functional Integrity
*   **Zero-Impact Execution**: Cleanup actions must not alter the primary functional behavior or performance benchmarks of the project.
*   **Verification Loop**: Every modification must pass existing automated test suites to ensure zero regression.

### 2. Redundancy Detection: Dead Code & Unused Assets
*   **Static Analysis**: Identify and locate variables, constants, table entries, and functions that are never referenced.
*   **Dynamic Caution**: For items potentially invoked via reflection, dynamic loading, or string concatenation, do not delete if 100% idleness cannot be confirmed. Proactive consultation is required.
*   **Dependency Pruning**: Detect and remove unused third-party libraries or internal module dependencies.

### 3. Logic Refinement: Complexity Governance
*   **Complexity Identification**: Locate logic blocks with high cyclomatic complexity, excessive nesting (3+ levels), or violations of the Single Responsibility Principle (SRP).
*   **Structural Optimization**: Propose concise, high-readability alternatives (e.g., replacing complex if-else chains with Strategy patterns or implementing early-return principles).
*   **Side-Effect Assessment**: Analyze external side effects before refactoring to ensure the implicit state machine remains intact.

### 4. Filesystem De-cluttering: Scripts, Configs & Structure
*   **Resource Validation**:
    *   **Scripts/Configs**: Justify the removal by identifying their historical context. If they are no longer invoked by current build or deployment pipelines, outline the deletion plan and its impact on CI/CD.
    *   **Files**: Delete obsolete or misleading documentation and "zombie" files.
*   **Architectural Alignment**: Identify structural flaws (e.g., business logic leaking into the driver layer). Propose a restructuring plan that aligns with ecosystem best practices (e.g., Standard Go Project Layout).

### 5. Test Suite Rationalization: Quality-Centric Filtering
*   **Criteria for Deletion**:
    *   **Irrelevant Items**: Remove trivial tests that fail to reflect structural errors or actual project integrity.
    *   **Fact-Stating Items**: Remove tests that merely state obvious facts without meaningful assertions or diagnostic value.
*   **Criteria for Retention**:
    *   **Structural Integrity**: Retain tests that catch fundamental architectural errors and reflect system stability.
    *   **Regression Protection**: Preserve tests covering edge cases and historical bug fixes.

### 6. Documentation Governance: Accuracy & Recency
*   **Obsolescence Identification**: Locate documents that are significantly outdated regarding progress, status, or technical implementation.
*   **Action Plan**: Propose either a **Refactor** (update to current state) or a **Removal/Archive** (for completely deprecated features) to prevent misleading information.

### 7. Risk Control & Consultation Protocol
*   **No Speculation**: If a dependency is ambiguous or the business logic is unclear, do not assume.
*   **Proactive Inquiry**: For high-risk operations—such as deleting configuration scripts or altering global file structures—you must submit a change list and seek clarification.
