Skip to content

Commit be89d42

Browse files
rekmarksclaudegithub-actions[bot]
authored
chore: Add Claude Code commands for common development and git workflows (#725)
Adds Claude commands for common development and git workflows: `/check`, `/commit-push`, `/pr`, and `/commit-push-pr` How and whether these commands work may depend on your local Claude Code setup, especially if `sandbox.enabled` is `true`. Claude can help debug any issues you're experiencing on your system. `/check` should always work. A handful of package scripts are made quieter on success in order to preserve our precious tokens. Note that these are [custom slash commands](https://code.claude.com/docs/en/slash-commands#custom-slash-commands), which is not the same as [skills](https://code.claude.com/docs/en/skills). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds Claude Code automation and streamlines package scripts for lower-noise CI/local runs. > > - **New commands**: `/.claude/commands/{check,commit-push,pr,commit-push-pr}.md` for lint/build/test, commit/push, and PR creation workflows > - **Script noise reduction**: switch `depcheck` to `--quiet`, add `prettier --log-level error`, use `vitest --reporter dot` for `test:dev`, and silence root `yarn dedupe` stdout > - **Repo constraints updated**: `yarn.config.cjs` expectations aligned with the new `lint:*` and `test:*` script values across all packages > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0814ffa. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Erik Marks <[email protected]>
1 parent 019e18c commit be89d42

File tree

30 files changed

+193
-79
lines changed

30 files changed

+193
-79
lines changed

.claude/commands/check.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: check
3+
description: Lints, builds, and tests the code.
4+
argument-hint: [package-name]
5+
allowed-tools:
6+
- Bash(yarn lint*)
7+
- Bash(yarn build*)
8+
- Bash(yarn test*)
9+
- Bash(yarn workspace *)
10+
model: claude-haiku-4-5
11+
---
12+
13+
Run the following commands to check the current state of the code:
14+
15+
If `$ARGUMENTS` is provided (e.g. `@metamask/ocap-kernel`), run the commands in
16+
that workspace using `yarn workspace $ARGUMENTS`:
17+
18+
1. `yarn workspace $ARGUMENTS lint:fix`
19+
2. `yarn workspace $ARGUMENTS build`
20+
3. `yarn workspace $ARGUMENTS test:dev`
21+
22+
If `$ARGUMENTS` is empty, run the commands at the monorepo root:
23+
24+
1. `yarn lint:fix`
25+
2. `yarn build`
26+
3. `yarn test:dev`
27+
28+
Return the results of the commands.

.claude/commands/commit-push-pr.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: commit-push-pr
3+
description: Optionally checks, then commits and pushes code to the remote repository, and creates a pull request.
4+
argument-hint: check | force
5+
allowed-tools:
6+
- Skill
7+
model: claude-haiku-4-5
8+
---
9+
10+
Run `/commit-push $ARGUMENTS` then `/pr`.

.claude/commands/commit-push.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: commit-push
3+
description: Optionally checks, then commits and pushes code to the remote repository.
4+
argument-hint: check | force
5+
allowed-tools:
6+
- Bash(git branch*)
7+
- Bash(git checkout*)
8+
- Bash(git add*)
9+
- Bash(git status*)
10+
- Bash(git commit*)
11+
- Bash(git push*)
12+
- Bash(git diff*)
13+
- Bash(git log*)
14+
- Skill
15+
model: claude-haiku-4-5
16+
---
17+
18+
Arguments: $ARGUMENTS
19+
20+
If the argument is "force", skip the check step. Otherwise (default), run the `/check` command first to lint, build, and test the code. If any of the checks fail, stop and report the errors.
21+
22+
Once ready, commit and push the code by following these steps:
23+
24+
1. Run these bash commands in parallel to understand the current state:
25+
26+
- `git status` to see all untracked files
27+
- `git diff HEAD` to see both staged and unstaged changes
28+
- `git log --oneline -10` to see recent commit messages for style consistency
29+
30+
2. If you are on the `main` branch, create a new feature branch using `git branch` and switch to it.
31+
32+
3. Analyze all changes and draft a commit message:
33+
34+
- Summarize the nature of the changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.)
35+
- Use the conventional commit format: `type(scope): description`
36+
- Keep the first line under 72 characters
37+
- Do not commit files that likely contain secrets (.env, credentials.json, etc.)
38+
39+
4. Stage and commit the changes:
40+
41+
- Add relevant files using `git add`
42+
- Create the commit with a message ending with:
43+
```
44+
Co-Authored-By: Claude <[email protected]>
45+
```
46+
- Use a HEREDOC for the commit message to ensure proper formatting
47+
48+
5. Push to the remote repository:
49+
50+
- Run `git push` to push the commit
51+
- If the branch has no upstream, use `git push -u origin <branch-name>`
52+
53+
6. Report the results including:
54+
- The commit hash
55+
- The commit message
56+
- The push status

