Skip to content
Back to skills

Coding

ASecurity

Load before the first line of code, test, comment or doc you write or change, also for a one-line fix or a rename. The user's rules for fixes, comments, tests and docs differ from your defaults, and work done without them is sent back.

  • 9 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
ai-agentsrustgoexpressawsdebugginggitapidatabasesecuritydocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add sherifabdlnaby/skills --skill coding --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coding?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coding
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sherifabdlnaby-coding/badge)](https://www.skillsdirectory.com/skills/sherifabdlnaby-coding)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coding
description: >
  Load before the first line of code, test, comment or doc you write or change, also for a one-line fix or a rename.
  The user's rules for fixes, comments, tests and docs differ from your defaults, and work done without them is sent back.
license: MIT
metadata:
  author: sherifabdlnaby
  version: "0.10.0"
---

# coding

Each rule has a stable ID (`M1`, `T2`, `C7`) that a finding or a check cites. A retired ID is never reused.

**How firm a rule is** follows what a breach costs after merge: firm is a one-way door (callers, stored data, or people depend on it before anyone can fix it), default gets costly once code builds on
it, loose is a two-way door a later rename or sweep fixes. `M9`, `V3`, `H1`, `T1`, `T3`, and `C0` are firm by the user's choice. A breach of any rule is firm when it persists state, changes released
behavior (an API, a CLI flag, a config key, an event), or ships a structure that other people's code must work around. A **skip** is a breach you keep on purpose. An agent never approves its own skip.
The owner's explicit OK, in chat or on the PR, counts as a human reviewer's approval.

A **yolo run**: the user started the **afk-yolo** skill, or told you in this task to decide everything yourself ("go yolo", "your call on everything"). An afk or afk-careful run, a cron run, and
a run told only "get it done" are not yolo runs: they cannot skip a Default rule.

| Level       | Rules                                                                      | A skip needs                                                    | **review** `loose`                      | `balanced`                        | `strict`                   |
| ----------- | -------------------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------- | --------------------------------- | -------------------------- |
| **Firm**    | `M1`-`M5`, `M17`, `M9`, `V3`, `H1`, `T1`, `T3`, `C0`, and any one-way door | the owner's or a human reviewer's explicit OK; never a yolo run | raised; blocks                          | raised; blocks                    | raised; blocks             |
| **Default** | Design, Tests, `V1`, `V6`                                                  | the owner's OK, or a yolo run                                   | raised; non-blocking (own code: fix it) | raised; blocks in own code        | raised; blocks in own code |
| **Loose**   | Readability, `V2`, `V5`, `H2`, `M16`, comments, docs, human-facing text    | a stated cost                                                   | not raised                              | raised when it costs every reader | raised; blocks in own code |

On someone else's PR, a `C0` breach is raised at every level and never blocks.

## Making changes

### Behavior and contracts

Firm.

- `M1` **Guard at the boundary, trust inside**: validate and parse raw data into domain types where it enters (CLI args, config, network, external APIs); inside, no re-validation and no redundant nil
  checks. The parse holds the input to what the spec demands; normalizing the spec does not ask for (trimming, defaults, coercion) is new behavior, not a guard.
- `M2` **Fix the type, don't silence it**: no cast or ignore (`as any`, `# type: ignore`) only to make the checker pass.
- `M3` **Migrate callers, then delete the old API**: in the same change, when no external user depends on it. No compatibility shim kept "just in case".
- `M4` **Converge, don't replay**: a state-changing operation reads the current state and applies only the difference, so it is safe to run twice or after a crash at any point. Leftovers (locks, temp
  files, claimed jobs) are recognizable as stale; write to a temp path and rename into place.
- `M5` **Separate before you serialize**: concurrent writers get their own file, key, or branch, merged where read. A lock or single writer only when one shared target is a real invariant.
- `M17` **Derive state, don't sync it**: compute a value from its source instead of keeping a second copy up to date by hand. A copy goes stale.

### Design

Default: cheap to fix in this change, expensive once other code depends on the shape.

- `M6` **Simple and idiomatic**: fit the existing system and take the idiomatic way first. Keep sane system defaults; override one only when the gain is worth the extra code. Before writing a helper,
  search the shared modules and the files next to the change, and use the one that exists.
