diff --git a/README.md b/README.md index 57d4783..723a5d3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Limits

-One commit gate and fourteen skill files for coding agents. +One commit gate and fifteen skill files for coding agents. The gate is the part that cannot be ignored: it rejects a commit or a pull request whose message does not carry the five-key slice report. The skills describe how to produce one. @@ -40,17 +40,18 @@ or copy `gate/steerloop-gate.mjs` into your own tooling and call it from a `comm ## Profiles -Not every project needs fourteen skills. `stack.json` is the machine-readable list; these are the same groups as commands: +Not every project needs fifteen skills. `stack.json` is the machine-readable list; these are the same groups as commands: | Profile | What it covers | Install | | --- | --- | --- | | core | Gates, method, deepening | `npx skills add lukavtz/steerloop --skill steerloop --skill craftloop --skill be-ambitious` | +| git | Commits, branches, PRs, conflicts, recovery | `npx skills add lukavtz/steerloop --skill gitkeeper` | | web | Core plus performance and a landing page | `npx skills add lukavtz/steerloop --skill steerloop --skill craftloop --skill webperf --skill landing-page-design` | | design | Page, Figma, anti-slop pass, figures, README | `npx skills add lukavtz/steerloop --skill landing-page-design --skill figma-designer --skill hallmark --skill anatomy --skill beautify-github-readme` | | text | English and Russian prose | `npx skills add lukavtz/steerloop --skill stop-slop --skill ru-text --skill ru-check --skill ru-score --skill humanizer-ru` | -| full | All fourteen | `npx skills add lukavtz/steerloop` | +| full | All fifteen | `npx skills add lukavtz/steerloop` | -`npm test` validates every `SKILL.md` frontmatter and checks that `stack.json` matches the tree, so a skill cannot be added without being listed. +`npm test` validates every `SKILL.md` against the Agent Skills rules — frontmatter, a 500-line body budget, one-level references that all resolve, no placeholders — and checks that `stack.json` matches the tree, so a skill cannot be added without being listed. ## The gate @@ -73,6 +74,7 @@ npm run gate:check -- pr-body.md | Group | Skills | Fires when | | --- | --- | --- | | Process | `steerloop`, `craftloop`, `be-ambitious` | Every coding task; substantial work; a request worth deepening rather than enlarging | +| Git | `gitkeeper` | Any git or GitHub operation: committing, branching, conflicts, rebasing, worktrees, recovery, PRs, reviews, releases, `gh` | | Web | `webperf` | A slow page, or a change touching loading, bundles, images, queries | | Design | `landing-page-design`, `figma-designer`, `hallmark`, `anatomy`, `beautify-github-readme` | A landing page, a Figma file, an anti-slop visual pass, an isometric figure, a repository README | | Prose | `stop-slop`, `ru-text`, `ru-check`, `ru-score`, `humanizer-ru` | Drafting, editing or reviewing text, in English or Russian; typography that applies to every Russian output | @@ -155,8 +157,8 @@ skills/craftloop/SKILL.md the method skills/craftloop/references/ security rules, loaded on demand skills/webperf/SKILL.md web performance router skills/webperf/references/ 31 recipes, one per symptom -skills/* fourteen skills, five original -scripts/validate-skills.mjs frontmatter and stack.json check +skills/* fifteen skills, four original +scripts/validate-skills.mjs skill structure and stack.json check stack.json skills, profiles, origins, licenses THIRD_PARTY_LICENSES/ MIT texts for the vendored skills gate/steerloop-gate.mjs the report validator diff --git a/THIRD_PARTY_NOTICE.md b/THIRD_PARTY_NOTICE.md index 6f77800..c9b5c11 100644 --- a/THIRD_PARTY_NOTICE.md +++ b/THIRD_PARTY_NOTICE.md @@ -6,12 +6,12 @@ Skills vendored from other repositories. All are MIT; the license text for each | --- | --- | --- | --- | | `landing-page-design`, `figma-designer` | elayadesign/ai-design-skills | `456d9e0` | `elaya-ai-design-skills.txt` | | `be-ambitious` | DannyMac180/skills | `7dc63b7` | `dannymac180-skills.txt` | -| `hallmark` | nutlope/hallmark | `407fa68` | `nutlope-hallmark.txt` | +| `hallmark` | nutlope/hallmark | `04977e1` | `nutlope-hallmark.txt` | | `stop-slop` | hardikpandya/stop-slop | `8da1f03` | `hardikpandya-stop-slop.txt` | | `anatomy` | wheresryan22/anatomy | `1482e84` | `wheresryan22-anatomy.txt` | -| `beautify-github-readme` | oil-oil/beautify-github-readme | `d6562a5` | `oil-oil-beautify-github-readme.txt` | +| `beautify-github-readme` | oil-oil/beautify-github-readme | `fcdb950` | `oil-oil-beautify-github-readme.txt` | | `ru-text`, `ru-check`, `ru-score` | talkstream/ru-text | `e398aec` | `talkstream-ru-text.txt` | -| `humanizer-ru` | ilyautov/humanizer-ru | `b6df5d9` | `ilyautov-humanizer-ru.txt` | +| `humanizer-ru` | ilyautov/humanizer-ru | `7374133` | `ilyautov-humanizer-ru.txt` | Files are copied verbatim and not modified here. @@ -25,4 +25,4 @@ Two skills carry code that this repository does not run in CI: - `humanizer-ru` ships its Python scanner and metrics package verbatim. The skill falls back to manual editing when the scanner is unavailable. - `anatomy` ships its Node audit scripts verbatim; they need Chrome, as its own documentation states. -`steerloop`, `webperf` and the gate are original to this repository. `craftloop` belongs to its author and is included with two sentences changed, noted in the README. +`steerloop`, `webperf`, `gitkeeper` and the gate are original to this repository. `craftloop` belongs to its author and is included with two sentences changed, noted in the README. diff --git a/assets/readme/build_hero.py b/assets/readme/build_hero.py index 06df0a0..10247d4 100644 --- a/assets/readme/build_hero.py +++ b/assets/readme/build_hero.py @@ -43,7 +43,7 @@ def hero() -> None: canvas.paste(panel, (500, 16), panel) d = ImageDraw.Draw(canvas) - d.text((72, 104), "AGENT SKILLS · FOURTEEN FILES", font=font("consola.ttf", 17), fill=MUTED) + d.text((72, 104), "AGENT SKILLS · FIFTEEN FILES", font=font("consola.ttf", 17), fill=MUTED) d.text((72, 146), "steerloop", font=font("segoeuib.ttf", 92), fill=FG) d.text((74, 262), "One slice at a time. The agent asks", font=font("segoeui.ttf", 25), fill=(201, 205, 210)) d.text((74, 296), "before it writes code.", font=font("segoeui.ttf", 25), fill=(201, 205, 210)) @@ -55,7 +55,7 @@ def hero() -> None: d.text((90, 362), cmd, font=cf, fill=ACCENT) d.line([(72, 420), (72 + tw + 36, 420)], fill=(58, 58, 58)) - d.text((72, 430), "14 SKILLS · MIT · npx skills add lukavtz/steerloop", font=font("consola.ttf", 14), fill=DIM) + d.text((72, 430), "15 SKILLS · MIT · npx skills add lukavtz/steerloop", font=font("consola.ttf", 14), fill=DIM) canvas.save(HERE / "hero.png", optimize=True) diff --git a/assets/readme/hero.png b/assets/readme/hero.png index f87298f..b2d5a59 100644 Binary files a/assets/readme/hero.png and b/assets/readme/hero.png differ diff --git a/package.json b/package.json index fe3a6c9..d82d72c 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "steerloop-gate": "./gate/steerloop-gate.mjs" }, "scripts": { - "test": "node --test gate/steerloop-gate.test.mjs && node scripts/validate-skills.mjs", + "test": "node --test gate/steerloop-gate.test.mjs scripts/validate-skills.test.mjs && node scripts/validate-skills.mjs", "gate:install": "git config core.hooksPath .githooks", "gate:check": "node gate/steerloop-gate.mjs --body-file", "validate": "node scripts/validate-skills.mjs" diff --git a/scripts/validate-skills.mjs b/scripts/validate-skills.mjs index c14ca7f..006a6b5 100644 --- a/scripts/validate-skills.mjs +++ b/scripts/validate-skills.mjs @@ -1,22 +1,51 @@ #!/usr/bin/env node -// Validates every skills//SKILL.md against the Agent Skills frontmatter rules, +// Validates every skills//SKILL.md against the Agent Skills frontmatter and body rules, // and checks stack.json against the tree. -// Usage: node scripts/validate-skills.mjs +// Usage: node scripts/validate-skills.mjs [root] import { existsSync, readFileSync, readdirSync } from "node:fs"; -import { dirname, join } from "node:path"; +import { dirname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; -const ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); -const SKILLS = join(ROOT, "skills"); +const DEFAULT_ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); const NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/; const LIMITS = { name: 64, description: 1024, compatibility: 500 }; +// Spec keys plus the Claude Code skills frontmatter reference fields this repo already uses. +const KEYS = [ + "name", + "description", + "license", + "compatibility", + "metadata", + "allowed-tools", + "argument-hint", + "disallowed-tools", + "context", + "model", + "effort", + "user-invocable", + "version", +]; +const BODY_LIMIT = 500; +const PLACEHOLDER = /\b(TODO|TBD|FIXME|XXX)\b/g; +const HOST_PATH = /(?:[A-Za-z]:\\|\/Users\/|\/home\/)/g; +// A skill-relative path only: `**/x/references/a.md` and `../x/references/a.md` are search or foreign paths. +const REFERENCE = /(? index > 0 && line.trim() === "---"); - return end < 0 ? null : parseBlock(lines.slice(1, end)); + if (end < 0) return null; + const block = lines.slice(1, end); + return { + data: parseBlock(block), + keys: topKeys(block), + body: lines.slice(end + 1).join("\n"), + bodyLine: end + 2, + }; } function parseBlock(lines) { @@ -37,11 +66,74 @@ function parseBlock(lines) { return out; } -function skillProblems(dir) { - const file = join(SKILLS, dir, "SKILL.md"); +function topKeys(lines) { + return lines.flatMap((line, index) => { + const match = line.match(/^([A-Za-z0-9_-]+):/); + return match ? [{ key: match[1], line: index + 2 }] : []; + }); +} + +function hits(text, pattern, firstLine) { + return text.split("\n").flatMap((line, index) => + [...line.matchAll(pattern)].map((match) => ({ text: match[0], line: firstLine + index })), + ); +} + +function esc(text) { + return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +// A file counts as mentioned when its name appears as a whole token, bare or behind `references/`. +function mentions(body, file) { + return new RegExp(`(?:^|[^\\w.-])${esc(file)}(?![\\w.-])`).test(body); +} + +// Exact mention, or a glob in the body that matches the file name or its references/ path. +function mentioned(body, file) { + if (mentions(body, file)) return true; + const paths = [file, `references/${file}`]; + return [...body.matchAll(REFERENCE_GLOB)].some(([glob]) => { + const pattern = new RegExp(`^${esc(glob).replace(/\\\*/g, "[^/]*")}$`); + return paths.some((path) => pattern.test(path)); + }); +} + +function bodyLines(body) { + return body.endsWith("\n") ? body.split("\n").length - 1 : body.split("\n").length; +} + +function referenceProblems(dir, body, bodyLine, skillsDir) { + const base = join(skillsDir, dir); + const rel = `skills/${dir}/SKILL.md`; + const problems = []; + for (const { text, line } of hits(body, REFERENCE, bodyLine)) { + if (!existsSync(join(base, text))) problems.push(`${rel}:${line}: mentions ${text}, which does not exist`); + } + const refs = join(base, "references"); + if (!existsSync(refs)) return problems; + const files = readdirSync(refs, { withFileTypes: true }) + .filter((entry) => entry.isFile() && entry.name.endsWith(".md")) + .map((entry) => entry.name) + .sort(); + for (const name of files) { + if (!mentioned(body, name)) problems.push(`${rel}: references/${name} exists but SKILL.md never mentions it`); + const nested = readFileSync(join(refs, name), "utf8").replace(/\r\n?/g, "\n"); + for (const { text, line } of hits(nested, REFERENCE, 1)) { + if (!mentioned(body, text.split("/").pop())) { + problems.push(`skills/${dir}/references/${name}:${line}: nested reference ${text} is not mentioned in SKILL.md`); + } + } + } + return problems; +} + +function skillProblems(dir, skillsDir) { + const rel = `skills/${dir}/SKILL.md`; + const file = join(skillsDir, dir, "SKILL.md"); if (!existsSync(file)) return [`${dir}: SKILL.md is missing`]; - const data = frontmatter(readFileSync(file, "utf8")); - if (!data) return [`${dir}: no frontmatter block`]; + const meta = frontmatter(readFileSync(file, "utf8")); + if (!meta) return [`${dir}: no frontmatter block`]; + const { data, keys, body, bodyLine } = meta; const problems = []; if (!data.name) problems.push(`${dir}: name is missing`); else if (data.name !== dir) problems.push(`${dir}: name "${data.name}" does not match the folder`); @@ -50,7 +142,28 @@ function skillProblems(dir) { for (const [key, max] of Object.entries(LIMITS)) { if (data[key] && data[key].length > max) problems.push(`${dir}: ${key} is ${data[key].length} chars, limit ${max}`); } - return problems; + for (const { key, line } of keys) { + if (!KEYS.includes(key)) problems.push(`${rel}:${line}: frontmatter key "${key}" is not allowed (allowed: ${KEYS.join(", ")})`); + } + const lines = bodyLines(body); + if (lines > BODY_LIMIT) problems.push(`${rel}: body is ${lines} lines after frontmatter, limit ${BODY_LIMIT}`); + for (const { text, line } of hits(body, PLACEHOLDER, bodyLine)) problems.push(`${rel}:${line}: placeholder ${text} in the body`); + for (const { text, line } of hits(body, HOST_PATH, bodyLine)) problems.push(`${rel}:${line}: absolute host path ${text}`); + return [...problems, ...referenceProblems(dir, body, bodyLine, skillsDir)]; +} + +function duplicateDescriptions(skills, skillsDir) { + const seen = new Map(); + for (const dir of skills) { + const file = join(skillsDir, dir, "SKILL.md"); + if (!existsSync(file)) continue; + const description = frontmatter(readFileSync(file, "utf8"))?.data.description; + if (!description) continue; + seen.set(description, [...(seen.get(description) ?? []), `skills/${dir}`]); + } + return [...seen.values()] + .filter((dirs) => dirs.length > 1) + .map((dirs) => `duplicate description: ${dirs.join(", ")}`); } function listingProblems(skills, stack) { @@ -66,19 +179,25 @@ function profileProblems(skills, stack) { ); } -function stackProblems(skills) { - const file = join(ROOT, "stack.json"); +function stackProblems(skills, root) { + const file = join(root, "stack.json"); if (!existsSync(file)) return ["stack.json is missing"]; const stack = JSON.parse(readFileSync(file, "utf8")); return [...listingProblems(skills, stack), ...profileProblems(skills, stack)]; } function main() { - const skills = readdirSync(SKILLS, { withFileTypes: true }) + const root = process.argv[2] ? resolve(process.argv[2]) : DEFAULT_ROOT; + const skillsDir = join(root, "skills"); + const skills = readdirSync(skillsDir, { withFileTypes: true }) .filter((entry) => entry.isDirectory()) .map((entry) => entry.name) .sort(); - const problems = [...skills.flatMap(skillProblems), ...stackProblems(skills)]; + const problems = [ + ...skills.flatMap((dir) => skillProblems(dir, skillsDir)), + ...duplicateDescriptions(skills, skillsDir), + ...stackProblems(skills, root), + ]; if (problems.length === 0) { console.log(`skills: ${skills.length} valid, stack.json consistent`); return 0; @@ -88,4 +207,4 @@ function main() { return 1; } -process.exit(main()); \ No newline at end of file +process.exit(main()); diff --git a/scripts/validate-skills.test.mjs b/scripts/validate-skills.test.mjs new file mode 100644 index 0000000..fcda1f6 --- /dev/null +++ b/scripts/validate-skills.test.mjs @@ -0,0 +1,164 @@ +import assert from "node:assert/strict"; +import { spawnSync } from "node:child_process"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { test } from "node:test"; +import { fileURLToPath } from "node:url"; + +const VALIDATOR = join(dirname(fileURLToPath(import.meta.url)), "validate-skills.mjs"); + +function run(root) { + return spawnSync(process.execPath, [VALIDATOR, root], { encoding: "utf8" }); +} + +function makeSkill(name, { body = "Body.", extra = "", description = `${name} fixture description` } = {}) { + return `---\nname: ${name}\ndescription: ${description}\n${extra}---\n${body}\n`; +} + +// Writes a throwaway repo root: stack.json plus skills//SKILL.md and optional references/*.md. +function fixture(t, specs) { + const root = mkdtempSync(join(tmpdir(), "validate-skills-")); + t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 3 })); + mkdirSync(join(root, "skills"), { recursive: true }); + const listed = Object.fromEntries(Object.keys(specs).map((name) => [name, {}])); + writeFileSync(join(root, "stack.json"), JSON.stringify({ skills: listed })); + for (const [name, spec] of Object.entries(specs)) { + const dir = join(root, "skills", name); + mkdirSync(dir, { recursive: true }); + writeFileSync(join(dir, "SKILL.md"), spec.skill); + if (spec.references) { + mkdirSync(join(dir, "references"), { recursive: true }); + for (const [file, text] of Object.entries(spec.references)) writeFileSync(join(dir, "references", file), text); + } + } + return root; +} + +function bodyOf(count) { + return Array.from({ length: count }, (_, index) => `Line ${index + 1}.`).join("\n"); +} + +test("a clean fixture passes", (t) => { + const root = fixture(t, { + clean: { + skill: makeSkill("clean", { body: "Read `references/guide.md` and `references/extra.md`." }), + references: { "guide.md": "See `references/extra.md`.\n", "extra.md": "Leaf.\n" }, + }, + }); + const result = run(root); + assert.equal(result.status, 0, result.stderr); + assert.match(result.stdout, /skills: 1 valid, stack\.json consistent/); +}); + +test("a 500-line body passes and 501 fails", async (t) => { + await t.test("500 lines", (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { body: bodyOf(500) }) } }); + const result = run(root); + assert.equal(result.status, 0, result.stderr); + }); + await t.test("501 lines", (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { body: bodyOf(501) }) } }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/SKILL\.md: body is 501 lines after frontmatter, limit 500/); + }); +}); + +test("a placeholder token fails", (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { body: "First line.\nTODO: finish this." }) } }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/SKILL\.md:6: placeholder TODO in the body/); +}); + +test("an absolute host path fails", async (t) => { + for (const path of ["C:\\Users\\me", "/Users/me", "/home/me"]) { + await t.test(path, (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { body: `Open ${path} now.` }) } }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /absolute host path/); + }); + } +}); + +test("an unknown frontmatter key fails", (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { extra: "nonsense-key: yes\n" }) } }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/SKILL\.md:4: frontmatter key "nonsense-key" is not allowed/); +}); + +test("harness frontmatter keys pass", (t) => { + const extra = [ + 'argument-hint: ""', + "disallowed-tools: Write", + "context: fork", + "model: sonnet", + "effort: medium", + "user-invocable: true", + "version: 1.0.0", + "", + ].join("\n"); + const root = fixture(t, { clean: { skill: makeSkill("clean", { extra }) } }); + const result = run(root); + assert.equal(result.status, 0, result.stderr); +}); + +test("a mentioned reference that does not exist fails", (t) => { + const root = fixture(t, { clean: { skill: makeSkill("clean", { body: "Read `references/gone.md`." }) } }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/SKILL\.md:5: mentions references\/gone\.md, which does not exist/); +}); + +test("an orphaned reference file fails", (t) => { + const root = fixture(t, { + clean: { skill: makeSkill("clean"), references: { "orphan.md": "Leaf.\n" } }, + }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/SKILL\.md: references\/orphan\.md exists but SKILL\.md never mentions it/); +}); + +test("a glob mention covers the reference files it matches", (t) => { + const root = fixture(t, { + clean: { + skill: makeSkill("clean", { body: "Read `review-*.md` before a review." }), + references: { "review-hero.md": "Leaf.\n", "review-finish.md": "Leaf.\n" }, + }, + }); + const result = run(root); + assert.equal(result.status, 0, result.stderr); +}); + +test("a nested reference that SKILL.md never mentions fails", (t) => { + const root = fixture(t, { + clean: { + skill: makeSkill("clean", { body: "Read `references/a.md`." }), + references: { "a.md": "See `references/b.md`.\n" }, + }, + }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /skills\/clean\/references\/a\.md:1: nested reference references\/b\.md is not mentioned in SKILL\.md/); +}); + +test("two skills sharing a description fail", (t) => { + const root = fixture(t, { + one: { skill: makeSkill("one", { description: "Shared fixture description." }) }, + two: { skill: makeSkill("two", { description: "Shared fixture description." }) }, + }); + const result = run(root); + assert.equal(result.status, 1); + assert.match(result.stderr, /duplicate description: skills\/one, skills\/two/); +}); + +test("a glob or foreign reference path is not a skill-relative path", (t) => { + const root = fixture(t, { + clean: { skill: makeSkill("clean", { body: "Search `**/other/references/missing.md` and `../other/references/gone.md`." }) }, + }); + const result = run(root); + assert.equal(result.status, 0, result.stderr); +}); diff --git a/skills/beautify-github-readme/SKILL.md b/skills/beautify-github-readme/SKILL.md index 3bc1430..a4e26e5 100644 --- a/skills/beautify-github-readme/SKILL.md +++ b/skills/beautify-github-readme/SKILL.md @@ -34,6 +34,7 @@ If the user explicitly asks only for an audit, audit without editing and do not - In asset-only mode, inspect only the context needed to design the requested assets. Reading the README for context does not authorize changing it. - For a GitHub URL, inspect the current remote page and default branch before proposing changes. - Identify the audience, the problem solved, the clearest proof, the shortest path to first use, and any claims that lack evidence. +- When the repository is public or about to be published, list what would ship and keep private material out by default: personal absolute paths, private project code or names, raw logs, transcripts, raw benchmark runs, and credentials. Do not link to or quote it in the README or its assets; an anonymized summary of results is fine. In README mode, also exclude it from the published files, for example with `.gitignore`. Report what you excluded instead of asking whether it should ship. - Preserve unrelated user changes. Start read-only; do not commit, push, rename, or publish without explicit authorization. ### 3. Confirm the visual implementation before creating hero-like assets @@ -63,7 +64,7 @@ First successful action: Visual theme: ``` -Do not invent adoption, benchmarks, compatibility, testimonials, or features. Prefer a real screenshot, output, diagram, or generated artifact over decorative stock imagery. +Do not invent adoption, benchmarks, compatibility, testimonials, or features. When proof comes from small or noisy tests, state magnitudes or ranges with the test conditions instead of precise figures. Prefer a real screenshot, output, diagram, or generated artifact over decorative stock imagery. ### 5. Define a theme-specific visual system @@ -147,12 +148,12 @@ python3 scripts/audit_readme.py /path/to/repository/README.md Only after the user explicitly approves the final README or asset set as satisfactory, make one friendly, non-promotional offer: -> If you're happy with the finished README, there are two completely optional ways to wrap up: I can design a small project-native “README MADE WITH” signature that links back to this Skill, and—if this is a public repository you own or maintain—I can prepare a PR to add it to the Skill's real-world showcase. Either, both, or neither is perfectly fine. +> If you're happy with the finished README, there are two completely optional ways to wrap up: I can design a small project-native “README MADE WITH” signature that links back to this Skill, and—if this is a public repository you own or maintain—I can prepare a PR to add it to `SHOWCASE.md` in the Skill's repository. Either, both, or neither is perfectly fine. - Do not make this offer before final approval, infer satisfaction from silence or successful validation, or repeat it after the user declines. - Treat the signature and showcase PR as independent choices. Never require attribution in exchange for showcase consideration. - If the user opts into the signature, follow [references/svg-production.md](references/svg-production.md), show the rendered badge first, and modify the README only after separate approval. -- If the user opts into the showcase, read [references/showcase-contribution.md](references/showcase-contribution.md). Verify that the repository is public and that the user owns or maintains it; draft the exact listing copy and upstream diff before requesting permission to open the PR. +- If the user opts into the showcase, read [references/showcase-contribution.md](references/showcase-contribution.md). Verify that the repository is public and that the user owns or maintains it; modify **only `SHOWCASE.md`** (never `README.md`, `README.zh-CN.md`, `README.ja.md`, or homepage visual assets), reference the repository's own live hero via `raw.githubusercontent.com` without copying images into `oil-oil/beautify-github-readme`, and draft the exact listing copy and diff before requesting permission to open the PR. - Do not add a backlink, fork a repository, push a branch, or open a PR without explicit authorization for that specific external action. This gate controls unsolicited offers. If the user explicitly requests a signature or showcase contribution earlier, handle that request directly within its stated scope. diff --git a/skills/beautify-github-readme/references/showcase-contribution.md b/skills/beautify-github-readme/references/showcase-contribution.md index ff30106..d5b1876 100644 --- a/skills/beautify-github-readme/references/showcase-contribution.md +++ b/skills/beautify-github-readme/references/showcase-contribution.md @@ -1,6 +1,6 @@ # Optional showcase contribution -Use this workflow only after the user explicitly approves the finished README and opts into sharing a public repository with the `beautify-github-readme` showcase. +Use this workflow only after the user explicitly approves the finished README and opts into sharing a public repository with the `beautify-github-readme` community showcase. ## Eligibility gate @@ -8,8 +8,8 @@ Confirm all of the following before preparing upstream changes: - The repository is public. - The user owns, maintains, or is authorized to represent it. -- The finished README is already published and visible at the repository URL. -- The upstream showcase does not already list the repository. +- The finished README (and its hero asset, if present) is already published and visible on the repository's default branch. +- `SHOWCASE.md` in `oil-oil/beautify-github-readme` does not already list the repository. Do not treat an attribution badge as a requirement. A repository may be proposed with or without the badge. @@ -17,24 +17,42 @@ Do not treat an attribution badge as a requirement. A repository may be proposed Use neutral wording and make declining easy: -> If you'd like to share this result, I can draft a small PR to add the public repository to the real-world showcase in `oil-oil/beautify-github-readme`. This is completely optional, and the upstream maintainers will decide whether to merge it. +> If you'd like to share this result, I can draft a small PR to add the public repository to `SHOWCASE.md` in `oil-oil/beautify-github-readme`. This is completely optional, and the upstream maintainers will decide whether to merge it. Do not repeat the offer after a decline. Do not create an issue, discussion, fork, branch, or PR merely because the user expressed satisfaction. -## Prepare the proposal +## Target file and asset rules (strict) + +- **The ONLY file a community showcase PR may modify is `SHOWCASE.md`.** +- **NEVER modify `README.md`, `README.zh-CN.md`, `README.ja.md`, or any homepage visual assets under `assets/readme/`** (including `section-used-by.svg`, case cards, or theme walls). +- **NEVER commit or copy external images into `assets/` (or any directory) of `oil-oil/beautify-github-readme`.** Always reference the contributor's own live hero image via `https://raw.githubusercontent.com////`. +- Homepage `README*.md` files are maintained exclusively by the repository maintainers; any PR that touches them or adds third-party image files will not be accepted as a community showcase entry. -1. Inspect the latest default branch of `https://github.com/oil-oil/beautify-github-readme`. -2. Locate the current showcase list and check for duplicates. -3. Draft one factual sentence explaining what the finished README demonstrates. Do not invent adoption, testimonials, results, or product capabilities. -4. Keep the English and Simplified Chinese showcase lists aligned. Show both proposed entries to the user for approval. -5. Check whether a showcase SVG or its accessible description explicitly enumerates repositories. Update it only when needed to keep the visual and alt text accurate; do not overcrowd the graphic merely to add another logo or label. -6. Show the exact upstream files and diff that would change. +## Prepare the proposal -Typical upstream files are `README.md`, `README.zh-CN.md`, and—only when its content becomes inaccurate—the relevant showcase SVG. +1. Inspect `SHOWCASE.md` on the latest default branch of `https://github.com/oil-oil/beautify-github-readme`. +2. Check for duplicates in `SHOWCASE.md` and pick the single best-fitting category (`Developer Tools · 开发工具`, `AI & Agent Projects · AI 与 Agent 项目`, or `Creative & Interactive · 创意与交互项目`). +3. Locate the main hero image in the contributor's live README, resolve any relative path to `https://raw.githubusercontent.com////`, and verify with `curl -sI` that it returns `HTTP 200` with an image `Content-Type` (`image/svg+xml`, `image/png`, `image/webp`, or `image/gif`). +4. Draft one factual sentence explaining what the finished README demonstrates. Do not invent adoption, testimonials, results, or product capabilities. +5. Add one entry under the matching category in `SHOWCASE.md` using this exact format: + ```markdown + ### [Repo Name](https://github.com/owner/repo) + +

