After completing each requested change, run the most relevant available validation.
Update the relevant documentation whenever code is changed.
Check the Git working tree and commit the completed changes.
Push the commit to the configured remote after every successful commit.
Keep commits scoped to the requested work and do not stage unrelated changes.
Report the commit hash in the final response.
If a change requires restarting a server, application, or other running process before it takes effect, explicitly tell the user what must be restarted.
If a compatibility issue arises, ask the user whether compatibility support is required before proceeding with compatibility-related work.
Code Preservation
Do not delete existing comments, debugging code, logs, or similar development artifacts unless the user explicitly requests their removal.
When extracting code, preserve the original code as much as possible. Do not make unrelated changes or optimizations.
Module Extraction
When extracting modules, prefer on-demand loading when it can be done without changing existing behavior or adding unnecessary complexity.
Prefer to keep individual files under 600 lines. When a file grows beyond that size, consider extracting cohesive modules without changing existing behavior.
Code Comments
Comment generated code as thoroughly as practical so its intent, control flow, edge cases, and important assumptions are easy to follow.
At minimum, explain complex logic, non-obvious behavior, and important design decisions.
Avoid comments that only restate the code; keep straightforward comments concise.
Layout
Prefer Flexbox for handling dynamic height and width layouts.
User Interaction
Do not use native modal dialogs such as window.alert, window.confirm, or window.prompt; use the application's custom dialog components instead.
Documentation
When reorganizing documentation, preserve the original content and meaning to the greatest extent possible.
Do not omit documentation details solely to make a document shorter or simpler.
Documentation may use multiple levels of hierarchy when needed to represent its structure clearly.
Put multiple distinct pieces of content on separate lines instead of combining them on a single line.
Prefix consecutive lines of distinct content with - so Markdown renders them as separate list items; do not rely on soft line breaks for separation.
File Format
Use UTF-8 encoding for all files.
Use Unix-style LF line endings for all files.
Preserve UTF-8 encoding and LF line endings when editing existing files.