@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,132 @@
1
+ ---
2
+ name: testing
3
+ description: Comprehensive testing standards covering unit tests, integration tests, edge case coverage, test structure, mocking strategies, and what makes a good vs bad test. Use this skill whenever the user writes new tests, modifies existing tests, debugs failing tests, asks for test coverage suggestions, requests a test for a specific function or component, mentions testing libraries (Jest, Vitest, React Testing Library, Pytest, Mocha, Cypress, Playwright), or asks how to verify code works. Apply when the user mentions tests, specs, assertions, mocks, stubs, fixtures, TDD, BDD, test coverage, or when they ask "how do I test this". Trigger even when testing is implied — for example, when the user asks Claude to verify behavior, prove something works, or write a regression check.
4
+ ---
5
+
6
+ # Testing Skill
7
+
8
+ This skill applies the org's testing standards. It loads when the task involves writing, reviewing, or debugging tests.
9
+
10
+ These rules layer on top of `rules/general.md`, `rules/code-standards.md`, and `rules/anti-patterns.md`.
11
+
12
+ ---
13
+
14
+ ## What to Test (Priority Order)
15
+
16
+ Test things in this order of importance:
17
+
18
+ 1. **Behavior at boundaries** — empty input, null, max/min values, off-by-one
19
+ 2. **Failure paths** — what happens when the network fails, the file is missing, the API returns 500
20
+ 3. **Business logic** — the rules that make this code valuable to the user
21
+ 4. **Integration points** — where your code meets other systems
22
+ 5. **Happy path** — the obvious "it works" case
23
+
24
+ Most teams test in reverse order — happy paths first, edge cases last (or never). Don't.
25
+
26
+ ## What NOT to Test
27
+
28
+ - **Implementation details** — internal function calls, private state, specific code paths
29
+ - **Third-party libraries** — if you're testing whether `lodash.merge` works, you're testing lodash
30
+ - **Trivial getters/setters** — testing `get name() { return this._name }` adds no value
31
+ - **Framework behavior** — don't write tests that prove React renders or Express routes
32
+ - **The same thing tested elsewhere** — don't duplicate coverage across unit/integration/e2e
33
+
34
+ > **Why:** Tests that target implementation break on every refactor without catching real bugs. They make code change expensive and discourage cleanup.
35
+
36
+ ## Test Structure
37
+
38
+ Every test follows **Arrange / Act / Assert** (AAA):
39
+
40
+ test("describes the behavior in plain English", () => {
41
+ // Arrange — set up the scenario
42
+ const input = makeUser({ age: 17 });// Act — perform the action
43
+ const result = canVote(input);// Assert — check the outcome
44
+ expect(result).toBe(false);
45
+ });
46
+
47
+ - **Test names describe behavior, not implementation.** ✅ `"rejects users under 18"` ❌ `"calls validateAge with user.age"`
48
+ - **One logical assertion per test.** Multiple `expect()` calls are fine if they verify a single behavior.
49
+ - **No conditional logic in tests.** No `if`, no `try/catch`, no loops over test cases (use parametrized tests instead).
50
+
51
+ ## Edge Cases to Always Consider
52
+
53
+ For any function or component, run through this checklist:
54
+
55
+ - [ ] Empty input (`""`, `[]`, `{}`, `null`, `undefined`)
56
+ - [ ] Single-item input (lists/arrays often break here)
57
+ - [ ] Maximum-size input (does it scale? does it crash?)
58
+ - [ ] Boundary values (off-by-one, zero, negative numbers)
59
+ - [ ] Invalid types (string when number expected)
60
+ - [ ] Concurrent calls (race conditions, if applicable)
61
+ - [ ] Network/IO failures (timeout, 5xx, malformed response)
62
+ - [ ] Permission denied / unauthorized
63
+ - [ ] Already-existing entity (duplicate create)
64
+ - [ ] Non-existent entity (read/update/delete on missing)
65
+
66
+ You don't need to test all of these for every function. You should at least *consider* them and pick the relevant ones.
67
+
68
+ ## Mocking
69
+
70
+ - **Mock at the boundary**, not internally. Mock the network call, not the function that calls the network.
71
+ - **Don't mock what you own.** If you wrote it, test it for real.
72
+ - **Don't over-mock.** A test where everything is mocked tests nothing.
73
+ - **Reset mocks between tests.** No shared state leaking between tests.
74
+
75
+ // ❌ Bad — mocking your own function defeats the purpose
76
+ jest.mock('./userService');
77
+ test("creates user", () => {
78
+ userService.create.mockReturnValue({ id: 1 });
79
+ ...
80
+ });// ✅ Good — mock the external boundary (HTTP, DB)
81
+ jest.mock('./httpClient');
82
+ test("creates user", () => {
83
+ httpClient.post.mockResolvedValue({ data: { id: 1 } });
84
+ const user = await userService.create({ name: "Alice" });
85
+ expect(user.id).toBe(1);
86
+ });
87
+
88
+ ## Determinism
89
+
90
+ Tests must produce the same result every time. Sources of flakiness to eliminate:
91
+
92
+ - **Time** — mock `Date.now()`, freeze the clock; never assert on "now"
93
+ - **Random** — seed random generators, mock `Math.random` if needed
94
+ - **Network** — mock all real HTTP calls in unit/integration tests
95
+ - **File system** — use temp dirs that are cleaned up; never read/write to real paths
96
+ - **Parallel test order** — tests must pass in any order (no test depending on another running first)
97
+
98
+ A flaky test is worse than no test — teammates start ignoring failures.
99
+
100
+ ## Coverage Targets
101
+
102
+ - **Unit tests:** target ~80% line coverage as a *floor*, not a goal.
103
+ - **100% coverage is suspicious** — usually means tests are testing implementation, not behavior.
104
+ - **Critical paths** (auth, payment, data integrity) — aim for 100% **branch** coverage.
105
+ - Coverage numbers measure quantity, not quality. A meaningful test of an edge case is worth more than 50 trivial assertions.
106
+
107
+ ## Test Naming
108
+
109
+ Choose one convention per project and stick with it. Common patterns:
110
+
111
+ - **`it("does X when Y")`** — `it("returns null when user is not found")`
112
+ - **`describe("function") + it("does X")`** — nested under `describe` blocks
113
+ - **`test("X scenario produces Y outcome")`** — flat, descriptive
114
+
115
+ Bad names tell you what the code does; good names tell you what the *behavior* is.
116
+
117
+ ## When Tests Should Block a Merge
118
+
119
+ - ❌ **Test fails** → must fix before merge
120
+ - ❌ **No test for new business logic** → must add before merge
121
+ - ⚠️ **Coverage drops** → discuss; sometimes acceptable, sometimes not
122
+ - ✅ **Test is slow but passes** → merge, optimize later
123
+ - ✅ **Test could be more thorough** → merge, file follow-up
124
+
125
+ ## When You're Unsure
126
+
127
+ - **Which test framework does the project use?** Check `package.json` / `pyproject.toml` before assuming.
128
+ - **Where do tests live?** `__tests__/`, `*.test.ts` next to source, separate `tests/` folder — confirm before placing.
129
+ - **Does the project mock fetch with MSW, jest.mock, or something else?** Match existing patterns.
130
+ - **Is there a fixtures/factories module?** Use it instead of inventing test data.
131
+
132
+ If any of the above is unclear, ask one question before writing tests.
@@ -1,22 +0,0 @@
1
- # Accessibility Review
2
-
3
- ## Purpose
4
-
5
- Use this skill when reviewing UI components, navigation flows, forms, dialogs, carousels, and data-heavy screens.
6
-
7
- ## Review Rules
8
-
9
- 1. Every interactive element must be reachable by keyboard.
10
- 2. Focus order must match visual order.
11
- 3. Dialogs must trap focus and restore it on close.
12
- 4. Buttons need meaningful accessible names.
13
- 5. Form inputs need labels, validation messaging, and error association.
14
- 6. Dynamic updates should announce meaningful changes when needed.
15
- 7. Color contrast should pass WCAG AA for normal text.
16
-
17
- ## Common Failure Points
18
-
19
- - Icon-only buttons without labels.
20
- - Divs pretending to be buttons, the classic costume party of broken UX.
21
- - Modals that lose focus.
22
- - Carousels that auto-rotate without pause controls.
@@ -1,8 +0,0 @@
1
- # UI Accessibility Checklist
2
-
3
- - [ ] Keyboard-only navigation works.
4
- - [ ] Visible focus indicator is present.
5
- - [ ] Screen reader labels are meaningful.
6
- - [ ] Form errors are announced or associated.
7
- - [ ] Dialog focus is trapped and restored.
8
- - [ ] Color contrast is acceptable.
@@ -1,9 +0,0 @@
1
- {
2
- "name": "accessibility-review",
3
- "version": "1.0.0",
4
- "description": "Accessibility checklist for reviewing UI, keyboard behavior, focus states, and screen-reader output.",
5
- "category": "quality",
6
- "tags": ["a11y", "accessibility", "ui", "review"],
7
- "entry": "SKILL.md",
8
- "compatibleWith": ["cursor", "claude", "chatgpt", "github-copilot"]
9
- }
@@ -1,37 +0,0 @@
1
- # Next.js Clean Architecture
2
-
3
- ## Purpose
4
-
5
- Use this skill when building or reviewing a scalable Next.js App Router project with TypeScript, server components, server actions, and reusable UI components.
6
-
7
- ## Core Rules
8
-
9
- 1. Keep business logic out of React components.
10
- 2. Prefer feature-based folders for domain code.
11
- 3. Use server components by default and client components only where browser APIs, state, or events are required.
12
- 4. Keep data access inside services, repositories, or server actions.
13
- 5. Model request and response types clearly.
14
- 6. Every user-facing view needs loading, empty, error, and success states.
15
- 7. Accessibility cannot be treated like decoration added after the building collapses.
16
-
17
- ## Recommended Folder Pattern
18
-
19
- ```txt
20
- src/
21
- app/
22
- features/
23
- users/
24
- components/
25
- actions/
26
- services/
27
- schema/
28
- types/
29
- components/
30
- ui/
31
- lib/
32
- db/
33
- ```
34
-
35
- ## Output Expectations
36
-
37
- When generating code, include the relevant file paths, TypeScript types, validation rules, and integration steps.
@@ -1,9 +0,0 @@
1
- # Definition of Done
2
-
3
- - [ ] TypeScript types are explicit where needed.
4
- - [ ] Loading state is handled.
5
- - [ ] Empty state is handled.
6
- - [ ] Error state is handled.
7
- - [ ] Server/client boundary is intentional.
8
- - [ ] Accessibility labels and keyboard paths are checked.
9
- - [ ] Code is easy to delete or refactor later.
@@ -1,7 +0,0 @@
1
- # Folder Structure Rules
2
-
3
- - Use `features/<feature-name>` for domain-specific code.
4
- - Use `components/ui` only for generic reusable UI primitives.
5
- - Use `lib` for shared helpers and platform clients.
6
- - Use `db` for database configuration and schema exports.
7
- - Avoid dumping everything into `utils`, the drawer of forgotten sins.
@@ -1,9 +0,0 @@
1
- {
2
- "name": "nextjs-clean-architecture",
3
- "version": "1.0.0",
4
- "description": "Next.js App Router architecture rules, folder patterns, and delivery checklist.",
5
- "category": "frontend",
6
- "tags": ["nextjs", "react", "typescript", "architecture"],
7
- "entry": "SKILL.md",
8
- "compatibleWith": ["cursor", "claude", "chatgpt", "github-copilot"]
9
- }
@@ -1,25 +0,0 @@
1
- # Shadcn CRUD Generator
2
-
3
- ## Purpose
4
-
5
- Use this skill when creating admin CRUD modules with Next.js, TypeScript, server actions, Shadcn UI, and a predictable folder structure.
6
-
7
- ## CRUD Rules
8
-
9
- 1. Each module must include list, create, edit, delete, and view patterns where applicable.
10
- 2. Use schema validation before mutation.
11
- 3. Keep table column definitions separate from page composition when the table grows.
12
- 4. Add confirmation before destructive actions.
13
- 5. Show toast or visible feedback after mutation.
14
- 6. Never hide errors in `console.log`, because that is not observability, that is denial.
15
-
16
- ## Generated Files
17
-
18
- ```txt
19
- features/<module>/
20
- components/
21
- actions/
22
- schema/
23
- types/
24
- data/
25
- ```
@@ -1,9 +0,0 @@
1
- {
2
- "name": "shadcn-crud-generator",
3
- "version": "1.0.0",
4
- "description": "CRUD scaffolding guidance and templates for Next.js + Shadcn admin panels.",
5
- "category": "generator",
6
- "tags": ["shadcn", "crud", "nextjs", "admin"],
7
- "entry": "SKILL.md",
8
- "compatibleWith": ["cursor", "claude", "chatgpt", "github-copilot"]
9
- }
@@ -1,16 +0,0 @@
1
- "use server";
2
-
3
- export async function create{{pascalName}}Action(input: unknown) {
4
- // Validate input, persist data, then revalidate affected paths.
5
- return { success: true };
6
- }
7
-
8
- export async function update{{pascalName}}Action(id: string, input: unknown) {
9
- // Validate id + input, update data, then revalidate affected paths.
10
- return { success: true };
11
- }
12
-
13
- export async function delete{{pascalName}}Action(id: string) {
14
- // Validate id, delete safely, then revalidate affected paths.
15
- return { success: true };
16
- }
@@ -1,13 +0,0 @@
1
- import { {{pascalName}}Table } from "@/features/{{kebabName}}/components/{{kebabName}}-table";
2
-
3
- export default async function {{pascalName}}Page() {
4
- return (
5
- <main className="space-y-6">
6
- <div>
7
- <h1 className="text-2xl font-semibold">{{title}}</h1>
8
- <p className="text-muted-foreground">Manage {{title}} records.</p>
9
- </div>
10
- <{{pascalName}}Table />
11
- </main>
12
- );
13
- }