refactor

Refactor existing Lean proofs for brevity, clarity, and documentation.

2|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/jeffrey-dot-li/lean-homology --skill refactor-jeffrey-dot-li
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/jeffrey-dot-li/lean-homology/tree/main/.claude/skills/refactor
Command: npx skills add https://github.com/jeffrey-dot-li/lean-homology --skill refactor-jeffrey-dot-li

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps improve existing Lean mathematical proofs by making them more concise, readable, and well-documented, ensuring the integrity and maintainability of formal verification efforts.

Core Features & Use Cases

  • Proof Optimization: Shortens and clarifies complex proof steps.
  • Documentation Enhancement: Adds Lean doc comments for better understanding.
  • Verification: Ensures the proof remains valid after each refactoring step.
  • Use Case: You have a lengthy proof in Lean that works but is hard to follow. Use this Skill to simplify it and add comments explaining each major step.

Quick Start

Use the refactor skill to improve the clarity of the proof in the current file.

Frequently Asked Questions about refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Lean proofs to make them more concise and readable?

To refactor Lean proofs for conciseness and readability, this Skill shortens complex proof steps, adds clarifying doc comments, and verifies the proof remains valid after each modification.

What is the best way to add documentation to existing formal verification proofs?

Adding documentation to formal verification proofs is done by inserting Lean doc comments throughout the code, which helps explain major steps and improves the maintainability of mathematical theorems.

Do I need specific diagnostic inputs to simplify complex Lean theorem proving code?

Yes, simplifying complex Lean theorem proving code requires providing `lean_goal` and `lean_diagnostic_messages` inputs to enable interactive proof analysis and ensure the refactored verification remains valid.

Can I use this refactoring approach on any working Lean mathematical proof?

Yes, you can apply this refactoring approach to any existing working Lean mathematical proof, as it focuses on optimizing and documenting proofs without altering their original formal verification integrity.

Why does my Lean proof refactoring process need interactive diagnostic messages?

Interactive diagnostic messages are needed during Lean proof refactoring to verify that each simplification step maintains the formal mathematical proof's validity and does not break the underlying theorem.