Skip to content

Commit fb5010d

Browse files
balzssclaude
andcommitted
chore: improve Claude Code config and docs
- Rewrite CLAUDE.md as a minimal, non-derivable reference (~45 lines, down from 200+). - Tighten /commit and /pr slash commands: pin gh to --body-file -, drop CI-covered items from test plan, note commitlint's 100-char body line limit. - Add .claude/settings.json with a read-only safe-command allowlist (git/pnpm/gh/file-search). - Ignore CLAUDE.local.md for personal overrides. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 84f11c1 commit fb5010d

5 files changed

Lines changed: 125 additions & 266 deletions

File tree

.claude/commands/commit.md

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,41 @@
22
description: Create a commit following InstUI conventions with HUSKY=0
33
---
44

5-
Create a commit following the Instructure UI commit conventions:
5+
Commit staged + relevant unstaged changes using Conventional Commits.
66

7-
## Format Requirements
8-
9-
Use Conventional Commits format:
7+
## Format
108

119
```
12-
type(scope): subject
13-
14-
[optional body]
15-
Document any breaking changes here with BREAKING CHANGE: prefix
16-
17-
[optional footer]
18-
```
19-
20-
**Types**: feat, fix, docs, style, refactor, test, chore
10+
type(scope): imperative subject
2111
22-
**Scope**: Full package name as-is (e.g., ui-button, ui-select). Use comma-separated for multiple packages, `many` for many packages, or omit for repo-wide changes.
12+
<optional body>
2313
24-
**Subject**: Brief imperative description (e.g., "add loading state", not "adds" or "added")
14+
BREAKING CHANGE: <only if applicable>
2515
26-
## Breaking Changes
27-
28-
Mark breaking changes with an exclamation mark after scope and document in body:
29-
30-
```
31-
feat(ui-select)!: remove deprecated onOpen prop
16+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
3217
33-
BREAKING CHANGE: The onOpen prop has been removed. Use onShowOptions instead.
18+
Co-Authored-By: Claude <noreply@anthropic.com>
3419
```
3520

36-
Breaking changes include:
37-
38-
- Removing/renaming props or components
39-
- Changing prop types or behavior
40-
- Changing defaults that affect behavior
41-
- Removing theme variables or exports
42-
43-
## Commit Footer
44-
45-
Always include:
21+
- **type**: one of `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. `commitlint.config.js` extends [`@commitlint/config-conventional`](https://www.npmjs.com/package/@commitlint/config-conventional), which defines the allowed set — pick the type that genuinely matches the change (`feat`/`fix` only for actual features/bug fixes).
22+
- **scope**: full package name (`ui-button`, `ui-select`). Comma-separate for a few, use `many` for several, omit for repo-wide.
23+
- **subject**: imperative ("add loading state", not "added"). Must start with a lowercase letter (commitlint's `subject-case` rejects sentence/Start/PascalCase). No trailing period.
24+
- **Body lines: hard-wrap at 100 characters.** Commitlint (`body-max-line-length: 100`) runs in CI and will reject longer lines. The footer lines (Claude Code attribution, Co-Authored-By) are exempt.
25+
- **Breaking changes**: add a `BREAKING CHANGE:` line in the body describing what breaks. See CLAUDE.md for what counts as breaking.
4626

47-
```
48-
🤖 Generated with [Claude Code](https://claude.com/claude-code)
27+
## Steps
4928

50-
Co-Authored-By: Claude <noreply@anthropic.com>
51-
```
29+
1. `git status` + `git diff` (and `git diff --staged` if anything's staged). **Abort if on `master`** — commit on a feature branch instead.
30+
2. Stage the files that belong in this commit — be specific, don't `git add -A`.
31+
3. Commit with `HUSKY=0` to skip the interactive husky prompt:
5232

53-
## Process
33+
```bash
34+
HUSKY=0 git commit -m "$(cat <<'EOF'
35+
<message>
36+
EOF
37+
)"
38+
```
5439
55-
1. Run `git status` and `git diff` to see changes
56-
2. Analyze the changes and draft appropriate commit message
57-
3. Add files to staging if needed: `git add <files>`
58-
4. Create commit with `HUSKY=0 git commit -m "$(cat <<'EOF'
59-
[commit message here with proper footer]
60-
EOF
61-
)"`
62-
5. Run `git status` after to verify
40+
4. `git status` to confirm.
6341
64-
**Important**: Use HUSKY=0 prefix to skip interactive prompt since AI can't interact with it.
42+
If the husky hook fails, fix the underlying issue and create a **new** commit — never `--amend` after a failed hook.

.claude/commands/pr.md

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,50 @@
22
description: Create a pull request following InstUI conventions
33
---
44

5-
Create a pull request following Instructure UI conventions:
5+
Open a PR for the current branch.
66

7-
## PR Requirements
7+
## Steps
88

9-
All PRs must include:
9+
1. `git status` — confirm branch + remote tracking. **Abort** if on `master` or if the branch has no commits ahead of `master` (`git rev-list --count master..HEAD` is 0) — there's nothing to open a PR for.
10+
2. `git log master..HEAD` and `git diff master...HEAD` — read **all** commits in the branch (not just the latest) so the summary covers everything that's changed.
11+
3. If not pushed: `git push -u origin <branch>`.
12+
4. Create the PR (see invocation below).
13+
5. Return the PR URL.
1014

