Guide: full working rules (v1.2)

Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.

Search terms: guide, working rules, project guide, handoff, claude.md, agents.md, classes, packages, security, backups, scale, templates

Last reviewed:

General working rules for AI agents and human developers. Version 1.2, 2026-12-01 (changes in §16).

This guide does not say what a product should do; product decisions live in each project’s own documents. It describes how the work is done: accuracy, efficiency, continuity, security, code quality and scale. The rules apply the same way to an AI agent and to a human developer.


0. How to use it

  1. At the start of a project, answer the questions in §1 and decide the project class: S, M, L or XL.
  2. Each rule shows the classes it applies to, for example [M+] (M and above) or [XL] (XL only). Do not apply rules outside your class. Unnecessary work is also a mistake: it costs time, money and tokens.
  3. Rules without a label apply to every class.
  4. Proportionality: every rule is applied in proportion to the risk it prevents. If you think a rule is unnecessary for this project, do not skip it silently: tell the project owner the reason in one sentence and leave the decision to them.
  5. If the project grows (more users, personal data, payments and so on), the class goes up and the new rules apply from that moment. A class change is written to HANDOFF.
  6. If the project’s own rules (CLAUDE.md, AGENTS.md, decision records) conflict with this guide, the project’s rule wins. Tell the project owner about the conflict once.
  7. The guide lives in the repository; it is not re-supplied each session. In the first session the guide is placed in the repository as docs/PROJE-CALISMA-KILAVUZU.md. CLAUDE.md / AGENTS.md records: the project class, the path of the guide, and a short summary (10–30 lines) of only the rules that fit this class. AI tools read CLAUDE.md / AGENTS.md on their own every session; the whole guide is opened only when the relevant topic comes up. This way the rules are not lost and tokens are not spent reading the whole guide each session.
  8. When a new version of the guide appears, the file in the repository is replaced, the summary in CLAUDE.md is reviewed, and the change is written to HANDOFF as one line.
  9. The project owner’s word always comes first. The owner may tighten a rule (for example “do not fix findings without talking to me”) or loosen it with a reason; this decision is written in the project’s own rules file.

1. Decide the project class

Question If yes, at least
Is it static content with no login and no personal data? (promotional site, landing page) S
Does it have user login, personal data or an external API key (for example an LLM)? M
Does it have an admin panel, roles or permissions, payments, file uploads or several kinds of users? L
Does it have thousands of concurrent users, a mobile app published in a store, a legal record-keeping duty or sensitive data (health, finance, location)? L
Does it target millions of users, have social interaction (follow, like, feed) or public content? XL

Typical examples:

Class Example
S One-page promotional site, portfolio
M Web-based AI assistant with few users (notes, reminders), small CRM, internal tool
L Complex site, multi-user CRM, booking or payment system, app with an admin panel, personal assistant app published in a store (sensitive data such as health or spending)
XL Social media, marketplace, mobile app with millions of users

If you are unsure, choose the higher class, but remember §0.4: state any unnecessary rule with its reason.

Note (v1.2): The highest row in the table applies. For example, an “assistant app” sits in M as an example, but if it is published in a store and holds health or spending data, it is L.


2. Core rules (every class)

2.1 Accuracy: no invention

2.2 Efficiency and token saving

Savings are not taken from quality: tests, verification, security or checklists are not skipped to save tokens or time.

2.3 Continuity: no loss of context

AI sessions lose their memory; the only lasting thing is the files in the repository. A human developer also has to hand over work one day.

