codebase-optimizer

Generate, audit, and synchronize SKILL.md documentation against actual codebase structure.

3|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/ZHLX2005/sl --skill codebase-optimizer-zhlx2005
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codebase-optimizer
Source: https://github.com/ZHLX2005/sl/tree/main/skills/codebase-optimizer
Command: npx skills add https://github.com/ZHLX2005/sl --skill codebase-optimizer-zhlx2005

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Skill documentation drifts out of sync with the real codebase as code evolves, leaving stale file paths, renamed classes, and dead API references that mislead the next developer or agent. This Skill keeps SKILL.md files accurate by auditing references against the actual code and synchronizing them after every feature change. ## Core Features & Use Cases - Create: Traverse any codebase directory (language-agnostic), analyze module dependencies, and generate an anti-corruption SKILL.md with executable detection rules and good/bad examples. - Audit & Sync: Extract every file path, class, and function reference from an existing skill and verify each one exists in the code with grep and test -f, then fix or remove broken references. - Post-Feature Sync: After a PR or commit, classify the git diff (new files, renames, signature changes, new dependencies) and update affected SKILL.md files and references/ docs in the same PR. - Reflection Loop: After using a skill, convert lessons learned and pitfalls into structured good_eg/bad_eg entries so the skill accumulates project experience. - Use Case: You just merged a branch that renamed class UserModel to class Account and moved auth/login.py. Run this Skill to find every skill referencing the old names, sed-replace them, verify all paths exist, and commit the doc sync alongside the code. ## Quick Start Ask the AI to audit the skills under .claude/skills against the current codebase and fix any references that no longer exist.

Frequently Asked Questions about codebase-optimizer

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

FAQPage Schema
How do I keep SKILL.md documentation in sync with my codebase?

Run the audit workflow: extract all file paths, class names, and function references from SKILL.md with grep, then verify each exists using test -f and language-appropriate grep patterns. Fix broken references or delete obsolete sections, and repeat after every feature merge.

How to generate coding standards documentation from an existing codebase?

Traverse the target directory with find, analyze file sizes and import graphs to map module boundaries, then write a SKILL.md containing responsibility tables, a dependency matrix, and concrete good/bad code examples. Every rule must include an executable detection command rather than vague advice.

Does this skill work with languages other than Python or JavaScript?

Yes, the method is language-agnostic. It adapts grep keywords to the target language, using class for Java/Python, struct for Go, fn for Rust, and so on. The same audit and sync workflow applies to any tech stack.

When should I sync skill documentation after a code change?

Sync before every commit, PR, or merge that changes file paths, class names, API signatures, routes, or dependencies. Use git diff --name-only to list changed files, grep the skills directory for affected references, and include the doc updates in the same PR.

What is the difference between the audit and post-feature sync workflows?

Audit is a periodic full scan checking every skill against the whole codebase. Post-feature sync is incremental, triggered by one specific change set, and focuses only on skills referencing the files modified in that diff.