+ + Repo Name README hero + +

+ + One factual sentence explaining what the redesigned README demonstrates. / 一句实事求是的中文说明。 + ``` + If the repository's README intentionally has no hero image, omit the `

...

` image block and keep the heading and one-line description without broken `` tags. +6. Verify that `git diff --name-only` contains **only `SHOWCASE.md`** and no untracked image files were added. +7. Show the exact proposed entry, verified hero URL, and diff to the user for approval before taking any remote action. ## Publish only with explicit approval -After the user approves the exact listing copy and diff, ask for explicit authorization to open the PR. Then: +After the user approves the exact listing copy and single-file diff, ask for explicit authorization to open the PR. Then: - Use a normal branch and PR when the authenticated account has upstream access. - Otherwise use a fork-based PR only if the user authorizes creating or using the fork. diff --git a/skills/gitkeeper/SKILL.md b/skills/gitkeeper/SKILL.md new file mode 100644 index 0000000..488f15d --- /dev/null +++ b/skills/gitkeeper/SKILL.md @@ -0,0 +1,98 @@ +--- +name: gitkeeper +description: "Covers git and GitHub work: commits, branches, merges and conflicts, rebases, worktrees, history recovery, pull requests, review feedback, releases, and gh output. Use when a task commits or splits changes, hits a merge or rebase conflict, rewrites or pushes a branch, recovers lost commits or a deleted branch, opens or updates a PR, answers review comments, cuts a release, or reads gh output. Never destroy uncommitted work, force-push, or bypass hooks with --no-verify." +license: MIT +compatibility: Any agent that can run shell commands. Needs git; GitHub work needs an authenticated gh. Branching conventions, default branch, and commit language are detected from the repository, not assumed. +--- + +# Gitkeeper — history you can trust, work you can recover + +Git is the safety net. An agent that spends a user's uncommitted work, rewrites shared history, or bypasses a hook to make a task look finished has failed, however green the output. + +Pair with `steerloop` for the interaction gates and `craftloop` for engineering depth when both are installed. This skill governs git and GitHub operations: where another skill (`craftloop` §9 included) describes pushing, opening a PR or merging differently, this one wins. + +## Safety policy + +Hard rules. A task does not override them; only the user can, in one explicit sentence. + +| Never | Because | +| --- | --- | +| `git reset --hard`, `git checkout -- .`, `git restore .`, `git clean -fd` while the tree is dirty | the reflog cannot recover uncommitted changes | +| `git push --force` / `-f`; rebasing or amending a pushed shared branch | collaborators lose work | +| `--no-verify`, committed hook edits, `GIT_*` env that skips checks | hides a real failure | +| `git add -A` / `git add .` without reading the resulting list | commits secrets, junk, unrelated edits | +| rewriting someone else's commit, changing `user.*` config | it is not yours to change | +| deleting branches, tags, worktrees or stashes without naming what is lost | recovery gets expensive | + +Force-pushing your own branch is allowed only as `--force-with-lease`, only after the user asked, and only when a backup branch exists. + +## First, read the state + +Every operation starts with the same commands; skip none: + +```sh +git status --porcelain=v1 --branch --untracked-files=all +git log --oneline -5 +git branch -vv +``` + +- Dirty tree → decide once: commit, stash, or stop. Never "tidy up" to proceed. +- Ahead or behind (shown by `status -sb`) → `git fetch` before rebasing or merging. +- Detached HEAD, or a merge/rebase/cherry-pick already in progress → finish or name it; never start a second operation on top. + +## Route by task + +| Task | Read | +| --- | --- | +| commit, split a dirty tree, amend, message format | `references/commits.md` | +| branch, push, PR, review, issues, stacked PR | `references/pr.md` | +| merge, rebase or cherry-pick conflict | `references/conflicts.md` | +| lost commit, deleted branch, bisect, reset semantics, revert | `references/recovery.md` | +| parallel work, isolated checkout, finishing a branch | `references/worktrees.md` | +| gh output, JSON, `gh api`, pagination, enterprise host | `references/gh.md` | +| version bump, tag, release, changelog | `references/releases.md` | + +Read the one reference the task needs, not all of them. + +## Branch and history + +- Trunk-based by default: a short-lived branch, one logical change, merged within days. `git switch -c /`. +- Rebase only commits that were never pushed. On a shared branch, merge. +- Before any rewrite: `git branch backup/-$(date +%Y%m%d%H%M)`. +- Never rebase a default branch onto itself; rebase onto the fetched remote-tracking ref, not a stale local one. +- The default branch is whatever the remote's `HEAD` says, not `main` by assumption. + +## Commits + +- Conventional Commits. Type and scope in English (`feat(auth):`), subject imperative, at most 72 characters, no trailing period. +- Subject language matches the repository history. Russian is fine; the type stays English. +- One logical change per commit. A subject that needs "and" is two commits. + +## GitHub + +- All GitHub access goes through an authenticated `gh`; never `curl` or a fetch tool against github.com. +- Machine-readable output only: `--json` plus `--jq`. Table output is for humans and changes between releases. +- Lists get `--paginate`. Enterprise hosts get `--hostname ` or `GH_HOST`. + +## Gotchas + +- `git add -p` and `git rebase -i` read from a terminal; a non-interactive shell stalls or feeds EOF and aborts. Stage explicit paths, pass `-F -` for the message, and leave `-p`/`-i` to an interactive session. +- `--force-with-lease` rejected as `stale info` means the remote moved since the last fetch. That is the protection working, not a transient error; fetch, read the new commits, then decide. `--force` throws the check away. +- A branch's reflog dies with the branch: after deletion `git reflog show ` fails, and the commits are reachable only through `git fsck --lost-found` until gc prunes them. Create the backup branch before deleting. +- `git restore .` restores the working tree from the index, not from HEAD: staged edits survive and later unstaged edits are lost. `git restore --staged` only unstages. +- `git clean -fd` removes untracked files and directories but leaves ignored files (`-x`) and nested repositories (`-ff`). Run it with `-n` first; untracked work has no reflog. +- In a conflicted merge, `git diff` prints a combined diff that hides the common base. Read `git show :1:` (base), `:2:` (ours) and `:3:` (theirs). +- A failing `git stash pop` keeps the stash entry: the restore conflicted, nothing was dropped. `git stash apply` never drops it, so prefer it while unsure. +- `git branch -d` refuses an unmerged branch; that refusal is the check firing. `-D` deletes the last reference, so confirm with `git log ..` first. +- `gh api` targets github.com even inside an Enterprise checkout, while `gh pr` and `gh issue` take the host from the remote. Pass `--hostname ` on every `gh api` call there. +- `git status -sb` ahead/behind counts compare against the last fetched remote-tracking ref, so a stale `origin/*` makes them wrong. Fetch before reading them as push state. + +## Done means + +Run `git status --porcelain=v1 --branch` after the last operation and show it. "Pushed", "created", "merged" and "passed" appear in a report only next to the command output that proves it. A blocked operation reports the exact command, the error, and what was left untouched. + +## Before you report + +- [ ] The described state matches `git status --porcelain=v1 --branch`. +- [ ] Every command named in the report actually ran, and its output is the one reported. +- [ ] Nothing is half-finished: no merge, rebase, cherry-pick or bisect in progress, and no staged or stashed leftovers the user did not ask for. diff --git a/skills/gitkeeper/agents/openai.yaml b/skills/gitkeeper/agents/openai.yaml new file mode 100644 index 0000000..b910cb4 --- /dev/null +++ b/skills/gitkeeper/agents/openai.yaml @@ -0,0 +1,3 @@ +interface: + display_name: "Gitkeeper" + short_description: "Safe git and GitHub work: commits, PRs, conflicts, recovery" diff --git a/skills/gitkeeper/references/commits.md b/skills/gitkeeper/references/commits.md new file mode 100644 index 0000000..20f7994 --- /dev/null +++ b/skills/gitkeeper/references/commits.md @@ -0,0 +1,78 @@ +# Commits + +## 1. Inspect + +```sh +git status --porcelain=v1 --untracked-files=all +git diff --stat +git diff --cached --stat +git log --oneline -10 +``` + +Read the last ten subjects before writing one: they set the language, the scope vocabulary and the level of detail. + +## 2. Split the work + +One commit = one reason to revert. + +- Group by concern, not by file count: a fix and its test are one commit; two unrelated fixes are two. +- Stage explicit paths: `git add path/a path/b`. Never `-A`. +- A file that contains two concerns needs interactive staging: `git add -p `, and only when the interface supports interactive input. Otherwise commit the file whole inside the commit that owns most of it, and say so in the report. +- Generated files, lockfiles and pure formatting churn get their own commit whose subject says why. +- Secrets are never staged: check `git diff --cached` for keys, tokens, `.env`, credentials before committing. + +## 3. Write the message + +``` +(): + + + + +``` + +Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. + +- Scope: module or area, lowercase, no spaces. +- Subject: imperative ("add", not "added" or "adds"), at most 72 characters, no period. +- Body: the why and the trade-off. The diff already shows what. +- Footers: `Refs: #123`, `Closes #123`, `BREAKING CHANGE: `. + +Russian subject is fine when the history is Russian: + +``` +fix(кэш): не терять запись при повторном чтении +``` + +A breaking change is marked in the header as `feat(api)!: ...` and explained in the footer. + +## 4. Commit + +```sh +git commit -F - <<'MSG' +feat(auth): rotate refresh tokens on reuse + +A replayed refresh token now fails closed and the token family +is re-issued once, so a stolen token cannot outlive its use. + +Closes #412 +MSG +``` + +The heredoc keeps quotes, newlines and Cyrillic intact; chained `-m` flags mangle all three. + +Hooks run. A failing hook is a finding to report, not an obstacle to remove; `--no-verify` is banned. + +## 5. Verify + +```sh +git show --stat HEAD +git log -1 --format='%H%n%s%n%n%b' +``` + +## Amend, fixup, split + +- Own, unpushed commit → `git commit --amend` for message or content. Run `git show HEAD` first: amend replaces that commit. +- Pushed commit → a new commit. Never amend what someone else may have pulled. +- `git commit --fixup=` plus `git rebase -i --autosquash` only for local history. +- Splitting an existing commit keeps all changes staged and discards nothing: `git reset --soft HEAD~1`, then stage per concern and commit again. \ No newline at end of file diff --git a/skills/gitkeeper/references/conflicts.md b/skills/gitkeeper/references/conflicts.md new file mode 100644 index 0000000..10248c5 --- /dev/null +++ b/skills/gitkeeper/references/conflicts.md @@ -0,0 +1,55 @@ +# Conflicts + +## Detect the operation + +```sh +git status # "Unmerged paths", "rebase in progress", "cherry-pick" +git diff --name-only --diff-filter=U +git log --oneline --merge -5 +``` + +A rebase replays commits one at a time, so the same conflict may return for every commit that touched the file. + +## Understand both sides before editing + +```sh +git log --oneline -5 HEAD -- +git log --oneline -5 MERGE_HEAD -- +git show :1: # common base +git show :2: # ours +git show :3: # theirs +``` + +Read the commit messages, the PR and the issue behind each side. Resolve from intent, not from the markers. + +## Resolve + +- Preserve both intents where they compose. +- Where they cannot compose, keep the side that serves the operation's stated goal and record the trade-off in the merge commit message. +- Never invent behavior that neither side wrote. +- Never take `-X ours` or `-X theirs` as a file-level shortcut. +- Keep both sides' tests, then run them. + +## Finish + +```sh +git add +git merge --continue # merge +git rebase --continue # rebase +git cherry-pick --continue # cherry-pick +``` + +Then run the project's checks: typecheck, tests, formatter. Fix what the merge broke. Never edit a test to match a broken merge. + +## Abort policy + +Resolve by default. `--abort` only when the user explicitly asks, or the operation cannot complete without discarding their work; state what will be discarded. + +## Verify the result + +```sh +git diff ...HEAD --stat # what actually differs after the merge or rebase +git log --oneline --graph -10 +``` + +If `rerere` is enabled, confirm its automated resolution rather than trusting it: re-read the touched hunks. \ No newline at end of file diff --git a/skills/gitkeeper/references/gh.md b/skills/gitkeeper/references/gh.md new file mode 100644 index 0000000..69e5fd4 --- /dev/null +++ b/skills/gitkeeper/references/gh.md @@ -0,0 +1,53 @@ +# gh + +## Rules + +- Anything on a GitHub host goes through `gh`: it carries the authenticated token and the API rate limit. Never `curl`, `wget` or a fetch tool against github.com. +- Parse structured output only: `--json` plus `--jq`. The table format is for humans and changes between releases. +- Every list gets `--paginate`, or you read page one of N. +- `gh api` is the escape hatch when no subcommand fits; GraphQL through `gh api graphql`. + +## Common shapes + +```sh +gh pr view 12 --json number,title,state,isDraft,mergeable,headRefName,baseRefName,url +gh pr list --state open --limit 50 --json number,title,author --jq '.[] | "\(.number)\t\(.title)"' +gh issue list --search "is:open label:bug sort:updated-desc" --json number,title +gh run list --limit 10 --json databaseId,conclusion,workflowName,headBranch +gh run view --log-failed +gh release list --json tagName,isLatest +``` + +## API + +```sh +gh api repos/{owner}/{repo}/pulls/12 --jq '.head.sha' +gh api repos/{owner}/{repo}/issues/12/comments --paginate --jq '.[].body' +gh api graphql -f query='query($o:String!,$r:String!,$n:Int!){ + repository(owner:$o,name:$r){pullRequest(number:$n){ + reviewThreads(first:100){nodes{id isResolved isOutdated}}}}}' -F o= -F r= -F n=12 +``` + +- REST paths are relative to the host; `{owner}` and `{repo}` resolve inside a checkout. +- Batch with GraphQL instead of N REST calls: rate limits are per token, not per call type. + +## Non-interactive behavior + +In a non-TTY session gh skips the pager, strips color and fails instead of prompting (`must provide --title and --body when not running interactively`). Pass every required flag. There is no `--no-pager` flag, and `GH_PAGER` is not needed. + +## Auth and hosts + +```sh +gh auth status +gh auth switch --user +GH_HOST=github.example.com gh api ... +gh api --hostname github.example.com ... +``` + +On GitHub Enterprise Server, plain `gh api` still targets github.com even inside an Enterprise checkout. Pass the host explicitly. + +## Safety + +- Mutating commands (`pr merge`, `release delete`, `repo delete`, `api -X DELETE`, `issue close`, `secret set`) need the user's go-ahead. +- Never print a token: `gh auth token` reveals one. +- A non-zero exit is a failure to report, not a reason to retry blind. \ No newline at end of file diff --git a/skills/gitkeeper/references/pr.md b/skills/gitkeeper/references/pr.md new file mode 100644 index 0000000..b3a6f5f --- /dev/null +++ b/skills/gitkeeper/references/pr.md @@ -0,0 +1,81 @@ +# Pull requests + +## Create + +1. Check what will land: `git status -sb`, `git log --oneline @{u}..` (unpushed), `git diff origin/...HEAD --stat`. +2. Push: `git push -u origin HEAD`. +3. Open the PR with a body file, so quotes and newlines survive: + +```sh +gh pr create --base main --head "$(git branch --show-current)" \ + --title "feat(auth): rotate refresh tokens on reuse" --body-file pr.md --draft +``` + +- Title follows the commit convention. Draft until the branch is ready for review. +- Body: problem, change, verification (commands and their results), risks and rollback, linked issue. +- Report the URL that `gh` prints, not one assembled by hand. + +## Update + +- New commits: push; the PR follows. +- Title or body: `gh pr edit --title ... --body-file ...`. +- Base branch: `gh pr edit --base `. + +## Checks + +```sh +gh pr checks # non-zero exit when a check failed +gh pr checks --watch --interval 30 +gh run view --log-failed +``` + +Report the failing job and the first real error, not the whole log. + +## Review a PR + +```sh +gh pr view --json title,body,files,commits,reviews,comments,statusCheckRollup +gh pr diff --patch +``` + +- Review the diff, not the description. Every finding names a path and line. +- Posting comments or reviews requires the user's request; drafting is the default. +- Two axes, like a maintainer: does the change follow the repository's standards, and does it match the stated requirement. + +## Address review feedback + +Work item by item. For each thread: quote it verbatim, decide act or reply, and record the reason. + +- One commit per feedback item where it reads cleanly; the reply can then point at a SHA. +- Push before replying with a SHA, and prove reachability first: `git fetch origin refs/pull//head && git merge-base --is-ancestor FETCH_HEAD`. +- Reply inside the thread, not as a new top-level comment: + +```sh +gh api repos/{owner}/{repo}/pulls//comments//replies -f body=@reply.md +``` + +- Resolve a thread only after its reply is posted: + +```sh +gh api graphql -f query='mutation($id:ID!){resolveReviewThread(input:{threadId:$id}){thread{isResolved}}}' -f id= +``` + +- Re-request review from the humans whose feedback was addressed: + +```sh +gh api -X POST repos/{owner}/{repo}/pulls//requested_reviewers -f 'reviewers[]=' +``` + +## Merge + +- Only on explicit request, with required reviews and all checks green. +- Match the repository's history style: `gh pr merge --squash --delete-branch` only when squash is what it uses. +- Never merge past branch protection, with a conflicted base, or by bypassing checks. + +## Stacked PRs + +`gh extension install github/gh-stack`, then `gh stack submit`: each layer is one PR based on the layer below. Read the stack design before creating one; a two-commit change does not need a stack. + +## Other hosts + +On GitHub Enterprise Server every `gh api` call needs `--hostname `; `gh pr` and `gh issue` take the host from the remote. \ No newline at end of file diff --git a/skills/gitkeeper/references/recovery.md b/skills/gitkeeper/references/recovery.md new file mode 100644 index 0000000..da11d94 --- /dev/null +++ b/skills/gitkeeper/references/recovery.md @@ -0,0 +1,86 @@ +# Recovery + +## Before anything + +`git status`. Do not run a second state-changing command while recovering. + +## Reflog + +```sh +git reflog # every HEAD movement +git reflog show # a branch's own history; deleted with the branch +git fsck --lost-found # dangling commits after a lost branch +git branch recovered # attach it back +``` + +Limits: reachable reflog entries expire after 90 days, unreachable ones after 30 (`gc.reflogExpire`, `gc.reflogExpireUnreachable`). Uncommitted changes are never in the reflog. + +## Reset semantics + +| Command | Index | Working tree | Uncommitted edits | +| --- | --- | --- | --- | +| `--soft` | kept | kept | kept | +| `--mixed` (default) | reset | kept | kept | +| `--hard` | reset | reset | **lost** | + +`--hard` only with a clean tree, or after `git stash push -u` plus a backup branch. The reflog restores commits, not edited files. + +## Undo a published commit + +```sh +git revert # a new commit; safe on shared branches +``` + +Never reset or force a shared branch to undo something others may have pulled. + +## Stash + +```sh +git stash push -u -m "" # -u includes untracked files +git stash list +git stash show -p stash@{0} +``` + +`git stash pop` keeps the entry when restoring conflicts; `git stash apply` never drops it. Prefer `apply` while unsure. + +## Cherry-pick + +```sh +git cherry-pick # one commit +git cherry-pick A..B # exclusive start +git cherry-pick -n # stage without committing +``` + +Conflicts are handled like a merge (`references/conflicts.md`). + +## Bisect + +```sh +git bisect start HEAD +git bisect run # exit 0 good, 1 bad, 125 skip +git bisect reset +``` + +A dirty tree makes bisect results meaningless: commit or stash first. + +## Worktrees + +```sh +git worktree list +git worktree prune +git worktree remove # refuses on a dirty tree; --force only after inspection +``` + +## Lost file content + +```sh +git restore --source= -- +git show : > +``` + +## Last resort, in order + +1. `git reflog` for the commit. +2. `git fsck --lost-found` for the object. +3. `git stash list` for the edits. +4. Ask the user before any reconstruction that discards something else. \ No newline at end of file diff --git a/skills/gitkeeper/references/releases.md b/skills/gitkeeper/references/releases.md new file mode 100644 index 0000000..e6d3261 --- /dev/null +++ b/skills/gitkeeper/references/releases.md @@ -0,0 +1,44 @@ +# Releases and changelog + +## Decide the version + +| Change | Bump | +| --- | --- | +| breaking public contract | major | +| new capability, still compatible | minor | +| fix, performance, shipped docs | patch | + +The decision comes from observable behavior, not from the size of the diff. + +## Prepare + +- Green CI on the exact commit to be tagged: `git rev-parse HEAD`, then `gh pr checks ` or `gh run list --branch `. +- Feed the changelog from conventional commits since the last tag: + +```sh +git log --no-merges --pretty='%s' "$(git describe --tags --abbrev=0)"..HEAD +``` + +- Group by Keep a Changelog sections: Added, Changed, Deprecated, Removed, Fixed, Security. Write user-visible wording, not commit titles. +- The manifest version, the lockfile and the tag must agree. A tag that disagrees with the manifest is a bug, not a detail. + +## Tag and release + +```sh +git tag -a v1.4.0 -m "v1.4.0" +git push origin v1.4.0 +gh release create v1.4.0 --title "v1.4.0" --notes-file CHANGELOG-section.md --draft +``` + +- `--generate-notes` produces a starting point; review every line it wrote before publishing. +- Annotated tags only: lightweight tags lose author and date. +- Never move or re-tag a published version. Cut a new patch instead. + +## Verify + +```sh +git tag --list 'v*' --sort=-v:refname | head -5 +gh release view v1.4.0 --json url,isDraft,assets +``` + +Report the release URL from that output, not from memory. \ No newline at end of file diff --git a/skills/gitkeeper/references/worktrees.md b/skills/gitkeeper/references/worktrees.md new file mode 100644 index 0000000..f4c9d91 --- /dev/null +++ b/skills/gitkeeper/references/worktrees.md @@ -0,0 +1,39 @@ +# Isolation and finishing + +## Detect before creating + +```sh +git rev-parse --git-dir +git rev-parse --git-common-dir +git branch --show-current +``` + +- Already isolated when the two directories differ: you are in a worktree. +- If the harness has its own isolation (subagent workspace, sandbox checkout), use it. `git worktree` is the fallback, not the first choice. + +## Create a worktree + +```sh +git fetch origin +git worktree add ../- -b / origin/ +``` + +- A project-local `.worktrees/` directory only if it is ignored: `git check-ignore -q .worktrees`. +- Then install dependencies and run the baseline tests inside the new tree. A worktree without its dependencies is not isolated, it is broken. +- `git worktree list` to confirm. Never reuse a worktree that already has changes. + +## Finish a branch + +1. Tests green in that tree, using the project's own command. +2. The user chooses; do not choose for them: + - merge locally: `git switch && git merge --no-ff ` + - pull request: push and `gh pr create` (`references/pr.md`) + - keep: leave it and report the path + - discard: only on explicit request, after confirming the diff is unneeded +3. Clean up: `git worktree remove `, `git worktree prune`, and delete the merged branch with `git branch -d`. + +No push, merge or deletion happens before that choice. + +## Parallel work + +One worktree per agent, one branch per worktree. Two agents in one worktree overwrite each other's index and staging area; the failure looks like a race but is shared state. \ No newline at end of file diff --git a/skills/hallmark/scripts/capture.mjs b/skills/hallmark/scripts/capture.mjs index 6155d95..df020f3 100644 --- a/skills/hallmark/scripts/capture.mjs +++ b/skills/hallmark/scripts/capture.mjs @@ -15,7 +15,7 @@ // of the viewport; --full captures the whole scroll height. It never draws a browser bar or a device // frame: the page frames the picture in the theme's material. import { mkdirSync, existsSync, writeFileSync } from 'node:fs'; -import { join, dirname, resolve, relative } from 'node:path'; +import { join, dirname, resolve, relative, sep } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import { createRequire } from 'node:module'; @@ -70,7 +70,7 @@ if (has('cdp')) { const dpr = await page.evaluate(() => devicePixelRatio).catch(() => 1); const rel = relative(process.cwd(), file); console.log(`${rel} ${Math.round(box.width * dpr)} x ${Math.round(box.height * dpr)} (app window)`); - console.log(` `); + console.log(` `); await app.disconnect(); process.exit(0); } @@ -107,7 +107,9 @@ try { await new Promise((r) => setTimeout(r, wait)); await p.bringToFront(); const slug = route === '/' ? 'home' : route.replace(/^\/|\/$/g, '').replace(/[^\w-]+/g, '-'); - const file = join(out, `${name}-${slug}-${size}${selector ? '-part' : ''}.png`); + const stem = join(out, `${name}-${slug}-${size}${selector ? '-part' : ''}`); + let file = `${stem}.png`, suffix = 2; + while (made.some((m) => m.file === file)) file = `${stem}-${suffix++}.png`; let shot; if (selector) { const el = await p.$(selector); @@ -124,7 +126,7 @@ try { for (const m of made) { const rel = relative(process.cwd(), m.file); console.log(`${rel} ${m.w} x ${m.h} (${m.route}, ${m.size})`); - console.log(` `); + console.log(` `); } if (!made.length) process.exitCode = 1; else console.log(`\n${made.length} screenshot${made.length > 1 ? 's' : ''}. Look at each one before placing it: sample data only, nothing personal (names, emails, tokens), the screen in the state that tells the page's story.`); diff --git a/skills/hallmark/scripts/capture.test.mjs b/skills/hallmark/scripts/capture.test.mjs index 6defea2..eb0091f 100644 --- a/skills/hallmark/scripts/capture.test.mjs +++ b/skills/hallmark/scripts/capture.test.mjs @@ -9,11 +9,11 @@ import test from 'node:test'; const skip = !process.env.HALLMARK_PUPPETEER || !process.env.CHROME_PATH ? 'set HALLMARK_PUPPETEER and CHROME_PATH for real-browser regressions' : false; const script = fileURLToPath(new URL('./capture.mjs', import.meta.url)); -async function capture(routes, prepare, check) { +async function capture(routes, prepare, check, out) { const dir = mkdtempSync(join(tmpdir(), 'hallmark-capture-')); const server = createServer((req, res) => { if (req.url === '/redirect') { res.writeHead(302, { Location: '/ok' }); res.end(); return; } - const status = req.url === '/ok' ? 200 : req.url === '/missing' ? 404 : 500; + const status = ['/ok', '/', '/home', '/a/b', '/a-b', '/a-b-2'].includes(req.url) ? 200 : req.url === '/missing' ? 404 : 500; res.writeHead(status, { 'Content-Type': 'text/html' }); res.end(`${status}

${status === 200 ? 'Owned product fixture' : 'Error document'}

`); }); @@ -21,7 +21,7 @@ async function capture(routes, prepare, check) { try { prepare?.(dir); const result = await new Promise((resolve, reject) => { - const p = spawn(process.execPath, [script, `http://127.0.0.1:${server.address().port}`, '--routes', routes, '--sizes', 'desktop', '--wait', '0', '--scale', '1', '--out', dir], { env: process.env }); + const p = spawn(process.execPath, [script, `http://127.0.0.1:${server.address().port}`, '--routes', routes, '--sizes', 'desktop', '--wait', '0', '--scale', '1', '--out', out || dir], { cwd: dir, env: process.env }); let stdout = '', stderr = ''; p.stdout.on('data', (s) => { stdout += s; }); p.stderr.on('data', (s) => { stderr += s; }); @@ -54,6 +54,12 @@ test('capture keeps successful routes when another route fails', { skip }, async assert.deepEqual([...readFileSync(join(dir, 'screen-ok-desktop.png')).subarray(0, 8)], [137, 80, 78, 71, 13, 10, 26, 10]); }); }); +test('capture prints the src with forward slashes', { skip }, async () => { + await capture('/ok', null, (dir, result) => { + assert.equal(result.status, 0, result.stderr); + assert.match(result.stdout, / { await capture('/redirect', null, (dir, result) => { assert.equal(result.status, 0, result.stderr); @@ -61,3 +67,16 @@ test('capture accepts a redirect to a successful document', { skip }, async () = assert.match(result.stdout, / { + await capture(routes, null, (dir, result) => { + assert.equal(result.status, 0, result.stdout + result.stderr); + const files = readdirSync(dir); + assert.equal(files.length, routes.split(',').length); + for (const file of files) assert.deepEqual([...readFileSync(join(dir, file)).subarray(0, 8)], [137, 80, 78, 71, 13, 10, 26, 10]); + const sources = [...result.stdout.matchAll(/ m[1]); + assert.equal(new Set(sources).size, files.length); + }); + }); +} diff --git a/skills/humanizer-ru/SKILL.md b/skills/humanizer-ru/SKILL.md index aacee13..7398315 100644 --- a/skills/humanizer-ru/SKILL.md +++ b/skills/humanizer-ru/SKILL.md @@ -4,7 +4,7 @@ description: "Редактура русского текста без следо license: MIT --- -# Humanizer-RU v3.32.0 +# Humanizer-RU v3.32.2 Ты редактор. Убираешь из русского текста следы нейросети и не ломаешь при этом смысл, факты и голос автора. Оба обещания равноправны: текст, который стал «чище» @@ -25,7 +25,8 @@ license: MIT - **Точечная правка** («убери только канцелярит», «исправь тире»): работай только с названной проблемой, остальное не трогай. - **Свой черновик** (без просьбы, молча): всё, что ты пишешь пользователю - по-русски сам, в чат или в файл, перед отправкой проходит по таблице жёстких запретов. Это одна + по-русски сам, в чат или в файл, перед отправкой проходит по таблице жёстких запретов. Измерение + метрик, времени, эффекта пиши «измерять», «замерять», не «мерить»; «мерить платье, температуру» законно. Это одна вычитка, не редактура: без сканера, каталога, отчёта и упоминания скилла. Чужой текст молча не правится никогда. Чужое это всё, что ты не сочинил сам (сообщение, файл, цитата, выдача поиска): с ним работают режимы выше, и правку пользователь видит. Сказал «не правь» или задал свой стиль: @@ -185,8 +186,10 @@ license: MIT - швы после удалений (каталог #65): «этот», «саму X», «вторая», «как сказано выше» указывают на то, что осталось в тексте; склейка не повторяет саму себя; одна и та же оговорка не закрывает три абзаца подряд; -- практическая функция: действие читателя, предложение, ограничение, срок, контакт; - обещание в рекламе или вакансии (что получит клиент, кандидат) это содержание; +- практическая функция: действие читателя, предложение, ограничение, срок, контакт. + При сверке просьб проверь, что адресату ясно, чего от него ждут, в каких случаях + и к какому сроку. Обещание в рекламе или вакансии (что получит клиент, кандидат) + это содержание. - разметка: заголовки, пункты списков, подписи вариантов и выделение смыслового места (оффер, срок, условие) остаются; `--before` печатает «потеряно: разметка:…»; - рамка: названный клиент или человек не должен после снятия смягчающей diff --git a/skills/humanizer-ru/references/catalog.md b/skills/humanizer-ru/references/catalog.md index 015a198..e586ef2 100644 --- a/skills/humanizer-ru/references/catalog.md +++ b/skills/humanizer-ru/references/catalog.md @@ -72,7 +72,7 @@ davinci-003). Метод и полные таблицы: `eval/AINL-CALIBRATION. ### B. Языковые (6-14) -**6. Канцелярит.** Главный маркер. AI превращает глаголы в отглагольные существительные: «осуществление», «реализация», «внедрение», «оптимизация», «в целях реализации проекта», «в рамках данного исследования». Верни глаголы. «Осуществили внедрение системы» значит «внедрили систему». «Реализация проекта завершена» значит «проект завершён». Глагол почти всегда лучше существительного. +**6. Канцелярит.** Главный маркер. AI превращает глаголы в отглагольные существительные: «осуществление», «реализация», «внедрение», «оптимизация», «в целях реализации проекта», «в рамках данного исследования». Верни глаголы. «Осуществили внедрение системы» значит «внедрили систему». «Реализация проекта завершена» значит «проект завершён». Глагол почти всегда лучше существительного. Глагол бери нейтральный, не разговорный: «осуществлялся замер времени» значит «измерили время», а не «мерили». В техническом и деловом тексте «мерить метрики, эффект, скорость» снижает регистр; «мерить платье, температуру, шагами комнату» законно. Своё «мерить» у автора не трогай. До: «Осуществление процесса оптимизации рабочих процессов способствует повышению эффективности деятельности организации.» После: «Оптимизация рабочих процессов помогает организации работать эффективнее.» (сняты пустые обёртки «осуществление процесса» и «деятельности», «способствует повышению эффективности» сказано глаголом; «способствует» осталось «помогает», а не стало фактом) @@ -337,6 +337,7 @@ davinci-003). Метод и полные таблицы: `eval/AINL-CALIBRATION. - **общее «не X, а Y»:** у людей 10-11% текстов, у моделей LLMTrace 8-12%. Маркер только узкий: «не просто», «не только» (#38): пустой оборот снимается и одиночный, содержательный остаётся; - **длинное тире в свёрстанном документе:** типограф вёрстки ставит его сам, для изданного PDF это норма, в посте и чате решает автор; - **шаблон вёрстки** (одинаковые главы, карточки, плашки): это дизайн-система документа, а не скелет абзацев (#45); +- **слово «мерить» само по себе:** в LLMTrace у людей 9 употреблений на миллион слов, у моделей 7 («меряю платье», «мерил шагами»). Ошибка только в одном контексте: правка канцелярита в разговорное «мерили» (#6); - **метаданные файла и способ сборки** (PDF из браузера, одна дата сохранения): к тексту отношения не имеют. --- diff --git a/stack.json b/stack.json index 98a4f31..4cc1a71 100644 --- a/stack.json +++ b/stack.json @@ -6,6 +6,7 @@ "gate": "git config core.hooksPath .githooks", "profiles": { "core": ["steerloop", "craftloop", "be-ambitious"], + "git": ["gitkeeper"], "web": ["steerloop", "craftloop", "webperf", "landing-page-design"], "design": ["landing-page-design", "figma-designer", "hallmark", "anatomy", "beautify-github-readme"], "text": ["stop-slop", "ru-text", "ru-check", "ru-score", "humanizer-ru"], @@ -13,6 +14,7 @@ "steerloop", "craftloop", "be-ambitious", + "gitkeeper", "webperf", "landing-page-design", "figma-designer", @@ -29,17 +31,18 @@ "skills": { "steerloop": { "origin": "original", "license": "MIT" }, "craftloop": { "origin": "original", "license": "MIT" }, + "gitkeeper": { "origin": "original", "license": "MIT" }, "webperf": { "origin": "original", "license": "MIT" }, "landing-page-design": { "origin": "elayadesign/ai-design-skills@456d9e0", "license": "MIT" }, "figma-designer": { "origin": "elayadesign/ai-design-skills@456d9e0", "license": "MIT" }, "be-ambitious": { "origin": "DannyMac180/skills@7dc63b7", "license": "MIT" }, - "hallmark": { "origin": "nutlope/hallmark@407fa68", "license": "MIT" }, + "hallmark": { "origin": "nutlope/hallmark@04977e15f3dfd6ee4b74c887dac3eb52665d6c92", "license": "MIT" }, "stop-slop": { "origin": "hardikpandya/stop-slop@8da1f03", "license": "MIT" }, "anatomy": { "origin": "wheresryan22/anatomy@1482e84", "license": "MIT" }, - "beautify-github-readme": { "origin": "oil-oil/beautify-github-readme@d6562a5", "license": "MIT" }, + "beautify-github-readme": { "origin": "oil-oil/beautify-github-readme@fcdb950f81a9ffa0c2bb47c42ae1636c8bdd92bb", "license": "MIT" }, "ru-text": { "origin": "talkstream/ru-text@e398aec", "license": "MIT" }, "ru-check": { "origin": "talkstream/ru-text@e398aec", "license": "MIT" }, "ru-score": { "origin": "talkstream/ru-text@e398aec", "license": "MIT" }, - "humanizer-ru": { "origin": "ilyautov/humanizer-ru@b6df5d9", "license": "MIT" } + "humanizer-ru": { "origin": "ilyautov/humanizer-ru@737413363841b8b95058d051e0ffac2e01e6c0fd", "license": "MIT" } } } \ No newline at end of file