Agent skill

Pre-Commit Check Gate

by ZeroDeng01 in ZeroDeng01/sublinkPro

Blocking checklist that runs formatting, lint and test commands for changed Go and frontend files before any git add, commit or pull request.

MITAuto-check: notesDevelopment

Install Pre-Commit Check Gate

skills CLI
$ npx skills add ZeroDeng01/sublinkPro --skill pre-commit-check -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ZeroDeng01/sublinkPro pre-commit-check --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ZeroDeng01/sublinkPro.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/pre-commit-check .claude/skills/pre-commit-check && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
pre-commit-check
GitHub stars
1.7k
Token cost
~2.9k tokens
SKILL.md length
1,099 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Blocking checklist that runs formatting, lint and test commands for changed Go and frontend files before any git add, commit or pull request.

  • Works in 9 steps: Identify Changed Files → Execute Backend Validation (if .go files… → Execute Frontend Validation (if webs/*… → …
  • Before staging or committing changes in this Go and React project
  • SKILL.md covers Critical Rules, When to Use This Skill, Skill Execution Protocol and Validation Failure Handling, plus 5 more sections
  • Calls git, yarn and go

What it does

This skill is written as a mandatory gate rather than a suggestion. The agent first lists changed files with `git status` and `git diff`, then sorts them into backend Go files, frontend files under `webs`, documentation, configuration or a mix. For Go changes it runs `gofmt` (reformatting and re-verifying if the output is not empty), `golangci-lint run` and the full `go test` suite, each of which must succeed before moving on.

Frontend changes get `yarn run lint` inside `webs`, with `lint:fix` and prettier as first-line repairs; the excerpt is cut off after that. The rules say to fix every failure, note what was validated in the commit message, stage only after validation passes, and present the result to you for final verification instead of committing automatically. It insists on running even if you say to skip checks. The commands are specific to this project's Go and yarn setup.

When your agent uses it

  • Before staging or committing changes in this Go and React project
  • Before opening or updating a pull request
  • Before telling the user that a piece of work is finished

Example prompts

  • “Run the pre-commit checks on my changes before I commit.”
  • “I changed the subscription handler in Go and a page under webs, validate everything first.”
  • “Check that formatting, lint and tests pass, then show me the result before anything is staged.”

Requirements

  • Go toolchain with `golangci-lint`
  • Yarn and Node for the frontend in `webs`
  • Git

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Identify Changed Files
  2. Execute Backend Validation (if .go files changed)
  3. Execute Frontend Validation (if webs/* files changed)
  4. Cross-Layer Sync Verification (if multi-layer change)
  5. Documentation Sync Verification (if docs should be updated)
  6. Test Coverage Verification (if key logic changed)
  7. Git Staging Verification
  8. Commit Message Preparation
  9. Report to User

What it can do on your machine

Read from SKILL.md and the folder at commit 11479da. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • yarn
    • go
    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, yarn and gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Pre-Commit Check Gate loads about 2.9k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 1,099 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:176
    - [ ] No `.env` files staged

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ZeroDeng01/sublinkPro at commit 11479da, republished under its MIT licence (© ZeroDeng01). 1,099 words, ~2,907 tokens.

Download SKILL.mdSave it as .claude/skills/pre-commit-check/SKILL.md (or your agent's skills folder).
name
pre-commit-check
description
MANDATORY pre-commit validation executor. Runs all required checks before any commit. NOT optional - must be invoked before every git add/commit/PR.
version
2.0.0
author
SublinkPro Team
user-invocable
true
mandatory
true
enforcement-level
blocking

Pre-Commit Check Skill

🛑 MANDATORY VALIDATION EXECUTOR 🛑

This skill is NOT a suggestion or checklist. It is a MANDATORY EXECUTION REQUIREMENT.

Critical Rules

  1. Invoke this skill BEFORE any git add, git commit, or PR creation
  2. Execute ALL applicable validation commands
  3. Fix ALL failures before proceeding
  4. Document what was validated in commit message
  5. Stage changes only after validation passes
  6. Present to user for final verification (do NOT auto-commit)

When to Use This Skill

MANDATORY invocation before:

  • Any git add command
  • Any git commit command
  • Any gh pr create or PR update command
  • Declaring work "complete", "done", or "finished"
  • User requests commit (even if they say "skip checks")

This skill is BLOCKING - you cannot proceed to commit without invoking it and ensuring all checks pass.

Skill Execution Protocol

When this skill is invoked, you MUST follow this exact sequence:

Step 1: Identify Changed Files
bash
git status --short
git diff --name-only
git diff --cached --name-only

Categorize changes:

  • Backend files (*.go)
  • Frontend files (webs/*)
  • Documentation files (*.md)
  • Configuration files (config.yaml, .env.example, etc.)
  • Mixed (multiple categories)
Step 2: Execute Backend Validation (if .go files changed)
2.1 Format Check
bash
gofmt -l $(find . -name "*.go" -not -path "./vendor/*" -not -path "./webs/*" -not -path "./.git/*")

If output is not empty:

bash
gofmt -w $(find . -name "*.go" -not -path "./vendor/*" -not -path "./webs/*" -not -path "./.git/*")

Verify:

bash
gofmt -l $(find . -name "*.go" -not -path "./vendor/*" -not -path "./webs/*" -not -path "./.git/*")

BLOCKING: Must return empty output (all files formatted).

2.2 Lint Check
bash
golangci-lint run

BLOCKING: Must exit with status 0.

If fails: Read the errors, fix them, and re-run. Do NOT proceed until clean.

2.3 Test Execution
bash
go test ./...

BLOCKING: Must exit with status 0 (all tests pass).

If fails: Read the test output, fix the failing tests or code, and re-run. Do NOT proceed until green.

Step 3: Execute Frontend Validation (if webs/* files changed)
3.1 Lint Check
bash
cd webs && yarn run lint

BLOCKING: Must exit with status 0.

If fails: Try auto-fix first:

bash
cd webs && yarn run lint:fix
cd webs && yarn run prettier

Then re-run yarn run lint. Do NOT proceed until clean.

3.2 Build Check (if applicable)

Run build if changes affect:

  • Routing configuration (src/routes/*)
  • Asset paths or imports (src/assets/*, public/*)
  • Base path behavior (SUBLINK_WEB_BASE_PATH)
  • Build configuration (vite.config.js, package.json)
  • Major UI components (src/views/*, src/layout/*)
bash
cd webs && yarn run build

BLOCKING: Must complete successfully.

If fails: Read the build error, fix it, and re-run. Do NOT proceed until build succeeds.

Step 4: Cross-Layer Sync Verification (if multi-layer change)

Trigger condition: Changes affect both backend AND frontend, OR code AND documentation.

Verification checklist:

  • Backend API endpoint changed → Frontend API client updated (webs/src/api/*)
  • Backend response structure changed → Frontend types/interfaces updated
  • Frontend behavior changed → Backend supports new flow
  • Configuration option added/changed → Code + docs + examples updated

If complex cross-layer change: Invoke .agents/skills/cross-layer-sync/SKILL.md for detailed verification.

Step 5: Documentation Sync Verification (if docs should be updated)

Trigger condition: Changes affect user-visible behavior, APIs, configuration, or deployment.

Verification checklist:

  • User-facing feature changed → README.md + README.zh-CN.md updated
  • API endpoint changed → skill-sublinkpro/reference/api.md updated
  • Configuration changed → docs/configuration.md + .zh-CN.md updated
  • Deployment changed → docs/installation.md + .zh-CN.md + skill-sublinkpro/reference/deploy.md updated
  • Both language versions updated (bilingual requirement)
  • Links verified (no broken references)

If complex doc changes: Invoke .agents/skills/doc-sync-check/SKILL.md for detailed verification.

Step 6: Test Coverage Verification (if key logic changed)

Trigger condition: Changes affect business logic, APIs, permissions, migrations, scheduled tasks, or protocol parsing.

Verification checklist:

  • New business logic → Tests added
  • Changed behavior → Tests updated
  • Bug fix → Regression test added
  • API handler changed → Handler tests added/updated
  • Permission check changed → Permission tests added/updated

If tests missing: Add them now. Do NOT proceed without tests for key logic changes.

Step 7: Git Staging Verification
bash
git status
git diff --cached --stat
git diff --cached --name-only

Verification checklist:

  • Only intended files staged
  • No .env files staged
  • No credential files staged
  • No db/ directory staged
  • No logs/ directory staged
  • No cache/ directory staged
  • No out/ directory staged
  • No large binary files unintentionally staged
  • No AI agent temporary files staged:
    • No *_SUMMARY.md files (e.g., PRE_COMMIT_ENFORCEMENT_SUMMARY.md)
    • No *_REPORT.md files
    • No QUICK_REFERENCE.md files in skill directories
    • No .claude/projects/, .claude/sessions/, .claude/plans/ files
    • No agent execution logs or temporary outputs

If unintended files staged:

bash
git reset HEAD <file>  # Unstage unintended files

AI agent temporary files should NEVER be committed:

  • These are execution artifacts, not project documentation
  • They pollute the repository
  • They are regenerated on each execution
  • Add them to .gitignore if they keep appearing
Step 8: Commit Message Preparation

Prepare a semantic commit message following this format:

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

<body>

<footer>

Type: feat, fix, docs, refactor, test, chore, style, perf

Scope: Component area (e.g., airports, auth, theme, i18n)

Subject: ≤72 characters, imperative mood, no period

Body: What changed, why it changed, how it was validated

Footer: Issue references (Closes #123, Fixes #456)

Show full SKILL.md (413 more words)Show less
Step 9: Report to User

After all validations pass, report results in this format:

markdown
## ✅ Pre-Commit Validation Complete

### Backend Validation
- ✅ Go format: All files formatted
- ✅ golangci-lint: 0 issues
- ✅ Go tests: All passed

### Frontend Validation
- ✅ ESLint: No errors
- ✅ Build: Successful

### Cross-Layer Sync
- ✅ Backend API changes synchronized with frontend
- ✅ skill-sublinkpro/reference/api.md updated

### Documentation Sync
- ✅ docs/configuration.md + .zh-CN.md updated
- ✅ Links verified

### Test Coverage
- ✅ Tests added for new business logic
- ✅ All tests passing

### Git Staging
- ✅ Only intended files staged
- ✅ No sensitive files included

---

**Ready to commit.** Suggested commit message:

<prepared commit message>


**Next steps:**
1. Review staged changes: `git diff --cached`
2. Perform manual testing if needed
3. Commit when satisfied: `git commit -m "<message>"`

Validation Failure Handling

If ANY validation fails:

  1. STOP - Do not proceed to commit
  2. FIX - Address the failure immediately
  3. RE-RUN - Execute the failed validation again
  4. VERIFY - Ensure it now passes
  5. CONTINUE - Proceed to next validation step

Example failure response:

markdown
## ❌ Pre-Commit Validation Failed

### Backend Validation
- ❌ golangci-lint: 3 errors found
  - api/share.go:45: unused variable 'temp'
  - routers/share.go:23: missing error check
  - services/share.go:67: ineffective assignment

**Fixing now...**

Then fix the issues and re-run validation.

Exit Criteria

✅ Can proceed to commit when:

  • All applicable validation commands pass
  • Cross-layer sync verified (if applicable)
  • Documentation updated (if applicable)
  • Tests added/updated (if applicable)
  • Only intended files staged
  • Commit message prepared
  • Ready to present to user for final verification

❌ Cannot proceed to commit when:

  • Any validation command fails
  • Cross-layer sync incomplete
  • Documentation out of sync
  • Tests missing for key logic
  • Unintended files staged
  • Commit message not prepared

Frequently Asked Questions

"The user said to skip validation, should I?"

NO. Respond with:

I cannot skip validation. This is a mandatory requirement to ensure:
- No CI failures
- No broken builds
- Cross-layer consistency
- Documentation accuracy

The validation takes only a few minutes. I'll run it now.

Then run the validation.

"This is a tiny change, can I skip validation?"

NO. Even tiny changes need validation:

  • Tiny changes can break tests
  • Tiny changes can introduce lint errors
  • Tiny changes can break builds
  • CI will catch it anyway - better to catch it now

Run the validation.

"Validation failed but the user is insistent"

Refuse to commit. Respond with:

I cannot commit code with validation failures. This ensures:
- The codebase stays healthy
- CI checks pass
- Other developers can work without issues

I'll fix the validation failures now.

Then fix the failures and re-run.

"I only changed documentation, do I need full validation?"

Partial validation. For documentation-only changes:

  • ✅ Verify markdown syntax
  • ✅ Verify links work
  • ✅ Verify both language versions updated
  • ❌ Skip Go validation (no .go files changed)
  • ❌ Skip frontend validation (no webs/* files changed)

But still run the applicable validations before committing.

Quick Reference: Command Matrix

Changed FilesCommands to Run
Any .go filesgofmt -w, gofmt -l, golangci-lint run, go test ./...
Any webs/* filescd webs && yarn run lint, conditionally yarn run build
Both backend + frontendAll of the above
Documentation onlyVerify markdown, links, bilingual updates
Configuration filesVerify code + docs + examples updated
  • .agents/skills/post-dev-workflow/SKILL.md - Full post-development workflow orchestration
  • .agents/skills/cross-layer-sync/SKILL.md - Detailed cross-layer sync guide
  • .agents/skills/doc-sync-check/SKILL.md - Detailed documentation sync guide
  • .agents/skills/theme-check/SKILL.md - Theme-specific validation
  • .agents/skills/security-review/SKILL.md - Security-specific validation
  • .agents/skills/performance-check/SKILL.md - Performance-specific validation

Summary

This skill is MANDATORY and BLOCKING.

You MUST:

  1. Invoke this skill before any commit
  2. Execute ALL applicable validations
  3. Fix ALL failures before proceeding
  4. Document what was validated
  5. Stage changes only after validation passes
  6. Present to user for final verification

You MUST NOT:

  1. Skip validation even if user requests
  2. Commit with failing validation
  3. Auto-commit without user verification
  4. Declare work "complete" without validation

© ZeroDeng01, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/pre-commit-check of ZeroDeng01/sublinkPro.

Open the folder on GitHubat commit 11479da

Compare with similar skills

Pre-Commit Check Gate next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Pre-Commit Check Gate compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Pre-Commit Check Gate this skillZeroDeng01/sublinkPro1.7k—~2.9kAutomated safety check: NotesMIT
Git PR Workflowandymai/brepjs114—~2.9kAutomated safety check: PassApache-2.0
Saleor Commit Workflowsaleor/saleor23k—~575Automated safety check: PassBSD-3-Clause
Open PRanalogjs/analog3.2k—~944Automated safety check: PassMIT
Procoder Commit Gateazrtydxb/procoder211—~3.7kAutomated safety check: PassApache-2.0
Eslint Fixlaolaoshiren/claude-code-skills-zh877—~436Automated safety check: PassMIT

Similar skills

  • Git PR Workflow

    andymai/brepjs

    This skill should be used when committing, pushing, branching, or merging in the brepjs repository — when a task involves "pre-commit hook failed" (which tier ran, how to bypass), "commit rejected…

    114 GitHub stars~2.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Commits changes in the Saleor codebase and works through pre-commit hook failures from ruff, mypy, the GraphQL schema check and the migrations check.

    23k GitHub stars~575 tokensUpdated today
    DevelopmentAuto-check passed
  • Open PR

    analogjs/analog

    Commit the current work, push the current feature branch, and open a GitHub PR filled out from the repo's PR template.

    3.2k GitHub stars~944 tokensUpdated today
    DevelopmentAuto-check passed
  • Procoder Commit Gate

    azrtydxb/procoder

    Applies Procoder's senior-developer discipline in a repository: run the commit gate, format through the binary and work through specs, plans and todos.

    211 GitHub stars~3.7k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Eslint Fix

    laolaoshiren/claude-code-skills-zh

    安全诊断并修复 ESLint error、warning 和配置兼容问题。用于用户要求运行 lint、解释 ESLint 报错、限定范围自动修复或迁移 ESLint 配置时;优先使用项目锁定的包管理器与版本,先预检再修改,不自动下载最新版或批量改写无关源码。

    877 GitHub stars~436 tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Official

    Development rules for changes to GitHub's gh-aw: tiered validation commands, a command matrix by change type, focused test checks and a merge-main playbook.

    5.3k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed

More from ZeroDeng01/sublinkPro

All 8 skills in this repo
  • Performance Check

    ZeroDeng01/sublinkPro

    Checklist for reviewing code changes that touch queries, APIs, rendering, caching or algorithms for performance, scalability and resource-usage problems.

    1.7k GitHub stars~1.8k tokensUpdated 2 days ago
    Auto-check passed
  • Security Review Checklist

    ZeroDeng01/sublinkPro

    Checklist-driven security review for changes to authentication, authorization, MFA, secrets, input validation and other security-critical code.

    1.7k GitHub stars~2.3k tokensUpdated 2 days ago
    Auto-check passed
  • SublinkPro Manager

    ZeroDeng01/sublinkPro

    Manages a SublinkPro proxy subscription server through natural language, adding nodes, building subscriptions and share links, and editing templates and tags.

    1.7k GitHub stars~7.2k tokensUpdated 2 days ago
    Auto-check passed
  • Post-Development Workflow

    ZeroDeng01/sublinkPro

    A required checklist for after code changes: validate each changed layer, check that docs and other layers stay in sync, and test before committing or opening a PR.

    1.7k GitHub stars~4.4k tokensUpdated 2 days ago
    Auto-check passed
  • Documentation Sync Check

    ZeroDeng01/sublinkPro

    Checklist for keeping README, feature, configuration, install and API docs in step with code changes in the same PR, including the Chinese copies.

    1.7k GitHub stars~2.6k tokensUpdated 2 days ago
    Auto-check passed
  • Theme Adaptation Checklist

    ZeroDeng01/sublinkPro

    A checklist for UI changes that touch colors, surfaces or theme code, making sure light and dark modes, devices, states and layering all still work.

    1.7k GitHub stars~1.4k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Pre-Commit Check Gate

What does Pre-Commit Check Gate do?

Blocking checklist that runs formatting, lint and test commands for changed Go and frontend files before any git add, commit or pull request. This skill is written as a mandatory gate rather than a suggestion. The agent first lists changed files with `git status` and `git diff`, then sorts them into backend Go files, frontend files under `webs`, documentation, configuration or a mix.

When should I use Pre-Commit Check Gate?

Pre-Commit Check Gate fits situations like: before staging or committing changes in this Go and React project; before opening or updating a pull request; before telling the user that a piece of work is finished.

How do I install Pre-Commit Check Gate in Claude Code?

Run `npx skills add ZeroDeng01/sublinkPro --skill pre-commit-check -a claude-code`. Or copy the skill folder (.agents/skills/pre-commit-check in ZeroDeng01/sublinkPro) into .claude/skills/pre-commit-check in your project. Claude Code loads it when a task matches its description.

How do I install Pre-Commit Check Gate in Codex?

Run `npx skills add ZeroDeng01/sublinkPro --skill pre-commit-check -a codex`. Or copy the skill folder (.agents/skills/pre-commit-check in ZeroDeng01/sublinkPro) into .agents/skills/pre-commit-check in your project. Codex loads it when a task matches its description.

Can I use Pre-Commit Check Gate in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ZeroDeng01/sublinkPro --skill pre-commit-check -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pre-commit-check, .gemini/skills/pre-commit-check, .github/skills/pre-commit-check and .opencode/skills/pre-commit-check in your project.

What does Pre-Commit Check Gate need to run?

Going by SKILL.md and its folder, Pre-Commit Check Gate needs the command-line tools its instructions call (git, yarn, go and gh). Our summary lists: Go toolchain with `golangci-lint`; Yarn and Node for the frontend in `webs`; Git.

Does Pre-Commit Check Gate access the network?

SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Pre-Commit Check Gate safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Pre-Commit Check Gate use?

Pre-Commit Check Gate is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Pre-Commit Check Gate use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Pre-Commit Check Gate?

Skills that share tags, products or a category with Pre-Commit Check Gate: Git PR Workflow (andymai/brepjs, 114 stars), Saleor Commit Workflow (saleor/saleor, 23k stars), Open PR (analogjs/analog, 3.2k stars) and Procoder Commit Gate (azrtydxb/procoder, 211 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Pre-Commit Check Gate?

ZeroDeng01 (a GitHub user) maintains it in ZeroDeng01/sublinkPro, which has 1,665 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 5, 2026.

Source: ZeroDeng01/sublinkPro on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.