code-simplifier
Code Simplifier
Enhance code clarity, consistency, and maintainability while preserving exact functionality. Apply project-specific best practices without altering behavior. Prioritize readable, explicit code over compact solutions.
Related Skills:
kavak-documentation- Query for Kavak coding standards and patterns before simplifying- Use
kavak-platform/platform_docs_searchMCP tool to verify Kavak-specific idioms
Workflow
1. Discover Project Standards
Locate project configuration files (in priority order):
.claude/CLAUDE.md,CLAUDE.md(root).cursor/rules/*.md,.cursor/rules/*.mdc,.cursorrulesAGENTS.md,.github/copilot-instructions.md.editorconfig,.prettierrc,.eslintrc.*
Extract coding standards and patterns. If none exist, apply general best practices.
2. Identify Target Code
- Default: Recently modified files (
git diff,git status) - Explicit: Files or directories specified by user
- Broad: When instructed to review entire modules
3. Apply Refinements
Preserve Functionality
- Never change what the code does, only how
- Run existing tests to verify no regressions
Apply Project Standards
- Follow discovered conventions
- Match existing code style
- Respect established patterns
Enhance Clarity
- Reduce complexity and nesting
- Eliminate redundant code
- Use clear variable/function names
- Avoid nested ternaries - use switch or if/else
- Choose clarity over brevity
Maintain Balance
- Don't create overly clever solutions
- Don't combine too many concerns
- Don't remove helpful abstractions
- Three similar lines > premature abstraction
4. Verify
- Functionality unchanged
- Code is simpler and maintainable
- Run linters/formatters if configured
Guidelines
- Operate autonomously after code is written/modified
- Don't add features or make "improvements" beyond simplification
- Don't add docstrings/comments to unchanged code
- Trust internal code and framework guarantees
References
| Reference | Purpose |
|---|---|
references/patterns.md |
Common simplification patterns |
references/anti-patterns.md |
Code smells to refactor |
references/examples.md |
Before/after examples |
More from carvalab/k-skills
code-review
Use this skill as the FINAL step after writing or modifying code — reviews for logic bugs, architecture violations, security issues, and performance problems. Trigger after completing a feature, fixing a bug, before merging, or when asked to "review this code", "check my changes", or "is this ready to merge". Fixes issues directly and runs quality gates (lint, typecheck, build, tests). Delegates style to automation, focuses on what matters.
38refactor-cleaner
Use this skill to find and remove dead code, unused dependencies, duplicate logic, and unused exports using detection tools (knip, depcheck, ts-prune, deadcode, staticcheck). Trigger on "clean up dead code", "remove unused", "find dead code", "reduce bundle size", "dependency audit", or when the codebase feels bloated. For simplifying living code (readability, naming, complexity reduction) without detection tools, use code-simplifier instead. Use this skill during maintenance windows or before major refactors.
36backend-development
Use this skill for ANY task in a Node.js/TypeScript or Go backend codebase — adding features, fixing bugs, refactoring, adding flows, modifying handlers, changing business logic, or writing new code. Trigger even when the task is vague like "add the flow to this", "implement this feature", "fix this", or "add X like Y" — if the project has go.mod, nest-cli.json, express routes, or server-side TypeScript, this skill applies. Covers REST APIs, PostgreSQL, Redis, authentication, job queues, events, microservices, Docker, CI/CD, Clean Architecture, SOLID, DRY, and code reuse patterns. When in doubt whether this is backend work, use this skill.
24doc-updater
Use this skill when documentation needs updating — after adding features, changing APIs, modifying architecture, or updating dependencies. Trigger on "update the docs", "generate codemap", "refresh the README", "document this", "update architecture docs", or when code changes make existing documentation stale. Generates codemaps from actual code, updates READMEs, architecture diagrams, and guides.
22frontend-development
Use this skill for ANY task in a Next.js or React frontend codebase — adding pages, building components, fixing UI bugs, styling, handling forms, fetching data, or modifying layouts. Trigger even when the task is vague like "add this feature", "fix the UI", "make this page", or "update the form" — if the project has next.config.*, React components, or client-side TypeScript, this skill applies. Covers App Router, Server Components, Server Actions, MUI styling, Zod validation, caching, and design quality. When in doubt whether this is frontend work, use this skill.
21test-driven-development
Use this skill when writing new features, fixing bugs, or adding test coverage. Enforces Red-Green-Refactor — write the test first, then the code. Trigger on "add tests", "write tests first", "TDD", "test this feature", "fix this bug" (reproduce with a failing test first), or when starting any new implementation. Prevents testing anti-patterns like over-mocking, test-per-method, and tests that pass but verify nothing.
19