agentleFS
AvinavaAvinava/agentic-react-express-ts/skills/self-correcting-loop/SKILL.md

self-correcting-loop

Skill0 starsChanged 6 months agoMITView on GitHub

Use on every commit. The pre-commit hooks run checks in parallel. If any fail, read ALL errors, fix them in one pass, and retry. NEVER use --no-verify.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    This is not a blocker — it's a feedback loop: Read the errors, fix them, retry.

    line 10
  2. Distinctive:

    If a test fails, the CODE is wrong, not the test.

    line 22
  3. Distinctive:

    If requirements changed, explain WHY in the commit message.

    line 24
  4. Distinctive:

    Ask the user before modifying any test file.

    line 25
  5. Distinctive:

    Every git commit triggers (in parallel):

    line 29
  6. Distinctive:

    Do NOT fix one error, commit, see the next, fix, commit.

    line 53
  7. Very specific:

    Remove the unused export. If it's intentionally public, add the entry to knip.json → entry.

    line 68
  8. Very specific:

    Remove the hardcoded secret.

    line 116
  9. Very specific:

    Use Conventional Commits: feat(scope): description, fix(scope): description, etc.

    line 125
  10. Distinctive:

    If you genuinely need to suppress a rule:

    line 129

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Self-correcting commit loop

This project uses Lefthook to run quality checks in parallel on every git commit. Total pipeline time: ~3 seconds. If any check fails, the commit is rejected and you see the errors.

This is not a blocker — it's a feedback loop. Read the errors, fix them, retry.

CRITICAL: Never bypass hooks

NEVER use git commit --no-verify or git commit -n.

The pre-commit hooks exist to catch YOUR mistakes. If hooks keep failing, fix the root cause — don't skip the check. The ONLY exception is if the user explicitly tells you to skip.

Test integrity

NEVER modify a test just to make it pass.

  • If a test fails, the CODE is wrong, not the test.
  • The ONLY reason to change a test is if the requirements changed.
  • If requirements changed, explain WHY in the commit message.
  • Ask the user before modifying any test file. Never delete or skip tests without approval.

The pipeline

Every git commit triggers (in parallel):

┌─ Prettier ────── auto-fixes formatting               (auto-fix via lint-staged)
├─ Knip ────────── detects unused exports/files         (manual fix)
├─ ESLint ──────── TS + import order + boundaries       (manual fix)
├─ TypeScript ──── full project typecheck               (manual fix)
├─ Vitest ──────── runs tests related to changed files  (manual fix)
├─ Gitleaks ────── detects hardcoded secrets/API keys   (manual fix)
└─ Commitlint ──── validates commit message format      (rephrase)

The loop

1. Make changes
2. git add the changed files
3. git commit -m "type(scope): description"
4. IF rejected → read ALL errors → fix ALL in one pass → goto 2
5. IF accepted → done

Critical: fix ALL errors in one pass

Do NOT fix one error, commit, see the next, fix, commit. Read the entire error output, identify every failure, fix all of them, stage, retry.

Reading common error output

Prettier

Auto-fixes via lint-staged. If you see it, stage the reformatted files and retry.

Knip

Unused exports:
  src/foo.ts: someExport

Remove the unused export. If it's intentionally public, add the entry to knip.json → entry.

ESLint — boundary violation

error  'no-restricted-imports' — Server code must not import from src/client.

Move the code or extract the shared bits to src/shared/. Don't suppress the rule.

ESLint — type lies

error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Replace any with the actual type or unknown (then narrow).

error  Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion

! lies to the compiler. Check the value properly:

const v = maybe();
if (!v) throw new Error('expected v');
// use v

TypeScript

error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.

Fix the type. Don't use @ts-ignore or as any.

Vitest

A test failed. Fix the code, not the test. See "Test integrity" above.

Gitleaks (secrets)

Finding: API_KEY = "sk-abc..."

Remove the hardcoded secret. Use process.env.… instead. If the secret already landed in history, alert the user — they need to rotate it.

Commitlint

✖ subject may not be empty
✖ type may not be empty

Use Conventional Commits: feat(scope): description, fix(scope): description, etc.

False-positive escape hatches

If you genuinely need to suppress a rule:

  • ESLint: // eslint-disable-next-line <rule-name> with a comment explaining why.
  • Knip: add the entry to knip.json.
  • Gitleaks: if it's a test fixture, add the fingerprint to .gitleaksignore.

Always ask the user before suppressing — they may prefer to fix the root cause.

Commit message format

<type>(<scope>): <subject>

Types: feat, fix, refactor, docs, test, chore, style, perf, ci.

Examples:

feat(contact): add email validation
fix(server): handle empty body in tRPC mutations
chore(deps): bump prisma to 7.4.1
docs(readme): clarify Postgres setup

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.