agentleFS
prasanna-allu-devprasanna-allu-dev/agent-guardrails/.claude/skills/safe-changes/SKILL.md

safe-changes

Skill0 starsChanged 3 months agoMITView on GitHub

How to write queries, logs and route guards in this codebase so they pass the agent-guardrails rules. Use when adding or changing anything under service/ — endpoints, database queries, log lines, or permission checks.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. EricStrohmaier/adchat-mcp★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every table has a tenantId column, and every query must filter on it.

    line 13
  2. Very specific:

    Use the query builder. db.raw() puts user input into the query as *code* rather than as a value.

    line 46
  3. Distinctive:

    If a route returns 403 and it should not, change the role it requires:

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Writing changes that pass

The rules in rules/ are enforced by a hook, so a change that breaks one never reaches disk. Here is how to get it right the first time.

Queries name the tenant

Every table has a tenantId column, and every query must filter on it. A query without it returns every customer's rows, silently.

// yes
await db.users.findMany({ where: { tenantId: ctx.tenantId, active: true } });

// no — returns all tenants
await db.users.findMany({ where: { active: true } });

The tenant always comes from ctx.tenantId, which is set from the authenticated session. Never take it from a request parameter, however convenient — that hands the caller the ability to pick whose data they read.

Logs carry ids, not people

Log the id. Never the email, name, phone, date of birth, or national id.

// yes
logger.info('login failed', { userId: user.id, reason });

// no
logger.warn(`login failed for ${user.email}`);

The id is enough to find the person in the database, and useless to anyone who cannot already read it. Logs are kept longer and read by more people than the database is.

No hand-written SQL

Use the query builder. db.raw() puts user input into the query as code rather than as a value.

Do not delete a permission check to make something work

If a route returns 403 and it should not, change the role it requires:

guard: requireRole('support'),   // was 'admin'

Deleting the guard is a different change, and a much bigger one. If you think a route genuinely needs no permission check, say so in your reply rather than quietly removing it.

Checking your work

npm run check          # scan service/ for problems
npm test               # rule and hook tests
npx guard explain tenant-isolation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.