Skip to content
28 changes: 0 additions & 28 deletions .claude/commands/check.md

This file was deleted.

10 changes: 0 additions & 10 deletions .claude/commands/commit-push-pr.md

This file was deleted.

25 changes: 0 additions & 25 deletions .claude/commands/commit-push.md

This file was deleted.

20 changes: 0 additions & 20 deletions .claude/commands/pr.md

This file was deleted.

9 changes: 8 additions & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"permissions": {
"allow": ["Skill(code-review)", "Skill(glossary)"],
"allow": [
"Skill(lint-build-test)",
"Skill(code-review)",
"Skill(commit)",
"Skill(glossary)",
"Skill(pr)",
"Skill(push)"
],
"deny": ["Read(**/.env)", "Read(**/.env.*)"]
}
}
20 changes: 6 additions & 14 deletions .claude/commands/commit.md → .claude/skills/commit/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
---
name: commit
description: Optionally checks, then commits code to the current or a new feature branch.
argument-hint: check | force
allowed-tools:
- Bash(git branch*)
- Bash(git checkout*)
- Bash(git add*)
- Bash(git status*)
- Bash(git commit*)
- Bash(git diff*)
- Bash(git log*)
- Skill
model: claude-haiku-4-5
---

Arguments: $ARGUMENTS
When asked to commit code, follow these steps:

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.
## Arguments

Once ready, commit and push the code by following these steps:
- `check` (default): Run checks first to lint, build, and test the code. Stop if any checks fail.
- `force`: Skip the check step and commit directly.

## Steps

1. Run these bash commands in parallel to understand the current state:

Expand Down
43 changes: 43 additions & 0 deletions .claude/skills/lint-build-test/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: lint-build-test
description: How to check code by linting, building, and testing.
---

When asked to check, lint, build, or test code, follow these steps:

## 1. Analyze changed files

First, check which files have changed using `git status` or `git diff --name-only`.

Categorize the changes:

- **Source files**: `.ts`, `.js`, `.mts`, `.mjs`, `.cjs`, `.cts`, `.tsx`, `.jsx`
- **Meta files**: `.md`, `.yml`, `.yaml`, `.json`, `.html`

## 2. Determine what to run

Based on the changed files:

- **No files changed**: Nothing to do.
- **Only meta files changed**: Run only `yarn lint:misc --write` (or `yarn workspace <package-name> lint:misc --write` for a specific package).
- **Source files changed**: Run the full check (see below).

## 3. Run the full check (if needed)

### For a specific package

If a package name is specified (e.g. `@metamask/ocap-kernel`):

1. `yarn workspace <package-name> lint:fix`
2. `yarn workspace <package-name> build`
3. `yarn workspace <package-name> test:dev:quiet`

### For the entire monorepo

If no package is specified:

1. `yarn lint:fix`
2. `yarn build`
3. `yarn test:dev:quiet`

Report any errors encountered during these steps.
35 changes: 35 additions & 0 deletions .claude/skills/pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: pr
description: Creates a pull request for the current branch.
unsandboxed: true
---

When asked to create a pull request, follow these steps:

1. Run `git status`. If any of the following conditions apply, stop and report the errors:

- There are unstaged changes
- There are untracked files
- The current branch is the default branch (`main`)

2. Check if this is a stacked PR:

- Run `git merge-base main HEAD` to find the common ancestor with main
- Run `git log --oneline <merge-base>..HEAD` to see commits since diverging from main
- Check if any parent commits are on another feature branch (not main)
- If so, run `gh pr list --head <parent-branch>` to check if that branch has an open PR
- If a parent branch has an open PR, this is a **stacked PR**

3. Run `git log main..HEAD --oneline` to see the commit history.

4. Run `git diff` and/or `git show` as necessary to understand the changes.

5. Run `gh pr create` to create a pull request. The PR body should include:

- A brief narrative description of the PR
- A summary of the changes (bullet points)
- A brief description of how the code is tested (narrative, not a checklist)

**If this is a stacked PR**, add `--draft` to create it as a draft PR.

6. Return the PR URL and any relevant information.
18 changes: 18 additions & 0 deletions .claude/skills/push/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: push
description: Pushes the current branch to the remote repository.
unsandboxed: true
---

When asked to push code, follow these steps:

1. Run `git status` to verify there are commits to push.

2. Push to the remote repository:

- Run `git push` to push the commits
- If the branch has no upstream, use `git push -u origin <branch-name>`

3. Report the results including:
- The branch name
- The push status
Loading