- `M7` **Subtract before you add** (extending an existing feature): the smallest diff that solves the problem, where possible. Remove what the change makes dead before you build.
- `M8` **Do not overfit** (adding a new system or functionality): design for the problem, not only the cases in this chat.
- `M9` **Speculative edge cases need buy-in** (firm): before adding code for an unlikely race or security case, tell the user the concrete failure, how likely it is, and what the code costs. Widen
  scope only on their go-ahead.
- `M10` **DRY**: a string, a threshold, a supported-values list has one authoritative home, easy to change or extend.
- `M11` **Separation of concerns**: split code where its parts change for different reasons. Add an extension point only when the axis is promised (`M13`).
- `M12` **Duplication over the wrong abstraction**: tolerate two similar blocks until the shared concept is obvious (rule of three); a helper/component that needs a `mode` flag to
  serve both callers is the wrong abstraction.
- `M13` **Extend along the promised axis**: at three cases the axis is promised (rule of three); shape code to make the fourth easy to add. A case is a
  variant the code switches on or repeats (a handler, a format, a provider), not a field or an argument.

### Readability

Loose: it costs each reader time, and a later rename, refactor, or sweep fixes it.

- `M14` **Don't name a general structure after its first occupant**: once something is a shared slot or grouping, name it for the axis it opens, not for today's only member. Specificity belongs on the
  leaves. A name others depend on (a config key, a public API) is firm under `M3`.
- `M15` **Minimize reader load**: inline wrappers with one caller and layers that only forward. Returns over mutation, locals over fields over globals. Early returns over nesting.

## Debugging and verifying

- `V1` **Fix the root cause**: the first place the system did something wrong. Ask whether the triggering state is legitimate: if yes, handle it where it broke; if not, a guard there hides the bug, so
  fix what produced it. The fix goes in the layer that owns the behavior, not in the caller that noticed it. Look for other instances of the pattern, list them, and ask before you fix them.
- `V2` **Attack the premise**: when two fixes that share one assumption fail the same check, write the assumption down and test it before a third fix.
- `V3` **Prove it on the real artifact**: run the feature, read the actual value, inspect the diff. "It compiles", a self-report, or cached output is not proof. When a check passes too easily, suspect
  the check.
- `V5` **Suggest a check for a repeated correction**: when a rule needed saying twice, suggest a type, lint, or check whose error names the fix. Build it on the user's go; stop and report when it gets
  hairy. Prose is for judgment calls only.
- `V6` **Explain the number**: before you trust a measured number, name what limits it and rule out that it measured errors, cached or skipped work, or noise. Report it with run count and spread.

## Human-review-ready

Work is **human-review-ready** when its owner, the person who runs you, gets it to review: a PR opens (a draft too), a draft goes ready, or you say the work is finished. **Slop** is comments,
docs, tests, and code that break this skill's rules.

- `H1` **Clean the diff before it is human-review-ready**: once, right before, on the whole diff: 1. the **no-comments** skill, 2. the **no-docs** skill, 3. the **review** skill on your own work. Do
  them yourself: their subagents run only when the user asks for a review (`/review`, or in their own words). Say that you did. A later diff that adds a function, a file, or a command runs them again
  on that diff, a review round too; a one-line nit or a rebase does not.
