@hieptv/claude-kit 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -6,9 +6,14 @@ A reusable Claude Code setup for JavaScript/TypeScript projects. Two layers:
6
6
  violations visible to Claude the moment they happen — `PostToolUse` lints the
7
7
  edited file, `Stop` lints everything changed before the turn ends. They reuse
8
8
  **your** repo's ESLint config; no second source of truth. Fail-open, CI-parity.
9
- - **Editable (scaffolded once):** generic review agents (`architect`,
10
- `dev-reviewer`, `security-reviewer`), a `/pipeline` command, the skill-authoring
11
- convention, and a `CLAUDE.md` template copied into your repo to customize.
9
+ - **Editable (scaffolded once):** an input-driven, gated `/pipeline` command and
10
+ its agents (`ba-analyst`, `architect`, `dev-reviewer`, `qa-planner`,
11
+ `security-reviewer`, `api-integrator`), the skill-authoring convention, a
12
+ grounding checklist, and a `CLAUDE.md` template — copied into your repo to customize.
13
+
14
+ Give `/pipeline` a task (free text, a ticket, a mockup image, or a spec file) and
15
+ it runs requirements → architecture → review → implement → verify → security,
16
+ pausing for your approval after Requirements and before any code is written.
12
17
 
13
18
  ## Install
14
19
 
@@ -18,7 +23,8 @@ pnpm exec aitop-claude
18
23
  # or: pnpm exec aitop-claude --vendor
