leanspec-pre-push
БесплатноБез исполняемых скриптовНе проверенRun before pushing code to the lean-spec repo to catch what reviewers and CI will catch later, and confirm the branch has a linked spec issue in a valid…
от codervisor★ 306 звёзд на GitHubОб этом скилле
leanspec-pre-push
Mechanical checklist that catches the reviewer / CI failures this repo has actually had, plus a spec-link check that enforces the SDD loop locally.
This is lean-spec's analogue of onsager-pre-push / duhem-pre-push. The discipline is the same; the toolchain checks are lean-spec's (pnpm + cargo). The repo-specific patterns below come from this monorepo's structure (TypeScript packages, Rust crates, i18n locale files, schemas).
Why
CI on pull_request checks out a merge of origin/main + the PR branch, not the branch alone. Local pnpm typecheck without that merge is insufficient.
The spec-link step enforces "no PR without a spec or a trivial label" at push time, before the PR is open — so the author sees the problem locally instead of hearing about it from a reviewer.
Steps
Run all of these from the repo root.
1. Sync main into the branch
git fetch origin main
git merge origin/main --no-edit
Resolve conflicts locally, before push — never on the PR "Resolve conflicts" web editor (it bypasses any local validation). If the merge aborts cleanly, skip to step 2.
Resolving conflicts
Inventory what conflicted:
git status --short # U* lines = unresolved paths git diff --name-only --diff-filter=UWork by pattern, not by file. A single logical conflict often spans several files. Match what you see against the patterns below before touching conflict markers — the right fix is often "take main's version and re-apply your change on top", not a line-by-line merge.
Resolve, then stage each resolved path with
git add <path>. Re-rungit statusuntil noU*entries remain.Verify before committing the merge. Run
pnpm typecheck && pnpm pre-push. Runpnpm testfor the affected packages. If the merge touched Rust, also runpnpm build:rustandpnpm test:rust.Only then:
git commit --no-edit # default "Merge branch 'main' ..." messageIf you get lost, bail and retry:
git merge --abortThis restores pre-merge state. Never
git reset --hardorgit checkout --without confirming nothing is staged you care about — the merge carries uncommitted resolutions.Prefer
mergeoverrebasefor syncing main here: the branch is likely already pushed, rebase rewrites history, and force-push is a destructive action.
Common collision patterns to watch for
CHANGELOG.md: both branches added entries under the same[Unreleased]heading. Both should land — concatenate alphabetically by category (Added, Changed, Fixed, …).package.jsonversion field: never resolve by hand. Runpnpm sync-versionsto re-derive from the root version. Seeleanspec-development"Publishing & Releases".pnpm-lock.yaml: never hand-edit. After resolving the sourcepackage.jsonconflicts, runpnpm installto regenerate the lockfile, thengit add pnpm-lock.yaml.Cargo.lock: never hand-edit. After resolving RustCargo.tomlconflicts, runpnpm build:rustand let cargo regenerate.locales/en.jsonandlocales/zh-CN.json: both branches added i18n keys. Both should land; verify each new key exists in both files. If one branch added a key only toenand the other added only tozh-CN, that's a process bug — fix the missing parity before committing the merge.schemas/*.json: JSON schema files. Both branches added fields. Merge by key; verify the schema still validates by running the validator (when wired) orpnpm typecheckto confirm the generated TypeScript types still compile.- Generated
packages/**/dist/: don't merge. Delete the conflict and rerunpnpm build. specs/legacy directory: don't author new files here post-migration. If a conflict exists inspecs/because both branches added a newspecs/NNN-slug/, the correct fix is usually to delete both new directories and migrate them to GitHub issues viaissue-spec. If they pre-date migration, take both arms.
2. Build / typecheck / test
Run, in order:
pnpm typecheck # mandatory before marking work complete
pnpm pre-push # typecheck + clippy
pnpm test # full Vitest suite
pnpm format:rust:check # if Rust changed
pnpm test:rust # if Rust changed
If the change touches the desktop bundle (packages/desktop/), also run pnpm dev:desktop smoke check.
Treat any warning as a blocker. Do not #[allow(dead_code)], #[allow(unused)], or @ts-ignore your way past it; fix the root cause. Rust clippy is -D warnings — warnings are errors.
3. i18n parity check
If the diff touches user-visible strings:
- Locale files live under
locales/en.jsonandlocales/zh-CN.json(and any per-package equivalents — seeI18N.md).
Установить leanspec-pre-push в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл leanspec-pre-push?
Run before pushing code to the lean-spec repo to catch what reviewers and CI will catch later, and confirm the branch has a linked spec issue in a valid state. Reproduces the merge-preview environment, walks through this repo's common merge-conflict patterns, and runs the project's typecheck / clippy / test gates. Triggers include "before push", "ready to push", "pre-push check", "push readiness", "prep for PR", "resolve merge conflict", "merge conflict", "branch has conflicts", "sync with main", or proactively before any git push on a lean-spec branch.
Как установить скилл leanspec-pre-push?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл leanspec-pre-push запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic