@robosoft/skillhub-cli 0.1.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +21 -21
  2. package/README.md +166 -184
  3. package/bin/skillhub.mjs +734 -364
  4. package/docs/skillhub-cli-logic.md +115 -83
  5. package/package.json +8 -5
  6. package/skillhub-registry/CHANGELOG.md +65 -0
  7. package/skillhub-registry/CLAUDE.md +108 -0
  8. package/skillhub-registry/README.md +196 -16
  9. package/skillhub-registry/docs/cheat-sheet.md +272 -0
  10. package/skillhub-registry/docs/contributing.md +166 -0
  11. package/skillhub-registry/docs/cost-hygiene.md +175 -0
  12. package/skillhub-registry/docs/customization.md +321 -0
  13. package/skillhub-registry/docs/exception-process.md +194 -0
  14. package/skillhub-registry/docs/installation.md +277 -0
  15. package/skillhub-registry/domain/api.md +303 -0
  16. package/skillhub-registry/domain/frontend/web-app.md +17 -0
  17. package/skillhub-registry/domain/frontend-app.md +46 -0
  18. package/skillhub-registry/domain/frontend-architecture.md +126 -0
  19. package/skillhub-registry/rules/anti-patterns.md +95 -0
  20. package/skillhub-registry/rules/code-standards.md +182 -0
  21. package/skillhub-registry/rules/frontend/antipattern.md +21 -0
  22. package/skillhub-registry/rules/frontend/component-standards.md +10 -0
  23. package/skillhub-registry/rules/frontend-app.md +24 -0
  24. package/skillhub-registry/rules/general.md +51 -0
  25. package/skillhub-registry/skills/api/SKILL.md +167 -0
  26. package/skillhub-registry/skills/build/SKILL.md +114 -0
  27. package/skillhub-registry/skills/fast/SKILL.md +56 -0
  28. package/skillhub-registry/skills/feature-dev/SKILL.md +166 -0
  29. package/skillhub-registry/skills/frontend/app/SKILL.md +28 -0
  30. package/skillhub-registry/skills/frontend/app/rules/main.md +6 -0
  31. package/skillhub-registry/skills/frontend/app/skill.json +10 -0
  32. package/skillhub-registry/skills/frontend/app/templates/feature/{{kebabName}}.tsx.hbs +11 -0
  33. package/skillhub-registry/skills/frontend-app/SKILL.md +48 -0
  34. package/skillhub-registry/skills/frontend-app/rules/main.md +6 -0
  35. package/skillhub-registry/skills/frontend-app/skill.json +11 -0
  36. package/skillhub-registry/skills/frontend-app/templates/feature/{{kebabName}}.tsx.hbs +11 -0
  37. package/skillhub-registry/skills/performance/SKILL.md +168 -0
  38. package/skillhub-registry/skills/react/SKILL.md +224 -0
  39. package/skillhub-registry/skills/refactor/SKILL.md +149 -0
  40. package/skillhub-registry/skills/review/SKILL.md +199 -0
  41. package/skillhub-registry/skills/strict/SKILL.md +74 -0
  42. package/skillhub-registry/skills/testing/SKILL.md +132 -0
  43. package/skillhub-registry/accessibility-review/1.0.0/SKILL.md +0 -22
  44. package/skillhub-registry/accessibility-review/1.0.0/checklist/ui-review.md +0 -8
  45. package/skillhub-registry/accessibility-review/1.0.0/skill.json +0 -9
  46. package/skillhub-registry/nextjs-clean-architecture/1.0.0/SKILL.md +0 -37
  47. package/skillhub-registry/nextjs-clean-architecture/1.0.0/checklist/definition-of-done.md +0 -9
  48. package/skillhub-registry/nextjs-clean-architecture/1.0.0/rules/folder-structure.md +0 -7
  49. package/skillhub-registry/nextjs-clean-architecture/1.0.0/skill.json +0 -9
  50. package/skillhub-registry/shadcn-crud-generator/1.0.0/SKILL.md +0 -25
  51. package/skillhub-registry/shadcn-crud-generator/1.0.0/skill.json +0 -9
  52. package/skillhub-registry/shadcn-crud-generator/1.0.0/templates/feature/actions.ts.hbs +0 -16
  53. package/skillhub-registry/shadcn-crud-generator/1.0.0/templates/feature/page.tsx.hbs +0 -13
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: react
3
+ description: Comprehensive React development standards including component structure, hooks usage, state management, rendering patterns, event handling, and React-specific anti-patterns. Use this skill whenever the user works with React, JSX, TSX, React components, hooks (useState, useEffect, useMemo, useCallback, custom hooks), Next.js, Remix, Vite+React, or any React-related library. Apply when reviewing React code, building React components, debugging React rendering issues, refactoring React applications, writing React tests, or discussing React architecture decisions. Trigger even when React is implied by file extensions (.jsx, .tsx) or component-style code, even if the user does not explicitly mention "React".
4
+ ---
5
+
6
+ # React Frontend Skill
7
+
8
+ This skill applies the org's React standards. It loads when the task involves React, JSX/TSX, hooks, or React-adjacent libraries.
9
+
10
+ These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md` — which still apply. This file adds React-specific guidance.
11
+
12
+ ---
13
+
14
+ ## Components
15
+
16
+ - Use **functional components only**. No class components in new code.
17
+ - Components must do **one thing**. If a component file exceeds ~150 lines or has more than ~5 hooks, split it.
18
+ - **Props are the contract.** Type them explicitly. No untyped `any` props.
19
+ - **Props should be flat where possible** — avoid deeply nested object props that obscure the API.
20
+ - **Default exports only for the primary component** of a file. Use named exports for helpers, sub-components, and types.
21
+
22
+ ## Hooks
23
+
24
+ - **`useState`** — local component state only. For shared state, lift to parent or use a state library.
25
+ - **`useEffect`** — side effects only (fetching, subscriptions, manual DOM). Never use `useEffect` to derive state from props/state — compute it directly during render.
26
+ - **`useMemo` / `useCallback`** — only when (a) the value is passed to a memoized child, (b) it's a dependency of another hook, or (c) profiling shows a measurable gain. **Never wrap primitives.**
27
+ - **Custom hooks** — extract reusable logic when used in 3+ places. Name with `use` prefix.
28
+ - **Dependency arrays must be exhaustive.** No suppressing the linter unless documented why.
29
+
30
+ ## State Management
31
+
32
+ - **Default to local state.** Lift only when needed by a sibling.
33
+ - **Context** for genuinely global app state (theme, auth, locale) — not a substitute for prop drilling that's only 2-3 levels.
34
+ - **External state library** (Zustand, Redux Toolkit, Jotai) when state is shared across many distant components, or when state changes need to be observed outside the React tree.
35
+ - **Server state** belongs in a server-state library (TanStack Query, SWR), not in `useState`.
36
+
37
+ ## Rendering
38
+
39
+ - **Conditional rendering** uses simple expressions:
40
+ - `condition && <Component />` for show/hide
41
+ - `condition ? <A /> : <B />` for either/or
42
+ - Extract to a variable or early return for anything more complex
43
+ - **Lists must use stable keys.** Never use array index as key when the list can reorder, filter, or have items inserted/removed.
44
+ - **No inline complex logic in JSX.** Extract to a named variable or helper function above the return.
45
+
46
+ ```jsx
47
+ // ❌ Bad — complex inline logic
48
+ return (
49
+ <div>
50
+ {users.filter(u => u.active && u.role === 'admin' && !u.banned)
51
+ .sort((a, b) => b.lastLogin - a.lastLogin)
52
+ .slice(0, 5)
53
+ .map(u => <UserCard key={u.id} user={u} />)}
54
+ </div>
55
+ );
56
+
57
+ // ✅ Good — named, testable, readable
58
+ const topActiveAdmins = getTopActiveAdmins(users, 5);
59
+
60
+ return (
61
+ <div>
62
+ {topActiveAdmins.map(u => <UserCard key={u.id} user={u} />)}
63
+ </div>
64
+ );
65
+ ```
66
+
67
+ ## Events
68
+
69
+ - **Named handlers, not inline functions** for non-trivial logic.
70
+ - **Handler naming convention:** `handle<Event>` for the function, `on<Event>` for the prop.
71
+ - `handleSubmit` is the function inside the component
72
+ - `onSubmit` is what the prop is called
73
+
74
+ ```jsx
75
+ // ✅ Good
76
+ function ContactForm({ onSubmit }) {
77
+ const handleSubmit = (e) => {
78
+ e.preventDefault();
79
+ onSubmit(formData);
80
+ };
81
+
82
+ return <form onSubmit={handleSubmit}>...</form>;
83
+ }
84
+ ```
85
+
86
+ ## Data Flow
87
+
88
+ - **One-way data flow:** parent → child via props.
89
+ - **Children communicate up via callbacks** passed as props.
90
+ - **No prop mutation.** Treat props as read-only.
91
+ - **Avoid prop drilling beyond 3 levels.** Lift state, use context, or restructure components.
92
+
93
+ ## Service Layer Separation
94
+
95
+ - **Components should not call APIs directly.** The pattern is: services → hooks → components.
96
+ - **Services** own the network call (axios, fetch, GraphQL client). One file per domain: `userService.ts`, `orderService.ts`, etc.
97
+ - **Hooks** wrap services with state, caching, and side-effect concerns (`useUser`, `useOrders`). This is where TanStack Query or SWR typically lives.
98
+ - **Components** consume hooks. They read state and render UI. They should not be aware of HTTP details.
99
+
100
+ ```ts
101
+ // userService.ts
102
+ export const fetchUser = (id: string) => fetch(`/api/users/${id}`).then(r => r.json());
103
+
104
+ // useUser.ts
105
+ export const useUser = (id: string) => {
106
+ const { data, isLoading, error } = useQuery(['user', id], () => fetchUser(id));
107
+ return { user: data, isLoading, error };
108
+ };
109
+
110
+ // UserProfile.tsx
111
+ export function UserProfile({ userId }: Props) {
112
+ const { user, isLoading } = useUser(userId);
113
+ return isLoading ? <Spinner /> : <div>{user.name}</div>;
114
+ }
115
+ ```
116
+
117
+ > **Why:** Keeping API details out of components makes them easier to test (no mocking fetch), easier to swap (REST → GraphQL doesn't ripple into UI), and easier to reuse (the same hook works across multiple components).
118
+
119
+ ## Forms
120
+
121
+ - **Controlled components** are the default for forms with validation, conditional fields, or external state binding.
122
+ - **Uncontrolled with refs** is acceptable only for trivial isolated inputs (a search box, a single toggle).
123
+ - **Every form needs three handled states:** idle, submitting, error/success.
124
+ - **Validation:** validate on the boundary that matters (on blur for fields, on submit for the form). Show errors near the field they apply to. Disable submit while submitting.
125
+ - **Use a form library** (React Hook Form, Formik) for non-trivial forms — don't reinvent state, validation, and error handling.
126
+
127
+ ```jsx
128
+ // Controlled form with state management
129
+ function LoginForm() {
130
+ const [email, setEmail] = useState('');
131
+ const [isSubmitting, setIsSubmitting] = useState(false);
132
+ const [error, setError] = useState(null);
133
+
134
+ const handleSubmit = async (e) => {
135
+ e.preventDefault();
136
+ setIsSubmitting(true);
137
+ setError(null);
138
+ try {
139
+ await login(email);
140
+ } catch (err) {
141
+ setError(err.message);
142
+ } finally {
143
+ setIsSubmitting(false);
144
+ }
145
+ };
146
+
147
+ return (
148
+ <form onSubmit={handleSubmit}>
149
+ <input value={email} onChange={(e) => setEmail(e.target.value)} />
150
+ {error && <span>{error}</span>}
151
+ <button disabled={isSubmitting}>{isSubmitting ? 'Logging in...' : 'Log In'}</button>
152
+ </form>
153
+ );
154
+ }
155
+ ```
156
+
157
+ > **Why:** Forms without these states create silent failures (user clicks submit, nothing happens, no feedback) — one of the most common React UX bugs.
158
+
159
+ ## Accessibility
160
+
161
+ - **Semantic HTML by default** — use `<button>`, `<a>`, `<nav>`, `<main>`, `<form>` for what they're for.
162
+ - **Never use `<div>` or `<span>` as a clickable element.** If it's clickable, it's a `<button>` (or `<a>` if it navigates).
163
+ - **Every `<img>` needs an `alt` attribute.** Decorative images use `alt=""`.
164
+ - **Every form input needs a `<label>`** (visible or `aria-label`).
165
+ - **Keyboard accessibility is not optional.** Users must be able to tab through, activate, and escape every interactive element.
166
+ - **Avoid `tabindex` values other than `0` and `-1`** (positive values break tab order).
167
+ - **Color is not the only signal.** Never use color alone to convey meaning (red text for errors needs an icon or label too).
168
+
169
+ > **Why:** Accessibility is not a special case — it's how the web is supposed to work. Semantic HTML gets you most of the way there for free, while custom divs require recreating browser behavior poorly.
170
+
171
+ ## Responsive Design
172
+
173
+ - **Mobile-first by default.** Design and write CSS for the smallest screen first, then add styles for larger breakpoints.
174
+ - **Use relative units:** `rem`, `em`, `%`, `vw/vh` — avoid pixel widths for layout.
175
+ - **Avoid fixed widths on layout containers.** Use `max-width` instead so content can shrink.
176
+ - **Layouts use flexbox or CSS grid;** absolute positioning only for overlays and edge cases.
177
+ - **Test for:** ~320px (small phone), ~768px (tablet), ~1024px+ (desktop).
178
+ - **Horizontal overflow on mobile is a bug,** not an accepted state.
179
+
180
+ > **Why:** Most users access the web on mobile or constrained viewports. Desktop-only design is no longer the default — it's a regression.
181
+
182
+ ## React-Specific Anti-Patterns
183
+
184
+ These are React-specific additions to `rules/anti-patterns.md`:
185
+
186
+ ### Overuse of `useEffect`
187
+
188
+ `useEffect` should be a last resort, not a first instinct. Common misuses:
189
+
190
+ - **Deriving state from props** — compute it during render instead.
191
+ - **Resetting state on prop change** — use a `key` on the component or compute during render.
192
+ - **Chaining state updates** — usually means state should be derived, not stored.
193
+ - **Fetching on mount when a server-state library would do it better** — use TanStack Query / SWR.
194
+
195
+ ### Premature memoization
196
+
197
+ Wrapping every function in `useCallback` and every value in `useMemo` adds cost without benefit. Memoize only when there's a measured reason. Profile first.
198
+
199
+ ### Massive `useEffect` with many dependencies
200
+
201
+ If a `useEffect` has 5+ dependencies, it's doing too much. Split it into multiple effects with focused responsibilities.
202
+
203
+ ### Inline object/array props that defeat memoization
204
+
205
+ ```jsx
206
+ // ❌ Bad — new object every render breaks <MemoChild>'s memoization
207
+ <MemoChild config={{ option: true }} />
208
+
209
+ // ✅ Good
210
+ const config = useMemo(() => ({ option: true }), []);
211
+ <MemoChild config={config} />
212
+ ```
213
+
214
+ ### `key={index}` in dynamic lists
215
+
216
+ Causes wrong components to update when items are reordered, inserted, or filtered. Use a stable, unique field from the data (`id`, `slug`, etc.).
217
+
218
+ ---
219
+
220
+ ## When You're Unsure
221
+
222
+ - For React 18+ features (Suspense, transitions, server components): confirm the project's React version before assuming.
223
+ - For Next.js / Remix specifics: check whether App Router or Pages Router is in use before suggesting routing patterns.
224
+ - For state libraries: confirm which one the project uses (Zustand vs Redux vs Jotai vs none) before suggesting code.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: refactor
3
+ description: Restructure existing code without changing behavior. Use this skill whenever the user invokes /refactor, asks to "refactor", "restructure", "clean up", "tidy up", "simplify", "improve readability", "extract", "consolidate", "deduplicate", "rename", "reorganize", or "modernize" code. Apply when the user wants better internal structure but the same external behavior — same inputs, same outputs, same side effects, same API. Do NOT trigger when the user wants new functionality (use /build) or wants critique without changes (use /review). Do NOT trigger when the user asks to fix a bug or change behavior — that's a behavior change, not a refactor.
4
+ ---
5
+
6
+ # Refactor Skill
7
+
8
+ This skill restructures existing code while preserving its behavior. It loads when the user wants improvements to *how* code is written, not *what* it does.
9
+
10
+ These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md`.
11
+
12
+ ---
13
+
14
+ ## The Iron Rule of Refactoring
15
+
16
+ **Behavior must not change.** Same inputs produce same outputs. Same side effects. Same errors. Same observable performance characteristics (within reason).
17
+
18
+ If the user asks you to "refactor and also fix this bug" — that's two tasks. Do them as separate steps with separate commits. Don't mix behavior changes into a refactor.
19
+
20
+ This rule is non-negotiable. A refactor that "accidentally" changes behavior is a regression, not a refactor.
21
+
22
+ ---
23
+
24
+ ## What Refactoring Is
25
+
26
+ Refactoring improves **internal structure** without changing **external behavior**:
27
+
28
+ - ✅ Renaming variables for clarity
29
+ - ✅ Extracting a function from inline code
30
+ - ✅ Inlining a function used only once
31
+ - ✅ Splitting a god function into smaller ones
32
+ - ✅ Replacing nested conditionals with early returns
33
+ - ✅ Extracting magic values to named constants
34
+ - ✅ Removing dead code
35
+ - ✅ Deduplicating logic (3+ copies)
36
+ - ✅ Reordering for readability
37
+ - ✅ Replacing manual loops with built-in methods (when equivalent)
38
+
39
+ ## What Refactoring Is NOT
40
+
41
+ These are *not* refactors, even if they look similar:
42
+
43
+ - ❌ Fixing a bug (behavior change)
44
+ - ❌ Adding a feature (behavior change)
45
+ - ❌ Changing an API signature (interface change — affects callers)
46
+ - ❌ "Improving" performance via different algorithms (behavior may differ at edge cases)
47
+ - ❌ Updating a dependency version (could change behavior subtly)
48
+ - ❌ Changing error messages or types (callers may depend on these)
49
+ - ❌ Modifying logging or telemetry (observable change)
50
+
51
+ If the user asks for any of these alongside a refactor, **separate them**:
52
+
53
+ - Phase 1: Pure refactor (preserves behavior)
54
+ - Phase 2: Behavior change (separate diff, separate commit)
55
+
56
+ ## The Refactor Workflow
57
+
58
+ ### Step 1: Understand the Existing Behavior
59
+
60
+ Before changing anything, understand what the code currently does:
61
+
62
+ - What are its inputs?
63
+ - What does it return?
64
+ - What side effects does it have (network, DB, filesystem, mutations)?
65
+ - What errors can it throw?
66
+ - Are there existing tests? Read them — they document expected behavior.
67
+
68
+ If the existing behavior is unclear, **ask before refactoring**. You cannot preserve what you don't understand.
69
+
70
+ ### Step 2: Identify the Problem
71
+
72
+ State *specifically* what's wrong with the current code. Not vague — concrete:
73
+
74
+ - ✅ "This function is 80 lines and has 5 distinct responsibilities"
75
+ - ✅ "These three blocks duplicate the same validation logic"
76
+ - ✅ "This nested ternary has 4 levels and is unreadable"
77
+ - ❌ "This code could be cleaner"
78
+ - ❌ "This needs improvement"
79
+
80
+ If you can't name the problem specifically, the code probably doesn't need refactoring.
81
+
82
+ ### Step 3: Plan the Refactor
83
+
84
+ State the approach in 1-3 bullets:
85
+
86
+ - What you're changing
87
+ - What you're preserving (the contract)
88
+ - How a future reader will benefit
89
+
90
+ For non-trivial refactors, also note: **what could go wrong?**
91
+
92
+ ### Step 4: Make ONE Change Per Step
93
+
94
+ Refactor in small, mechanical steps. Examples:
95
+
96
+ - Step A: Extract this block into a named function (no behavior change)
97
+ - Step B: Rename `x` to `customerEmail` everywhere (no behavior change)
98
+ - Step C: Replace nested `if` with early returns (no behavior change)
99
+
100
+ Each step should be reviewable in isolation. Avoid sweeping changes that touch many things at once.
101
+
102
+ ### Step 5: Verify Behavior Preserved
103
+
104
+ After each step, confirm behavior is unchanged:
105
+
106
+ - ✅ **Tests still pass?** Run them.
107
+ - ✅ **No tests exist?** Mention this — it's a risk for refactoring.
108
+ - ✅ **Manually trace a few inputs through old vs. new code?** Match.
109
+
110
+ If you can't verify behavior is preserved, **say so explicitly** and let the user decide whether to proceed.
111
+
112
+ ## Risk-Adjusted Behavior
113
+
114
+ Match the rigor to the risk:
115
+
116
+ | Risk level | Behavior |
117
+ |---|---|
118
+ | Pure local refactor (rename, reorder, extract) | Proceed; mention briefly |
119
+ | Refactor crossing function boundaries | Verify against tests; flag any test gaps |
120
+ | Refactor changing module interfaces | **Stop** — this is an API change, not a refactor |
121
+ | Refactor in untested code | Flag the lack of tests; offer to add them first |
122
+ | Refactor in security-sensitive code (auth, payments) | Highest care; recommend pair review |
123
+
124
+ ## Output Format
125
+
126
+ For refactor tasks, structure the response as:
127
+
128
+ What's changing: [1-2 sentences]
129
+ What's preserved: [the contract — inputs, outputs, side effects][Optional: list of refactoring steps if multi-step][The refactored code][Optional: any behavior preservation concerns, test gaps, or follow-ups]
130
+
131
+ Don't pad with explanation of what refactoring is. The user knows.
132
+
133
+ ## When to Push Back
134
+
135
+ If the user asks for a refactor that:
136
+
137
+ - **Has no tests covering the existing behavior** → Flag it. Suggest writing characterization tests first.
138
+ - **Crosses into bug-fix territory** → Separate the concerns. Refactor first, fix second.
139
+ - **Changes an API used by other code** → That's not a refactor; it's an interface migration.
140
+ - **Is actually a rewrite, not a refactor** → Say so. A rewrite needs different planning.
141
+
142
+ Don't silently expand scope. The user asked for a refactor — give them a refactor.
143
+
144
+ ## What This Skill Does NOT Cover
145
+
146
+ - **New code** → use `/build`
147
+ - **Critique without changes** → use `/review`
148
+ - **Bug fixes** → those are behavior changes; separate task
149
+ - **Architecture-level redesigns** → those need design discussion, not skill-driven mechanical refactoring
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: review
3
+ description: Critique existing code without changing it — identify bugs, issues, smells, anti-patterns, and improvement opportunities. Use this skill whenever the user invokes /review, asks to "review", "critique", "audit", "check", "look at", "evaluate", "assess", "give feedback on", or "what do you think of" their code. Apply when the user shares code and wants analysis rather than modification — they want to know what's wrong, what could be better, and what's good. Do NOT trigger when the user wants the code modified (use /refactor or /build) or wants new code written. Trigger when the user asks "is this code good?", "any issues with this?", "code review please", "PR review", or shares a diff for feedback.
4
+ ---
5
+
6
+ # Review Skill
7
+
8
+ This skill critiques existing code without modifying it. It loads when the user wants analysis, not changes.
9
+
10
+ These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md`.
11
+
12
+ If `/strict` mode is also active, apply maximum rigor — flag every violation, however minor.
13
+
14
+ ---
15
+
16
+ ## What Review Is
17
+
18
+ Review produces **prioritized feedback** on existing code:
19
+
20
+ - ✅ Identify bugs, race conditions, logic errors
21
+ - ✅ Identify security vulnerabilities
22
+ - ✅ Identify violations of `rules/` and `anti-patterns.md`
23
+ - ✅ Identify maintainability concerns (clarity, naming, structure)
24
+ - ✅ Identify missing tests / edge cases
25
+ - ✅ Acknowledge what's well done
26
+
27
+ ## What Review Is NOT
28
+
29
+ - ❌ **Rewriting the code.** Only suggest changes; don't make them. (User can ask for `/refactor` after.)
30
+ - ❌ **Style nitpicking** that doesn't affect correctness or maintainability — unless `/strict` is on.
31
+ - ❌ **Personal preference disguised as a rule.** If a rule exists, cite it. If not, don't pretend.
32
+ - ❌ **Approval theater.** "Looks great!" responses aren't reviews. If there's nothing to flag, say so honestly — but actually look first.
33
+
34
+ ---
35
+
36
+ ## The Review Workflow
37
+
38
+ ### Step 1: Understand the Code's Purpose
39
+
40
+ Before critiquing, understand what the code is *trying* to do:
41
+
42
+ - What's the input/output contract?
43
+ - What context is it operating in (production endpoint? internal script? test helper?)
44
+ - What does the surrounding codebase do?
45
+
46
+ If purpose is unclear, ask before reviewing. You can't fairly critique code whose intent you don't understand.
47
+
48
+ ### Step 2: Run the Review Checklist
49
+
50
+ Walk through these categories systematically. Don't skip any.
51
+
52
+ #### Correctness
53
+ - Are there logic errors?
54
+ - Are edge cases handled (empty, null, max/min, boundary)?
55
+ - Are error paths handled or silently swallowed?
56
+ - Are there race conditions or concurrency bugs?
57
+ - Off-by-one errors?
58
+ - Is the happy path actually correct?
59
+
60
+ #### Security
61
+ - Is user input validated at the boundary?
62
+ - Are there injection risks (SQL, XSS, command injection, path traversal)?
63
+ - Are secrets exposed (in logs, error messages, responses)?
64
+ - Are auth/authorization checks present where needed?
65
+ - Are timing attacks possible (e.g., string comparison on tokens)?
66
+
67
+ #### Performance
68
+ - Any obvious N+1 queries?
69
+ - Any unbounded loops or recursion?
70
+ - Any expensive operations in hot paths?
71
+ - Any memory leaks (event listeners, subscriptions, timers not cleaned up)?
72
+ - (Note: don't critique performance speculatively without evidence — see `skills/performance`)
73
+
74
+ #### Standards Compliance
75
+ - Does it violate any rule in `rules/code-standards.md`? (function size, nesting, naming, magic values, error handling)
76
+ - Does it match any anti-pattern in `rules/anti-patterns.md`?
77
+ - If a domain skill applies (`react`, `testing`, etc.), does it follow those conventions?
78
+
79
+ #### Maintainability
80
+ - Will another developer understand this in 6 months?
81
+ - Are names accurate and meaningful?
82
+ - Is the code doing one thing or many?
83
+ - Is there comment debt (out-of-date comments, commented-out code)?
84
+ - Is the file/module organization clear?
85
+
86
+ #### Tests
87
+ - Is the new code tested?
88
+ - Do tests cover edge cases or just happy paths?
89
+ - Are tests deterministic?
90
+ - Any flaky test smells (timing dependencies, shared state, real network calls)?
91
+
92
+ ### Step 3: Categorize Findings
93
+
94
+ Sort every finding into one of three buckets:
95
+
96
+ - **Critical** — must fix before merge. Bugs, security issues, broken behavior, missing critical edge cases.
97
+ - **Improvement** — should fix. Standards violations, maintainability problems, missing tests for non-trivial logic.
98
+ - **Minor** — nice to have. Style nudges, alternative approaches, very small clarity wins.
99
+
100
+ If something doesn't fit a bucket clearly, it's probably a Minor.
101
+
102
+ ### Step 4: Acknowledge What's Good
103
+
104
+ Genuinely look for things done well. This is not flattery — it's signal:
105
+
106
+ - Tells the author what to keep doing
107
+ - Calibrates the reviewer (a review with only criticism is suspicious)
108
+ - Builds trust that the criticism is fair
109
+
110
+ If the code is genuinely poor throughout, say so honestly — but in measured terms.
111
+
112
+ ---
113
+
114
+ ## Output Format
115
+
116
+ Review responses always use this structure:
117
+
118
+ Summary: [1-2 sentence overall take]
119
+ Critical Issues
120
+ [Numbered list. Each item: file:line reference, what's wrong, why it matters, suggested direction.]
121
+ [If none: "None found."]
122
+ Improvements
123
+ [Numbered list. Same format.]
124
+ [If none: "None."]
125
+ Minor Suggestions
126
+ [Numbered list. Same format.]
127
+ [If none: "None."]
128
+ What's Good
129
+ [2-4 specific things done well. Be concrete — "uses early returns to flatten control flow" beats "good code style".]
130
+
131
+ Each finding includes:
132
+ - **Where** — file path and line number if available
133
+ - **What** — the specific issue
134
+ - **Why** — why it matters (cite a rule when relevant: "violates `rules/code-standards.md` magic values")
135
+ - **How** — the direction to fix (don't write the fix; describe it)
136
+
137
+ ## Severity Discipline
138
+
139
+ Don't inflate severity. The categories must mean something:
140
+
141
+ - A magic number is **not** Critical.
142
+ - A missing edge case **is** Critical if the case can occur in production.
143
+ - A naming nit is **Minor**, not Improvement.
144
+ - An unhandled error path **is** Critical.
145
+ - A long function with otherwise correct logic is Improvement, not Critical.
146
+
147
+ If everything is Critical, nothing is. Reserve the label for things that genuinely block merge.
148
+
149
+ ## When to Ask Before Reviewing
150
+
151
+ Ask before reviewing when:
152
+
153
+ - The code's purpose is unclear
154
+ - You can't see the surrounding context (the diff is partial, the file is partial)
155
+ - The user asks "what do you think?" about something where the answer depends on intent
156
+
157
+ Don't ask when:
158
+
159
+ - The code is self-explanatory
160
+ - The user asked for review on a self-contained piece
161
+
162
+ ## When `/strict` Is Active
163
+
164
+ If `/strict` mode is also loaded:
165
+
166
+ - Lower the threshold for Critical (any bug-risk pattern is Critical)
167
+ - Lower the threshold for Improvement (any standards deviation is Improvement)
168
+ - Be pedantic about anti-patterns
169
+ - Don't accept "this works" as good enough — flag fragility
170
+
171
+ Without `/strict`:
172
+
173
+ - Apply rules pragmatically
174
+ - Don't critique stylistic choices that don't affect correctness or maintainability
175
+ - Treat code review as collaborative, not adversarial
176
+
177
+ ## When You're Uncertain
178
+
179
+ - **Don't fabricate issues to seem thorough.** "Looks fine to me" is a valid review for code that's fine.
180
+ - **Don't pretend to know things you don't.** If you can't tell whether `await` is needed without seeing the calling code, say so.
181
+ - **Cite rules, not opinions.** If you call out a violation, name the rule. If you have a stylistic preference, label it as such.
182
+
183
+ ## What This Skill Does NOT Cover
184
+
185
+ - **Modifying the code** → use `/refactor`
186
+ - **Writing new code** → use `/build`
187
+ - **Architecture review at a system level** → review covers code; system design needs discussion
188
+
189
+ ---
190
+
191
+ ## Honest Calibration
192
+
193
+ A good review is one the author would actually act on. Calibrate accordingly:
194
+
195
+ - Too soft → issues slip through, the review adds no value
196
+ - Too harsh → the author defends instead of improving, the review damages trust
197
+ - Too long → the author skims, the important findings get lost
198
+
199
+ Aim for: **fair, specific, prioritized, actionable.** Cite the rule. Note the line. Suggest the direction. Move on.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: strict
3
+ description: Activates Strict Mode for production-ready, high-rigor code review and authoring. Use this skill whenever the user invokes /strict, says "strict mode", "production-ready", "robust", "harden this", "no shortcuts", "review thoroughly", "be picky", "be critical", "battle-tested", "enterprise-grade", or otherwise signals they want maximum rigor. Apply when the user is preparing code for production, security review, audit, or critical paths. Do NOT trigger when the user wants speed, prototypes, or quick iterations — see /fast for that.
4
+ ---
5
+
6
+ # Strict Mode
7
+
8
+ This skill switches Claude into maximum-rigor mode. All `rules/` apply with full strength, and the bar for "good enough" rises significantly.
9
+
10
+ This is the right mode for production code, security-sensitive paths, and code that will outlive the current sprint.
11
+
12
+ ---
13
+
14
+ ## What Strict Mode Demands
15
+
16
+ ### Code Quality
17
+ - 🔒 **Every rule in `rules/code-standards.md` enforced strictly.** No exceptions without explicit reasoning.
18
+ - 🔒 **Every anti-pattern in `rules/anti-patterns.md` flagged.** Even minor instances.
19
+ - 🔒 **No magic values.** Every constant named.
20
+ - 🔒 **Every function < 40 lines.** No "but this one needs to be longer."
21
+ - 🔒 **Nesting < 3 levels.** No exceptions.
22
+
23
+ ### Edge Cases
24
+ - 🔒 **Enumerate edge cases before writing code.** Empty / null / max / min / concurrent / boundary / invalid type.
25
+ - 🔒 **Each edge case must have a test or an explicit comment justifying why it's not tested.**
26
+ - 🔒 **Failure paths get equal weight to happy paths.**
27
+
28
+ ### Errors
29
+ - 🔒 **No silent failures.** Every catch logs, transforms, retries, or propagates.
30
+ - 🔒 **Every error carries enough context to debug from logs alone.**
31
+ - 🔒 **Every external call has a timeout.**
32
+ - 🔒 **Every async operation handles cancellation.**
33
+
34
+ ### Security
35
+ - 🔒 **Validate all inputs at boundaries.** Trust nothing from the user, the network, or the database.
36
+ - 🔒 **No secrets in code.** No tokens, passwords, API keys — even in tests.
37
+ - 🔒 **Output encoding** for any user-controlled string rendered to a client.
38
+ - 🔒 **Authorization checks** on every protected operation, not just at the route level.
39
+
40
+ ### Tests
41
+ - 🔒 **New code must come with tests.** No "I'll add tests later."
42
+ - 🔒 **Tests cover edge cases, not just happy paths.**
43
+ - 🔒 **No flaky tests merge.** Determinism enforced.
44
+
45
+ ## Behavior
46
+
47
+ - **Be critical.** Call out every violation, even if it's not in the user's request.
48
+ - **Don't accept mediocre patterns.** If something can be cleaner, say so.
49
+ - **Prefer robust over clever.** Boring code that handles edge cases beats clever code that doesn't.
50
+ - **Slow down.** Strict Mode trades speed for rigor — that's the whole point.
51
+
52
+ ## Output Format in Strict Mode
53
+
54
+ For code authoring tasks:
55
+ - Lead with **edge cases identified**
56
+ - Then the implementation
57
+ - Then **what was deliberately not handled and why**
58
+ - Then **suggested follow-up tests / monitoring**
59
+
60
+ For code review tasks:
61
+ - **Critical Issues** (must fix before merge)
62
+ - **Improvements** (should fix)
63
+ - **Minor suggestions** (nice to have)
64
+ - **What's good** (call out genuinely well-written sections)
65
+
66
+ ## When to Push Back on the User
67
+
68
+ In Strict Mode, Claude is empowered to disagree. If the user requests something that violates the rules:
69
+
70
+ - **State the violation clearly.** "This violates the no-magic-values rule because..."
71
+ - **Propose the compliant alternative.**
72
+ - **If the user insists**, comply but flag the deviation in a comment.
73
+
74
+ Strict Mode is the only mode where Claude is encouraged to be pedantic. If the user wants flexibility, they can use the default mode or `/fast`.