agentleFS
IgorKonovalovIgorKonovalov/market-analyzer/.claude/skills/safe-commit/SKILL.md

safe-commit

Skill2 starsChanged 2 months agoMITView on GitHub

Stage and commit ONLY the files you changed, safely, in this repo. Use whenever you are about to commit work — especially after implementing a plan phase or a bug fix. Enforces explicit-path staging (never `git add -A`/`.`), commits the message inline via the PowerShell tool's here-string (no message files, no `.git` access), runs the project quality gates first, and the no-history-rewrite rule. Trigger on "commit this", "commit the phase", "stage and commit", or any moment a commit is imminent.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. munvard/dockterm★ 48same name
    2. mauroepce/claude-workspace★ 1same name
    3. niyaznurbhasha/claude-skills★ 0same 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.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run git status and git --no-pager diff --stat.

    line 25
  2. Distinctive:

    Run only the gates relevant to what changed:

    line 31
  3. Distinctive:

    All relevant gates must be green before you stage.

    line 36
  4. Distinctive:

    Don't write a message file.

    line 50
  5. Distinctive:

    Use the PowerShell tool with a single-quoted here-string so nothing in the message is expanded or truncated:

    line 51
  6. Very specific:

    Use @'...'@ (single-quoted, literal), not @"..."@ — $ and backticks stay literal.

    line 63
  7. Distinctive:

    Run git --no-pager show --stat --oneline HEAD and confirm the commit contains exactly your files with the intended message.

    line 76
  8. Distinctive:

    Never: commit from the Bash tool — it mangles here-strings.

    line 81

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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

safe-commit — market-analyser

A small, strict commit ceremony for this repo. It gets your own changes committed cleanly — without sweeping in stray files or mangling the message. It does not decide what to commit or write the design — it just commits.

Two facts shape it:

  • Explicit-path staging. A PreToolUse hook (block-broad-git-add.js) hard-blocks git add -A/--all/./:/. Stray untracked files (and the occasional parallel session) must never get swept in. Stage by named path, always.
  • Message via the PowerShell tool. The Bash tool truncates PowerShell here-strings (@'...'@) and strays @/backticks into commit subjects. The PowerShell tool handles a single-quoted here-string cleanly — so commit the message inline from there. No message files, no .git/ access, no cleanup.

The ceremony

1. See what's there — and what's yours

Run git status and git --no-pager diff --stat. Identify the files this session created or modified. If you see in-progress files you don't recognise (rare, but parallel sessions still happen), leave them alone — never stage, stash, move, or git checkout them. When in doubt, ask.

2. Run the gates (before staging)

Run only the gates relevant to what changed:

  • Python (src/, tests/): .venv/Scripts/python.exe -m pytest -m "not network", then .venv/Scripts/python.exe -m mypy --strict src tests, then .venv/Scripts/ruff.exe check.
  • Desktop (desktop/): pnpm --filter desktop lint, pnpm --filter desktop test:main, pnpm gen-types:check, and pnpm test:e2e when renderer/IPC behaviour changed.
  • Docs only (docs/, *.md): no code gates; a markdown/mermaid check if the plan names one.

All relevant gates must be green before you stage. If a gate fails, fix it (or surface it) — do not commit around a red gate.

3. Stage by explicit path — never broadly

Stage each file you own, by path:

git add src/market_analyser/data/yahoo.py tests/data/test_yahoo.py

Never git add -A, git add ., git add --all, or git add :/ — the hook will deny them, and they'd sweep an untracked or parallel-session file into your commit. Then re-run git status and confirm the staged set is exactly your files and nothing else.

4. Commit the message inline via the PowerShell tool

Don't write a message file. Don't commit from the Bash tool — it mangles the here-string. Use the PowerShell tool with a single-quoted here-string so nothing in the message is expanded or truncated:

git commit -m @'
feat(data): fetch Yahoo OHLCV by absolute period1/period2

Body explaining the why, wrapped at ~72 cols. Reference the plan/ADR.
'@

Here-string rules:

  • Use @'...'@ (single-quoted, literal), not @"..."@ — $ and backticks stay literal.
  • The closing '@ must be at column 0 (no indentation) on its own line, or it's a parse error.
  • It's one bare git commit — no &&, no cd prefix. (The repo's backdate hook wraps git commit automatically; don't add date env vars yourself.)
  • Keep the message body plain ASCII: straight hyphens (-), no em-dashes (—), no internal double-quotes ("). Even inside a single-quoted here-string these can get split out and reach git as separate pathspecs, aborting the commit with pathspec '...' did not match any file. (This bit commit db7f17b on its first attempt — the body had — and "..." and git tried to treat each word as a file.) Write type(scope): subject plainly; if you need to quote a token, use single quotes or backticks, not ".

Conventional-commit format: type(scope): subject, blank line, then the body.

5. Verify, then stop

Run git --no-pager show --stat --oneline HEAD and confirm the commit contains exactly your files with the intended message. Do not push — the user pushes.

Hard rules (non-negotiable)

  • Never git add -A / . / --all / :/. Explicit paths only.
  • Never commit from the Bash tool — it mangles here-strings. PowerShell tool only.
  • Never rewrite history: no git commit --amend, no rebase, no reset, no force-push — even for a cosmetic typo in an unpushed commit. Fix mistakes forward with a new commit.
  • Never touch another session's uncommitted/untracked files (no stage, stash, move, or checkout). Surface and wait.
  • Never push.
  • One logical change (or one plan phase) per commit.

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.