Skip to content
Back to skills

Create Rule

ASecurity

Turn a convention into something that fails fast instead of a paragraph someone has to remember: a compiler, formatter, linter or test rule when one can check it, or a short doc that says why not when none can. Use when the person asks to enforce a convention ("make this a lint rule", "add an analyzer rule", "enforce this in CI", "que no vuelva a pasar"), when the same correction comes up twice, or right after the person corrects the agent on a convention of the repository that a tool could c...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsvueapi

Works with

  • api

Security analysis

A100/100

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

Scanned December 2, 2026

npx -y skills add JorgeCostaMacia/agent-harness --skill create-rule --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Create Rule?

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

Security grade badge for Create Rule
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jorgecostamacia-create-rule/badge)](https://www.skillsdirectory.com/skills/jorgecostamacia-create-rule)

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: create-rule
description: >-
  Turn a convention into something that fails fast instead of a paragraph
  someone has to remember: a compiler, formatter, linter or test rule when one
  can check it, or a short doc that says why not when none can. Use when the
  person asks to enforce a convention ("make this a lint rule", "add an analyzer
  rule", "enforce this in CI", "que no vuelva a pasar"), when the same
  correction comes up twice, or right after the person corrects the agent on
  a convention of the repository that a tool could check ("don't do X", "we
  always Y"), to offer it.
---

# Create a rule

A convention in a doc is only a suggestion. It holds only if the person who writes the code reads that doc and understands it the same way. A rule that fails the build holds for everyone, person or agent: the agent sees the error and fixes the code. So every correction ends as a rule when a tool can check it, and as a short doc only when none can.

## 1. Agree the convention

- Write it in one sentence, with one example from this repository that breaks it and one that follows it.
- Say whether it applies to new code only or to the whole repository.
- Show it to the person and wait for a yes. Write nothing before that.

## 2. Find how the repository checks things

Read the repository's `AGENTS.md`, its docs and its build or package configuration. Find the one command that already gates a change (build, format check, lint, tests) and where it runs: locally, in a pre-commit hook or in CI. The new rule joins that command; it never adds a check nobody runs.

Find also:

- a rule that already covers part of the convention. Extend it, or repair it when it stays green on a violation;
- how the repository exempts existing code today;
- whether the tool's configuration merges or replaces a list of options. A new entry in a list of banned APIs can remove the entry of another convention.

## 3. Pick the cheapest tool that covers all of it

Take the first option that catches every case of the convention, and nothing else:

1. A setting of the compiler, the type system or the formatter (a warning raised to an error, a style option).
2. A rule the linter or analyzer already ships, switched on or raised to an error.
3. A configurable generic rule: a list of banned APIs, imports or syntax patterns, with the message to show.
4. A maintained plugin that has the rule, after the person agrees to the new dependency.
5. A small custom rule inside the repository.
6. A test that checks the convention: an architecture test over the code's dependencies, or a test that scans the files.

Before you choose a rule of a tool, check that the version that the repository installs has it.

## 4. Make it fail, then pass

- An error for new code, never a warning: warnings collect and nobody reads them.
- The message names the convention and points to its doc: `… Convention: docs/<path>.md`.
- Existing violations: fix them when they are few. When they are many, keep them in a baseline that can only shrink. A baseline is a list of known violations that fails when an entry stops violating, so people clean it as they change the code.
- Measure the violations by running the rule, never by a text search. Keep the baseline in the tool's own suppression file first, then in a list of exemptions in the rule's configuration, then in comments in the code.
- See it fail on the breaking example and pass on the repository. Keep both cases as tests that the repository's check runs, for every rule and not only for a custom rule. A tool upgrade can switch a rule off without a message. A broken rule looks the same as a rule that everybody follows.

## 5. Record it

- Write or update the convention's doc in `docs/`, in the shape of [`references/doc.md`](references/doc.md), ending with `**Enforced by:** <tool> · <rule>`.
- A new doc gets its row in the repository's `AGENTS.md` index, saying when to read it.
- When no tool can check the convention exactly, the doc is the result: its examples, why it matters, and `**Enforced by:** not enforced; <why no tool can check it>`.

## 6. Commit

One commit for the convention: the rule, its configuration, the baseline if any, its tests and its doc, following the repository's commit conventions. No push.

Then tell the person the rule, the size of the baseline, and how the baseline shrinks.

## Not a rule

Taste, one-off decisions and anything a tool would often get wrong stay out. A rule that fires on correct code teaches everyone to ignore rules.

Files in this skill

  • SKILL.md4.2 KB
  • references/doc.md542 B

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.