File Content Rule
CLAUDE.md / AGENTS.md Permanent project rules, architecture summary, document index Read first in every session. If it exceeds 500 lines, simplify: move finished topics to a separate document, leave a one-line summary and the file path. [L+] Domain-specific rules go to separate domain files (for example .claude/rules/*.md).
HANDOFF.md “Where we stopped”: 5–10 lines of current status at the top, open instructions (⏳), pending owner decisions, work waiting on a branch or only locally Updated at the end of every work round. If it exceeds 300 lines, old sections move to an archive file.
docs/kararlar/ (decision records) [M+] Dated decision documents: what was decided, why, by whom Written the moment the decision is made.
Open issues list [M+] One list: tasks, questions, owner’s tasks The next task is chosen from here.

2.3a Interruption and handover rules

If the session limit is about to run out, the context is about to overflow, the machine may shut down, or the project owner says “stop / I am handing over”:

  1. No new work is started.
  2. A half-finished edit is either completed or reverted; no code that does not compile is left behind.
  3. The code is committed and pushed to the working branch (not the main branch; no --force).
  4. HANDOFF is updated: what is done, what is half-done, how to restart.
  5. The branch name and the last commit ID are reported. The next session (the same or another agent / account) must be able to continue with no loss. While a long task is running, a “work in progress” line is kept for each running job.

2.4 Communication with the project owner

2.5 Security baseline

2.6 Git and record discipline

2.6a Audit and large-run rules [L+]

2.6b Sub-agents and cost

2.7 Code and documents a human can read


3. Packages and versions

Rule Class
Package and version choices are verified from an official source; the current stable version is used, no pre-release (alpha, beta). S+
The lockfile is committed; installs are done locked (for example --frozen-lockfile). M+
Every dependency is pinned to an exact version (no ^, ~). Docker images by digest (@sha256), CI actions by full commit ID. L+
7-day rule: a newly published version is not installed before at least 7 days have passed (against supply chain attacks). L+
Security exception: if there is a critical vulnerability, the fixed version published by the official source may be installed without waiting 7 days. It is written with the reason and an end date, and the project owner is told. L+
All versions are collected in one file (for example a pnpm catalog). Package files refer only to it. XL
Packages that run install scripts are not installed without approval. If the publisher’s trust is lower than in previous versions, installation stops. The security scan (audit) turns red on a finding of medium level or above. XL
Major version upgrades are done one by one, with the official migration guide and their own tests. An update whose release notes cannot be verified is not taken. L+
Platform-specific native packages are installed with the platform’s own tool (for example npx expo install in Expo). Otherwise an incompatible version is installed and the error appears only as a crash on a real device. M+ mobile
There is one package manager and it is enforced (for example only pnpm). M+
The equivalent for each language ecosystem is applied: for example in Go, go.mod + go.sum fixed and the toolchain version fixed; in Python, a locked dependency file. M+
Open-source licence page: the name and licence of every library used in the published app / site are visible (for example Settings → Open source licences); the list is generated from the lockfile; a forbidden licence turns the guard red. M+ (published product)
A dependency list (SBOM) is produced. L+
Security scan exceptions: each exception is kept as a machine-readable record (advisory ID, package, affected versions, level); when the package is updated or the level rises, the exception becomes invalid automatically; at most 30 days, extension needs a reason + official source + proof that “it is not reachable in our code”; silenced warnings are listed separately in the report. L+
A dependency update bot (for example Dependabot) is turned on only for security patches; one grouped proposal per ecosystem. L+
Selector override: if a sub-package’s version is forced for security, a fix is written for each major version line; forcing without a selector makes the consumer jump a major version unknowingly. XL

4. Code quality and architecture

4.1 Industry standards (S-codes) [L+]

Each part is designed before it is written with the standard mechanism of its area: “works correctly” is not enough; behavior under load, failure and repetition also follows the standard. The list is kept in a project document, the status column is updated at every audit, and new rows are added when needed.

Code Area Standard
S1 Client retry exponential backoff + jitter + the server’s Retry-After; limited attempts
S2 Repeatability of writes a unique key on every write (Idempotency-Key); the server processes the same key once
S3 Early rejection under overload per-process concurrency limit + short queue; when full, an immediate 429 / 503; priority for critical writes
S4 Connection pooler code compatible with a transaction-mode pooler
S5 Read scaling read replica + read-your-writes consistency
S6 Timeouts an upper time on every external call (query, storage, email, notification, AI, external process)
S7 Circuit breaker not sending requests for a while to an external service that keeps failing, a single half-open trial
S8 Cache cache + correct invalidation for data that is read often and changes rarely; merging identical reads that arrive at the same time
S9 Background job guarantee jobs are not lost, limited retries, an alarm for stuck jobs, single processing
S10 Graceful shutdown on the shutdown signal no new requests, in-flight ones finish, pools close
S11 Rate limit per account, counters in a shared store, limit values are not leaked
S12 Security headers HSTS, nosniff, CSP, frame ban, Referrer-Policy, CORS allow list
S13 Monitoring / alerting error tracking, latency / error-rate metrics, alert at a threshold
S14 Memory / queue limit in-process queues are bounded
S15 Error responses through one path capacity / connection trouble is “busy” (429 / 503 + Retry-After), a real error is a report + 500; capacity trouble is never a 500
S16 Response compression text responses gzip / brotli; except responses carrying secret information (BREACH)

[XL] Every code commit carries a Standard: line (the S-codes applied + not applied: <reason>); the push lock rejects a commit without it.


5. Tests and guards: when needed, in proportion

Principle: testing is proportional to risk and to the lifetime of the code. Writing a full test suite for a one-off prototype is waste. Leaving a flow that touches the data of millions of users without tests is negligence.

Guard: a test that checks a rule automatically with code. Examples: “are versions pinned”, “is the new index in both the schema and the migration”, “is anything on screen moving by itself”.

Class Minimum tests
S Build and type check; manual check that the page opens, links and the form work; view at mobile width.
M + Automated tests for critical flows: login, saving data, payment if there is one. A permission check test. A local check command before pushing.
L + End-to-end (e2e) tests, a short CI run, guards, screen checks (both themes, all supported languages), permission and access-to-others’-data (IDOR) tests.
XL + Mutation proof, load tests (with a coverage map), attack drills, performance and accumulation measurements (§9).

Kinds of tests and guards: static guard (reads the code as text), runtime guard (the server does not start if it sees a wrong setting), pipeline (local check command, push lock, CI), unit test, end-to-end (e2e) test, screen guard (screenshot / layout check: two themes + all languages), test guard (checks the coverage of tests: for example is every endpoint in the load test map, does every personal data table have a delete path). All are listed in one inventory document: what it protects, why it exists, when it runs, what to do if it turns red.

When a guard is written:

When a guard is not written: a one-off job, a prototype, rules that are a matter of taste.

Rules:


6. Security (by class)

[S]

[M+]

[L+]

[XL]


7. Data and database

[S] Keep no data if possible. If form data is kept, how long it is kept is written down.

[M+]

[L+]

[XL]


8. Infrastructure portability: fits any server, database and storage

Principle: the application is not locked to one cloud provider, storage product or server. Changing provider must be possible without changing code, only by settings. How far this is applied depends on the class.

8.1 Containers (Docker)

Rule Class
The project starts locally with one command (for example docker compose up); including the database, object store and helper services. M+
The application is packaged as a Docker image; the same image runs in every environment (local, test, live), and only the settings change between environments. M+
The image is built in multiple stages, runs as a non-root user, and the base image is pinned by digest (@sha256). There is a health check endpoint. L+
Runtime versions such as Node and Python are the same in CI, local and live (exact version). L+
The process is stateless: files and sessions are in the database or object store, not on the container’s disk. This allows horizontal scaling. L+

8.2 Object storage (S3 and compatibles)

8.3 Backup infrastructure

Rule Class
An automatic daily backup of the database is taken and the retention period is written down. M+
Restoring is tried regularly and the trial is recorded. M+
The backup is kept at a different provider or account from the main system. Even if the main account is taken over, the backup cannot be deleted. L+
The object store also has a backup or versioning. L+
Backup runs as a separate service or container and its failure raises an alarm. Backups are encrypted. L+
A full copy of the code (all branches and history) is regularly handed to the project owner; the project can be recovered even if GitHub access is lost. L+
A disaster recovery plan is written: data loss tolerance (RPO), recovery time (RTO), step-by-step return. XL

8.4 Database choice and portability

8.5 Other services


9. Scale and performance [L+]


10. Topic-specific additions

10.1 Apps that use AI (LLM) [M+]

10.2 Mobile apps [M+]

10.3 Multiple languages [M+ if needed]

10.4 Accessibility [S+]


11. Working environment: GitHub, local, cloud

The same rules apply in every environment.


12. Multi-session work [XL]

In large projects the context of a single session is not enough. Division of work:

Session Task Prohibitions
Manager Takes the work from the project owner, gives it to the right session, verifies the results, gives a short report. Does not write code.
Code Writes, tests, pushes, updates documents. Does the research needed for its own work itself. Main and release only with the owner’s word.
Research Does research on official sources, policies and documents; brings exact quotes. Does not change files, does not commit.
Measurement Does code review and measurement (query plan, size, load). Does not change files, does not commit.

13. Starting instruction template

When starting a new project, give the agent this:

In this project you will work by the rules of the attached PROJE-CALISMA-KILAVUZU.md.
1. Put the guide in the repository: docs/PROJE-CALISMA-KILAVUZU.md. Commit and push.
2. Decide the project class (S/M/L/XL) by §1 and write the reason in one sentence.
3. If the repository has no CLAUDE.md/AGENTS.md and HANDOFF.md, create them with the
   templates in §14. Write into CLAUDE.md the project class, the path of the guide and a
   short summary of "the rules that fit the class" (§0.7). Commit and push these too.
4. Apply the rules that fit the class, not those outside it (proportionality, §0.4).
5. The project owner does not know code; speak briefly, simplify concepts.
6. Ask the owner product decisions; on technical decisions follow the guide.
7. Update HANDOFF.md at the end of every work round.
Purpose of the project: <one paragraph>

This instruction is given only in the first session. Later sessions read CLAUDE.md on their own; thanks to the path and summary there, the guide does not need to be given again.


14. Templates

14.1 CLAUDE.md / AGENTS.md skeleton

# <Project name>: Project context
Project class: <S/M/L/XL> (reason). Guide: docs/PROJE-CALISMA-KILAVUZU.md
(opened in full only when the relevant topic comes up)
⛔ Every session reads HANDOFF.md after this file and updates it at the end of a work round.

## Rules valid in this class (short summary from the guide, 10–30 lines)

## What this project is
## Stack (language, framework, database, storage, hosting)
## Monorepo / folder structure
## Critical rules (project-specific, numbered)
## Document index (decision records, open issues, deletion schedule)
## About the project owner / communication

14.2 HANDOFF.md skeleton

# HANDOFF: where we stopped
## 🔴 Current status (5–10 lines, dated)
## ⏳ Open instructions (the owner's, not yet done)
## ❓ Decisions expected from the owner
## 📦 Work waiting on a branch / only local
## 📌 Rule changes (dated one-liners)
## History (moved to the archive when old)

14.3 Decision record skeleton

# <DD-MM-YYYY> <Decision title>
**Decided by:** project owner · **Status:** valid / replaced by: <path>
## Decision
## Reason
## Affected places (code, tests, documents)
## History notes (⛔ date: change)

14.4 Commit message template

<area>: <what changed, short>

<why; which problem it solves>

Side effect: <what was checked, which tests ran, security meaning>

15. One-page checklists by class

S: Promotional site

M: Assistant app, small CRM

L: Complex site, app with an admin panel

XL: Social media, millions of users


16. Release notes

v1.2 (2026-12-01): the assistant / mobile contradiction in the class table was resolved (the highest row applies); the repetition in the L and XL test rows was removed; added: honest reporting layers (§2.1), interruption and handover rules (§2.3a), audit and large-run rules (§2.6a), sub-agent limit and cost control (§2.6b), open-source licence page, SBOM, security scan exception rules, ecosystem equivalents (§3), industry standards S1–S16 (§4.1), kinds of tests and guards + order when red + flakiness (§5), limits inventory, the admin panel not seeing private content, signup security, username rules (§6), related records rule, correct deletion / backup schedule in the contract, data localization and separate databases (§7), the “busy” rule and the load test coverage map (§9), architecture ready for hundreds of languages (§10.3), accessibility (§10.4).

v1.1 (2026-11-20): first published version.

Sources