claude: /pr

This commit is contained in:
Sridhar Ratnakumar 2025-10-13 16:24:19 -04:00
parent d20c23e519
commit bca0572d35
4 changed files with 65 additions and 108 deletions

View file

@ -1,60 +0,0 @@
---
name: c
description: Commit current changes
---
This command commits the current changes to git.
**Usage**: `/c [summary]`
**Parameters**:
- `summary` (optional): A brief description of the changes being committed. This will be used alongside the git diff analysis to generate a more accurate commit message.
**What it does**:
1. Runs a single `git add` command with all modified/new files as arguments (never on directories or '.')
2. Runs `git commit` to commit the staged changes
3. Never runs `git push` automatically
**Important constraints**:
- Claude should NEVER automatically commit changes unless this command is explicitly invoked
- Only adds individual files, never uses `git add .` or `git add <directory>`
- Use a single `git add` command with all files as arguments instead of multiple separate commands
- Never automatically pushes changes
- Never rewrites git history (no rebase, amend, reset --hard, etc.)
- Only commits when user explicitly runs this command
**Workflow**:
1. Check git status to identify modified and new files
2. Add all files in a single command using `git add <file1> <file2> <file3>...`
3. Analyze git diff to understand the changes made
4. Generate a meaningful commit message based on the actual changes
5. Run `git commit` with the generated message
6. Confirm successful commit
**Commit Message Generation**:
- Analyze the git diff to understand what changed
- If a user summary is provided, use it as context to better understand the intent behind the changes
- Create a concise, descriptive commit message that explains the purpose of the changes
- Focus on the "what" and "why" rather than generic descriptions
- Prefix the commit message with component (and subcomponent if it exists, separated by /), e.g., `claude-code/command/c: Include component path in commit message`
- Examples of good vs bad messages:
- Good: "tmux: Add configuration with custom key bindings"
- Bad: "Update home configuration"
- Good: "ssh: Fix broken agent forwarding in development environment"
- Bad: "Update configuration files"
- Good: "claude-code/command/c: Add commit message generation guidelines"
**Prerequisites**:
- Must be in a git repository
- Must have changes to commit
**Examples**:
```
/c
```
This will stage individual files and commit all current changes with an auto-generated commit message.
```
/c "Fix authentication bug"
```
This will commit changes with a message based on both the git diff analysis and the provided summary about fixing an authentication bug.

View file

@ -1,24 +0,0 @@
---
name: ci
description: Run local CI using omnix
---
This command runs the Nix project using omnix.
Steps:
1. Run `git add` to add any untracked files added by you **DO NOT COMMIT** changes.
2. Run `pre-commit run -a` to autoformat.
3. Run `om ci` to do a full build.
If `om ci` fails, fix all issues.
This will:
- Build all flake outputs, which includes:
- Run tests
- Check formatting
- Validate flake structure
- Perform other CI validations
Prerequisites:
- Must be in a flake-enabled project directory
- omnix (`om`) must be available in the environment

View file

@ -1,24 +0,0 @@
---
name: fastci
description: Run fast CI for Haskell projects
---
This command runs a fast CI pipeline for Haskell projects using Cabal.
Steps:
1. Run `git add <FILE>` (*NOT* `git add .`) to add any untracked files added by you **DO NOT COMMIT** changes.
1. Fix all hlint warnings
1. Ensure it builds (`cabal build all`) *AND* fix all GHC warnings
1. Ensure tests pass: `cabal test all`
1. Run `pre-commit run -a` to autoformat.
This will:
- Clean up code by fixing compiler and linter warnings
- Validate formatting and pre-commit hooks
- Ensure the project builds successfully
- Run the full test suite
Prerequisites:
- Must be in a Haskell project directory with cabal.project or *.cabal files
- GHC, Cabal, and hlint must be available in the Nix devShell environment
- pre-commit must be configured for the project

View file

@ -0,0 +1,65 @@
# PR Command
Create and open a draft pull request on GitHub for the current branch.
## Workflow
1. **Gather Information**
- Get the current branch name using `git branch --show-current`
- Get the default branch (usually `main` or `master`) using `git remote show origin | grep 'HEAD branch'`
- Analyze recent commits on this branch (not in default branch) to understand changes
- Review changed files to understand the scope of changes
2. **Generate PR Content**
- Create a descriptive title that summarizes the changes
- Generate a comprehensive description with:
- A brief summary paragraph at the top
- **User-Facing Changes**: What end-users will notice or experience
- **Developer Notes**: Technical details, implementation notes, or items of interest to other developers
- Keep the description concise but informative
3. **Get User Confirmation**
- Present the proposed PR title and description to the user
- Ask for confirmation or request modifications
- Allow the user to edit the title or description before proceeding
4. **Create Draft PR**
- Once confirmed, use the `gh` CLI to create a draft PR:
```bash
gh pr create --draft --title "TITLE" --body "DESCRIPTION"
```
- Report the PR URL to the user
## Requirements
- The `gh` CLI must be installed and authenticated (if not installed, use `nix run nixpkgs#gh` to run it)
- The repository must have a remote configured on GitHub
- The current branch must have commits that aren't in the default branch
## Example Output Format
```
PR Title: Add new authentication system
PR Description:
This PR introduces a modern OAuth-based authentication system alongside improved password management, enhancing both security and user experience.
## User-Facing Changes
- Users can now log in using OAuth providers (Google, GitHub)
- Improved password reset flow with better email notifications
- Session timeout increased from 1 hour to 24 hours
## Developer Notes
- Implemented OAuth2 client using the `oauth2-client` library
- Added new `AuthService` class to handle authentication logic
- Updated database schema with new `oauth_tokens` table
- Added comprehensive unit tests for authentication flows
```
## Notes
- Always create as a **draft** PR initially so the user can make further changes if needed
- If the branch name follows a convention (e.g., `feature/`, `fix/`), incorporate that context into the title
- If there are uncommitted changes, warn the user before proceeding