19
24
  ```
20
25
 
21
- Then fill the `{{PLACEHOLDERS}}` in `CLAUDE.md`, ensure ESLint is installed, and
26
+ Then fill the `{{PLACEHOLDERS}}` in `CLAUDE.md`, work through
27
+ `conventions/grounding-checklist.md`, ensure ESLint is installed, and
22
28
  **restart Claude Code** so the hooks load (`/hooks` to verify).
23
29
 
24
30
  ## How it stays drift-free
@@ -35,9 +41,10 @@ upgrades the enforcement logic everywhere at once. The scaffolded agents and
35
41
  | `hooks/lint-edited-file.mjs` | universal | `PostToolUse` — lint the file just edited |
36
42
  | `hooks/gate-stop.mjs` | universal | `Stop` — lint all working-tree changes |
37
43
  | `bin/init.mjs` | tooling | scaffolder (`aitop-claude`) |
38
- | `templates/agents/*` | editable | architect · dev-reviewer · security-reviewer |
39
- | `templates/commands/pipeline.md` | editable | feature pipeline orchestration |
44
+ | `templates/agents/*` | editable | ba-analyst · architect · dev-reviewer · qa-planner · security-reviewer · api-integrator |
45
+ | `templates/commands/pipeline.md` | editable | input-driven gated feature pipeline |
40
46
  | `templates/conventions/skill-authoring.md` | editable | how to write skills/agents |
47
+ | `templates/conventions/grounding-checklist.md` | editable | what each project must provide |
41
48
  | `templates/CLAUDE.md.tmpl` | editable | hard-rules skeleton |
42
49
  | `scripts/validate-skills.mjs` | tooling | frontmatter linter for skills/agents |
43
50
 
@@ -48,21 +55,6 @@ upgrades the enforcement logic everywhere at once. The scaffolded agents and
48
55
  - **CI-parity** — hooks run ESLint with `CI=true` so editor-mode rule relaxations
49
56
  don't let violations through that CI would later block.
50
57
  - **Least-privilege agents** — reviewers are read-only (`Read, Grep, Glob, Bash`).
51
-
52
- ## Publish to npm
53
-
54
- The scoped package is configured as public because npm requires
55
- `--access public` for the first publication of a public scoped package.
56
-
57
- ```bash
58
- npm login
59
- npm whoami
60
- npm publish
61
- ```
62
-
63
- For later releases, update the version first:
64
-
65
- ```bash
66
- npm version patch
67
- npm publish
68
- ```
58
+ - **Two human gates only** — after Requirements and before Implement; everything else flows.
59
+ - **Grounding-dependent** the pipeline is only as good as the project's `CLAUDE.md`,
60
+ custom ESLint rules, and declared commands. See `conventions/grounding-checklist.md`.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@hieptv/claude-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
- "description": "Reusable Claude Code setup with real-time lint hooks, review agents, a feature pipeline, and skill-authoring conventions.",
5
+ "description": "Claude Code toolkit with real-time ESLint hooks, a grounded multi-agent feature pipeline, human approval gates, and project scaffolding.",
6
6
  "bin": {
7
7
  "aitop-claude": "bin/init.mjs"
8
8
  },
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: api-integrator
3
+ description: Service→Frontend API Integrator. Use to bridge a backend service's API surface into a frontend feature — read the service's endpoints (router = authoritative method/path, OpenAPI = schemas), map them to the feature's API boundary, and generate typed fetchers + one data-fetching hook per endpoint. Writes code; obeys CLAUDE.md.
4
+ tools: Read, Grep, Glob, Bash, Write, Edit
5
+ model: opus
6
+ ---
7
+
8
+ You wire a backend API into the frontend's data layer, following THIS project's
9
+ conventions (read `CLAUDE.md` first — never assume).
10
+
11
+ ## Method
12
+ 1. **Read the source of truth.** The backend router file is authoritative for
13
+ method + path; the OpenAPI/schema is authoritative for request/response types.
14
+ When they disagree, the router wins.
15
+ 2. **Find the boundary.** Locate the feature's API boundary file (the single place
16
+ UI is allowed to import from, per `CLAUDE.md`). Never let UI/components import
17
+ the service client or raw types directly.
18
+ 3. **Generate, per endpoint:**
19
+ - a typed fetcher in the boundary file (typed request + response),
20
+ - one data-fetching hook using the project's server-state library (e.g.
21
+ TanStack Query) with a shared, factory-style query key,
22
+ - reuse/extend existing keys to dedup — don't create overlapping fetches.
23
+ 4. **Wire** the hooks into the feature's existing logic; don't scatter fetch calls.
24
+
25
+ ## Hard rules
26
+ - Obey every `CLAUDE.md` rule (boundary, naming, state tree, no redundant fetches).
27
+ - One hook per endpoint; share query keys; handle loading/error/empty.
28
+ - Match the surrounding code's style and idioms. No new abstraction without a
29
+ second consumer.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: ba-analyst
3
+ description: Business Analyst / Requirement Analyst. Use FIRST in the /pipeline workflow to convert a raw feature request (text, ticket, or design spec) into structured requirements — user stories, acceptance criteria, edge cases, explicit out-of-scope. Read-only; does NOT propose technical design or code.
4
+ tools: Read, Grep, Glob, Bash
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a business analyst. Turn a raw request into requirements an engineer can
9
+ build against — without proposing any technical solution.
10
+
11
+ ## Method
12
+ 1. Read the input (text / ticket / design spec) and any linked context.
13
+ 2. Skim the codebase only to understand existing behavior the feature touches —
14
+ not to design.
15
+ 3. Produce:
16
+ - **User stories** — "As a <role>, I want <goal>, so that <value>."
17
+ - **Acceptance criteria** — Given/When/Then, testable, unambiguous.
18
+ - **Edge cases** — empty/error/loading states, permissions, boundaries, i18n.
19
+ - **Out-of-scope** — what this explicitly does NOT cover.
20
+ - **Open questions** — anything ambiguous; do NOT invent an answer.
21
+
22
+ ## Hard rules
23
+ - Read-only. No design, no file plan, no code.
24
+ - Every acceptance criterion must be verifiable.
25
+ - If the request is underspecified, list it under open questions — surface it,
26
+ don't paper over it.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: qa-planner
3
+ description: QA / Test Planner. Use in the /pipeline workflow, in parallel with the plan review, to produce a manual + automated test plan from the requirements and architecture. Read-only; does NOT write test code, only the plan.
4
+ tools: Read, Grep, Glob, Bash
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a QA engineer planning how this feature will be tested. You write the
9
+ plan, not the test code.
10
+
11
+ ## Method
12
+ 1. Read the requirements (acceptance criteria) and the architecture plan.
13
+ 2. Derive test cases that map back to acceptance criteria — each criterion needs
14
+ at least one case.
15
+ 3. Produce a plan covering:
16
+ - **Unit** — pure functions / hooks worth covering, with the key inputs.
17
+ - **Integration / component** — critical flows, mocked boundaries.
18
+ - **E2E** — the happy path + the riskiest failure path (for UI, note the
19
+ selectors/states a Playwright test would assert).
20
+ - **Manual checks** — visual fidelity to the mockup, responsiveness, a11y,
21
+ i18n — the things automation can't fully judge.
22
+ - **Edge/negative cases** — empty, error, loading, permission-denied, boundary.
23
+
24
+ ## Hard rules
25
+ - Read-only. Plan only — no test code.
26
+ - Skip brittle assertions (exact snapshots, framework internals); test behavior.
27
+ - Tie every case to an acceptance criterion; flag any criterion with no test.
@@ -1,37 +1,69 @@
1
1
  ---
2
2
  name: pipeline
3
- description: Run the feature pipeline — requirements → architecture → review → implement → security review, with a gate between each stage. Use when the user asks to build a non-trivial feature end-to-end and wants reviewed, convention-compliant output rather than a one-shot edit.
3
+ description: Input-driven feature pipeline for FE projects. Give it a task (free text, a ticket id/URL, a mockup image path, or a spec file) and it runs the full coding workflow — requirements → architecture → review → implement → verify → security with human-approval gates. Use when the user wants a non-trivial feature built end-to-end with reviewed, convention-compliant output.
4
4
  ---
5
5
 
6
- # Feature pipeline
6
+ # Feature pipeline (gated)
7
7
 
8
- Drive a feature from request to reviewed implementation through explicit stages.
9
- Each stage has a **gate**: do not proceed until its output is sound. State the
10
- verdict at each gate; if a gate fails, fix before advancing — never skip silently.
8
+ Run the whole coding workflow for the task in `$ARGUMENTS`. Stop and ask for
9
+ explicit approval at the two human gates below never auto-proceed past them.
10
+ State the verdict at every gate; if a gate fails, fix before advancing.
11
11
 
12
- ## Stages
12
+ ## 0 · Ground & classify input
13
+ - Read `CLAUDE.md` (hard rules, stack, folder layout, API boundary, test/scaffold
14
+ commands). If `CLAUDE.md` is missing or still has `{{PLACEHOLDERS}}`, STOP and
15
+ tell the user to complete grounding first (see `conventions/grounding-checklist.md`).
16
+ - Classify `$ARGUMENTS`:
17
+ - **mockup image** (`.png/.jpg` path) → first derive a design spec (run the
18
+ project's `mockup-spec` flow if present) and treat it as the requirements input.
19
+ - **ticket** (URL / `PROJ-123`) → fetch it if an integration exists, else ask
20
+ the user to paste the description.
21
+ - **file path** → read it as the spec.
22
+ - **free text** → use as-is.
23
+ - Create the run folder `.claude/pipeline/<slug>/` for all artifacts.
13
24
 
14
- 1. **Requirements.** Restate the request as user stories + acceptance criteria +
15
- explicit out-of-scope. Surface ambiguities now.
16
- **Gate:** requirements are unambiguous and agreed.
25
+ ## 1 · Requirements delegate to `ba-analyst`
26
+ Produce user stories + acceptance criteria + edge cases + explicit out-of-scope.
27
+ Write `01-requirements.md`.
17
28
 
18
- 2. **Architecture** delegate to the `architect` agent.
19
- Produce the file-level plan, data flow, API contract, and todo list.
20
- **Gate:** plan obeys `CLAUDE.md`, reuses existing code, no premature abstraction.
29
+ > **🚦 GATE 1 (human approval).** Present the requirements summary and the open
30
+ > questions. **STOP and ask the user to approve or adjust before continuing.**
21
31
 
22
- 3. **Plan review** — delegate to `dev-reviewer` (and `security-reviewer` if the
23
- feature touches auth/PII/external input). Run them in parallel.
24
- **Gate:** no `[BLOCK]` findings remain unaddressed.
32
+ ## 2 · Architecture — delegate to `architect`
33
+ Turn the approved requirements into a file-level plan: files to change, components
34
+ to reuse, data flow, API contract, step-by-step todos. Write `02-architecture.md`.
25
35
 
26
- 4. **Implement.** Execute the plan top-to-bottom. Keep diffs minimal and idiomatic.
27
- The repo's lint hooks enforce conventions in real time — fix what they flag.
28
- **Gate:** typecheck + lint pass; acceptance criteria met.
36
+ ## 3 · Plan review run in parallel
37
+ Delegate concurrently to `dev-reviewer`, `qa-planner`, and (if the feature touches
38
+ auth / PII / external input / a backend API) `security-reviewer`. Fold their
39
+ findings back into the plan. Write `03-review.md` + `04-test-plan.md`.
29
40
 
30
- 5. **Security review** delegate to `security-reviewer` on the actual diff.
31
- **Gate:** no `[CRITICAL]`/`[HIGH]` findings remain.
41
+ > **🚦 GATE 2 (human approval).** Present the reviewed plan + test plan. **STOP and
42
+ > ask the user to approve before any code is written.** Do not implement until approved.
43
+
44
+ ## 4 · Implement
45
+ - Scaffold with the project's generator first (e.g. `gen:feature`) when adding a
46
+ new domain — don't hand-create the folder layout.
47
+ - For backend wiring, delegate to `api-integrator`.
48
+ - Write minimal, idiomatic diffs that obey `CLAUDE.md`. The repo's lint hooks
49
+ enforce conventions on every edit — fix what they flag immediately.
50
+
51
+ ## 5 · Verify
52
+ Run the project's declared commands (from `CLAUDE.md` / `package.json`):
53
+ typecheck → lint → tests. Everything must pass. The `Stop` hook also gates the
54
+ turn end on lint. Write results to `05-implementation-log.md`.
55
+
56
+ ## 6 · Security review — delegate to `security-reviewer`
57
+ Audit the actual diff (`git diff`). Resolve every `[CRITICAL]`/`[HIGH]` finding.
58
+ Write `06-security-review.md`.
59
+
60
+ ## 7 · Summary
61
+ Report what changed (files + acceptance criteria met), verify results, and any
62
+ follow-ups. Offer to open a PR — do not push/commit unless the user asks.
32
63
 
33
64
  ## Rules
34
- - Write artifacts (requirements, plan, reviews) under `.claude/pipeline/<slug>/`
35
- so the run is auditable and resumable.
36
- - Prefer parallel sub-agents where stages are independent (e.g. dev + security review).
37
- - Lead with blockers. Don't pad with nits.
65
+ - Two human gates only (after Requirements, before Implement). Everything else flows.
66
+ - Prefer parallel sub-agents where stages are independent.
67
+ - Lead with blockers; don't pad with nits.
68
+ - Every stage leaves an artifact under `.claude/pipeline/<slug>/` so the run is
69
+ auditable and resumable.
@@ -0,0 +1,37 @@
1
+ # Grounding checklist — what each project MUST provide
2
+
3
+ The kit is the engine; this is the fuel. The `/pipeline` orchestrator is only as
4
+ good as the grounding below. Without it, the pipeline runs but produces
5
+ convention-violating or wrong-altitude code. Complete this before relying on
6
+ autonomous runs.
7
+
8
+ ## Required (pipeline depends on these)
9
+ - [ ] **`CLAUDE.md` filled in** — no `{{PLACEHOLDERS}}` left. Specifically:
10
+ - Hard rules (folder layout, API boundary, state decision tree, security).
11
+ - Tech stack (framework, UI library, state libs, test stack).
12
+ - Where new code lives + where it must NOT go.
13
+ - [ ] **ESLint configured** — the hooks lint via the project's own config. Custom
14
+ rules that encode hard rules (import boundaries, design-system-first) make the
15
+ real-time enforcement actually bite.
16
+ - [ ] **Declared commands** — typecheck, lint, and test commands discoverable in
17
+ `package.json` so the Verify stage can run them.
18
+ - [ ] **Feature scaffolder** — a `gen:feature` (or equivalent) so new domains get
19
+ the correct folder layout instead of hand-rolled structure.
20
+
21
+ ## Strongly recommended
22
+ - [ ] **Custom ESLint rules** for the project's non-negotiables (e.g. block legacy
23
+ imports, enforce the design system). Mechanical rules > prose the model may skip.
24
+ - [ ] **pre-commit hook** (husky) as the commit-time backstop behind the live hooks.
25
+ - [ ] **A design-spec / mockup flow** for UI tasks, so image input becomes a
26
+ token-accurate spec the pipeline can build to.
27
+ - [ ] **Playwright + MCP** if you want reproducible UI verification (the QA plan
28
+ references it; a ui-test-author can fill it in).
29
+
30
+ ## How the pipeline degrades when grounding is missing
31
+ | Missing | Effect |
32
+ |---|---|
33
+ | `CLAUDE.md` placeholders | Architect/implementer guess conventions → drift |
34
+ | No custom ESLint rules | Hooks catch only generic lint, not your boundaries |
35
+ | No test command | Verify stage can't prove correctness |
36
+ | No scaffolder | Folder layout hand-made → inconsistent across features |
37
+ | No mockup flow | UI fidelity unverifiable → manual review mandatory |