📦 deps(thirdparty): update snapshots
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
---
|
||||
name: address-github-comments
|
||||
description: "Use when you need to address review or issue comments on an open GitHub Pull Request using the gh CLI."
|
||||
risk: unknown
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Address GitHub Comments
|
||||
|
||||
## Overview
|
||||
|
||||
Efficiently address PR review comments or issue feedback using the GitHub CLI (`gh`). This skill ensures all feedback is addressed systematically.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Ensure `gh` is authenticated.
|
||||
|
||||
```bash
|
||||
gh auth status
|
||||
```
|
||||
|
||||
If not logged in, run `gh auth login`.
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Inspect Comments
|
||||
|
||||
Fetch the comments for the current branch's PR.
|
||||
|
||||
```bash
|
||||
gh pr view --comments
|
||||
```
|
||||
|
||||
Or use a custom script if available to list threads.
|
||||
|
||||
### 2. Categorize and Plan
|
||||
|
||||
- List the comments and review threads.
|
||||
- Propose a fix for each.
|
||||
- **Wait for user confirmation** on which comments to address first if there are many.
|
||||
|
||||
### 3. Apply Fixes
|
||||
|
||||
Apply the code changes for the selected comments.
|
||||
|
||||
### 4. Respond to Comments
|
||||
|
||||
Once fixed, respond to the threads as resolved.
|
||||
|
||||
```bash
|
||||
gh pr comment <PR_NUMBER> --body "Addressed in latest commit."
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
- **Applying fixes without understanding context**: Always read the surrounding code of a comment.
|
||||
- **Not verifying auth**: Check `gh auth status` before starting.
|
||||
|
||||
## When to Use
|
||||
This skill is applicable to execute the workflow or actions described in the overview.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
---
|
||||
name: agents-md
|
||||
description: This skill should be used when the user asks to "create AGENTS.md", "update AGENTS.md", "maintain agent docs", "set up CLAUDE.md", or needs to keep agent instructions concise. Enforces research-backed best practices for minimal, high-signal agent documentation.
|
||||
risk: unknown
|
||||
source: community
|
||||
---
|
||||
|
||||
# Maintaining AGENTS.md
|
||||
|
||||
AGENTS.md is the canonical agent-facing documentation. Keep it minimal—agents are capable and don't need hand-holding. Target under 60 lines; never exceed 100. Instruction-following quality degrades as document length increases.
|
||||
|
||||
## When to Use
|
||||
- The user asks to create, update, or audit `AGENTS.md` or `CLAUDE.md`.
|
||||
- The project needs concise, high-signal agent instructions derived from the actual toolchain and repo layout.
|
||||
- Existing agent documentation is too long, duplicated, or drifting away from real project conventions.
|
||||
|
||||
## File Setup
|
||||
|
||||
1. Create `AGENTS.md` at project root
|
||||
2. Create symlink: `ln -s AGENTS.md CLAUDE.md`
|
||||
|
||||
## Before Writing
|
||||
|
||||
Analyze the project to understand what belongs in the file:
|
||||
|
||||
1. **Package manager** — Check for lock files (`pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`, `uv.lock`, `poetry.lock`)
|
||||
2. **Linter/formatter configs** — Look for `.eslintrc`, `biome.json`, `ruff.toml`, `.prettierrc`, etc. (don't duplicate these in AGENTS.md)
|
||||
3. **CI/build commands** — Check `Makefile`, `package.json` scripts, CI configs for canonical commands
|
||||
4. **Monorepo indicators** — Check for `pnpm-workspace.yaml`, `nx.json`, Cargo workspace, or subdirectory `package.json` files
|
||||
5. **Existing conventions** — Check for existing CONTRIBUTING.md, docs/, or README patterns
|
||||
|
||||
## Writing Rules
|
||||
|
||||
- **Headers + bullets** — No paragraphs
|
||||
- **Code blocks** — For commands and templates
|
||||
- **Reference, don't embed** — Point to existing docs: "See `CONTRIBUTING.md` for setup" or "Follow patterns in `src/api/routes/`"
|
||||
- **No filler** — No intros, conclusions, or pleasantries
|
||||
- **Trust capabilities** — Omit obvious context
|
||||
- **Prefer file-scoped commands** — Per-file test/lint/typecheck commands over project-wide builds
|
||||
- **Don't duplicate linters** — Code style lives in linter configs, not AGENTS.md
|
||||
|
||||
## Required Sections
|
||||
|
||||
### Package Manager
|
||||
Which tool and key commands only:
|
||||
```markdown
|
||||
## Package Manager
|
||||
Use **pnpm**: `pnpm install`, `pnpm dev`, `pnpm test`
|
||||
```
|
||||
|
||||
### File-Scoped Commands
|
||||
Per-file commands are faster and cheaper than full project builds. Always include when available:
|
||||
```markdown
|
||||
## File-Scoped Commands
|
||||
| Task | Command |
|
||||
|------|---------|
|
||||
| Typecheck | `pnpm tsc --noEmit path/to/file.ts` |
|
||||
| Lint | `pnpm eslint path/to/file.ts` |
|
||||
| Test | `pnpm jest path/to/file.test.ts` |
|
||||
```
|
||||
|
||||
### Commit Attribution
|
||||
Always include this section. Agents should use their own identity:
|
||||
```markdown
|
||||
## Commit Attribution
|
||||
AI commits MUST include:
|
||||
```
|
||||
Co-Authored-By: (the agent model's name and attribution byline)
|
||||
```
|
||||
Example: `Co-Authored-By: Claude Sonnet 4 <noreply@example.com>`
|
||||
```
|
||||
|
||||
### Key Conventions
|
||||
Project-specific patterns agents must follow. Keep brief.
|
||||
|
||||
## Optional Sections
|
||||
|
||||
Add only if truly needed:
|
||||
- API route patterns (show template, not explanation)
|
||||
- CLI commands (table format)
|
||||
- File naming conventions
|
||||
- Project structure hints (point to critical files, flag legacy code to avoid)
|
||||
- Monorepo overrides (subdirectory `AGENTS.md` files override root)
|
||||
|
||||
## Anti-Patterns
|
||||
|
||||
Omit these:
|
||||
- "Welcome to..." or "This document explains..."
|
||||
- "You should..." or "Remember to..."
|
||||
- Linter/formatter rules already in config files (`.eslintrc`, `biome.json`, `ruff.toml`)
|
||||
- Listing installed skills or plugins (agents discover these automatically)
|
||||
- Full project-wide build commands when file-scoped alternatives exist
|
||||
- Obvious instructions ("run tests", "write clean code")
|
||||
- Explanations of why (just say what)
|
||||
- Long prose paragraphs
|
||||
|
||||
## Example Structure
|
||||
|
||||
```markdown
|
||||
# Agent Instructions
|
||||
|
||||
## Package Manager
|
||||
Use **pnpm**: `pnpm install`, `pnpm dev`
|
||||
|
||||
## Commit Attribution
|
||||
AI commits MUST include:
|
||||
```
|
||||
Co-Authored-By: (the agent model's name and attribution byline)
|
||||
```
|
||||
|
||||
## File-Scoped Commands
|
||||
| Task | Command |
|
||||
|------|---------|
|
||||
| Typecheck | `pnpm tsc --noEmit path/to/file.ts` |
|
||||
| Lint | `pnpm eslint path/to/file.ts` |
|
||||
| Test | `pnpm jest path/to/file.test.ts` |
|
||||
|
||||
## API Routes
|
||||
[Template code block]
|
||||
|
||||
## CLI
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `pnpm cli sync` | Sync data |
|
||||
```
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
---
|
||||
name: changelog-automation
|
||||
description: "Automate changelog generation from commits, PRs, and releases following Keep a Changelog format. Use when setting up release workflows, generating release notes, or standardizing commit conventions."
|
||||
risk: unknown
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Changelog Automation
|
||||
|
||||
Patterns and tools for automating changelog generation, release notes, and version management following industry standards.
|
||||
|
||||
## Use this skill when
|
||||
|
||||
- Setting up automated changelog generation
|
||||
- Implementing conventional commits
|
||||
- Creating release note workflows
|
||||
- Standardizing commit message formats
|
||||
- Managing semantic versioning
|
||||
|
||||
## Do not use this skill when
|
||||
|
||||
- The project has no release process or versioning
|
||||
- You only need a one-time manual release note
|
||||
- Commit history is unavailable or unreliable
|
||||
|
||||
## Instructions
|
||||
|
||||
- Select a changelog format and versioning strategy.
|
||||
- Enforce commit conventions or labeling rules.
|
||||
- Configure tooling to generate and publish notes.
|
||||
- Review output for accuracy, completeness, and wording.
|
||||
- If detailed examples are required, open `resources/implementation-playbook.md`.
|
||||
|
||||
## Safety
|
||||
|
||||
- Avoid exposing secrets or internal-only details in release notes.
|
||||
|
||||
## Resources
|
||||
|
||||
- `resources/implementation-playbook.md` for detailed patterns, templates, and examples.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+538
@@ -0,0 +1,538 @@
|
||||
# Changelog Automation Implementation Playbook
|
||||
|
||||
This file contains detailed patterns, checklists, and code samples referenced by the skill.
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### 1. Keep a Changelog Format
|
||||
|
||||
```markdown
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- New feature X
|
||||
|
||||
## [1.2.0] - 2024-01-15
|
||||
|
||||
### Added
|
||||
- User profile avatars
|
||||
- Dark mode support
|
||||
|
||||
### Changed
|
||||
- Improved loading performance by 40%
|
||||
|
||||
### Deprecated
|
||||
- Old authentication API (use v2)
|
||||
|
||||
### Removed
|
||||
- Legacy payment gateway
|
||||
|
||||
### Fixed
|
||||
- Login timeout issue (#123)
|
||||
|
||||
### Security
|
||||
- Updated dependencies for CVE-2024-1234
|
||||
|
||||
[Unreleased]: https://github.com/user/repo/compare/v1.2.0...HEAD
|
||||
[1.2.0]: https://github.com/user/repo/compare/v1.1.0...v1.2.0
|
||||
```
|
||||
|
||||
### 2. Conventional Commits
|
||||
|
||||
```
|
||||
<type>[optional scope]: <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
| Type | Description | Changelog Section |
|
||||
|------|-------------|-------------------|
|
||||
| `feat` | New feature | Added |
|
||||
| `fix` | Bug fix | Fixed |
|
||||
| `docs` | Documentation | (usually excluded) |
|
||||
| `style` | Formatting | (usually excluded) |
|
||||
| `refactor` | Code restructure | Changed |
|
||||
| `perf` | Performance | Changed |
|
||||
| `test` | Tests | (usually excluded) |
|
||||
| `chore` | Maintenance | (usually excluded) |
|
||||
| `ci` | CI changes | (usually excluded) |
|
||||
| `build` | Build system | (usually excluded) |
|
||||
| `revert` | Revert commit | Removed |
|
||||
|
||||
### 3. Semantic Versioning
|
||||
|
||||
```
|
||||
MAJOR.MINOR.PATCH
|
||||
|
||||
MAJOR: Breaking changes (feat! or BREAKING CHANGE)
|
||||
MINOR: New features (feat)
|
||||
PATCH: Bug fixes (fix)
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
### Method 1: Conventional Changelog (Node.js)
|
||||
|
||||
```bash
|
||||
# Install tools
|
||||
npm install -D @commitlint/cli @commitlint/config-conventional
|
||||
npm install -D husky
|
||||
npm install -D standard-version
|
||||
# or
|
||||
npm install -D semantic-release
|
||||
|
||||
# Setup commitlint
|
||||
cat > commitlint.config.js << 'EOF'
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
rules: {
|
||||
'type-enum': [
|
||||
2,
|
||||
'always',
|
||||
[
|
||||
'feat',
|
||||
'fix',
|
||||
'docs',
|
||||
'style',
|
||||
'refactor',
|
||||
'perf',
|
||||
'test',
|
||||
'chore',
|
||||
'ci',
|
||||
'build',
|
||||
'revert',
|
||||
],
|
||||
],
|
||||
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']],
|
||||
'subject-max-length': [2, 'always', 72],
|
||||
},
|
||||
};
|
||||
EOF
|
||||
|
||||
# Setup husky
|
||||
npx husky init
|
||||
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg
|
||||
```
|
||||
|
||||
### Method 2: standard-version Configuration
|
||||
|
||||
```javascript
|
||||
// .versionrc.js
|
||||
module.exports = {
|
||||
types: [
|
||||
{ type: 'feat', section: 'Features' },
|
||||
{ type: 'fix', section: 'Bug Fixes' },
|
||||
{ type: 'perf', section: 'Performance Improvements' },
|
||||
{ type: 'revert', section: 'Reverts' },
|
||||
{ type: 'docs', section: 'Documentation', hidden: true },
|
||||
{ type: 'style', section: 'Styles', hidden: true },
|
||||
{ type: 'chore', section: 'Miscellaneous', hidden: true },
|
||||
{ type: 'refactor', section: 'Code Refactoring', hidden: true },
|
||||
{ type: 'test', section: 'Tests', hidden: true },
|
||||
{ type: 'build', section: 'Build System', hidden: true },
|
||||
{ type: 'ci', section: 'CI/CD', hidden: true },
|
||||
],
|
||||
commitUrlFormat: '{{host}}/{{owner}}/{{repository}}/commit/{{hash}}',
|
||||
compareUrlFormat: '{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}',
|
||||
issueUrlFormat: '{{host}}/{{owner}}/{{repository}}/issues/{{id}}',
|
||||
userUrlFormat: '{{host}}/{{user}}',
|
||||
releaseCommitMessageFormat: 'chore(release): {{currentTag}}',
|
||||
scripts: {
|
||||
prebump: 'echo "Running prebump"',
|
||||
postbump: 'echo "Running postbump"',
|
||||
prechangelog: 'echo "Running prechangelog"',
|
||||
postchangelog: 'echo "Running postchangelog"',
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```json
|
||||
// package.json scripts
|
||||
{
|
||||
"scripts": {
|
||||
"release": "standard-version",
|
||||
"release:minor": "standard-version --release-as minor",
|
||||
"release:major": "standard-version --release-as major",
|
||||
"release:patch": "standard-version --release-as patch",
|
||||
"release:dry": "standard-version --dry-run"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Method 3: semantic-release (Full Automation)
|
||||
|
||||
```javascript
|
||||
// release.config.js
|
||||
module.exports = {
|
||||
branches: [
|
||||
'main',
|
||||
{ name: 'beta', prerelease: true },
|
||||
{ name: 'alpha', prerelease: true },
|
||||
],
|
||||
plugins: [
|
||||
'@semantic-release/commit-analyzer',
|
||||
'@semantic-release/release-notes-generator',
|
||||
[
|
||||
'@semantic-release/changelog',
|
||||
{
|
||||
changelogFile: 'CHANGELOG.md',
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/npm',
|
||||
{
|
||||
npmPublish: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/github',
|
||||
{
|
||||
assets: ['dist/**/*.js', 'dist/**/*.css'],
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/git',
|
||||
{
|
||||
assets: ['CHANGELOG.md', 'package.json'],
|
||||
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Method 4: GitHub Actions Workflow
|
||||
|
||||
```yaml
|
||||
# .github/workflows/release.yml
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_type:
|
||||
description: 'Release type'
|
||||
required: true
|
||||
default: 'patch'
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Run semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npx semantic-release
|
||||
|
||||
# Alternative: manual release with standard-version
|
||||
manual-release:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Bump version and generate changelog
|
||||
run: npx standard-version --release-as ${{ inputs.release_type }}
|
||||
|
||||
- name: Push changes
|
||||
run: git push --follow-tags origin main
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
body_path: CHANGELOG.md
|
||||
generate_release_notes: true
|
||||
```
|
||||
|
||||
### Method 5: git-cliff (Rust-based, Fast)
|
||||
|
||||
```toml
|
||||
# cliff.toml
|
||||
[changelog]
|
||||
header = """
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
"""
|
||||
body = """
|
||||
{% if version %}\
|
||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% else %}\
|
||||
## [Unreleased]
|
||||
{% endif %}\
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits %}
|
||||
- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}\
|
||||
{{ commit.message | upper_first }}\
|
||||
{% if commit.github.pr_number %} ([#{{ commit.github.pr_number }}](https://github.com/owner/repo/pull/{{ commit.github.pr_number }})){% endif %}\
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
"""
|
||||
footer = """
|
||||
{% for release in releases -%}
|
||||
{% if release.version -%}
|
||||
{% if release.previous.version -%}
|
||||
[{{ release.version | trim_start_matches(pat="v") }}]: \
|
||||
https://github.com/owner/repo/compare/{{ release.previous.version }}...{{ release.version }}
|
||||
{% endif -%}
|
||||
{% else -%}
|
||||
[unreleased]: https://github.com/owner/repo/compare/{{ release.previous.version }}...HEAD
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
"""
|
||||
trim = true
|
||||
|
||||
[git]
|
||||
conventional_commits = true
|
||||
filter_unconventional = true
|
||||
split_commits = false
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "Features" },
|
||||
{ message = "^fix", group = "Bug Fixes" },
|
||||
{ message = "^doc", group = "Documentation" },
|
||||
{ message = "^perf", group = "Performance" },
|
||||
{ message = "^refactor", group = "Refactoring" },
|
||||
{ message = "^style", group = "Styling" },
|
||||
{ message = "^test", group = "Testing" },
|
||||
{ message = "^chore\\(release\\)", skip = true },
|
||||
{ message = "^chore", group = "Miscellaneous" },
|
||||
]
|
||||
filter_commits = false
|
||||
tag_pattern = "v[0-9]*"
|
||||
skip_tags = ""
|
||||
ignore_tags = ""
|
||||
topo_order = false
|
||||
sort_commits = "oldest"
|
||||
|
||||
[github]
|
||||
owner = "owner"
|
||||
repo = "repo"
|
||||
```
|
||||
|
||||
```bash
|
||||
# Generate changelog
|
||||
git cliff -o CHANGELOG.md
|
||||
|
||||
# Generate for specific range
|
||||
git cliff v1.0.0..v2.0.0 -o CHANGELOG.md
|
||||
|
||||
# Preview without writing
|
||||
git cliff --unreleased --dry-run
|
||||
```
|
||||
|
||||
### Method 6: Python (commitizen)
|
||||
|
||||
```toml
|
||||
# pyproject.toml
|
||||
[tool.commitizen]
|
||||
name = "cz_conventional_commits"
|
||||
version = "1.0.0"
|
||||
version_files = [
|
||||
"pyproject.toml:version",
|
||||
"src/__init__.py:__version__",
|
||||
]
|
||||
tag_format = "v$version"
|
||||
update_changelog_on_bump = true
|
||||
changelog_incremental = true
|
||||
changelog_start_rev = "v0.1.0"
|
||||
|
||||
[tool.commitizen.customize]
|
||||
message_template = "{{change_type}}{% if scope %}({{scope}}){% endif %}: {{message}}"
|
||||
schema = "<type>(<scope>): <subject>"
|
||||
schema_pattern = "^(feat|fix|docs|style|refactor|perf|test|chore)(\\(\\w+\\))?:\\s.*"
|
||||
bump_pattern = "^(feat|fix|perf|refactor)"
|
||||
bump_map = {"feat" = "MINOR", "fix" = "PATCH", "perf" = "PATCH", "refactor" = "PATCH"}
|
||||
```
|
||||
|
||||
```bash
|
||||
# Install
|
||||
pip install commitizen
|
||||
|
||||
# Create commit interactively
|
||||
cz commit
|
||||
|
||||
# Bump version and update changelog
|
||||
cz bump --changelog
|
||||
|
||||
# Check commits
|
||||
cz check --rev-range HEAD~5..HEAD
|
||||
```
|
||||
|
||||
## Release Notes Templates
|
||||
|
||||
### GitHub Release Template
|
||||
|
||||
```markdown
|
||||
## What's Changed
|
||||
|
||||
### 🚀 Features
|
||||
{{ range .Features }}
|
||||
- {{ .Title }} by @{{ .Author }} in #{{ .PR }}
|
||||
{{ end }}
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
{{ range .Fixes }}
|
||||
- {{ .Title }} by @{{ .Author }} in #{{ .PR }}
|
||||
{{ end }}
|
||||
|
||||
### 📚 Documentation
|
||||
{{ range .Docs }}
|
||||
- {{ .Title }} by @{{ .Author }} in #{{ .PR }}
|
||||
{{ end }}
|
||||
|
||||
### 🔧 Maintenance
|
||||
{{ range .Chores }}
|
||||
- {{ .Title }} by @{{ .Author }} in #{{ .PR }}
|
||||
{{ end }}
|
||||
|
||||
## New Contributors
|
||||
{{ range .NewContributors }}
|
||||
- @{{ .Username }} made their first contribution in #{{ .PR }}
|
||||
{{ end }}
|
||||
|
||||
**Full Changelog**: https://github.com/owner/repo/compare/v{{ .Previous }}...v{{ .Current }}
|
||||
```
|
||||
|
||||
### Internal Release Notes
|
||||
|
||||
```markdown
|
||||
# Release v2.1.0 - January 15, 2024
|
||||
|
||||
## Summary
|
||||
This release introduces dark mode support and improves checkout performance
|
||||
by 40%. It also includes important security updates.
|
||||
|
||||
## Highlights
|
||||
|
||||
### 🌙 Dark Mode
|
||||
Users can now switch to dark mode from settings. The preference is
|
||||
automatically saved and synced across devices.
|
||||
|
||||
### ⚡ Performance
|
||||
- Checkout flow is 40% faster
|
||||
- Reduced bundle size by 15%
|
||||
|
||||
## Breaking Changes
|
||||
None in this release.
|
||||
|
||||
## Upgrade Guide
|
||||
No special steps required. Standard deployment process applies.
|
||||
|
||||
## Known Issues
|
||||
- Dark mode may flicker on initial load (fix scheduled for v2.1.1)
|
||||
|
||||
## Dependencies Updated
|
||||
| Package | From | To | Reason |
|
||||
|---------|------|-----|--------|
|
||||
| react | 18.2.0 | 18.3.0 | Performance improvements |
|
||||
| lodash | 4.17.20 | 4.17.21 | Security patch |
|
||||
```
|
||||
|
||||
## Commit Message Examples
|
||||
|
||||
```bash
|
||||
# Feature with scope
|
||||
feat(auth): add OAuth2 support for Google login
|
||||
|
||||
# Bug fix with issue reference
|
||||
fix(checkout): resolve race condition in payment processing
|
||||
|
||||
Closes #123
|
||||
|
||||
# Breaking change
|
||||
feat(api)!: change user endpoint response format
|
||||
|
||||
BREAKING CHANGE: The user endpoint now returns `userId` instead of `id`.
|
||||
Migration guide: Update all API consumers to use the new field name.
|
||||
|
||||
# Multiple paragraphs
|
||||
fix(database): handle connection timeouts gracefully
|
||||
|
||||
Previously, connection timeouts would cause the entire request to fail
|
||||
without retry. This change implements exponential backoff with up to
|
||||
3 retries before failing.
|
||||
|
||||
The timeout threshold has been increased from 5s to 10s based on p99
|
||||
latency analysis.
|
||||
|
||||
Fixes #456
|
||||
Reviewed-by: @alice
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
- **Follow Conventional Commits** - Enables automation
|
||||
- **Write clear messages** - Future you will thank you
|
||||
- **Reference issues** - Link commits to tickets
|
||||
- **Use scopes consistently** - Define team conventions
|
||||
- **Automate releases** - Reduce manual errors
|
||||
|
||||
### Don'ts
|
||||
- **Don't mix changes** - One logical change per commit
|
||||
- **Don't skip validation** - Use commitlint
|
||||
- **Don't manual edit** - Generated changelogs only
|
||||
- **Don't forget breaking changes** - Mark with `!` or footer
|
||||
- **Don't ignore CI** - Validate commits in pipeline
|
||||
|
||||
## Resources
|
||||
|
||||
- [Keep a Changelog](https://keepachangelog.com/)
|
||||
- [Conventional Commits](https://www.conventionalcommits.org/)
|
||||
- [Semantic Versioning](https://semver.org/)
|
||||
- [semantic-release](https://semantic-release.gitbook.io/)
|
||||
- [git-cliff](https://git-cliff.org/)
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
---
|
||||
name: commit
|
||||
description: ALWAYS use this skill when committing code changes — never commit directly without it. Creates commits following Sentry conventions with proper conventional commit format and issue references. Trigger on any commit, git commit, save changes, or commit message task.
|
||||
risk: critical
|
||||
source: community
|
||||
---
|
||||
|
||||
# Sentry Commit Messages
|
||||
|
||||
Follow these conventions when creating commits for Sentry projects.
|
||||
|
||||
## When to Use
|
||||
- The user asks to commit code, prepare a commit message, or save changes in git.
|
||||
- You need Sentry-style commit formatting with conventional commit structure and issue references.
|
||||
- The task requires enforcing branch safety before committing, especially avoiding direct commits on `main` or `master`.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before committing, always check the current branch:
|
||||
|
||||
```bash
|
||||
git branch --show-current
|
||||
```
|
||||
|
||||
**If you're on `main` or `master`, you MUST create a feature branch first** — unless the user explicitly asked to commit to main. Do not ask the user whether to create a branch; just proceed with branch creation. The `create-branch` skill will still propose a branch name for the user to confirm.
|
||||
|
||||
Use the `create-branch` skill to create the branch. After `create-branch` completes, verify the current branch has changed before proceeding:
|
||||
|
||||
```bash
|
||||
git branch --show-current
|
||||
```
|
||||
|
||||
If still on `main` or `master` (e.g., the user aborted branch creation), stop — do not commit.
|
||||
|
||||
## Format
|
||||
|
||||
```
|
||||
<type>(<scope>): <subject>
|
||||
|
||||
<body>
|
||||
|
||||
<footer>
|
||||
```
|
||||
|
||||
The header is required. Scope is optional. All lines must stay under 100 characters.
|
||||
|
||||
## Commit Types
|
||||
|
||||
| Type | Purpose |
|
||||
|------|---------|
|
||||
| `feat` | New feature |
|
||||
| `fix` | Bug fix |
|
||||
| `ref` | Refactoring (no behavior change) |
|
||||
| `perf` | Performance improvement |
|
||||
| `docs` | Documentation only |
|
||||
| `test` | Test additions or corrections |
|
||||
| `build` | Build system or dependencies |
|
||||
| `ci` | CI configuration |
|
||||
| `chore` | Maintenance tasks |
|
||||
| `style` | Code formatting (no logic change) |
|
||||
| `meta` | Repository metadata |
|
||||
| `license` | License changes |
|
||||
|
||||
## Subject Line Rules
|
||||
|
||||
- Use imperative, present tense: "Add feature" not "Added feature"
|
||||
- Capitalize the first letter
|
||||
- No period at the end
|
||||
- Maximum 70 characters
|
||||
|
||||
## Body Guidelines
|
||||
|
||||
- Explain **what** and **why**, not how
|
||||
- Use imperative mood and present tense
|
||||
- Include motivation for the change
|
||||
- Contrast with previous behavior when relevant
|
||||
|
||||
## Footer: Issue References
|
||||
|
||||
Reference issues in the footer using these patterns:
|
||||
|
||||
```
|
||||
Fixes GH-1234
|
||||
Fixes #1234
|
||||
Fixes SENTRY-1234
|
||||
Refs LINEAR-ABC-123
|
||||
```
|
||||
|
||||
- `Fixes` closes the issue when merged
|
||||
- `Refs` links without closing
|
||||
|
||||
## AI-Generated Changes
|
||||
|
||||
When changes were primarily generated by a coding agent (like Claude Code), include the Co-Authored-By attribution in the commit footer:
|
||||
|
||||
```
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
This is the only indicator of AI involvement that should appear in commits. Do not add phrases like "Generated by AI", "Written with Claude", or similar markers in the subject, body, or anywhere else in the commit message.
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple fix
|
||||
|
||||
```
|
||||
fix(api): Handle null response in user endpoint
|
||||
|
||||
The user API could return null for deleted accounts, causing a crash
|
||||
in the dashboard. Add null check before accessing user properties.
|
||||
|
||||
Fixes SENTRY-5678
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
### Feature with scope
|
||||
|
||||
```
|
||||
feat(alerts): Add Slack thread replies for alert updates
|
||||
|
||||
When an alert is updated or resolved, post a reply to the original
|
||||
Slack thread instead of creating a new message. This keeps related
|
||||
notifications grouped together.
|
||||
|
||||
Refs GH-1234
|
||||
```
|
||||
|
||||
### Refactor
|
||||
|
||||
```
|
||||
ref: Extract common validation logic to shared module
|
||||
|
||||
Move duplicate validation code from three endpoints into a shared
|
||||
validator class. No behavior change.
|
||||
```
|
||||
|
||||
### Breaking change
|
||||
|
||||
```
|
||||
feat(api)!: Remove deprecated v1 endpoints
|
||||
|
||||
Remove all v1 API endpoints that were deprecated in version 23.1.
|
||||
Clients should migrate to v2 endpoints.
|
||||
|
||||
BREAKING CHANGE: v1 endpoints no longer available
|
||||
Fixes SENTRY-9999
|
||||
```
|
||||
|
||||
## Revert Format
|
||||
|
||||
```
|
||||
revert: feat(api): Add new endpoint
|
||||
|
||||
This reverts commit abc123def456.
|
||||
|
||||
Reason: Caused performance regression in production.
|
||||
```
|
||||
|
||||
## Principles
|
||||
|
||||
- Each commit should be a single, stable change
|
||||
- Commits should be independently reviewable
|
||||
- The repository should be in a working state after each commit
|
||||
|
||||
## References
|
||||
|
||||
- [Sentry Commit Messages](https://develop.sentry.dev/engineering-practices/commit-messages/)
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: create-pr
|
||||
description: Alias for sentry-skills:pr-writer. Use when users explicitly ask for "create-pr" or reference the legacy skill name. Redirects to the canonical PR writing workflow.
|
||||
risk: unknown
|
||||
source: community
|
||||
---
|
||||
|
||||
# Alias: create-pr
|
||||
|
||||
This skill name is kept for compatibility.
|
||||
|
||||
## When to Use
|
||||
- The user explicitly asks for `create-pr` or refers to the legacy skill name.
|
||||
- You need to redirect pull request creation work to the canonical `sentry-skills:pr-writer` workflow.
|
||||
- The task is specifically about writing or updating a pull request rather than general git operations.
|
||||
|
||||
Use `sentry-skills:pr-writer` as the canonical skill for creating and editing pull requests.
|
||||
|
||||
If invoked via `create-pr`, run the same workflow and conventions documented in `sentry-skills:pr-writer`.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+420
@@ -0,0 +1,420 @@
|
||||
---
|
||||
name: git-advanced-workflows
|
||||
description: "Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence."
|
||||
risk: critical
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Git Advanced Workflows
|
||||
|
||||
Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.
|
||||
|
||||
## Do not use this skill when
|
||||
|
||||
- The task is unrelated to git advanced workflows
|
||||
- You need a different domain or tool outside this scope
|
||||
|
||||
## Instructions
|
||||
|
||||
- Clarify goals, constraints, and required inputs.
|
||||
- Apply relevant best practices and validate outcomes.
|
||||
- Provide actionable steps and verification.
|
||||
- If detailed examples are required, open `resources/implementation-playbook.md`.
|
||||
|
||||
## Use this skill when
|
||||
|
||||
- Cleaning up commit history before merging
|
||||
- Applying specific commits across branches
|
||||
- Finding commits that introduced bugs
|
||||
- Working on multiple features simultaneously
|
||||
- Recovering from Git mistakes or lost commits
|
||||
- Managing complex branch workflows
|
||||
- Preparing clean PRs for review
|
||||
- Synchronizing diverged branches
|
||||
|
||||
## Core Concepts
|
||||
|
||||
### 1. Interactive Rebase
|
||||
|
||||
Interactive rebase is the Swiss Army knife of Git history editing.
|
||||
|
||||
**Common Operations:**
|
||||
- `pick`: Keep commit as-is
|
||||
- `reword`: Change commit message
|
||||
- `edit`: Amend commit content
|
||||
- `squash`: Combine with previous commit
|
||||
- `fixup`: Like squash but discard message
|
||||
- `drop`: Remove commit entirely
|
||||
|
||||
**Basic Usage:**
|
||||
```bash
|
||||
# Rebase last 5 commits
|
||||
git rebase -i HEAD~5
|
||||
|
||||
# Rebase all commits on current branch
|
||||
git rebase -i $(git merge-base HEAD main)
|
||||
|
||||
# Rebase onto specific commit
|
||||
git rebase -i abc123
|
||||
```
|
||||
|
||||
### 2. Cherry-Picking
|
||||
|
||||
Apply specific commits from one branch to another without merging entire branches.
|
||||
|
||||
```bash
|
||||
# Cherry-pick single commit
|
||||
git cherry-pick abc123
|
||||
|
||||
# Cherry-pick range of commits (exclusive start)
|
||||
git cherry-pick abc123..def456
|
||||
|
||||
# Cherry-pick without committing (stage changes only)
|
||||
git cherry-pick -n abc123
|
||||
|
||||
# Cherry-pick and edit commit message
|
||||
git cherry-pick -e abc123
|
||||
```
|
||||
|
||||
### 3. Git Bisect
|
||||
|
||||
Binary search through commit history to find the commit that introduced a bug.
|
||||
|
||||
```bash
|
||||
# Start bisect
|
||||
git bisect start
|
||||
|
||||
# Mark current commit as bad
|
||||
git bisect bad
|
||||
|
||||
# Mark known good commit
|
||||
git bisect good v1.0.0
|
||||
|
||||
# Git will checkout middle commit - test it
|
||||
# Then mark as good or bad
|
||||
git bisect good # or: git bisect bad
|
||||
|
||||
# Continue until bug found
|
||||
# When done
|
||||
git bisect reset
|
||||
```
|
||||
|
||||
**Automated Bisect:**
|
||||
```bash
|
||||
# Use script to test automatically
|
||||
git bisect start HEAD v1.0.0
|
||||
git bisect run ./test.sh
|
||||
|
||||
# test.sh should exit 0 for good, 1-127 (except 125) for bad
|
||||
```
|
||||
|
||||
### 4. Worktrees
|
||||
|
||||
Work on multiple branches simultaneously without stashing or switching.
|
||||
|
||||
```bash
|
||||
# List existing worktrees
|
||||
git worktree list
|
||||
|
||||
# Add new worktree for feature branch
|
||||
git worktree add ../project-feature feature/new-feature
|
||||
|
||||
# Add worktree and create new branch
|
||||
git worktree add -b bugfix/urgent ../project-hotfix main
|
||||
|
||||
# Remove worktree
|
||||
git worktree remove ../project-feature
|
||||
|
||||
# Prune stale worktrees
|
||||
git worktree prune
|
||||
```
|
||||
|
||||
### 5. Reflog
|
||||
|
||||
Your safety net - tracks all ref movements, even deleted commits.
|
||||
|
||||
```bash
|
||||
# View reflog
|
||||
git reflog
|
||||
|
||||
# View reflog for specific branch
|
||||
git reflog show feature/branch
|
||||
|
||||
# Restore deleted commit
|
||||
git reflog
|
||||
# Find commit hash
|
||||
git checkout abc123
|
||||
git branch recovered-branch
|
||||
|
||||
# Restore deleted branch
|
||||
git reflog
|
||||
git branch deleted-branch abc123
|
||||
```
|
||||
|
||||
## Practical Workflows
|
||||
|
||||
### Workflow 1: Clean Up Feature Branch Before PR
|
||||
|
||||
```bash
|
||||
# Start with feature branch
|
||||
git checkout feature/user-auth
|
||||
|
||||
# Interactive rebase to clean history
|
||||
git rebase -i main
|
||||
|
||||
# Example rebase operations:
|
||||
# - Squash "fix typo" commits
|
||||
# - Reword commit messages for clarity
|
||||
# - Reorder commits logically
|
||||
# - Drop unnecessary commits
|
||||
|
||||
# Force push cleaned branch (safe if no one else is using it)
|
||||
git push --force-with-lease origin feature/user-auth
|
||||
```
|
||||
|
||||
### Workflow 2: Apply Hotfix to Multiple Releases
|
||||
|
||||
```bash
|
||||
# Create fix on main
|
||||
git checkout main
|
||||
git commit -m "fix: critical security patch"
|
||||
|
||||
# Apply to release branches
|
||||
git checkout release/2.0
|
||||
git cherry-pick abc123
|
||||
|
||||
git checkout release/1.9
|
||||
git cherry-pick abc123
|
||||
|
||||
# Handle conflicts if they arise
|
||||
git cherry-pick --continue
|
||||
# or
|
||||
git cherry-pick --abort
|
||||
```
|
||||
|
||||
### Workflow 3: Find Bug Introduction
|
||||
|
||||
```bash
|
||||
# Start bisect
|
||||
git bisect start
|
||||
git bisect bad HEAD
|
||||
git bisect good v2.1.0
|
||||
|
||||
# Git checks out middle commit - run tests
|
||||
npm test
|
||||
|
||||
# If tests fail
|
||||
git bisect bad
|
||||
|
||||
# If tests pass
|
||||
git bisect good
|
||||
|
||||
# Git will automatically checkout next commit to test
|
||||
# Repeat until bug found
|
||||
|
||||
# Automated version
|
||||
git bisect start HEAD v2.1.0
|
||||
git bisect run npm test
|
||||
```
|
||||
|
||||
### Workflow 4: Multi-Branch Development
|
||||
|
||||
```bash
|
||||
# Main project directory
|
||||
cd ~/projects/myapp
|
||||
|
||||
# Create worktree for urgent bugfix
|
||||
git worktree add ../myapp-hotfix hotfix/critical-bug
|
||||
|
||||
# Work on hotfix in separate directory
|
||||
cd ../myapp-hotfix
|
||||
# Make changes, commit
|
||||
git commit -m "fix: resolve critical bug"
|
||||
git push origin hotfix/critical-bug
|
||||
|
||||
# Return to main work without interruption
|
||||
cd ~/projects/myapp
|
||||
git fetch origin
|
||||
git cherry-pick hotfix/critical-bug
|
||||
|
||||
# Clean up when done
|
||||
git worktree remove ../myapp-hotfix
|
||||
```
|
||||
|
||||
### Workflow 5: Recover from Mistakes
|
||||
|
||||
```bash
|
||||
# Accidentally reset to wrong commit
|
||||
git reset --hard HEAD~5 # Oh no!
|
||||
|
||||
# Use reflog to find lost commits
|
||||
git reflog
|
||||
# Output shows:
|
||||
# abc123 HEAD@{0}: reset: moving to HEAD~5
|
||||
# def456 HEAD@{1}: commit: my important changes
|
||||
|
||||
# Recover lost commits
|
||||
git reset --hard def456
|
||||
|
||||
# Or create branch from lost commit
|
||||
git branch recovery def456
|
||||
```
|
||||
|
||||
## Advanced Techniques
|
||||
|
||||
### Rebase vs Merge Strategy
|
||||
|
||||
**When to Rebase:**
|
||||
- Cleaning up local commits before pushing
|
||||
- Keeping feature branch up-to-date with main
|
||||
- Creating linear history for easier review
|
||||
|
||||
**When to Merge:**
|
||||
- Integrating completed features into main
|
||||
- Preserving exact history of collaboration
|
||||
- Public branches used by others
|
||||
|
||||
```bash
|
||||
# Update feature branch with main changes (rebase)
|
||||
git checkout feature/my-feature
|
||||
git fetch origin
|
||||
git rebase origin/main
|
||||
|
||||
# Handle conflicts
|
||||
git status
|
||||
# Fix conflicts in files
|
||||
git add .
|
||||
git rebase --continue
|
||||
|
||||
# Or merge instead
|
||||
git merge origin/main
|
||||
```
|
||||
|
||||
### Autosquash Workflow
|
||||
|
||||
Automatically squash fixup commits during rebase.
|
||||
|
||||
```bash
|
||||
# Make initial commit
|
||||
git commit -m "feat: add user authentication"
|
||||
|
||||
# Later, fix something in that commit
|
||||
# Stage changes
|
||||
git commit --fixup HEAD # or specify commit hash
|
||||
|
||||
# Make more changes
|
||||
git commit --fixup abc123
|
||||
|
||||
# Rebase with autosquash
|
||||
git rebase -i --autosquash main
|
||||
|
||||
# Git automatically marks fixup commits
|
||||
```
|
||||
|
||||
### Split Commit
|
||||
|
||||
Break one commit into multiple logical commits.
|
||||
|
||||
```bash
|
||||
# Start interactive rebase
|
||||
git rebase -i HEAD~3
|
||||
|
||||
# Mark commit to split with 'edit'
|
||||
# Git will stop at that commit
|
||||
|
||||
# Reset commit but keep changes
|
||||
git reset HEAD^
|
||||
|
||||
# Stage and commit in logical chunks
|
||||
git add file1.py
|
||||
git commit -m "feat: add validation"
|
||||
|
||||
git add file2.py
|
||||
git commit -m "feat: add error handling"
|
||||
|
||||
# Continue rebase
|
||||
git rebase --continue
|
||||
```
|
||||
|
||||
### Partial Cherry-Pick
|
||||
|
||||
Cherry-pick only specific files from a commit.
|
||||
|
||||
```bash
|
||||
# Show files in commit
|
||||
git show --name-only abc123
|
||||
|
||||
# Checkout specific files from commit
|
||||
git checkout abc123 -- path/to/file1.py path/to/file2.py
|
||||
|
||||
# Stage and commit
|
||||
git commit -m "cherry-pick: apply specific changes from abc123"
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always Use --force-with-lease**: Safer than --force, prevents overwriting others' work
|
||||
2. **Rebase Only Local Commits**: Don't rebase commits that have been pushed and shared
|
||||
3. **Descriptive Commit Messages**: Future you will thank present you
|
||||
4. **Atomic Commits**: Each commit should be a single logical change
|
||||
5. **Test Before Force Push**: Ensure history rewrite didn't break anything
|
||||
6. **Keep Reflog Aware**: Remember reflog is your safety net for 90 days
|
||||
7. **Branch Before Risky Operations**: Create backup branch before complex rebases
|
||||
|
||||
```bash
|
||||
# Safe force push
|
||||
git push --force-with-lease origin feature/branch
|
||||
|
||||
# Create backup before risky operation
|
||||
git branch backup-branch
|
||||
git rebase -i main
|
||||
# If something goes wrong
|
||||
git reset --hard backup-branch
|
||||
```
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
- **Rebasing Public Branches**: Causes history conflicts for collaborators
|
||||
- **Force Pushing Without Lease**: Can overwrite teammate's work
|
||||
- **Losing Work in Rebase**: Resolve conflicts carefully, test after rebase
|
||||
- **Forgetting Worktree Cleanup**: Orphaned worktrees consume disk space
|
||||
- **Not Backing Up Before Experiment**: Always create safety branch
|
||||
- **Bisect on Dirty Working Directory**: Commit or stash before bisecting
|
||||
|
||||
## Recovery Commands
|
||||
|
||||
```bash
|
||||
# Abort operations in progress
|
||||
git rebase --abort
|
||||
git merge --abort
|
||||
git cherry-pick --abort
|
||||
git bisect reset
|
||||
|
||||
# Restore file to version from specific commit
|
||||
git restore --source=abc123 path/to/file
|
||||
|
||||
# Undo last commit but keep changes
|
||||
git reset --soft HEAD^
|
||||
|
||||
# Undo last commit and discard changes
|
||||
git reset --hard HEAD^
|
||||
|
||||
# Recover deleted branch (within 90 days)
|
||||
git reflog
|
||||
git branch recovered-branch abc123
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- **references/git-rebase-guide.md**: Deep dive into interactive rebase
|
||||
- **references/git-conflict-resolution.md**: Advanced conflict resolution strategies
|
||||
- **references/git-history-rewriting.md**: Safely rewriting Git history
|
||||
- **assets/git-workflow-checklist.md**: Pre-PR cleanup checklist
|
||||
- **assets/git-aliases.md**: Useful Git aliases for advanced workflows
|
||||
- **scripts/git-clean-branches.sh**: Clean up merged and stale branches
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+1100
File diff suppressed because it is too large
Load Diff
+54
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: lint-and-validate
|
||||
description: "MANDATORY: Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free."
|
||||
risk: unknown
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Lint and Validate Skill
|
||||
|
||||
> **MANDATORY:** Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free.
|
||||
|
||||
### Procedures by Ecosystem
|
||||
|
||||
#### Node.js / TypeScript
|
||||
1. **Lint/Fix:** `npm run lint` or `npx eslint "path" --fix`
|
||||
2. **Types:** `npx tsc --noEmit`
|
||||
3. **Security:** `npm audit --audit-level=high`
|
||||
|
||||
#### Python
|
||||
1. **Linter (Ruff):** `ruff check "path" --fix` (Fast & Modern)
|
||||
2. **Security (Bandit):** `bandit -r "path" -ll`
|
||||
3. **Types (MyPy):** `mypy "path"`
|
||||
|
||||
## The Quality Loop
|
||||
1. **Write/Edit Code**
|
||||
2. **Run Audit:** `npm run lint && npx tsc --noEmit`
|
||||
3. **Analyze Report:** Check the "FINAL AUDIT REPORT" section.
|
||||
4. **Fix & Repeat:** Submitting code with "FINAL AUDIT" failures is NOT allowed.
|
||||
|
||||
## Error Handling
|
||||
- If `lint` fails: Fix the style or syntax issues immediately.
|
||||
- If `tsc` fails: Correct type mismatches before proceeding.
|
||||
- If no tool is configured: Check the project root for `.eslintrc`, `tsconfig.json`, `pyproject.toml` and suggest creating one.
|
||||
|
||||
---
|
||||
**Strict Rule:** No code should be committed or reported as "done" without passing these checks.
|
||||
|
||||
---
|
||||
|
||||
## Scripts
|
||||
|
||||
| Script | Purpose | Command |
|
||||
|--------|---------|---------|
|
||||
| `scripts/lint_runner.py` | Unified lint check | `python scripts/lint_runner.py <project_path>` |
|
||||
| `scripts/type_coverage.py` | Type coverage analysis | `python scripts/type_coverage.py <project_path>` |
|
||||
|
||||
## When to Use
|
||||
This skill is applicable to execute the workflow or actions described in the overview.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Lint Runner - Unified linting and type checking
|
||||
Runs appropriate linters based on project type.
|
||||
|
||||
Usage:
|
||||
python lint_runner.py <project_path>
|
||||
|
||||
Supports:
|
||||
- Node.js: npm run lint, npx tsc --noEmit
|
||||
- Python: ruff check, mypy
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
# Fix Windows console encoding
|
||||
try:
|
||||
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def detect_project_type(project_path: Path) -> dict:
|
||||
"""Detect project type and available linters."""
|
||||
result = {
|
||||
"type": "unknown",
|
||||
"linters": []
|
||||
}
|
||||
|
||||
# Node.js project
|
||||
package_json = project_path / "package.json"
|
||||
if package_json.exists():
|
||||
result["type"] = "node"
|
||||
try:
|
||||
pkg = json.loads(package_json.read_text(encoding='utf-8'))
|
||||
scripts = pkg.get("scripts", {})
|
||||
deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
|
||||
|
||||
# Check for lint script
|
||||
if "lint" in scripts:
|
||||
result["linters"].append({"name": "npm lint", "cmd": ["npm", "run", "lint"]})
|
||||
elif "eslint" in deps:
|
||||
result["linters"].append({"name": "eslint", "cmd": ["npx", "eslint", "."]})
|
||||
|
||||
# Check for TypeScript
|
||||
if "typescript" in deps or (project_path / "tsconfig.json").exists():
|
||||
result["linters"].append({"name": "tsc", "cmd": ["npx", "tsc", "--noEmit"]})
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
# Python project
|
||||
if (project_path / "pyproject.toml").exists() or (project_path / "requirements.txt").exists():
|
||||
result["type"] = "python"
|
||||
|
||||
# Check for ruff
|
||||
result["linters"].append({"name": "ruff", "cmd": ["ruff", "check", "."]})
|
||||
|
||||
# Check for mypy
|
||||
if (project_path / "mypy.ini").exists() or (project_path / "pyproject.toml").exists():
|
||||
result["linters"].append({"name": "mypy", "cmd": ["mypy", "."]})
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def run_linter(linter: dict, cwd: Path) -> dict:
|
||||
"""Run a single linter and return results."""
|
||||
result = {
|
||||
"name": linter["name"],
|
||||
"passed": False,
|
||||
"output": "",
|
||||
"error": ""
|
||||
}
|
||||
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
linter["cmd"],
|
||||
cwd=str(cwd),
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding='utf-8',
|
||||
errors='replace',
|
||||
timeout=120
|
||||
)
|
||||
|
||||
result["output"] = proc.stdout[:2000] if proc.stdout else ""
|
||||
result["error"] = proc.stderr[:500] if proc.stderr else ""
|
||||
result["passed"] = proc.returncode == 0
|
||||
|
||||
except FileNotFoundError:
|
||||
result["error"] = f"Command not found: {linter['cmd'][0]}"
|
||||
except subprocess.TimeoutExpired:
|
||||
result["error"] = "Timeout after 120s"
|
||||
except Exception as e:
|
||||
result["error"] = str(e)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def main():
|
||||
project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print(f"[LINT RUNNER] Unified Linting")
|
||||
print(f"{'='*60}")
|
||||
print(f"Project: {project_path}")
|
||||
print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
|
||||
# Detect project type
|
||||
project_info = detect_project_type(project_path)
|
||||
print(f"Type: {project_info['type']}")
|
||||
print(f"Linters: {len(project_info['linters'])}")
|
||||
print("-"*60)
|
||||
|
||||
if not project_info["linters"]:
|
||||
print("No linters found for this project type.")
|
||||
output = {
|
||||
"script": "lint_runner",
|
||||
"project": str(project_path),
|
||||
"type": project_info["type"],
|
||||
"checks": [],
|
||||
"passed": True,
|
||||
"message": "No linters configured"
|
||||
}
|
||||
print(json.dumps(output, indent=2))
|
||||
sys.exit(0)
|
||||
|
||||
# Run each linter
|
||||
results = []
|
||||
all_passed = True
|
||||
|
||||
for linter in project_info["linters"]:
|
||||
print(f"\nRunning: {linter['name']}...")
|
||||
result = run_linter(linter, project_path)
|
||||
results.append(result)
|
||||
|
||||
if result["passed"]:
|
||||
print(f" [PASS] {linter['name']}")
|
||||
else:
|
||||
print(f" [FAIL] {linter['name']}")
|
||||
if result["error"]:
|
||||
print(f" Error: {result['error'][:200]}")
|
||||
all_passed = False
|
||||
|
||||
# Summary
|
||||
print("\n" + "="*60)
|
||||
print("SUMMARY")
|
||||
print("="*60)
|
||||
|
||||
for r in results:
|
||||
icon = "[PASS]" if r["passed"] else "[FAIL]"
|
||||
print(f"{icon} {r['name']}")
|
||||
|
||||
output = {
|
||||
"script": "lint_runner",
|
||||
"project": str(project_path),
|
||||
"type": project_info["type"],
|
||||
"checks": results,
|
||||
"passed": all_passed
|
||||
}
|
||||
|
||||
print("\n" + json.dumps(output, indent=2))
|
||||
|
||||
sys.exit(0 if all_passed else 1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Type Coverage Checker - Measures TypeScript/Python type coverage.
|
||||
Identifies untyped functions, any usage, and type safety issues.
|
||||
"""
|
||||
import sys
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
# Fix Windows console encoding for Unicode output
|
||||
try:
|
||||
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
||||
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
||||
except AttributeError:
|
||||
pass # Python < 3.7
|
||||
|
||||
def check_typescript_coverage(project_path: Path) -> dict:
|
||||
"""Check TypeScript type coverage."""
|
||||
issues = []
|
||||
passed = []
|
||||
stats = {'any_count': 0, 'untyped_functions': 0, 'total_functions': 0}
|
||||
|
||||
ts_files = list(project_path.rglob("*.ts")) + list(project_path.rglob("*.tsx"))
|
||||
ts_files = [f for f in ts_files if 'node_modules' not in str(f) and '.d.ts' not in str(f)]
|
||||
|
||||
if not ts_files:
|
||||
return {'type': 'typescript', 'files': 0, 'passed': [], 'issues': ["[!] No TypeScript files found"], 'stats': stats}
|
||||
|
||||
for file_path in ts_files[:30]: # Limit
|
||||
try:
|
||||
content = file_path.read_text(encoding='utf-8', errors='ignore')
|
||||
|
||||
# Count 'any' usage
|
||||
any_matches = re.findall(r':\s*any\b', content)
|
||||
stats['any_count'] += len(any_matches)
|
||||
|
||||
# Find functions without return types
|
||||
# function name(params) { - no return type
|
||||
untyped = re.findall(r'function\s+\w+\s*\([^)]*\)\s*{', content)
|
||||
# Arrow functions without types: const fn = (x) => or (x) =>
|
||||
untyped += re.findall(r'=\s*\([^:)]*\)\s*=>', content)
|
||||
stats['untyped_functions'] += len(untyped)
|
||||
|
||||
# Count typed functions
|
||||
typed = re.findall(r'function\s+\w+\s*\([^)]*\)\s*:\s*\w+', content)
|
||||
typed += re.findall(r':\s*\([^)]*\)\s*=>\s*\w+', content)
|
||||
stats['total_functions'] += len(typed) + len(untyped)
|
||||
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
# Analyze results
|
||||
if stats['any_count'] == 0:
|
||||
passed.append("[OK] No 'any' types found")
|
||||
elif stats['any_count'] <= 5:
|
||||
issues.append(f"[!] {stats['any_count']} 'any' types found (acceptable)")
|
||||
else:
|
||||
issues.append(f"[X] {stats['any_count']} 'any' types found (too many)")
|
||||
|
||||
if stats['total_functions'] > 0:
|
||||
typed_ratio = (stats['total_functions'] - stats['untyped_functions']) / stats['total_functions'] * 100
|
||||
if typed_ratio >= 80:
|
||||
passed.append(f"[OK] Type coverage: {typed_ratio:.0f}%")
|
||||
elif typed_ratio >= 50:
|
||||
issues.append(f"[!] Type coverage: {typed_ratio:.0f}% (improve)")
|
||||
else:
|
||||
issues.append(f"[X] Type coverage: {typed_ratio:.0f}% (too low)")
|
||||
|
||||
passed.append(f"[OK] Analyzed {len(ts_files)} TypeScript files")
|
||||
|
||||
return {'type': 'typescript', 'files': len(ts_files), 'passed': passed, 'issues': issues, 'stats': stats}
|
||||
|
||||
def check_python_coverage(project_path: Path) -> dict:
|
||||
"""Check Python type hints coverage."""
|
||||
issues = []
|
||||
passed = []
|
||||
stats = {'untyped_functions': 0, 'typed_functions': 0, 'any_count': 0}
|
||||
|
||||
py_files = list(project_path.rglob("*.py"))
|
||||
py_files = [f for f in py_files if not any(x in str(f) for x in ['venv', '__pycache__', '.git', 'node_modules'])]
|
||||
|
||||
if not py_files:
|
||||
return {'type': 'python', 'files': 0, 'passed': [], 'issues': ["[!] No Python files found"], 'stats': stats}
|
||||
|
||||
for file_path in py_files[:30]: # Limit
|
||||
try:
|
||||
content = file_path.read_text(encoding='utf-8', errors='ignore')
|
||||
|
||||
# Count Any usage
|
||||
any_matches = re.findall(r':\s*Any\b', content)
|
||||
stats['any_count'] += len(any_matches)
|
||||
|
||||
# Find functions with type hints
|
||||
typed_funcs = re.findall(r'def\s+\w+\s*\([^)]*:[^)]+\)', content)
|
||||
typed_funcs += re.findall(r'def\s+\w+\s*\([^)]*\)\s*->', content)
|
||||
stats['typed_functions'] += len(typed_funcs)
|
||||
|
||||
# Find functions without type hints
|
||||
all_funcs = re.findall(r'def\s+\w+\s*\(', content)
|
||||
stats['untyped_functions'] += len(all_funcs) - len(typed_funcs)
|
||||
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
total = stats['typed_functions'] + stats['untyped_functions']
|
||||
|
||||
if total > 0:
|
||||
typed_ratio = stats['typed_functions'] / total * 100
|
||||
if typed_ratio >= 70:
|
||||
passed.append(f"[OK] Type hints coverage: {typed_ratio:.0f}%")
|
||||
elif typed_ratio >= 40:
|
||||
issues.append(f"[!] Type hints coverage: {typed_ratio:.0f}%")
|
||||
else:
|
||||
issues.append(f"[X] Type hints coverage: {typed_ratio:.0f}% (add type hints)")
|
||||
|
||||
if stats['any_count'] == 0:
|
||||
passed.append("[OK] No 'Any' types found")
|
||||
elif stats['any_count'] <= 3:
|
||||
issues.append(f"[!] {stats['any_count']} 'Any' types found")
|
||||
else:
|
||||
issues.append(f"[X] {stats['any_count']} 'Any' types found")
|
||||
|
||||
passed.append(f"[OK] Analyzed {len(py_files)} Python files")
|
||||
|
||||
return {'type': 'python', 'files': len(py_files), 'passed': passed, 'issues': issues, 'stats': stats}
|
||||
|
||||
def main():
|
||||
target = sys.argv[1] if len(sys.argv) > 1 else "."
|
||||
project_path = Path(target)
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print(" TYPE COVERAGE CHECKER")
|
||||
print("=" * 60 + "\n")
|
||||
|
||||
results = []
|
||||
|
||||
# Check TypeScript
|
||||
ts_result = check_typescript_coverage(project_path)
|
||||
if ts_result['files'] > 0:
|
||||
results.append(ts_result)
|
||||
|
||||
# Check Python
|
||||
py_result = check_python_coverage(project_path)
|
||||
if py_result['files'] > 0:
|
||||
results.append(py_result)
|
||||
|
||||
if not results:
|
||||
print("[!] No TypeScript or Python files found.")
|
||||
sys.exit(0)
|
||||
|
||||
# Print results
|
||||
critical_issues = 0
|
||||
for result in results:
|
||||
print(f"\n[{result['type'].upper()}]")
|
||||
print("-" * 40)
|
||||
for item in result['passed']:
|
||||
print(f" {item}")
|
||||
for item in result['issues']:
|
||||
print(f" {item}")
|
||||
if item.startswith("[X]"):
|
||||
critical_issues += 1
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
if critical_issues == 0:
|
||||
print("[OK] TYPE COVERAGE: ACCEPTABLE")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"[X] TYPE COVERAGE: {critical_issues} critical issues")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
---
|
||||
name: receiving-code-review
|
||||
description: "Code review requires technical evaluation, not emotional performance."
|
||||
risk: unknown
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Code Review Reception
|
||||
|
||||
## Overview
|
||||
|
||||
Code review requires technical evaluation, not emotional performance.
|
||||
|
||||
**Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
|
||||
|
||||
## The Response Pattern
|
||||
|
||||
```
|
||||
WHEN receiving code review feedback:
|
||||
|
||||
1. READ: Complete feedback without reacting
|
||||
2. UNDERSTAND: Restate requirement in own words (or ask)
|
||||
3. VERIFY: Check against codebase reality
|
||||
4. EVALUATE: Technically sound for THIS codebase?
|
||||
5. RESPOND: Technical acknowledgment or reasoned pushback
|
||||
6. IMPLEMENT: One item at a time, test each
|
||||
```
|
||||
|
||||
## Forbidden Responses
|
||||
|
||||
**NEVER:**
|
||||
- "You're absolutely right!" (explicit CLAUDE.md violation)
|
||||
- "Great point!" / "Excellent feedback!" (performative)
|
||||
- "Let me implement that now" (before verification)
|
||||
|
||||
**INSTEAD:**
|
||||
- Restate the technical requirement
|
||||
- Ask clarifying questions
|
||||
- Push back with technical reasoning if wrong
|
||||
- Just start working (actions > words)
|
||||
|
||||
## Handling Unclear Feedback
|
||||
|
||||
```
|
||||
IF any item is unclear:
|
||||
STOP - do not implement anything yet
|
||||
ASK for clarification on unclear items
|
||||
|
||||
WHY: Items may be related. Partial understanding = wrong implementation.
|
||||
```
|
||||
|
||||
**Example:**
|
||||
```
|
||||
your human partner: "Fix 1-6"
|
||||
You understand 1,2,3,6. Unclear on 4,5.
|
||||
|
||||
❌ WRONG: Implement 1,2,3,6 now, ask about 4,5 later
|
||||
✅ RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."
|
||||
```
|
||||
|
||||
## Source-Specific Handling
|
||||
|
||||
### From your human partner
|
||||
- **Trusted** - implement after understanding
|
||||
- **Still ask** if scope unclear
|
||||
- **No performative agreement**
|
||||
- **Skip to action** or technical acknowledgment
|
||||
|
||||
### From External Reviewers
|
||||
```
|
||||
BEFORE implementing:
|
||||
1. Check: Technically correct for THIS codebase?
|
||||
2. Check: Breaks existing functionality?
|
||||
3. Check: Reason for current implementation?
|
||||
4. Check: Works on all platforms/versions?
|
||||
5. Check: Does reviewer understand full context?
|
||||
|
||||
IF suggestion seems wrong:
|
||||
Push back with technical reasoning
|
||||
|
||||
IF can't easily verify:
|
||||
Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"
|
||||
|
||||
IF conflicts with your human partner's prior decisions:
|
||||
Stop and discuss with your human partner first
|
||||
```
|
||||
|
||||
**your human partner's rule:** "External feedback - be skeptical, but check carefully"
|
||||
|
||||
## YAGNI Check for "Professional" Features
|
||||
|
||||
```
|
||||
IF reviewer suggests "implementing properly":
|
||||
grep codebase for actual usage
|
||||
|
||||
IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
|
||||
IF used: Then implement properly
|
||||
```
|
||||
|
||||
**your human partner's rule:** "You and reviewer both report to me. If we don't need this feature, don't add it."
|
||||
|
||||
## Implementation Order
|
||||
|
||||
```
|
||||
FOR multi-item feedback:
|
||||
1. Clarify anything unclear FIRST
|
||||
2. Then implement in this order:
|
||||
- Blocking issues (breaks, security)
|
||||
- Simple fixes (typos, imports)
|
||||
- Complex fixes (refactoring, logic)
|
||||
3. Test each fix individually
|
||||
4. Verify no regressions
|
||||
```
|
||||
|
||||
## When To Push Back
|
||||
|
||||
Push back when:
|
||||
- Suggestion breaks existing functionality
|
||||
- Reviewer lacks full context
|
||||
- Violates YAGNI (unused feature)
|
||||
- Technically incorrect for this stack
|
||||
- Legacy/compatibility reasons exist
|
||||
- Conflicts with your human partner's architectural decisions
|
||||
|
||||
**How to push back:**
|
||||
- Use technical reasoning, not defensiveness
|
||||
- Ask specific questions
|
||||
- Reference working tests/code
|
||||
- Involve your human partner if architectural
|
||||
|
||||
**Signal if uncomfortable pushing back out loud:** "Strange things are afoot at the Circle K"
|
||||
|
||||
## Acknowledging Correct Feedback
|
||||
|
||||
When feedback IS correct:
|
||||
```
|
||||
✅ "Fixed. [Brief description of what changed]"
|
||||
✅ "Good catch - [specific issue]. Fixed in [location]."
|
||||
✅ [Just fix it and show in the code]
|
||||
|
||||
❌ "You're absolutely right!"
|
||||
❌ "Great point!"
|
||||
❌ "Thanks for catching that!"
|
||||
❌ "Thanks for [anything]"
|
||||
❌ ANY gratitude expression
|
||||
```
|
||||
|
||||
**Why no thanks:** Actions speak. Just fix it. The code itself shows you heard the feedback.
|
||||
|
||||
**If you catch yourself about to write "Thanks":** DELETE IT. State the fix instead.
|
||||
|
||||
## Gracefully Correcting Your Pushback
|
||||
|
||||
If you pushed back and were wrong:
|
||||
```
|
||||
✅ "You were right - I checked [X] and it does [Y]. Implementing now."
|
||||
✅ "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."
|
||||
|
||||
❌ Long apology
|
||||
❌ Defending why you pushed back
|
||||
❌ Over-explaining
|
||||
```
|
||||
|
||||
State the correction factually and move on.
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
| Mistake | Fix |
|
||||
|---------|-----|
|
||||
| Performative agreement | State requirement or just act |
|
||||
| Blind implementation | Verify against codebase first |
|
||||
| Batch without testing | One at a time, test each |
|
||||
| Assuming reviewer is right | Check if breaks things |
|
||||
| Avoiding pushback | Technical correctness > comfort |
|
||||
| Partial implementation | Clarify all items first |
|
||||
| Can't verify, proceed anyway | State limitation, ask for direction |
|
||||
|
||||
## Real Examples
|
||||
|
||||
**Performative Agreement (Bad):**
|
||||
```
|
||||
Reviewer: "Remove legacy code"
|
||||
❌ "You're absolutely right! Let me remove that..."
|
||||
```
|
||||
|
||||
**Technical Verification (Good):**
|
||||
```
|
||||
Reviewer: "Remove legacy code"
|
||||
✅ "Checking... build target is 10.15+, this API needs 13+. Need legacy for backward compat. Current impl has wrong bundle ID - fix it or drop pre-13 support?"
|
||||
```
|
||||
|
||||
**YAGNI (Good):**
|
||||
```
|
||||
Reviewer: "Implement proper metrics tracking with database, date filters, CSV export"
|
||||
✅ "Grepped codebase - nothing calls this endpoint. Remove it (YAGNI)? Or is there usage I'm missing?"
|
||||
```
|
||||
|
||||
**Unclear Item (Good):**
|
||||
```
|
||||
your human partner: "Fix items 1-6"
|
||||
You understand 1,2,3,6. Unclear on 4,5.
|
||||
✅ "Understand 1,2,3,6. Need clarification on 4 and 5 before implementing."
|
||||
```
|
||||
|
||||
## GitHub Thread Replies
|
||||
|
||||
When replying to inline review comments on GitHub, reply in the comment thread (`gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies`), not as a top-level PR comment.
|
||||
|
||||
## The Bottom Line
|
||||
|
||||
**External feedback = suggestions to evaluate, not orders to follow.**
|
||||
|
||||
Verify. Question. Then implement.
|
||||
|
||||
No performative agreement. Technical rigor always.
|
||||
|
||||
## When to Use
|
||||
This skill is applicable to execute the workflow or actions described in the overview.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
---
|
||||
name: requesting-code-review
|
||||
description: "Use when completing tasks, implementing major features, or before merging to verify work meets requirements"
|
||||
risk: unknown
|
||||
source: community
|
||||
date_added: "2026-02-27"
|
||||
---
|
||||
|
||||
# Requesting Code Review
|
||||
|
||||
Dispatch superpowers:code-reviewer subagent to catch issues before they cascade.
|
||||
|
||||
**Core principle:** Review early, review often.
|
||||
|
||||
## When to Request Review
|
||||
|
||||
**Mandatory:**
|
||||
- After each task in subagent-driven development
|
||||
- After completing major feature
|
||||
- Before merge to main
|
||||
|
||||
**Optional but valuable:**
|
||||
- When stuck (fresh perspective)
|
||||
- Before refactoring (baseline check)
|
||||
- After fixing complex bug
|
||||
|
||||
## How to Request
|
||||
|
||||
**1. Get git SHAs:**
|
||||
```bash
|
||||
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
||||
HEAD_SHA=$(git rev-parse HEAD)
|
||||
```
|
||||
|
||||
**2. Dispatch code-reviewer subagent:**
|
||||
|
||||
Use Task tool with superpowers:code-reviewer type, fill template at `code-reviewer.md`
|
||||
|
||||
**Placeholders:**
|
||||
- `{WHAT_WAS_IMPLEMENTED}` - What you just built
|
||||
- `{PLAN_OR_REQUIREMENTS}` - What it should do
|
||||
- `{BASE_SHA}` - Starting commit
|
||||
- `{HEAD_SHA}` - Ending commit
|
||||
- `{DESCRIPTION}` - Brief summary
|
||||
|
||||
**3. Act on feedback:**
|
||||
- Fix Critical issues immediately
|
||||
- Fix Important issues before proceeding
|
||||
- Note Minor issues for later
|
||||
- Push back if reviewer is wrong (with reasoning)
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
[Just completed Task 2: Add verification function]
|
||||
|
||||
You: Let me request code review before proceeding.
|
||||
|
||||
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
||||
HEAD_SHA=$(git rev-parse HEAD)
|
||||
|
||||
[Dispatch superpowers:code-reviewer subagent]
|
||||
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
|
||||
PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
|
||||
BASE_SHA: a7981ec
|
||||
HEAD_SHA: 3df7661
|
||||
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
||||
|
||||
[Subagent returns]:
|
||||
Strengths: Clean architecture, real tests
|
||||
Issues:
|
||||
Important: Missing progress indicators
|
||||
Minor: Magic number (100) for reporting interval
|
||||
Assessment: Ready to proceed
|
||||
|
||||
You: [Fix progress indicators]
|
||||
[Continue to Task 3]
|
||||
```
|
||||
|
||||
## Integration with Workflows
|
||||
|
||||
**Subagent-Driven Development:**
|
||||
- Review after EACH task
|
||||
- Catch issues before they compound
|
||||
- Fix before moving to next task
|
||||
|
||||
**Executing Plans:**
|
||||
- Review after each batch (3 tasks)
|
||||
- Get feedback, apply, continue
|
||||
|
||||
**Ad-Hoc Development:**
|
||||
- Review before merge
|
||||
- Review when stuck
|
||||
|
||||
## Red Flags
|
||||
|
||||
**Never:**
|
||||
- Skip review because "it's simple"
|
||||
- Ignore Critical issues
|
||||
- Proceed with unfixed Important issues
|
||||
- Argue with valid technical feedback
|
||||
|
||||
**If reviewer wrong:**
|
||||
- Push back with technical reasoning
|
||||
- Show code/tests that prove it works
|
||||
- Request clarification
|
||||
|
||||
See template at: requesting-code-review/code-reviewer.md
|
||||
|
||||
## When to Use
|
||||
This skill is applicable to execute the workflow or actions described in the overview.
|
||||
|
||||
## Limitations
|
||||
- Use this skill only when the task clearly matches the scope described above.
|
||||
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
||||
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
# Code Review Agent
|
||||
|
||||
You are reviewing code changes for production readiness.
|
||||
|
||||
**Your task:**
|
||||
1. Review {WHAT_WAS_IMPLEMENTED}
|
||||
2. Compare against {PLAN_OR_REQUIREMENTS}
|
||||
3. Check code quality, architecture, testing
|
||||
4. Categorize issues by severity
|
||||
5. Assess production readiness
|
||||
|
||||
## What Was Implemented
|
||||
|
||||
{DESCRIPTION}
|
||||
|
||||
## Requirements/Plan
|
||||
|
||||
{PLAN_REFERENCE}
|
||||
|
||||
## Git Range to Review
|
||||
|
||||
**Base:** {BASE_SHA}
|
||||
**Head:** {HEAD_SHA}
|
||||
|
||||
```bash
|
||||
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
||||
git diff {BASE_SHA}..{HEAD_SHA}
|
||||
```
|
||||
|
||||
## Review Checklist
|
||||
|
||||
**Code Quality:**
|
||||
- Clean separation of concerns?
|
||||
- Proper error handling?
|
||||
- Type safety (if applicable)?
|
||||
- DRY principle followed?
|
||||
- Edge cases handled?
|
||||
|
||||
**Architecture:**
|
||||
- Sound design decisions?
|
||||
- Scalability considerations?
|
||||
- Performance implications?
|
||||
- Security concerns?
|
||||
|
||||
**Testing:**
|
||||
- Tests actually test logic (not mocks)?
|
||||
- Edge cases covered?
|
||||
- Integration tests where needed?
|
||||
- All tests passing?
|
||||
|
||||
**Requirements:**
|
||||
- All plan requirements met?
|
||||
- Implementation matches spec?
|
||||
- No scope creep?
|
||||
- Breaking changes documented?
|
||||
|
||||
**Production Readiness:**
|
||||
- Migration strategy (if schema changes)?
|
||||
- Backward compatibility considered?
|
||||
- Documentation complete?
|
||||
- No obvious bugs?
|
||||
|
||||
## Output Format
|
||||
|
||||
### Strengths
|
||||
[What's well done? Be specific.]
|
||||
|
||||
### Issues
|
||||
|
||||
#### Critical (Must Fix)
|
||||
[Bugs, security issues, data loss risks, broken functionality]
|
||||
|
||||
#### Important (Should Fix)
|
||||
[Architecture problems, missing features, poor error handling, test gaps]
|
||||
|
||||
#### Minor (Nice to Have)
|
||||
[Code style, optimization opportunities, documentation improvements]
|
||||
|
||||
**For each issue:**
|
||||
- File:line reference
|
||||
- What's wrong
|
||||
- Why it matters
|
||||
- How to fix (if not obvious)
|
||||
|
||||
### Recommendations
|
||||
[Improvements for code quality, architecture, or process]
|
||||
|
||||
### Assessment
|
||||
|
||||
**Ready to merge?** [Yes/No/With fixes]
|
||||
|
||||
**Reasoning:** [Technical assessment in 1-2 sentences]
|
||||
|
||||
## Critical Rules
|
||||
|
||||
**DO:**
|
||||
- Categorize by actual severity (not everything is Critical)
|
||||
- Be specific (file:line, not vague)
|
||||
- Explain WHY issues matter
|
||||
- Acknowledge strengths
|
||||
- Give clear verdict
|
||||
|
||||
**DON'T:**
|
||||
- Say "looks good" without checking
|
||||
- Mark nitpicks as Critical
|
||||
- Give feedback on code you didn't review
|
||||
- Be vague ("improve error handling")
|
||||
- Avoid giving a clear verdict
|
||||
|
||||
## Example Output
|
||||
|
||||
```
|
||||
### Strengths
|
||||
- Clean database schema with proper migrations (db.ts:15-42)
|
||||
- Comprehensive test coverage (18 tests, all edge cases)
|
||||
- Good error handling with fallbacks (summarizer.ts:85-92)
|
||||
|
||||
### Issues
|
||||
|
||||
#### Important
|
||||
1. **Missing help text in CLI wrapper**
|
||||
- File: index-conversations:1-31
|
||||
- Issue: No --help flag, users won't discover --concurrency
|
||||
- Fix: Add --help case with usage examples
|
||||
|
||||
2. **Date validation missing**
|
||||
- File: search.ts:25-27
|
||||
- Issue: Invalid dates silently return no results
|
||||
- Fix: Validate ISO format, throw error with example
|
||||
|
||||
#### Minor
|
||||
1. **Progress indicators**
|
||||
- File: indexer.ts:130
|
||||
- Issue: No "X of Y" counter for long operations
|
||||
- Impact: Users don't know how long to wait
|
||||
|
||||
### Recommendations
|
||||
- Add progress reporting for user experience
|
||||
- Consider config file for excluded projects (portability)
|
||||
|
||||
### Assessment
|
||||
|
||||
**Ready to merge: With fixes**
|
||||
|
||||
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
||||
```
|
||||
Reference in New Issue
Block a user