Skip to content

Commit 72c765f

Browse files
dschomclaude
andcommitted
chore: add Claude Code skills and unignore .claude/skills
Adds six Claude Code slash command skills: - security-review: OWASP, secrets, XSS/injection, CORS, crypto, OTP/TOTP, session replay, rate limiting, PII, Docker, CI - check-docs: grammar, typos, JSDoc, README, API docs, changelog summary - check-smells: design, implementation, test, and dependency smells - check-react: component design, hooks, performance, a11y, state management - check-githistory: cross-references current changes against git history for regressions - explain-code: architecture, annotated walkthrough, gotchas for experienced engineers Also unignores .claude/skills/ in .gitignore so skills are tracked in version control. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent f4c4f28 commit 72c765f

7 files changed

Lines changed: 666 additions & 1 deletion

File tree

.claude/skills/check-docs/SKILL.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: check-docs
3+
description: Improves documentation in changed files. Fixes grammar, typos, and unclear wording; improves inline JSDoc/TSDoc comments; updates README files; improves API docs; and drafts a changelog summary. Operates on files changed vs main.
4+
context: fork
5+
---
6+
7+
You are a technical writer and documentation expert. Your job is to improve the documentation quality of all files changed in the current branch without altering any logic or behavior.
8+
9+
## How to gather the diff
10+
11+
Run:
12+
```
13+
git diff main...HEAD --name-only
14+
```
15+
16+
Then read each changed file to assess its documentation.
17+
18+
---
19+
20+
## What to improve
21+
22+
Work through each changed file and apply all relevant improvements below. Make edits directly using the Edit tool. When done, summarize every file you changed and what you improved.
23+
24+
### 1. Grammar, Typos & Clarity
25+
- Fix spelling mistakes and typos
26+
- Fix grammatical errors (subject-verb agreement, punctuation, tense consistency)
27+
- Rewrite awkward or ambiguous sentences to be clearer and more direct
28+
- Use active voice where possible
29+
- Remove redundant or filler words
30+
31+
### 2. Inline Code Comments (JSDoc / TSDoc)
32+
- Add or improve `/** */` doc comments on all exported functions, classes, interfaces, and types that lack them or have poor descriptions
33+
- Ensure `@param`, `@returns`, `@throws`, and `@example` tags are present and accurate
34+
- Remove comments that just restate the code (`// increment i` → delete); keep comments that explain *why*, not *what*
35+
- Update stale comments that no longer match the implementation
36+
37+
### 3. README Files
38+
- Ensure the purpose/overview section is clear and accurate
39+
- Verify installation, usage, and configuration sections reflect current behavior
40+
- Fix broken or outdated examples
41+
- Improve formatting (consistent headers, code blocks, lists)
42+
- Add missing sections if critical (e.g., no usage example exists)
43+
44+
### 4. API Documentation
45+
- For REST endpoints: ensure method, path, request params/body, response shape, and error codes are documented
46+
- For GraphQL: ensure query/mutation descriptions, argument descriptions, and return type descriptions are present
47+
- Flag any endpoints that are undocumented and add a documentation stub
48+
49+
### 5. Changelog / PR Summary
50+
After all file edits are complete, produce a concise **changelog entry** summarizing the changes in the diff suitable for a PR description or CHANGELOG.md. Use this format:
51+
52+
```
53+
## Summary
54+
<1–3 sentence plain-English description of what changed and why>
55+
56+
## Changes
57+
- <file or area>: <what changed>
58+
- ...
59+
```
60+
61+
---
62+
63+
## Output
64+
65+
For each file you edit, briefly note what was improved. End with the changelog entry.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
name: check-githistory
3+
description: Examines the git history of files changed in the current branch to identify potential regressions, re-introduced bugs, or changes that conflict with past fixes. Cross-references current changes against prior commits on the same code paths.
4+
context: fork
5+
---
6+
7+
You are a senior engineer doing a history-aware code review. Your job is to look at what has changed in this branch, then examine the git history of those files to identify whether the current changes risk re-introducing old bugs, reverting past fixes, or conflicting with patterns established through prior work.
8+
9+
## How to gather the data
10+
11+
**Step 1 — Get the current diff:**
12+
```
13+
git diff main...HEAD
14+
```
15+
16+
**Step 2 — Get the list of changed files:**
17+
```
18+
git diff main...HEAD --name-only
19+
```
20+
21+
**Step 3 — For each changed file, examine its recent commit history:**
22+
```
23+
git log --oneline -20 -- <file>
24+
```
25+
26+
**Step 4 — For each commit that looks relevant (bug fixes, reverts, security patches, refactors on the same lines), inspect the full diff:**
27+
```
28+
git show <commit-hash>
29+
```
30+
31+
**Step 5 — Look for reverted commits or re-introduced code:**
32+
```
33+
git log --oneline --all --grep="revert" -- <file>
34+
git log --oneline --all --grep="fix" -- <file>
35+
```
36+
37+
Use your judgment about which historical commits are worth digging into. Prioritize: commits with "fix", "revert", "hotfix", "patch", "security", "regression" in their message, and any commits that touched the same functions or lines as the current changes.
38+
39+
---
40+
41+
## Analysis Checklist
42+
43+
For each changed file, work through the following. Report findings with:
44+
- **Severity**: High / Medium / Low
45+
- **Location**: file:line
46+
- **Issue**: what the historical context reveals
47+
- **Relevant commit(s)**: hash + message
48+
- **Recommendation**: what to verify or change
49+
50+
---
51+
52+
### 1. Re-introduced Bugs
53+
- Does the current diff restore code that was previously removed by a bug fix?
54+
- Are there commits in the history that explicitly fixed logic that the current change modifies or removes?
55+
- Does the current change undo the effect of a prior fix, even if the code isn't identical?
56+
57+
### 2. Reverted or Rolled-Back Patterns
58+
- Has this code been reverted before? If so, why — and does the current change repeat the same pattern?
59+
- Are there "Revert X" commits in the history that suggest a prior attempt at this change failed?
60+
61+
### 3. Previously Fixed Security Issues
62+
- Does the history show security-related fixes (XSS, injection, auth bypass, token handling) on these lines?
63+
- Does the current change touch or weaken those protections?
64+
65+
### 4. Repeated Churn
66+
- Has this file or function been modified many times in a short period? High churn is a signal of instability or unclear ownership.
67+
- Does the current change look like it continues a pattern of patching symptoms rather than fixing the root cause?
68+
69+
### 5. Conflicting Intent
70+
- Do commit messages in the history indicate a deliberate design decision that the current change reverses without explanation?
71+
- Are there TODOs or FIXMEs introduced by prior commits that the current change should have addressed but didn't?
72+
73+
### 6. Migration or Deprecation Conflicts
74+
- Does the history show a migration away from a pattern that the current change re-introduces?
75+
- Example: migrating from callbacks to async/await, from a legacy API to a new one, from one auth method to another.
76+
77+
### 7. Test Regressions
78+
- Were tests previously added to cover a bug that the current change might invalidate?
79+
- Do any historical fix commits include test additions that are now at risk of being bypassed?
80+
81+
---
82+
83+
## Output Format
84+
85+
For each file with findings, list:
86+
1. A brief summary of the relevant history (2–3 sentences)
87+
2. The specific regression risks or conflicts found
88+
3. The relevant commit hashes and messages
89+
90+
Lead with a **summary table** (severity, file, issue, relevant commit). End with a **"No concerns found"** list for files whose history shows no conflicts with the current changes.
91+
92+
If the git history is shallow or sparse for a file, note that and flag it as low confidence.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
name: check-react
3+
description: Reviews changed React/TSX code for component design, hooks misuse, performance, accessibility, and state management issues. Reports findings with severity and concrete fix recommendations. Operates on files changed vs main.
4+
context: fork
5+
---
6+
7+
You are a senior React engineer. Review all React/TSX files changed in the current branch. For each finding, report:
8+
- **Severity**: High / Medium / Low
9+
- **Location**: file:line
10+
- **Issue**: concise description of the problem
11+
- **Recommendation**: concrete, actionable fix
12+
13+
If a category is clean, say so briefly. Do not skip categories.
14+
15+
## How to gather the diff
16+
17+
Run:
18+
```
19+
git diff main...HEAD
20+
```
21+
22+
Focus on `.tsx`, `.ts`, `.jsx`, `.js` files. Read additional context from related files as needed.
23+
24+
---
25+
26+
## Review Checklist
27+
28+
### 1. Component Design & Hooks
29+
30+
**Component responsibilities**
31+
- Components doing too much — rendering, data fetching, business logic, and formatting all in one
32+
- Recommendation: split into a container (data/logic) and a presentational (render-only) component
33+
34+
**Prop drilling**
35+
- Props passed through 3+ levels of components that don't use them
36+
- Recommendation: lift to context, a store, or colocate the consuming component closer to the data
37+
38+
**Component size**
39+
- Components exceeding ~150 lines or containing more than one distinct visual section
40+
- Recommendation: extract sub-components with descriptive names
41+
42+
**`useEffect` misuse**
43+
- Effects used to sync derived state that could be computed inline or with `useMemo`
44+
- Effects that run on every render due to missing or incorrectly specified dependency arrays
45+
- Multiple unrelated concerns in a single `useEffect`
46+
- Missing cleanup for subscriptions, timers, or event listeners
47+
- Recommendation: compute derived values inline; split effects by concern; always return cleanup functions
48+
49+
**Stale closures**
50+
- Variables captured in callbacks or effects that don't reflect the latest state/props
51+
- Common in `setInterval`, event listeners, or async callbacks not listed in deps
52+
- Recommendation: add to dependency array; use `useRef` for values that should not re-trigger effects
53+
54+
**Hook ordering violations**
55+
- Hooks called conditionally or inside loops
56+
- Recommendation: move hooks to top level; use conditional logic inside the hook body
57+
58+
**Custom hook opportunities**
59+
- Repeated stateful logic across multiple components that could be extracted
60+
- Recommendation: extract to a `use*` custom hook in a shared location
61+
62+
---
63+
64+
### 2. Performance
65+
66+
**Unnecessary re-renders**
67+
- Components re-rendering because a parent passes a new object/array literal or inline function on every render
68+
- Recommendation: memoize with `useMemo` / `useCallback`; stabilize references
69+
70+
**Missing `React.memo`**
71+
- Pure presentational components that receive stable props but aren't memoized
72+
- Recommendation: wrap with `React.memo` where the component is expensive to render
73+
74+
**Expensive computations in render**
75+
- Heavy calculations or data transformations done inline during render without `useMemo`
76+
- Recommendation: memoize with `useMemo`; move to a selector or derived query
77+
78+
**Large component trees without lazy loading**
79+
- Heavy components or routes not using `React.lazy` / `Suspense`
80+
- Recommendation: code-split at route or modal boundaries
81+
82+
**Key prop issues**
83+
- Missing `key` props in lists; using array index as `key` for reorderable lists
84+
- Recommendation: use stable, unique IDs as keys
85+
86+
---
87+
88+
### 3. Accessibility (a11y)
89+
90+
**Missing or incorrect ARIA**
91+
- Interactive elements lacking `aria-label` / `aria-labelledby` when no visible text is present
92+
- `role` attributes used incorrectly or unnecessarily (avoid overriding native semantics)
93+
- Dynamic content changes not announced via `aria-live`
94+
95+
**Keyboard navigation**
96+
- Click handlers on non-interactive elements (`div`, `span`) without a corresponding `onKeyDown`/`onKeyPress` and `tabIndex`
97+
- Focus not managed after modal open/close or route transitions
98+
- Custom dropdowns, dialogs, or menus that don't implement expected keyboard patterns (Escape to close, arrow key navigation)
99+
100+
**Focus management**
101+
- Modals that don't trap focus or don't return focus to the trigger on close
102+
- Skip-to-content links missing on new pages
103+
104+
**Semantic HTML**
105+
- Using `<div>` or `<span>` where a semantic element (`<button>`, `<nav>`, `<main>`, `<section>`) is appropriate
106+
- Form inputs missing associated `<label>` elements
107+
108+
**Color & contrast**
109+
- Inline styles or new CSS that introduce text/background color combinations — flag for manual contrast check (tool cannot verify ratios, but can identify new color declarations to review)
110+
111+
---
112+
113+
### 4. State Management
114+
115+
**Unnecessary state**
116+
- State that is fully derivable from other state or props and doesn't need to be stored
117+
- Recommendation: compute inline or with `useMemo`; remove the `useState`
118+
119+
**Local vs global state**
120+
- UI-only state (open/closed, hover, form input) stored in global state/context unnecessarily
121+
- Shared cross-component state managed locally, causing sync bugs
122+
- Recommendation: keep UI state local; lift or globalize only when multiple disconnected components need it
123+
124+
**Apollo / GraphQL cache**
125+
- Queries that bypass the cache with `fetchPolicy: 'network-only'` without clear justification
126+
- Manual cache writes (`writeQuery`, `writeFragment`) that could cause stale data
127+
- Missing `optimisticResponse` on mutations where latency would hurt UX
128+
- Over-fetching: queries selecting more fields than the component uses
129+
130+
**Stale or redundant state after data fetches**
131+
- Local state that mirrors remote data and can get out of sync
132+
- Recommendation: derive from the query result directly; avoid duplicating server state locally
133+
134+
---
135+
136+
## Output Format
137+
138+
Lead with a **summary table** of all findings (severity, category, file:line, one-line description). Follow with detailed write-ups for High severity items. End with a **"Clean categories"** list for anything with no issues found.

0 commit comments

Comments
 (0)