Better code full

From NazmusSayad/.dotfiles · View interactive version

Better code full is an AI agent skill from the GitHub repository NazmusSayad/.dotfiles. Rethinks the design of existing code, such as data flow, state, and the paths between parts, and rebuilds it in a simpler and more direct way without changing its behavior.

How to use this skill

Skill file

Working scope

Understand the scope before you do anything else. The scope can be a PR, a commit, a branch, specific files or folders, or the whole repository. If the user did not state the scope, default to the changes made in the current chat. If the scope is unclear, ask the user and wait for the answer. Do not guess. Then work only inside that scope.

Goal

Find a simpler design for the code in scope and change the code to it. Local tidying, such as inlining a helper or removing a variable, is not the goal. Look for changes that remove whole mechanisms: paths, copies of state, events, layers, and special cases.

Keep the behavior exactly the same. This includes what the user sees, what is stored, what is sent, and edge cases such as timing, ordering, errors, and who receives an update. If a simpler design needs any change in behavior, do not make it. Describe the change and its effect, and ask first.

Understand the whole design first

Read all the code in scope before you change anything. For a PR, read the full diff and the code it touches. Map:

Look for a simpler design

Ask how you would build the same behavior from the start with what you know now. Common signs that the design can be simpler:

Before you keep a mechanism, find out why it exists. Code that looks unnecessary often protects behavior, such as an instant open from a cache, an optimistic update, or a provider difference. Keep it when removing it would change behavior.

Prefer one large simplification over many small edits. Fewer lines are good only when the result is easier to follow.

Make the change

Change the design completely. Remove everything the old design needed: types, events, fields, state, resets, subscriptions, helpers, and their imports. Do not leave the old path beside the new one. Avoid incidental changes to names, formatting, and unrelated code.

Check the result

Check that each flow in scope behaves as before, step by step, including edge cases. Check that no reference to a removed part remains. Run typecheck and lint.

Report

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.