{"id":"release-skills","name":"release-skills","summary":"ユニバーサルリリースのワークフロー。バージョンファイルや変更履歴を自動検出します。","body":"# Release Skills\n\nUniversal release workflow supporting any project type with multi-language changelog.\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.\n3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.\n\nConcrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.\n\n## Quick Start\n\nJust run `/release-skills` - auto-detects your project configuration.\n\n## Supported Projects\n\n| Project Type | Version File | Auto-Detected |\n|--------------|--------------|---------------|\n| Node.js | package.json | ✓ |\n| Python | pyproject.toml | ✓ |\n| Rust | Cargo.toml | ✓ |\n| Claude Plugin | marketplace.json | ✓ |\n| Generic | VERSION / version.txt | ✓ |\n\n## Options\n\n| Flag | Description |\n|------|-------------|\n| `--dry-run` | Preview changes without executing |\n| `--major` | Force major version bump |\n| `--minor` | Force minor version bump |\n| `--patch` | Force patch version bump |\n| `--backfill-releases` | Create missing GitHub Releases for existing tags from changelog sections |\n\n## Workflow\n\n### Step 1: Detect Project Configuration\n\n1. Check for `.releaserc.yml` (optional config override)\n   - If present, inspect whether it defines release hooks\n2. Auto-detect version file by scanning (priority order):\n   - `package.json` (Node.js)\n   - `pyproject.toml` (Python)\n   - `Cargo.toml` (Rust)\n   - `marketplace.json` or `.claude-plugin/marketplace.json` (Claude Plugin)\n   - `VERSION` or `version.txt` (Generic)\n3. Scan for changelog files using glob patterns:\n   - `CHANGELOG*.md`\n   - `HISTORY*.md`\n   - `CHANGES*.md`\n4. Identify language of each changelog by filename suffix\n5. Detect GitHub release support:\n   - Check whether `origin` points to GitHub\n   - Check whether `gh` is installed and authenticated\n   - Check existing releases with `gh release list --limit 5` when available\n6. Display detected configuration\n\n**Project Hook Contract**:\n\nIf `.releaserc.yml` defines `release.hooks`, keep the release workflow generic and delegate project-specific packaging/publishing to those hooks.\n\nSupported hooks:\n\n| Hook | Purpose | Expected Responsibility |\n|------|---------|-------------------------|\n| `prepare_artifact` | Make one target releasable | Validate the target is self-contained, sync/embed local dependencies, optionally stage extra files |\n| `publish_artifact` | Publish one releasable target | Upload the prepared target (or a staged directory if the project uses one), attach version/changelog/tags |\n\nSupported placeholders:\n\n| Placeholder | Meaning |\n|-------------|---------|\n| `{project_root}` | Absolute path to repository root |\n| `{target}` | Absolute path to the module/skill being released |\n| `{artifact_dir}` | Absolute path to a temporary staging directory for this target, when the project uses one |\n| `{version}` | Version selected by the release workflow |\n| `{dry_run}` | `true` or `false` |\n| `{release_notes_file}` | Absolute path to a UTF-8 file containing release notes/changelog text |\n\nExecution rules:\n- Keep the skill generic: do not hardcode registry/package-manager/project layout details into this SKILL.\n- If `prepare_artifact` exists, run it once per target before publish-related checks that need the final releasable target state.\n- Write release notes to a temp file and pass that file path to `publish_artifact`; do not inline multiline changelog text into shell commands.\n- If hooks are absent, fall back to the default project-agnostic release workflow.\n\n**Language Detection Rules**:\n\nChangelog files follow the pattern `CHANGELOG_{LANG}.md` or `CHANGELOG.{lang}.md`, where `{lang}` / `{LANG}` is a language or region code.\n\n| Pattern | Example | Language |\n|---------|---------|----------|\n| No suffix | `CHANGELOG.md` | en (default) |\n| `_{LANG}` (uppercase) | `CHANGELOG_CN.md`, `CHANGELOG_JP.md` | Corresponding language |\n| `.{lang}` (lowercase) | `CHANGELOG.zh.md`, `CHANGELOG.ja.md` | Corresponding language |\n| `.{lang-region}` | `CHANGELOG.zh-CN.md` | Corresponding region variant |\n\nCommon language codes: `zh` (Chinese), `ja` (Japanese), `ko` (Korean), `de` (German), `fr` (French), `es` (Spanish).\n\n**Output Example**:\n```\nProject detected:\n  Version file: package.json (1.2.3)\n  Changelogs:\n    - CHANGELOG.md (en)\n    - CHANGELOG.zh.md (zh)\n    - CHANGELOG.ja.md (ja)\n```\n\n### Step 2: Analyze Changes Since Last Tag\n\n```bash\nLAST_TAG=$(git tag --sort=-v:refname | head -1)\ngit log ${LAST_TAG}..HEAD --oneline\ngit diff ${LAST_TAG}..HEAD --stat\n```\n\nCategorize by conventional commit types:\n\n| Type | Description |\n|------|-------------|\n| feat | New features |\n| fix | Bug fixes |\n| docs | Documentation |\n| refactor | Code refactoring |\n| perf | Performance improvements |\n| test | Test changes |\n| style | Formatting, styling |\n| chore | Maintenance (skip in changelog) |\n\n**Breaking Change Detection**:\n- Commit message starts with `BREAKING CHANGE`\n- Commit body/footer contains `BREAKING CHANGE:`\n- Removed public APIs, renamed exports, changed interfaces\n\nIf breaking changes detected, warn user: \"Breaking changes detected. Consider major version bump (--major flag).\"\n\n### Step 3: Determine Version Bump\n\nRules (in priority order):\n1. User flag `--major/--minor/--patch` → Use specified\n2. BREAKING CHANGE detected → Major bump (1.x.x → 2.0.0)\n3. `feat:` commits present → Minor bump (1.2.x → 1.3.0)\n4. Otherwise → Patch bump (1.2.3 → 1.2.4)\n\nDisplay version change: `1.2.3 → 1.3.0`\n\n### Step 4: Generate Multi-language Changelogs\n\nFor each detected changelog file:\n\n1. **Identify language** from filename suffix\n2. **Detect third-party contributors**:\n   - Check merge commits: `git log ${LAST_TAG}..HEAD --merges --pretty=format:\"%H %s\"`\n   - For each merged PR, identify the PR author via `gh pr view <number> --json author --jq '.author.login'`\n   - Compare against repo owner (`gh repo view --json owner --jq '.owner.login'`)\n   - If PR author ≠ repo owner → third-party contributor\n3. **Generate content in that language**:\n   - Section titles in target language\n   - Change descriptions written naturally in target language (not translated)\n   - Date format: YYYY-MM-DD (universal)\n   - **Third-party contributions**: Append contributor attribution `(by @username)` to the changelog entry\n4. **Insert at file head** (preserve existing content)\n\n**Section Title Translations** (built-in):\n\n| Type | en | zh | ja | ko | de | fr | es |\n|------|----|----|----|----|----|----|-----|\n| feat | Features | 新功能 | 新機能 | 새로운 기능 | Funktionen | Fonctionnalités | Características |\n| fix | Fixes | 修复 | 修正 | 수정 | Fehlerbehebungen | Corrections | Correcciones |\n| docs | Documentation | 文档 | ドキュメント | 문서 | Dokumentation | Documentation | Documentación |\n| refactor | Refactor | 重构 | リファクタリング | 리팩토링 | Refactoring | Refactorisation | Refactorización |\n| perf | Performance | 性能优化 | パフォーマンス | 성능 | Leistung | Performance | Rendimiento |\n| breaking | Breaking Changes | 破坏性变更 | 破壊的変更 | 주요 변경사항 | Breaking Changes | Changements majeurs | Cambios importantes |\n\n**Changelog Format**:\n\n```markdown\n## {VERSION} - {YYYY-MM-DD}\n\n### Features\n- Description of new feature\n- Description of third-party contribution (by @username)\n\n### Fixes\n- Description of fix\n\n### Documentation\n- Description of docs changes\n```\n\nOnly include sections that have changes. Omit empty sections.\n\n**Third-Party Attribution Rules**:\n- Only add `(by @username)` for contributors who are NOT the repo owner\n- Use GitHub username with `@` prefix\n- Place at the end of the changelog entry line\n- Apply to all languages consistently (always use `(by @username)` format, not translated)\n\n**Multi-language Example**:\n\nEnglish (CHANGELOG.md):\n```markdown\n## 1.3.0 - 2026-01-22\n\n### Features\n- Add user authentication module (by @contributor1)\n- Support OAuth2 login\n\n### Fixes\n- Fix memory leak in connection pool\n```\n\nChinese (CHANGELOG.zh.md):\n```markdown\n## 1.3.0 - 2026-01-22\n\n### 新功能\n- 新增用户认证模块 (by @contributor1)\n- 支持 OAuth2 登录\n\n### 修复\n- 修复连接池内存泄漏问题\n```\n\nJapanese (CHANGELOG.ja.md):\n```markdown\n## 1.3.0 - 2026-01-22\n\n### 新機能\n- ユーザー認証モジュールを追加 (by @contributor1)\n- OAuth2 ログインをサポート\n\n### 修正\n- コネクションプールのメモリリークを修正\n```\n\n### Step 5: Group Changes by Skill/Module\n\nAnalyze commits since last tag and group by affected skill/module:\n\n1. **Identify changed files** per commit\n2. **Group by skill/module**:\n   - `skills/<skill-name>/*` → Group under that skill\n   - Root files (CLAUDE.md, etc.) → Group as \"project\"\n   - Multiple skills in one commit → Split into multiple groups\n3. **For each group**, identify related README updates needed\n\n**Example Grouping**:\n```\nbaoyu-cover-image:\n  - feat: add new style options\n  - fix: handle transparent backgrounds\n  → README updates: options table\n\nbaoyu-comic:\n  - refactor: improve panel layout algorithm\n  → No README updates needed\n\nproject:\n  - docs: update CLAUDE.md architecture section\n```\n\n### Step 6: Commit Each Skill/Module Separately\n\nFor each skill/module group (in order of changes):\n\n1. **Check README updates needed**:\n   - Scan `README*.md` for mentions of this skill/module\n   - Verify options/flags documented correctly\n   - Update usage examples if syntax changed\n   - Update feature descriptions if behavior changed\n\n2. **Stage and commit**:\n   ```bash\n   git add skills/<skill-name>/*\n   git add README.md README.zh.md  # If updated for this skill\n   git commit -m \"<type>(<skill-name>): <meaningful description>\"\n   ```\n\n3. **Commit message format**:\n   - Use conventional commit format: `<type>(<scope>): <description>`\n   - `<type>`: feat, fix, refactor, docs, perf, etc.\n   - `<scope>`: skill name or \"project\"\n   - `<description>`: Clear, meaningful description of changes\n\n**Example Commits**:\n```bash\ngit commit -m \"feat(baoyu-cover-image): add watercolor and minimalist styles\"\ngit commit -m \"fix(baoyu-comic): improve panel layout for long dialogues\"\ngit commit -m \"docs(project): update architecture documentation\"\n```\n\n**Common README Updates Needed**:\n| Change Type | README Section to Check |\n|-------------|------------------------|\n| New options/flags | Options table, usage examples |\n| Renamed options | Options table, usage examples |\n| New features | Feature description, examples |\n| Breaking changes | Migration notes, deprecation warnings |\n| Restructured internals | Architecture section (if exposed to users) |\n\n### Step 7: Generate Changelog and Update Version\n\n1. **Generate multi-language changelogs** (as described in Step 4)\n2. **Update version file**:\n   - Read version file (JSON/TOML/text)\n   - Update version number\n   - Write back (preserve formatting)\n3. **Create release notes file**:\n   - Prefer the new version section from `CHANGELOG.md`\n   - If no English/default changelog exists, use the first detected changelog\n   - Extract only the exact `## {VERSION} - {YYYY-MM-DD}` section through the next `##`\n   - Match both plain version and tag-prefixed headings when needed, e.g. `1.2.3` and `v1.2.3`\n   - Keep breaking changes near the top; if needed, add a short highlight before other sections\n   - Write notes to a UTF-8 temp file and reuse it for annotated tag messages, GitHub Releases, and `publish_artifact`\n   - In normal mode, stop rather than creating an empty tag or GitHub Release when notes cannot be found\n\n**Version Paths by File Type**:\n\n| File | Path |\n|------|------|\n| package.json | `$.version` |\n| pyproject.toml | `project.version` |\n| Cargo.toml | `package.version` |\n| marketplace.json | `$.metadata.version` |\n| VERSION / version.txt | Direct content |\n\n### Step 8: User Confirmation\n\nBefore creating the release commit, ask user to confirm:\n\n**Use AskUserQuestion with three questions**:\n\n1. **Version bump** (single select):\n   - Show recommended version based on Step 3 analysis\n   - Options: recommended (with label), other semver options\n   - Example: `1.2.3 → 1.3.0 (Recommended)`, `1.2.3 → 1.2.4`, `1.2.3 → 2.0.0`\n\n2. **Push to remote** (single select):\n   - Options: \"Yes, push after commit\", \"No, keep local only\"\n\n3. **Publish GitHub Release** (single select):\n   - Offer this only when GitHub release support is available\n   - Default to \"Yes, publish after tag push\" when the user also chose push\n   - If the user keeps the release local, do not create or edit a GitHub Release\n\n**Example Output Before Confirmation**:\n```\nCommits created:\n  1. feat(baoyu-cover-image): add watercolor and minimalist styles\n  2. fix(baoyu-comic): improve panel layout for long dialogues\n  3. docs(project): update architecture documentation\n\nChangelog preview (en):\n  ## 1.3.0 - 2026-01-22\n  ### Features\n  - Add watercolor and minimalist styles to cover-image\n  ### Fixes\n  - Improve panel layout for long dialogues in comic\n\nRelease notes source: CHANGELOG.md#1.3.0\nReady to create release commit, annotated tag, and GitHub Release.\n```\n\n### Step 9: Create Release Commit and Annotated Tag\n\nAfter user confirmation:\n\n1. **Stage version and changelog files**:\n   ```bash\n   git add <version-file>\n   git add CHANGELOG*.md\n   ```\n\n2. **Create release commit**:\n   ```bash\n   git commit -m \"chore: release v{VERSION}\"\n   ```\n\n3. **Create annotated tag**:\n   ```bash\n   git tag -a v{VERSION} -F <release-notes-file>\n   ```\n   If `.releaserc.yml` sets `tag.sign: true`, use `git tag -s` with the same notes file.\n\n4. **Push if user confirmed** (Step 8):\n   ```bash\n   git push origin main\n   git push origin v{VERSION}\n   ```\n\n**Note**: Do NOT add Co-Authored-By line. This is a release commit, not a code contribution.\n\n### Step 10: Publish Release Artifacts and GitHub Release\n\nProject artifact publishing and GitHub Releases are separate outputs:\n\n1. **Project artifacts**:\n   - If `release.hooks.publish_artifact` exists, run it once per prepared target\n   - Pass the same `{release_notes_file}` used for the tag and GitHub Release\n   - In dry-run mode, pass `{dry_run}=true` and report what would be published\n\n2. **GitHub Release**:\n   - Run only if the user confirmed remote publishing and GitHub support is available\n   - Ensure the tag exists on the remote before creating the release\n   - Create or update using the extracted notes:\n     ```bash\n     if gh release view v{VERSION} >/dev/null 2>&1; then\n       gh release edit v{VERSION} --title \"v{VERSION}\" --notes-file <release-notes-file>\n     else\n       gh release create v{VERSION} --title \"v{VERSION}\" --notes-file <release-notes-file> --verify-tag\n     fi\n     ```\n   - Never inline multiline release notes into shell commands\n\n**Post-Release Output**:\n```\nRelease v1.3.0 created.\n\nCommits:\n  1. feat(baoyu-cover-image): add watercolor and minimalist styles\n  2. fix(baoyu-comic): improve panel layout for long dialogues\n  3. docs(project): update architecture documentation\n  4. chore: release v1.3.0\n\nTag: v1.3.0\nTag type: annotated\nGitHub Release: published  # or \"skipped/local only\"\nStatus: Pushed to origin  # or \"Local only - run git push when ready\"\n```\n\n## Backfill Existing GitHub Releases\n\nUse this mode when the user asks to backfill historical releases or passes `--backfill-releases`.\n\n1. Do not bump versions, edit changelogs, or create release commits.\n2. List existing tags in version order and detect missing releases:\n   ```bash\n   git tag --sort=v:refname\n   gh release view <tag>\n   ```\n3. For each tag without a GitHub Release:\n   - Normalize the changelog lookup by stripping the configured tag prefix, e.g. `v1.2.3` -> `1.2.3`\n   - Extract the matching section from `CHANGELOG.md`; fall back to the first matching changelog file\n   - Skip or ask before publishing if no matching changelog section exists\n   - Create the release with:\n     ```bash\n     gh release create <tag> --title \"<tag>\" --notes-file <release-notes-file> --verify-tag\n     ```\n4. Detect lightweight tags with `git cat-file -t <tag>` (`commit` means lightweight, `tag` means annotated).\n5. Do not rewrite public lightweight tags by default. Converting an existing remote tag to an annotated tag requires explicit user confirmation because it rewrites a published reference.\n\n## Configuration (.releaserc.yml)\n\nOptional config file in project root to override defaults:\n\n```yaml\n# .releaserc.yml - Optional configuration\n\n# Version file (auto-detected if not specified)\nversion:\n  file: package.json\n  path: $.version  # JSONPath for JSON, dotted path for TOML\n\n# Changelog files (auto-detected if not specified)\nchangelog:\n  files:\n    - path: CHANGELOG.md\n      lang: en\n    - path: CHANGELOG.zh.md\n      lang: zh\n    - path: CHANGELOG.ja.md\n      lang: ja\n\n  # Section mapping (conventional commit type → changelog section)\n  # Use null to skip a type in changelog\n  sections:\n    feat: Features\n    fix: Fixes\n    docs: Documentation\n    refactor: Refactor\n    perf: Performance\n    test: Tests\n    chore: null\n\n# Commit message format\ncommit:\n  message: \"chore: release v{version}\"\n\n# Tag format\ntag:\n  prefix: v  # Results in v1.0.0\n  sign: false\n\n# Additional files to include in release commit\ninclude:\n  - README.md\n  - package.json\n```\n\n## Dry-Run Mode\n\nWhen `--dry-run` is specified:\n\n```\n=== DRY RUN MODE ===\n\nProject detected:\n  Version file: package.json (1.2.3)\n  Changelogs: CHANGELOG.md (en), CHANGELOG.zh.md (zh)\n\nLast tag: v1.2.3\nProposed version: v1.3.0\n\nChanges grouped by skill/module:\n  baoyu-cover-image:\n    - feat: add watercolor style\n    - feat: add minimalist style\n    → Commit: feat(baoyu-cover-image): add watercolor and minimalist styles\n    → README updates: options table\n\n  baoyu-comic:\n    - fix: panel layout for long dialogues\n    → Commit: fix(baoyu-comic): improve panel layout for long dialogues\n    → No README updates\n\nChangelog preview (en):\n  ## 1.3.0 - 2026-01-22\n  ### Features\n  - Add watercolor and minimalist styles to cover-image\n  ### Fixes\n  - Improve panel layout for long dialogues in comic\n\nChangelog preview (zh):\n  ## 1.3.0 - 2026-01-22\n  ### 新功能\n  - 为 cover-image 添加水彩和极简风格\n  ### 修复\n  - 改进 comic 长对话的面板布局\n\nCommits to create:\n  1. feat(baoyu-cover-image): add watercolor and minimalist styles\n  2. fix(baoyu-comic): improve panel layout for long dialogues\n  3. chore: release v1.3.0\n\nNo changes made. Run without --dry-run to execute.\n```\n\n## Example Usage\n\n```\n/release-skills              # Auto-detect version bump\n/release-skills --dry-run    # Preview only\n/release-skills --minor      # Force minor bump\n/release-skills --patch      # Force patch bump\n/release-skills --major      # Force major bump (with confirmation)\n/release-skills --backfill-releases  # Create missing GitHub Releases for existing tags\n```\n\n## When to Use\n\nTrigger this skill when user requests:\n- \"release\", \"发布\", \"create release\", \"new version\", \"新版本\"\n- \"bump version\", \"update version\", \"更新版本\"\n- \"prepare release\"\n- \"release notes\", \"GitHub Release\", \"回填 Release\"\n- \"push to remote\" (with uncommitted changes)\n\n**Important**: If user says \"just push\" or \"直接 push\" with uncommitted changes, STILL follow all steps above first.","author":"@JimLiu","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/JimLiu/baoyu-skills/tree/main/.claude/skills/release-skills","license":"MIT","category":"coding","lang":"en","tokens":5033,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}