11-
1. **Summary**: Brief description of changes (1-3 bullet points)
12-
2. **Test Plan**: Clear steps for reviewers to test the changes
13-
3. **Jira Reference**: Include relevant Jira ticket number if applicable (e.g., `Fixes INST-1234`)
14-
4. **AI Disclosure**: Must clearly indicate this was created with AI assistance
15+
If the branch name or any commit references a Jira ticket (e.g. `INSTUI-1234`), include it. If you can't find one, ask the user once before opening — don't invent one.
1516

16-
## Draft vs Ready
17+
## gh invocation
1718

18-
- Open as **draft** when work is in progress or not ready for review
19-
- Mark as **ready for review** only when complete and all requirements met
19+
Use `--body-file -` with a heredoc on stdin. This avoids shell-quoting issues and is the form supported by current `gh` versions. If unsure about flags, run `gh pr create --help` first — do **not** fall back to older forms like `gh pr create -t ... -b ...` with inline `-b`.
2020

21-
## Process
22-
23-
1. Run `git status` to check current branch and remote tracking
24-
2. Run `git log master..HEAD` to see all commits that will be in the PR
25-
3. Run `git diff master...HEAD` to see full diff from base branch
26-
4. Analyze changes across ALL commits (not just latest)
27-
5. Draft PR summary covering all changes
28-
6. **If Jira ticket number is unknown, ask the user for it before creating the PR**
29-
7. Push to remote if needed: `git push -u origin <branch>`
30-
8. Create PR with `gh pr create --title "title" --body "$(cat <<'EOF'
21+
```bash
22+
gh pr create --title "<title>" --body-file - <<'EOF'
23+
<body>
24+
EOF
25+
```
3126

32-
## Summary
27+
Open as draft (`--draft`) if the work is in progress.
3328

34-
- Bullet point 1
35-
- Bullet point 2
29+
## Body format
3630

37-
## Test Plan
31+
Keep it **short**. No preamble, no restating the title, no "this PR does X" filler.
3832

39-
- [ ] Step 1
40-
- [ ] Step 2
33+
```
34+
## Summary
35+
- <one line per logically distinct change; 1–4 bullets total>
4136
42-
## Jira Reference
37+
## Test Plan
38+
- <only manual / non-CI checks a reviewer should do>
4339
44-
Fixes INST-XXXX (or omit this section if not applicable)
40+
Fixes INSTUI-XXXX
4541
4642
🤖 Generated with [Claude Code](https://claude.com/claude-code)
47-
EOF
48-
)"` 9. Return the PR URL
43+
```
4944

50-
**Important**:
45+
Rules:
5146

52-
- Base branch is usually `master` (not main)
53-
- Analyze ALL commits in the branch, not just the latest one
54-
- Use markdown checklists for test plan
55-
- Include AI attribution footer
56-
- Always confirm Jira ticket number with user if not found in commits or branch name
47+
- **Summary**: terse bullets. Each bullet is one change, not a paragraph. Skip context the diff already shows.
48+
- **Test Plan**: only what CI **doesn't** cover — manual UI checks, RTL, a11y spot-checks, visual regression cases to look at, edge cases worth poking. Never include "tests pass", "lint passes", "types check", "build succeeds" — CI runs those.
49+
- If there's genuinely nothing to manually verify (e.g. pure refactor with full test coverage), write `- No manual verification needed; covered by existing tests.` and move on.
50+
- Omit the `Fixes` line entirely if no ticket applies. Don't write `Fixes INSTUI-XXXX (or omit if not applicable)`.
51+
- Keep the Claude Code footer.

.claude/settings.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(git status:*)",
5+
"Bash(git diff:*)",
6+
"Bash(git log:*)",
7+
"Bash(git show:*)",
8+
"Bash(git branch:*)",
9+
"Bash(git blame:*)",
10+
"Bash(git stash list:*)",
11+
"Bash(pnpm run lint)",
12+
"Bash(pnpm run lint:changes)",
13+
"Bash(pnpm run lint:commits)",
14+
"Bash(pnpm run ts:check)",
15+
"Bash(pnpm run test:vitest)",
16+
"Bash(pnpm run test:vitest *)",
17+
"Bash(pnpm list:*)",
18+
"Bash(pnpm why:*)",
19+
"Bash(ls:*)",
20+
"Bash(find:*)",
21+
"Bash(grep:*)",
22+
"Bash(rg:*)",
23+
"Bash(tree:*)",
24+
"Bash(wc:*)",
25+
"Bash(pwd)",
26+
"Bash(node --version)",
27+
"Bash(pnpm --version)",
28+
"Bash(gh pr view:*)",
29+
"Bash(gh pr list:*)",
30+
"Bash(gh pr diff:*)",
31+
"Bash(gh pr checks:*)",
32+
"Bash(gh issue view:*)",
33+
"Bash(gh issue list:*)",
34+
"Bash(gh api:*)",
35+
"Bash(gh --help)",
36+
"Bash(gh * --help)"
37+
]
38+
}
39+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ tsconfig.node.build.tsbuildinfo
2828
.claude/settings.local.json
2929
.claude/cache/
3030
.claude/*.local.*
31+
CLAUDE.local.md
3132

3233
# Ignore all commands except shared ones
3334
.claude/commands/*

0 commit comments

Comments
 (0)