.claude/commands/pr.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: pr
3+
description: Creates a pull request for the current branch.
4+
allowed-tools:
5+
- Bash(git status*)
6+
- Bash(git log*)
7+
- Bash(git show*)
8+
- Bash(git diff*)
9+
- Bash(gh pr create*)
10+
model: claude-haiku-4-5
11+
---
12+
13+
1. Run `git status`. If any of the following conditions apply, stop and report the errors:
14+
- There are unstaged changes
15+
- There are untracked files
16+
- The current branch is the default branch (`main`)
17+
2. Run `git log main..HEAD --oneline` to see the commit history.
18+
3. Run `git diff` and/or `git show` as necessary to understand the changes.
19+
4. Run `gh pr create` to create a pull request.
20+
5. Return the results of the commands.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./.turbo && yarn workspaces foreach --all --parallel --interlaced --verbose run clean",
2121
"create-package": "tsx packages/create-package/src/index.ts",
2222
"lint": "yarn constraints && yarn lint:eslint && yarn lint:misc --check && yarn lint:dependencies",
23-
"lint:dependencies": "yarn dedupe --check && yarn depcheck && yarn workspaces foreach --all --parallel --verbose run lint:dependencies",
24-
"lint:dependencies:fix": "yarn dedupe && yarn depcheck && yarn workspaces foreach --all --parallel --verbose run lint:dependencies",
23+
"lint:dependencies": "yarn dedupe --check >/dev/null && yarn depcheck --quiet && yarn workspaces foreach --all --parallel --verbose run lint:dependencies",
24+
"lint:dependencies:fix": "yarn dedupe >/dev/null && yarn depcheck --quiet && yarn workspaces foreach --all --parallel --verbose run lint:dependencies",
2525
"lint:eslint": "yarn eslint . --cache",
2626
"lint:fix": "yarn constraints --fix && yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:dependencies:fix",
27-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '**/*.yml' '!**/CHANGELOG.old.md' '!.yarnrc.yml' '!CLAUDE.md' '!merged-packages/**' --ignore-path .gitignore",
27+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '**/*.yml' '!**/CHANGELOG.old.md' '!.yarnrc.yml' '!CLAUDE.md' '!merged-packages/**' --ignore-path .gitignore --log-level error",
2828
"postinstall": "simple-git-hooks && yarn rebuild:native",
2929
"prepack": "./scripts/prepack.sh",
3030
"pretest": "bash scripts/reset-coverage-thresholds.sh",
3131
"rebuild:native": "./scripts/rebuild-native.sh",
3232
"test": "yarn pretest && vitest run",
3333
"test:ci": "vitest run --coverage false",
34-
"test:dev": "yarn test --mode development",
34+
"test:dev": "yarn test --mode development --reporter dot",
3535
"test:e2e": "yarn workspaces foreach --all run test:e2e",
3636
"test:e2e:ci": "yarn workspaces foreach --all run test:e2e:ci",
3737
"test:verbose": "yarn test --reporter verbose",