- `H2` **The loop**: between edits, run the tests of the code you changed and of its callers (`V3`). Leave the linters to the repo's commit hook and the rest of the suite to its push hook. At each
  milestone, commit or push, then read the hook output. Do not commit only to run the linters. When it shows no hook ran, run that part yourself (the repo's check, or its full test suite), once,
  before the work is human-review-ready, and suggest the **mise-fy** skill to add the hook.
- `M16` **Refactor apart from feature work**: an opportunistic refactor is in its own commit, so each commit stays reviewable.

## Tests

Default, except `T1` and `T3` (firm): a weak test costs more as code builds on it.

- `T1` **Test behavior, not implementation**: a test fails when the behavior breaks and passes when only the internals change. Drive it through the public interface of the unit that owns the behavior,
  and derive the expected value from the requirement, never from the code under test. A tautological test is a checksum: correct and broken code pass it alike. Signs: it asserts the value a mock was
  told to return, computes the expected value with the code under test, snapshots what the code just wrote, or only checks that nothing throws.
- `T2` **Cover the behavior change**: each behavior the change adds or changes gets a test; a copy or config tweak does not. An input variant gets its own test only when the spec names it or the code
  handles it on its own path. A bug fix gets a regression test you saw fail without the fix.
- `T3` **Deterministic**: the test sets every input, the time included: pass the clock in or patch it, and read no `now()` in a test. No sleeps, live network, or test-order dependence. A flaky test
  is a bug to fix, not to retry.
- `T4` **Lowest layer that shows it, few mocks**: test where the behavior lives. Mock what is slow or not yours (network, clock, a third-party service).

## Writing for the stranger

Loose. These apply to comments, docs, and human-facing text alike.

- `W1` **Write for the stranger**: the reader has only the file, the doc, or the screen, and the project; not this session or its history.
- `W2` **Describe it as it is now**: present tense. History belongs in the commit message.
- `W3` **Name the set, not its members**: `// sanitize PII fields`, not `// sanitize email, phone, SSN`. A list goes stale when a member is added.
- `W4` **No dashes**: no em dash, en dash, or hyphen used as one. Use a comma, a colon, or parentheses.

## Code comments

- `C0` **No comment off the keep list** (firm): the code is the documentation and git is the history. Write a comment only for an item on the keep list, in 1 to 4 lines. When you are not sure an item
  applies, delete the comment.

To enforce these rules on a diff, use the **no-comments** skill.

**Keep list:**

- **Section banner**: a short banner that groups a long file into sections (`// ===== Retry =====`).
- **File header**: one or two lines at the top of a file on what it is for, when its name and place do not say it. Not a list of what it contains.
- **External cause**: a vendor, platform, or protocol behavior we cannot reshape, or the paper, spec, or RFC a formula or algorithm comes from, with a link:
  `// workaround: SDK drops keepalive on h2, see github.com/x/y#456`.
- **Published API contract**: a doc comment on the public API of a library or package that others import, when its name and types do not show the behavior. An exported function inside an app
  gets none.
- **Required doc comment**: one a language convention or a linter requires (e.g. Go's doc comment on an exported name). Keep it to the contract.
- **Coupling nothing else connects**, when one source of truth is not possible: `# change TIMEOUT in worker.py if you change this`.
- **Concurrency or ownership rule the types cannot express**: `// guarded by mu`, `// caller holds the lock`.
- **Warning against a "fix"** that names what breaks: `// not HTTP/2: the proxy drops long-lived streams`. When the cause is our own code, encode it as a test instead.
- **Regression guard**: a test that exists for a past bug links it: `// regression: github.com/x/y#456`.
- **TODO with what ends it**: a ticket, date, event, or measured limit: `// TODO(PROJ-123): drop fallback after v2 ships`, `// good enough: O(n²) scan; revisit past ~1k rules`.
- **Config hint**: in a config file or template, a short hint beside a line, or a commented-out option a user will turn on (`# pinned: matches CI`). `C7` does not apply to it.
- License headers, tool directives, and generated-code markers (`// Code generated by X; DO NOT EDIT.`).

A surprise in our own code is not on the list. Rename, extract, or type it until the behavior is obvious.

- `C15` **Verify "do not remove"**: an `IMPORTANT` or `do not remove` comment is a claim. Check it in the code and its history. True: on the user's go, encode it as a type, test, or lint, then delete
  the comment. False: delete it.
- `C16` **Explain a detail where it lives**: when a function gets a new behavior, say so in the function, not at its call sites.

**Checkable rules.** A comment fails when it has:

- `C1` change narration: `Added`, `Updated`, `Changed`, `Now`, `previously`, `migrated from`, `moved to`, `for now`. Describe the code as it is, or delete.
- `C2` only the words of the name below it (`// get user` above `getUser()`).
- `C3` a step label (`// Step 1:`, `// Arrange`).
- `C4` more than 4 lines, except a license. Keep the constraint, drop the background.
- `C5` `TODO`, `FIXME`, `HACK`, or `XXX` with no ticket or link.
- `C6` a bare `#123` for our own PR or issue. Keep the reason; git keeps the number.
- `C7` commented-out code.
- `C8` a placeholder for code (`// ... rest of the code`, `// omitted for brevity`).
- `C9` words for a person: `you`, `Replace this with your`, `Note:`.
- `C10` a lint or type suppression with no reason. A rule that guards correctness or safety gets fixed, not suppressed.
- `C11` an empty `@param` or `@returns`, or a JSDoc `{type}` in typed code.
- `C12` an emoji.
- `C13` a figurative verb, metaphor noun, or stock AI word: `lands`, `ships` (outside a release), `surfaces`, `wires up`, `bakes in`, `plumbs`, `threads through`, `unblocks`, `substrate`,
  `wedge`, `nexus`, `scaffolding`, `paradigm`, `ratchet`, `north star`, `flywheel`, `additionally`, `crucial`, `delve`, `enhance`, `foster`, `landscape`, `pivotal`, `showcase`, `testament`,
  `underscore`, `vibrant`, `robust`, `seamless`, `utilize`, `leverage`. Use the literal word.

`C1` and `C9` match some real uses (`now()`, a `Note:` before an external quirk), so a check reports them as warnings.

## Docs

Loose. Docs are module and API docs, `AGENTS.md`, developer guides, and skill files. Agents read them more than people do. In skill files, the **skill-fy** skill's shape (router arrows, bold lead-ins,
leading words, steps mixed with reference) wins over `D7` and `D8`. To enforce these rules on changed docs and human-facing text, use the **no-docs** skill.

- `D1` **Document at the reader's level of abstraction** (information hiding): every layer (a UI, a CLI, an API, a module, a README) has a reader who uses it through its contract. Write what that
  reader needs to use it, and hide how it works below. The user guide does not explain the API, the API reference does not explain the database, and a module's doc does not explain its callers.
- `D2` **Write what the reader would get wrong without it**: leave out what they take for granted, what the code already shows, and what you learned while building it. Write what they would not
  predict: a limit, a side effect, an irreversible step, a default that differs from the norm.
- `D4` **Give today's change its real size**: only the space it takes in the whole system; touch outer-layer text only where what its reader sees changed.
- `D5` **Rewrite, don't append**: when a fact changes, rewrite or remove the text that states it. Do not add a second account next to the old one.
- `D6` **Link the source, don't copy it**: a doc points to the code, config, or command that holds a fact. A copy drifts.
- `D7` **One doc, one mode** (Diátaxis): tutorial, how-to, reference, or explanation. Split a doc that mixes them, and link the parts.
- `D8` **Plain words**: no `C13` words.
- `D9` **Real names**: write the real symbol, file, flag, or command, not a synonym or a description of it.
- `D10` **Match the voice** the doc already has, except heading case: headings are in sentence case.
- `D11` **Nothing that rots**: no hard-coded counts, versions, or file lists. A count or tree the doc needs comes with the command that regenerates it.
- `D12` **An emoji draws the eye**: an emoji marks the one or two things the reader must not miss when they glance, or celebrates. If most lines, rows, or headings would get one, use none: an
  emoji on every line draws the eye to nothing. A status column is fine when its icons differ. Not in code comments (`C12`).

## Human-facing text

Loose. UI elements, `README.md`, CLI help and output, release notes, and user guides: text a person reads without the code. The `W` and `D` rules apply, plus:

- `U1` **The product's words**: name things as the product shows them (its labels, commands, and settings), not by code symbols or internal names. In human-facing text, `U1` replaces `D9`.
- `U2` **Errors say what to do**: an error or warning says what happened and what the person does next: "Can't save: that name is taken. Pick another name."
- `U3` **Hide what the layer hides**: do not explain what the person finds intuitive, and do not show them the complexity this layer exists to hide from them. Put depth behind a link for those
  who want it.
- `U4` **No emoji**: in human-facing text, `U4` replaces `D12`.

Files in this skill

  • README.md8 B
  • SKILL.md4.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.