← Home Coding basics

The small rules that prevent large mistakes

For anyone building with coding agents: understand the risk, apply a concrete rule, then use a prompt to inspect your own project.

practice 01

Names should describe behaviour

Risk: A function called handleData hides whether it reads, writes or deletes.

Rule: Name its actual effect, such as saveUserProfile, then check callers before renaming.

See the full example →
check prompt
Review names in this code for vague terms, hidden side effects and inconsistent file or component names. Do not rename yet. Propose a small plan and its risks.
practice 02

API keys do not belong in the browser

Risk: Frontend bundles are downloaded by visitors; a key compiled into one can be read and reused.

Rule: Keep provider credentials on a server endpoint and let the browser call that endpoint.

See the full example →
check prompt
Inspect the frontend diff and configuration for keys, tokens, connection strings and private endpoints. Report exact exposures; propose a server-side design. Do not print secret values.
practice 03

Keep local configuration out of Git

Risk: Renaming a real .env to .env.example can publish the same credentials under a friendlier filename.

Rule: Commit placeholders only. If a key reached Git, revoke it; .gitignore does not erase history.

See the full example →
check prompt
List tracked configuration files and likely secret-bearing files. Suggest only relevant .gitignore entries and a placeholder-only .env.example. Do not reveal values.
practice 04

Check what Git really tracks

Risk: A new ignore rule does not untrack a file already committed.

Rule: Inspect git ls-files and git check-ignore -v before assuming a local secret is protected.

See the full example →
check prompt
Review this repository's .gitignore for build output, dependencies, cache, local databases and environment files. Identify tracked files the ignore rule cannot protect.
practice 05

Keep changes coherent

Risk: Mixing a formula fix with a dependency update and redesign makes regressions hard to isolate.

Rule: Keep code and tests for one fix together, and split independent changes.

See the full example →
check prompt
Review local changes and propose coherent commit groups by purpose. Do not stage or commit. Explain any file that does not fit the requested task.
practice 06

Add dependencies deliberately

Risk: A package adds maintenance, compatibility and supply-chain costs; the project may already have what you need.

Rule: Compare framework features, existing utilities, a small local function and a new package.

See the full example →
check prompt
Before adding a package, check the runtime requirement, existing project utilities, framework built-ins and the package's maintenance. Explain the smallest maintainable choice.
DOTTORLONE / PRIVACY

Advertising supports DottorLone.

Ads help keep these guides free. Agreeing to banners does not sign you up for phone offers: DottorLone does not ask for your phone number.

If you agree, Adsterra and its partners use cookies or similar technologies and browsing data to display, personalize and measure ads.

No Adsterra ads load before you agree.

On your first visit, closing this dialog keeps Adsterra off. You can change your choice through “Privacy choices” in the footer. Google consent is separate. Privacy policy.

Details and Google choices

What you allow for Adsterra

Adsterra, operated by Ad Market Limited and affiliated companies, and its partners may receive your IP address, visited URLs and browser or device data. This choice is optional, lasts six months and does not count as consent to Google. Data and withdrawal details · Adsterra privacy ↗

Google

Google manages its own choices through its European regulations message when it is available for this site and your visit.

Google choices are not available yet. You can keep reading and manage Adsterra separately.