packages/brow-2-brow/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/brow-2-brow",
1616
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo",
1717
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
18-
"lint:dependencies": "depcheck",
18+
"lint:dependencies": "depcheck --quiet",
1919
"lint:eslint": "eslint . --cache",
2020
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
21-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
21+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error",
2222
"test": "vitest run --config vitest.config.ts",
2323
"test:clean": "yarn test --no-cache --coverage.clean",
24-
"test:dev": "yarn test --mode development",
24+
"test:dev": "yarn test --mode development --reporter dot",
2525
"test:verbose": "yarn test --reporter verbose",
2626
"test:watch": "vitest --config vitest.config.ts",
2727
"start": "npm run build:dev && esbuild src/index.js --serve --sourcemap --bundle --outdir=dist --servedir=dist --external:@types/web",

packages/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/cli",
2121
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo",
2222
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
23-
"lint:dependencies": "depcheck",
23+
"lint:dependencies": "depcheck --quiet",
2424
"lint:eslint": "eslint . --cache",
2525
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
26-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
26+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error",
2727
"publish:preview": "yarn npm publish --tag preview",
2828
"test": "vitest run --config vitest.config.ts",
2929
"test:clean": "yarn test --no-cache --coverage.clean",
30-
"test:dev": "yarn test --mode development",
30+
"test:dev": "yarn test --mode development --reporter dot",
3131
"test:verbose": "yarn test --reporter verbose",
3232
"test:watch": "vitest --config vitest.config.ts",
3333
"test:integration": "vitest run --config vitest.integration.config.ts"

packages/create-package/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/create-package",
3434
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo",
3535
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
36-
"lint:dependencies": "depcheck",
36+
"lint:dependencies": "depcheck --quiet",
3737
"lint:eslint": "eslint . --cache",
3838
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
39-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
39+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error",
4040
"publish:preview": "yarn npm publish --tag preview",
4141
"test": "vitest run --config vitest.config.ts",
4242
"test:clean": "yarn test --no-cache --coverage.clean",
43-
"test:dev": "yarn test --mode development",
43+
"test:dev": "yarn test --mode development --reporter dot",
4444
"test:verbose": "yarn test --reporter verbose",
4545
"test:watch": "vitest --config vitest.config.ts"
4646
},

packages/extension/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/extension",
2424
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist ./.turbo",
2525
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
26-
"lint:dependencies": "depcheck",
26+
"lint:dependencies": "depcheck --quiet",
2727
"lint:eslint": "eslint . --cache",
2828
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
29-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
29+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error",
3030
"publish:preview": "yarn npm publish --tag preview",
3131
"postinstall": "yarn playwright install chromium",
3232
"start": "./scripts/start.sh",
3333
"test": "vitest run --config vitest.config.ts",
3434
"test:build": "tsx ./test/build/build-tests.ts",
3535
"test:clean": "yarn test --no-cache --coverage.clean",
36-
"test:dev": "yarn test --mode development",
36+
"test:dev": "yarn test --mode development --reporter dot",
3737
"test:verbose": "yarn test --reporter verbose",
3838
"test:watch": "vitest --config vitest.config.ts",
3939
"test:e2e": "yarn playwright test",

packages/kernel-agents/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@
5454
"changelog:validate": "../../scripts/validate-changelog.sh @ocap/kernel-agents",
5555
"clean": "rimraf --glob './*.tsbuildinfo' ./.eslintcache ./coverage ./dist",
5656
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies",
57-
"lint:dependencies": "depcheck",
57+
"lint:dependencies": "depcheck --quiet",
5858
"lint:eslint": "eslint . --cache",
5959
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies",
60-
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore",
60+
"lint:misc": "prettier --no-error-on-unmatched-pattern '**/*.json' '**/*.md' '**/*.html' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path ../../.gitignore --log-level error",
6161
"publish:preview": "yarn npm publish --tag preview",
6262
"test": "vitest run --config vitest.config.ts",
6363
"test:e2e": "vitest run --config vitest.config.e2e.ts",
6464
"test:clean": "yarn test --no-cache --coverage.clean",
65-
"test:dev": "yarn test --mode development",
65+
"test:dev": "yarn test --mode development --reporter dot",
6666
"test:verbose": "yarn test --reporter verbose",
6767
"test:watch": "vitest --config vitest.config.ts"
6868
},

0 commit comments

Comments
 (0)