@react-vault/create-app 0.1.0

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 (117) hide show
  1. package/LICENSE +12 -0
  2. package/README.md +16 -0
  3. package/bin/create-app.js +8 -0
  4. package/claude-toolkit/README.md +131 -0
  5. package/claude-toolkit/agents/bfsi-accessibility-auditor.md +132 -0
  6. package/claude-toolkit/agents/bfsi-architect.md +156 -0
  7. package/claude-toolkit/agents/bfsi-code-reviewer.md +137 -0
  8. package/claude-toolkit/agents/bfsi-compliance-auditor.md +161 -0
  9. package/claude-toolkit/agents/bfsi-pii-scanner.md +142 -0
  10. package/claude-toolkit/agents/bfsi-pr-reviewer.md +114 -0
  11. package/claude-toolkit/agents/bfsi-security-reviewer.md +136 -0
  12. package/claude-toolkit/commands/bfsi-audit.md +46 -0
  13. package/claude-toolkit/commands/bfsi-doctor.md +97 -0
  14. package/claude-toolkit/commands/bfsi-review.md +46 -0
  15. package/claude-toolkit/commands/bfsi-scaffold.md +47 -0
  16. package/claude-toolkit/hooks/hooks.json +181 -0
  17. package/claude-toolkit/hooks/scripts/a11y-check.sh +63 -0
  18. package/claude-toolkit/hooks/scripts/audit-prompt.sh +36 -0
  19. package/claude-toolkit/hooks/scripts/block-destructive.sh +41 -0
  20. package/claude-toolkit/hooks/scripts/block-force-push.sh +30 -0
  21. package/claude-toolkit/hooks/scripts/format.sh +42 -0
  22. package/claude-toolkit/hooks/scripts/inject-context.sh +44 -0
  23. package/claude-toolkit/hooks/scripts/lint.sh +45 -0
  24. package/claude-toolkit/hooks/scripts/protect-files.sh +53 -0
  25. package/claude-toolkit/hooks/scripts/save-compliance-context.sh +35 -0
  26. package/claude-toolkit/hooks/scripts/scan-pii.sh +87 -0
  27. package/claude-toolkit/hooks/scripts/scan-secrets.sh +67 -0
  28. package/claude-toolkit/hooks/scripts/verify-clean.sh +50 -0
  29. package/claude-toolkit/package.json +22 -0
  30. package/claude-toolkit/plugin.json +31 -0
  31. package/claude-toolkit/skills/bfsi-api-endpoint/SKILL.md +105 -0
  32. package/claude-toolkit/skills/bfsi-commit/SKILL.md +102 -0
  33. package/claude-toolkit/skills/bfsi-compliance-check/SKILL.md +107 -0
  34. package/claude-toolkit/skills/bfsi-encrypt-helper/SKILL.md +127 -0
  35. package/claude-toolkit/skills/bfsi-error-message/SKILL.md +162 -0
  36. package/claude-toolkit/skills/bfsi-feature/SKILL.md +120 -0
  37. package/claude-toolkit/skills/bfsi-feature/references/architecture.md +69 -0
  38. package/claude-toolkit/skills/bfsi-feature/references/audit-events.md +70 -0
  39. package/claude-toolkit/skills/bfsi-feature/scripts/scaffold.mjs +136 -0
  40. package/claude-toolkit/skills/bfsi-form/SKILL.md +73 -0
  41. package/claude-toolkit/skills/bfsi-form/references/validation-regex.md +50 -0
  42. package/claude-toolkit/skills/bfsi-onboarding/SKILL.md +110 -0
  43. package/claude-toolkit/skills/bfsi-pii-field/SKILL.md +90 -0
  44. package/claude-toolkit/skills/bfsi-test-pattern/SKILL.md +179 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +339 -0
  48. package/dist/index.js.map +1 -0
  49. package/package.json +69 -0
  50. package/templates/_shared/.claude/settings.json +31 -0
  51. package/templates/_shared/.env.local.sample +25 -0
  52. package/templates/_shared/.github/workflows/ci.yml +49 -0
  53. package/templates/_shared/CLAUDE.md +89 -0
  54. package/templates/_shared/README.md +50 -0
  55. package/templates/_shared/index.html +16 -0
  56. package/templates/_shared/package.json +73 -0
  57. package/templates/_shared/postcss.config.cjs +6 -0
  58. package/templates/_shared/src/app/App.tsx +13 -0
  59. package/templates/_shared/src/app/globals.css +64 -0
  60. package/templates/_shared/src/env.ts +33 -0
  61. package/templates/_shared/src/i18n/i18n.ts +18 -0
  62. package/templates/_shared/src/i18n/translations/en.json +54 -0
  63. package/templates/_shared/src/i18n/translations/hi.json +30 -0
  64. package/templates/_shared/src/main.tsx +16 -0
  65. package/templates/_shared/src/routes/ProtectedRoute.tsx +28 -0
  66. package/templates/_shared/src/routes/index.tsx +67 -0
  67. package/templates/_shared/src/shared/ErrorBoundary.tsx +60 -0
  68. package/templates/_shared/tailwind.config.ts +68 -0
  69. package/templates/_shared/tests/setup.ts +7 -0
  70. package/templates/_shared/tsconfig.json +33 -0
  71. package/templates/_shared/tsconfig.node.json +13 -0
  72. package/templates/_shared/vite.config.ts +47 -0
  73. package/templates/rtk-query/.claude/skills/axios-auth/SKILL.md +103 -0
  74. package/templates/rtk-query/.claude/skills/axios-auth/references/error-shape.md +84 -0
  75. package/templates/rtk-query/.claude/skills/axios-auth/references/full-code-walkthrough.md +146 -0
  76. package/templates/rtk-query/.claude/skills/axios-auth/references/notification-wiring.md +141 -0
  77. package/templates/rtk-query/.claude/skills/constants-organization/SKILL.md +112 -0
  78. package/templates/rtk-query/.claude/skills/constants-organization/references/example-files.md +134 -0
  79. package/templates/rtk-query/.claude/skills/constants-organization/references/tag-types-catalog.md +53 -0
  80. package/templates/rtk-query/.claude/skills/redux-store-integration/SKILL.md +159 -0
  81. package/templates/rtk-query/.claude/skills/redux-store-integration/references/localStorage-persistence.md +70 -0
  82. package/templates/rtk-query/.claude/skills/redux-store-integration/references/middleware-patterns.md +82 -0
  83. package/templates/rtk-query/.claude/skills/rtk-query-api/SKILL.md +148 -0
  84. package/templates/rtk-query/.claude/skills/rtk-query-api/references/cache-strategies.md +96 -0
  85. package/templates/rtk-query/.claude/skills/rtk-query-api/references/endpoint-cookbook.md +145 -0
  86. package/templates/rtk-query/.claude/skills/rtk-query-api/references/optimistic-update.md +53 -0
  87. package/templates/rtk-query/README.md +84 -0
  88. package/templates/rtk-query/package.partial.json +7 -0
  89. package/templates/rtk-query/src/app/App.tsx +23 -0
  90. package/templates/rtk-query/src/axiosconfig/axiosInstance.ts +26 -0
  91. package/templates/rtk-query/src/axiosconfig/baseQuery.ts +72 -0
  92. package/templates/rtk-query/src/axiosconfig/interceptor.ts +42 -0
  93. package/templates/rtk-query/src/redux/invalidateCacheMiddleware.ts +20 -0
  94. package/templates/rtk-query/src/redux/reduxHooks.ts +10 -0
  95. package/templates/rtk-query/src/redux/rootReducer.ts +18 -0
  96. package/templates/rtk-query/src/redux/store.ts +36 -0
  97. package/templates/tanstack-query/.claude/skills/axios-auth/SKILL.md +109 -0
  98. package/templates/tanstack-query/.claude/skills/axios-auth/references/error-shape.md +89 -0
  99. package/templates/tanstack-query/.claude/skills/axios-auth/references/full-code-walkthrough.md +121 -0
  100. package/templates/tanstack-query/.claude/skills/axios-auth/references/notification-pattern.md +109 -0
  101. package/templates/tanstack-query/.claude/skills/constants-organization/SKILL.md +144 -0
  102. package/templates/tanstack-query/.claude/skills/constants-organization/references/example-files.md +111 -0
  103. package/templates/tanstack-query/.claude/skills/constants-organization/references/query-key-factories.md +129 -0
  104. package/templates/tanstack-query/.claude/skills/query-client-setup/SKILL.md +165 -0
  105. package/templates/tanstack-query/.claude/skills/query-client-setup/references/devtools.md +67 -0
  106. package/templates/tanstack-query/.claude/skills/query-client-setup/references/global-handlers.md +94 -0
  107. package/templates/tanstack-query/.claude/skills/tanstack-services/SKILL.md +142 -0
  108. package/templates/tanstack-query/.claude/skills/tanstack-services/references/audited-mutation.md +144 -0
  109. package/templates/tanstack-query/.claude/skills/tanstack-services/references/optimistic-update.md +102 -0
  110. package/templates/tanstack-query/.claude/skills/tanstack-services/references/service-cookbook.md +151 -0
  111. package/templates/tanstack-query/README.md +63 -0
  112. package/templates/tanstack-query/package.partial.json +8 -0
  113. package/templates/tanstack-query/src/api/axiosInstance.ts +20 -0
  114. package/templates/tanstack-query/src/api/http.ts +62 -0
  115. package/templates/tanstack-query/src/api/queryClient.ts +28 -0
  116. package/templates/tanstack-query/src/app/App.tsx +20 -0
  117. package/templates/tanstack-query/src/services/example.ts +32 -0
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: bfsi-doctor
3
+ description: Health check for a BFSI project. Verifies env vars, dep versions, .claude config, hook registration, package consistency, and BFSI-specific gotchas.
4
+ ---
5
+
6
+ # /bfsi-doctor
7
+
8
+ You are running a health check. Don't delegate — execute the checks directly.
9
+
10
+ ## Checks
11
+
12
+ Run each check, report status (✅ / ⚠️ / ❌), and remediation for any failures.
13
+
14
+ ### Environment
15
+
16
+ 1. **Node version** — `node --version`. Should be ≥ 20.11.0.
17
+ 2. **pnpm version** — `pnpm --version`. Should be ≥ 9.0.0.
18
+ 3. **Git** — `git --version`. Any modern git.
19
+ 4. **In a project root** — check for `package.json` in `$CLAUDE_PROJECT_DIR`.
20
+
21
+ ### Project config
22
+
23
+ 5. **`.claude/settings.json` exists** and enables the BFSI toolkit plugin.
24
+ 6. **`.env.local.sample` exists** with placeholders for VITE\_\* vars.
25
+ 7. **`tsconfig.json`** extends `tsconfig.base.json` (or has equivalent strict settings).
26
+ 8. **`.eslintrc.cjs`** present (or `eslint.config.js`).
27
+ 9. **`.husky/pre-commit`** present and executable.
28
+ 10. **`.github/workflows/ci.yml`** present.
29
+
30
+ ### Dependencies
31
+
32
+ 11. **Critical packages installed:**
33
+
34
+ - `react`, `react-dom`
35
+ - `@react-vault/core` (or link: ref to local workspace)
36
+ - `@react-vault/ui`
37
+ - One of: `@reduxjs/toolkit` OR `@tanstack/react-query`
38
+ - `react-hook-form`, `zod`
39
+ - `react-router-dom`
40
+ - `react-i18next`
41
+ - `tailwindcss`, `autoprefixer`, `postcss`
42
+ - `vitest`, `@testing-library/react`
43
+
44
+ 12. **No duplicate React** — `pnpm why react` should show one version.
45
+
46
+ ### BFSI conventions
47
+
48
+ 13. **`src/features/` exists** (or features live somewhere obvious).
49
+ 14. **`src/routes/ProtectedRoute.tsx`** exists.
50
+ 15. **i18n setup** — `src/i18n/i18n.ts` exists and `App.tsx` wraps in `I18nextProvider`.
51
+ 16. **Audit endpoint configured** — `VITE_AUDIT_ENDPOINT` in `.env.local.sample`.
52
+ 17. **Sentry stub configured** — `VITE_SENTRY_DSN` placeholder present.
53
+
54
+ ### Claude toolkit
55
+
56
+ 18. **`/hooks` registered** — at least 8 hooks visible (run via Bash if possible; otherwise describe to user).
57
+ 19. **`/plugin` shows `toolkit` enabled.**
58
+ 20. **At least 8 skills available** — list via `ls .claude/skills` if user-level, or via `/plugin` for plugin-level.
59
+
60
+ ### Security
61
+
62
+ 21. **No `.env` files committed** — `git ls-files | grep -E '\.env(\..*)?$' | grep -v 'sample\|example'` should be empty.
63
+ 22. **No node_modules tracked** — `git ls-files | grep node_modules` should be empty.
64
+ 23. **No PEM/key files tracked** — `git ls-files | grep -E '\.(pem|key|p12|pfx)$'` should be empty.
65
+
66
+ ## Output
67
+
68
+ ```markdown
69
+ # /bfsi-doctor health check
70
+
71
+ ## Summary
72
+
73
+ {count_pass} ✅ {count_warn} ⚠️ {count_fail} ❌
74
+
75
+ ## Failures (must fix)
76
+
77
+ {for each ❌, with remediation}
78
+
79
+ ## Warnings (recommended fixes)
80
+
81
+ {for each ⚠️, with rationale}
82
+
83
+ ## All green
84
+
85
+ {categories that fully passed}
86
+
87
+ ## Next steps
88
+
89
+ {Top 3 actions ordered by urgency}
90
+ ```
91
+
92
+ ## Notes
93
+
94
+ - Be quiet if everything passes — a short "all green" is fine.
95
+ - For `⚠️` items, explain WHY they matter (not just the fact).
96
+ - For `❌` items, give the EXACT command or file edit to remediate.
97
+ - Don't apply fixes yourself; the user runs them.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: bfsi-review
3
+ description: Run the full BFSI PR review pipeline — spawns security, code, a11y, PII, and performance reviewers in parallel and synthesises their findings into a merge recommendation.
4
+ argument-hint: [diff-range or --pr <num>]
5
+ ---
6
+
7
+ # /bfsi-review
8
+
9
+ You are running a full BFSI PR review. Delegate to the `bfsi-pr-reviewer` agent which orchestrates the specialist agents in parallel.
10
+
11
+ ## Workflow
12
+
13
+ 1. **Establish scope.**
14
+
15
+ If the user provided `$ARGUMENTS`:
16
+ - `--pr <num>` → use `gh pr diff <num>` for the scope
17
+ - A branch name or git revspec → use `git diff <revspec>...HEAD`
18
+ - File globs → review just those files
19
+ - Empty → default to `git diff origin/main...HEAD`
20
+
21
+ 2. **Verify we're in a project with the toolkit enabled.**
22
+
23
+ Check `.claude/settings.json` for the plugin reference. If missing, tell the user to run from a scaffolded BFSI project root.
24
+
25
+ 3. **Delegate to the orchestrator.**
26
+
27
+ Spawn the `bfsi-pr-reviewer` agent with the determined scope. The orchestrator handles all parallel coordination of specialists.
28
+
29
+ 4. **Surface the orchestrator's output to the user verbatim.**
30
+
31
+ Don't re-summarise. The orchestrator's output is the final review.
32
+
33
+ 5. **End with a recommendation.**
34
+
35
+ The orchestrator's report ends with one of:
36
+ - ✅ APPROVED
37
+ - ⚠️ MERGEABLE WITH FOLLOW-UP
38
+ - ❌ NOT MERGE-READY
39
+
40
+ If NOT MERGE-READY, suggest the most relevant skill or agent to address the first critical finding (e.g., "Run `/bfsi-commit` after fixing", or "Use `bfsi-protected-route` skill to add the missing guard").
41
+
42
+ ## Notes
43
+
44
+ - The pipeline is read-only — no fixes applied.
45
+ - Each specialist may take 30s–2min; the orchestrator runs them in parallel so total time is ≈ the slowest one.
46
+ - The orchestrator de-duplicates findings across specialists, so the synthesis is concise.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: bfsi-scaffold
3
+ description: Interactive feature / API / form scaffolding for BFSI projects. Routes to the right skill based on what the user wants to create.
4
+ argument-hint: [feature|api|form|route|table] [args]
5
+ ---
6
+
7
+ # /bfsi-scaffold
8
+
9
+ You are dispatching the user to the right scaffolding skill.
10
+
11
+ ## Workflow
12
+
13
+ If `$ARGUMENTS` starts with a known kind, route directly:
14
+
15
+ - `feature <Name>` → invoke skill `bfsi-feature` with `$Name`
16
+ - `api <Method> <Path>` → invoke skill `bfsi-api-endpoint`
17
+ - `form <Name>` → invoke skill `bfsi-form`
18
+ - `route <Path>` → invoke skill `bfsi-protected-route`
19
+ - `table <Name>` → invoke skill `bfsi-data-table`
20
+ - `pii <Field>` → invoke skill `bfsi-pii-field`
21
+ - `i18n <Key>` → invoke skill `bfsi-i18n-key`
22
+ - `audit <Action>` → invoke skill `bfsi-audit-action`
23
+ - `confirm` → invoke skill `bfsi-confirm-modal`
24
+
25
+ If `$ARGUMENTS` is empty or doesn't match, ask the user which kind:
26
+
27
+ ```
28
+ What would you like to scaffold?
29
+
30
+ 1. feature — full feature module (api + containers + components + tests + i18n)
31
+ 2. api — single API endpoint (RTK Query or TanStack)
32
+ 3. form — RHF + Zod form with BFSI defaults
33
+ 4. route — protected route with permission check
34
+ 5. table — access-controlled data table
35
+ 6. pii — wrap a field with PIIMaskedDisplay
36
+ 7. i18n — add an i18n key across all locales
37
+ 8. audit — wrap an action with audit logging
38
+ 9. confirm — confirmation modal (with optional MFA)
39
+
40
+ Type the kind plus any args (e.g. "feature KycVerification").
41
+ ```
42
+
43
+ Then route based on the response.
44
+
45
+ ## Notes
46
+
47
+ This command is a thin router. The actual scaffolding lives in the dedicated skills, which encapsulate the BFSI conventions for each artefact type.
@@ -0,0 +1,181 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "if": "Bash(rm -rf *)",
10
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/block-destructive.sh",
11
+ "args": [],
12
+ "statusMessage": "[bfsi] checking destructive shell"
13
+ }
14
+ ]
15
+ },
16
+ {
17
+ "matcher": "Bash",
18
+ "hooks": [
19
+ {
20
+ "type": "command",
21
+ "if": "Bash(git push --force *)",
22
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/block-force-push.sh",
23
+ "args": [],
24
+ "statusMessage": "[bfsi] checking force push"
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "matcher": "Bash",
30
+ "hooks": [
31
+ {
32
+ "type": "command",
33
+ "if": "Bash(git push --force-with-lease *)",
34
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/block-force-push.sh",
35
+ "args": [],
36
+ "statusMessage": "[bfsi] checking force push with lease"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "matcher": "Edit|Write",
42
+ "hooks": [
43
+ {
44
+ "type": "command",
45
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/protect-files.sh",
46
+ "args": [],
47
+ "statusMessage": "[bfsi] checking protected files"
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "matcher": "Edit|Write",
53
+ "hooks": [
54
+ {
55
+ "type": "command",
56
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/scan-secrets.sh",
57
+ "args": [],
58
+ "statusMessage": "[bfsi] scanning for secret patterns"
59
+ }
60
+ ]
61
+ }
62
+ ],
63
+ "PostToolUse": [
64
+ {
65
+ "matcher": "Edit|Write",
66
+ "hooks": [
67
+ {
68
+ "type": "command",
69
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/format.sh",
70
+ "args": [],
71
+ "async": true,
72
+ "timeout": 60,
73
+ "statusMessage": "[bfsi] formatting (async)"
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "matcher": "Edit|Write",
79
+ "hooks": [
80
+ {
81
+ "type": "command",
82
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/lint.sh",
83
+ "args": [],
84
+ "async": true,
85
+ "timeout": 60,
86
+ "statusMessage": "[bfsi] linting (async)"
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "matcher": "Edit|Write",
92
+ "hooks": [
93
+ {
94
+ "type": "command",
95
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/scan-pii.sh",
96
+ "args": [],
97
+ "statusMessage": "[bfsi] scanning for PII patterns"
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "matcher": "Write",
103
+ "hooks": [
104
+ {
105
+ "type": "command",
106
+ "if": "Write(*.tsx)",
107
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/a11y-check.sh",
108
+ "args": [],
109
+ "async": true,
110
+ "timeout": 120,
111
+ "statusMessage": "[bfsi] a11y check (async)"
112
+ }
113
+ ]
114
+ }
115
+ ],
116
+ "SessionStart": [
117
+ {
118
+ "matcher": "startup|resume",
119
+ "hooks": [
120
+ {
121
+ "type": "command",
122
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/inject-context.sh",
123
+ "args": [],
124
+ "statusMessage": "[bfsi] loading project context"
125
+ }
126
+ ]
127
+ }
128
+ ],
129
+ "UserPromptSubmit": [
130
+ {
131
+ "hooks": [
132
+ {
133
+ "type": "command",
134
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/audit-prompt.sh",
135
+ "args": [],
136
+ "async": true,
137
+ "timeout": 30
138
+ }
139
+ ]
140
+ }
141
+ ],
142
+ "Stop": [
143
+ {
144
+ "hooks": [
145
+ {
146
+ "type": "command",
147
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/verify-clean.sh",
148
+ "args": [],
149
+ "async": true,
150
+ "timeout": 90,
151
+ "statusMessage": "[bfsi] post-turn verification (async)"
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ "hooks": [
157
+ {
158
+ "type": "agent",
159
+ "model": "sonnet",
160
+ "timeout": 300,
161
+ "statusMessage": "[bfsi] reviewing diff against project standards",
162
+ "prompt": "You are a post-turn code-review gate. The user just finished a coding turn. Decide whether the diff is clean enough to stop, or whether to ask the user if they want Claude to fix issues before stopping.\n\n# Step 0 — Skip-list\n\nLook at $ARGUMENTS for the `stop_hook_active` field. If it is `true`, return `{ \"ok\": true }` immediately — Claude is already in a stop-hook loop and we should not stack another round.\n\nRun `git diff --name-only` and `git diff --stat`. If the working tree is clean, or the only changes are to docs (`*.md`, `docs/`, `README*`, `LICENSE`), test fixtures, or `.gitignore`, return `{ \"ok\": true }` — no review needed.\n\n# Step 1 — Classify findings strictly\n\nRead the uncommitted diff (`git diff`) and the relevant skill files under `.claude/skills/` (especially `axios-auth`, `constants-organization`, and whichever data-layer skill exists: `rtk-query-api` or `tanstack-services`). Cross-reference against `CLAUDE.md` at the project root.\n\nClassify every finding strictly by this rubric:\n\n**P0 — CRITICAL (must fix before merge)**:\n- Hardcoded secret/key/token in source\n- PAN / Aadhaar / account# / CVV / OTP / password in `console.*`, `localStorage`, URL params, Sentry/telemetry, error message, or audit metadata\n- `dangerouslySetInnerHTML` without an explicit sanitiser\n- Weak crypto: md5, sha1, `Math.random()` for security, AES-ECB, custom \"scrambling\"\n- Auth token stored anywhere other than `setAuthToken(axios, token)` (no localStorage)\n- API response used without `schema.parse(...)` (no Zod validation)\n- `rm -rf` or destructive shell in source\n- `eval`, `new Function(...)`, `Function(...)` calls\n\n**P1 — HIGH (should fix this PR)**:\n- `any` type in app code (excluding `*.test.*` fixtures)\n- Mutation without audit wrapper: `useMutation` not `useAuditedMutation` (TanStack), or RTK mutation missing `showFailureNotification: true` for sensitive ops\n- `<Route>` without `<ProtectedRoute permission=\"...\">` for non-public routes\n- PII field rendered as `{user.pan}` (or similar) without `<PIIMaskedDisplay>`\n- Inline regex / URL string / RTK tag-type instead of going through `regexConstants.ts` / `urlConstants.ts` / `tagTypes.ts`\n- Missing idempotency-key on a state-changing mutation\n- Form field with `autoComplete=\"on\"` for PII\n- Missing `transformResponse: schema.parse` on an RTK Query endpoint\n\n**P2 — MEDIUM/LOW (track separately, DO NOT prompt for these)**:\n- Naming, style, missing tests, unused vars, magic numbers, file length\n- Comment quality, redundant code, refactor opportunities\n\n# Step 2 — Branch on findings\n\n**If no P0/P1 findings exist**: return `{ \"ok\": true }` and you are done. Do NOT prompt the user.\n\n**If P0 and/or P1 findings exist**: continue to Step 3.\n\n# Step 3 — Show findings + ask the user\n\nFirst, print the findings as a numbered list (one line per finding):\n\n ```\n P0/P1 findings in the current diff:\n 1. [P0] file/path.ts:42 — Hardcoded API key (fix: move to env var)\n 2. [P1] file/path.tsx:88 — Missing <PIIMaskedDisplay> on user.pan\n ...\n ```\n\nThen use the `AskUserQuestion` tool with EXACTLY this shape:\n\n question: \"Found N P0/P1 issue(s). What should I do?\"\n header: \"Auto-review\"\n multiSelect: false\n options:\n - label: \"Fix all now\"\n description: \"I'll resolve every P0/P1 finding in this turn before stopping.\"\n - label: \"Fix selected ones\"\n description: \"Show me a checkbox list of just the P0/P1 findings; I'll fix only what you tick.\"\n - label: \"Skip — let me handle them\"\n description: \"Don't touch the code. The findings list above is for your reference.\"\n\nIf user picked \"Fix all now\":\n Return `{ \"ok\": false, \"reason\": \"Fix the following P0/P1 findings before stopping:\\n\\n<full numbered list including file:line and concrete fix for each>\" }`\n\nIf user picked \"Fix selected ones\":\n Use AskUserQuestion AGAIN with `multiSelect: true` and one option per finding. Then return `{ \"ok\": false, \"reason\": \"Fix ONLY these selected P0/P1 findings:\\n<the picked subset with file:line and fix>\" }`.\n\nIf user picked \"Skip\":\n Return `{ \"ok\": true }`. The findings list is already printed; the user has it.\n\n# Hard rules\n\n- Be precise. Cite `file:line` for every finding. Vague findings = unfixable findings.\n- Do not invent findings. If you cannot identify a concrete file:line that violates a rule, do not include it.\n- Never block on P2. Mention them at most once at the end of the printed list, as info.\n- If the AskUserQuestion tool is unavailable in this context, default to printing the findings + returning `{ \"ok\": true }` so the user is not blocked.\n\n$ARGUMENTS"
163
+ }
164
+ ]
165
+ }
166
+ ],
167
+ "PreCompact": [
168
+ {
169
+ "matcher": "auto|manual",
170
+ "hooks": [
171
+ {
172
+ "type": "command",
173
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/save-compliance-context.sh",
174
+ "args": [],
175
+ "statusMessage": "[bfsi] snapshotting compliance context"
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ }
181
+ }
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ # Async post-write a11y heuristic for .tsx files.
3
+ # Runs lightweight pattern checks; the full audit lives in bfsi-accessibility-auditor agent.
4
+ set -euo pipefail
5
+
6
+ INPUT=$(cat)
7
+ FILE_PATH=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // ""')
8
+
9
+ if [[ -z "$FILE_PATH" ]] || [[ ! -f "$FILE_PATH" ]]; then
10
+ exit 0
11
+ fi
12
+
13
+ [[ "$FILE_PATH" == *.tsx ]] || exit 0
14
+
15
+ declare -a FINDINGS=()
16
+
17
+ # <img> without alt
18
+ if grep -nE '<img[^>]*>' "$FILE_PATH" | grep -vE 'alt=' >/dev/null 2>&1; then
19
+ while IFS= read -r line; do
20
+ FINDINGS+=("$line — <img> without alt attribute")
21
+ done < <(grep -nE '<img[^>]*>' "$FILE_PATH" | grep -vE 'alt=' | head -3)
22
+ fi
23
+
24
+ # <button> with empty children and no aria-label
25
+ if grep -nE '<button[^>]*>[[:space:]]*</button>' "$FILE_PATH" >/dev/null 2>&1; then
26
+ while IFS= read -r line; do
27
+ if ! printf '%s' "$line" | grep -qE 'aria-label='; then
28
+ FINDINGS+=("$line — empty <button> without aria-label")
29
+ fi
30
+ done < <(grep -nE '<button[^>]*>[[:space:]]*</button>' "$FILE_PATH" | head -3)
31
+ fi
32
+
33
+ # <div onClick=...> (should be <button>)
34
+ if grep -nE '<div[^>]+onClick=' "$FILE_PATH" >/dev/null 2>&1; then
35
+ while IFS= read -r line; do
36
+ if ! printf '%s' "$line" | grep -qE 'role="button"'; then
37
+ FINDINGS+=("$line — clickable <div> without role='button' (prefer <button>)")
38
+ fi
39
+ done < <(grep -nE '<div[^>]+onClick=' "$FILE_PATH" | head -3)
40
+ fi
41
+
42
+ # outline: none without a focus replacement
43
+ if grep -nE 'outline:[[:space:]]*none' "$FILE_PATH" >/dev/null 2>&1; then
44
+ while IFS= read -r line; do
45
+ FINDINGS+=("$line — 'outline: none' removes focus indicator; provide a replacement focus style")
46
+ done < <(grep -nE 'outline:[[:space:]]*none' "$FILE_PATH" | head -3)
47
+ fi
48
+
49
+ if [[ ${#FINDINGS[@]} -gt 0 ]]; then
50
+ CTX="[bfsi-a11y] possible accessibility issues in $(basename "$FILE_PATH"):"
51
+ for f in "${FINDINGS[@]}"; do
52
+ CTX="$CTX
53
+ $f"
54
+ done
55
+ CTX="$CTX
56
+
57
+ Run the bfsi-accessibility-auditor agent for a full WCAG 2.1 AA audit."
58
+ jq -n --arg msg "$CTX" '{
59
+ systemMessage: $msg
60
+ }'
61
+ fi
62
+
63
+ exit 0
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ # Opt-in prompt audit log. Enabled when BFSI_AUDIT_PROMPTS=1 is set in the shell env.
3
+ # Per Claude Code spec: async, no decision control.
4
+ set -euo pipefail
5
+
6
+ # Only run if explicitly enabled
7
+ [[ "${BFSI_AUDIT_PROMPTS:-0}" == "1" ]] || exit 0
8
+
9
+ INPUT=$(cat)
10
+ PROMPT=$(printf '%s' "$INPUT" | jq -r '.prompt // ""')
11
+ SESSION=$(printf '%s' "$INPUT" | jq -r '.session_id // ""')
12
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
13
+
14
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
15
+ AUDIT_DIR="$PROJECT_DIR/.claude"
16
+ AUDIT_LOG="$AUDIT_DIR/audit.log"
17
+
18
+ mkdir -p "$AUDIT_DIR"
19
+
20
+ # Scrub obvious PII patterns from the prompt before logging
21
+ SCRUBBED=$(printf '%s' "$PROMPT" |
22
+ sed -E 's/[A-Z]{5}[0-9]{4}[A-Z]/<PAN>/g' |
23
+ sed -E 's/[0-9]{12}/<AADHAAR-ish>/g' |
24
+ sed -E 's/[6-9][0-9]{9}/<MOBILE>/g' |
25
+ sed -E 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/<EMAIL>/g'
26
+ )
27
+
28
+ # Append a JSON line
29
+ jq -n -c \
30
+ --arg ts "$TIMESTAMP" \
31
+ --arg session "$SESSION" \
32
+ --arg prompt "$SCRUBBED" \
33
+ '{timestamp: $ts, session_id: $session, event: "user_prompt", prompt_scrubbed: $prompt}' \
34
+ >> "$AUDIT_LOG"
35
+
36
+ exit 0
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # Blocks destructive `rm -rf` invocations.
3
+ # Allows `rm -rf node_modules`, `rm -rf dist`, `rm -rf .turbo`, `rm -rf coverage` — known build artefacts.
4
+ # Per Claude Code spec: exit 2 to block; stderr surfaces to Claude.
5
+
6
+ set -euo pipefail
7
+
8
+ INPUT=$(cat)
9
+ COMMAND=$(printf '%s' "$INPUT" | jq -r '.tool_input.command // ""')
10
+
11
+ # Allowed targets (build artefacts only)
12
+ ALLOWED='^rm -rf (\./)?(node_modules|dist|build|coverage|\.turbo|\.next|out|playwright-report|\.cache|\.scratch)(/?$| )'
13
+
14
+ if [[ -z "$COMMAND" ]]; then
15
+ exit 0
16
+ fi
17
+
18
+ if [[ "$COMMAND" =~ $ALLOWED ]]; then
19
+ exit 0
20
+ fi
21
+
22
+ if [[ "$COMMAND" =~ rm[[:space:]]+-rf ]]; then
23
+ cat >&2 <<EOF
24
+ [bfsi] Blocked destructive shell command:
25
+
26
+ $COMMAND
27
+
28
+ The bfsi-claude-toolkit blocks 'rm -rf' except for known build artefacts
29
+ (node_modules, dist, build, coverage, .turbo, .next).
30
+
31
+ If you need to remove other files:
32
+ - Use 'rm' (not 'rm -rf') for single files
33
+ - Use 'rm -r' (no -f) so errors surface
34
+ - For directories: pass --force per-call with explicit consent
35
+
36
+ If you genuinely need 'rm -rf <other-path>', edit the file manually outside Claude.
37
+ EOF
38
+ exit 2
39
+ fi
40
+
41
+ exit 0
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # Blocks 'git push --force' to protected branches (main, master, staging, production, release/*).
3
+ # `--force-with-lease` is treated identically — both can rewrite history on the remote.
4
+ set -euo pipefail
5
+
6
+ INPUT=$(cat)
7
+ COMMAND=$(printf '%s' "$INPUT" | jq -r '.tool_input.command // ""')
8
+
9
+ PROTECTED='(main|master|staging|production|release/[^[:space:]]+)'
10
+
11
+ if [[ "$COMMAND" =~ git[[:space:]]+push[[:space:]]+.*--force(-with-lease)?.*[[:space:]]+($PROTECTED)([[:space:]]|$) ]]; then
12
+ cat >&2 <<EOF
13
+ [bfsi] Blocked: force push to a protected branch.
14
+
15
+ $COMMAND
16
+
17
+ Force push to main / master / staging / production / release branches is
18
+ blocked by bfsi-claude-toolkit. This protects audit trail integrity (RBI
19
+ Annexure I §12, SOC2 CC7.2).
20
+
21
+ If the remote needs rewinding, do it manually via:
22
+ - Git GUI with explicit confirmation
23
+ - Direct shell outside Claude (you'll see the safeguards)
24
+ - Reach out to a tech-lead for approval
25
+ EOF
26
+ exit 2
27
+ fi
28
+
29
+ # Allow force push to feature branches
30
+ exit 0
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+ # Async post-write Prettier on the changed file. Best-effort: silent on success,
3
+ # logs to stderr on failure (non-blocking, since async).
4
+ set -euo pipefail
5
+
6
+ INPUT=$(cat)
7
+ FILE_PATH=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // ""')
8
+
9
+ if [[ -z "$FILE_PATH" ]] || [[ ! -f "$FILE_PATH" ]]; then
10
+ exit 0
11
+ fi
12
+
13
+ # Only run on files Prettier can handle
14
+ case "$FILE_PATH" in
15
+ *.ts|*.tsx|*.js|*.jsx|*.json|*.md|*.yml|*.yaml|*.css|*.scss|*.html)
16
+ ;;
17
+ *)
18
+ exit 0
19
+ ;;
20
+ esac
21
+
22
+ # Resolve project root (closest package.json with prettier)
23
+ ROOT="$(dirname "$FILE_PATH")"
24
+ while [[ "$ROOT" != "/" ]] && [[ ! -f "$ROOT/package.json" ]]; do
25
+ ROOT="$(dirname "$ROOT")"
26
+ done
27
+
28
+ if [[ ! -f "$ROOT/package.json" ]]; then
29
+ exit 0
30
+ fi
31
+
32
+ # Use the project's prettier if available
33
+ if command -v pnpm >/dev/null 2>&1; then
34
+ cd "$ROOT" && pnpm exec prettier --write "$FILE_PATH" 2>&1 | tail -5 >&2 || true
35
+ elif command -v npx >/dev/null 2>&1; then
36
+ cd "$ROOT" && npx prettier --write "$FILE_PATH" 2>&1 | tail -5 >&2 || true
37
+ fi
38
+
39
+ # Inform Claude on next turn that format ran
40
+ jq -n --arg file "$(basename "$FILE_PATH")" '{
41
+ systemMessage: ("[bfsi] formatted " + $file)
42
+ }'
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # SessionStart hook: injects project context for Claude.
3
+ # Plain stdout becomes additional context (per Claude Code spec for SessionStart).
4
+ set -euo pipefail
5
+
6
+ cd "${CLAUDE_PROJECT_DIR:-$(pwd)}" 2>/dev/null || cd "$(pwd)"
7
+
8
+ # Branch + recent commits
9
+ BRANCH=$(git branch --show-current 2>/dev/null || echo "(not a git repo)")
10
+ RECENT=$(git log --oneline -5 2>/dev/null || echo "(no recent commits)")
11
+ DIRTY=$(git status --short 2>/dev/null | head -10 || echo "")
12
+
13
+ cat <<EOF
14
+ [bfsi-claude-toolkit] Project context loaded.
15
+
16
+ Current branch: $BRANCH
17
+
18
+ Recent commits:
19
+ $RECENT
20
+
21
+ Uncommitted changes:
22
+ ${DIRTY:-(clean working tree)}
23
+
24
+ BFSI conventions in effect:
25
+ - All API responses go through Zod parse
26
+ - All mutations use useAuditedMutation
27
+ - All routes use <ProtectedRoute permission=...>
28
+ - PII fields display via <PIIMaskedDisplay>
29
+ - No card data in HTML inputs (use <PCITokenizedCardInput>)
30
+ - Tokens in memory, never localStorage
31
+ - Commits use Conventional Commits with BFSI types (security, compliance, audit)
32
+
33
+ Available commands: /bfsi-review, /bfsi-scaffold, /bfsi-audit, /bfsi-doctor
34
+ Available skills: /bfsi-feature, /bfsi-form, /bfsi-pii-field, /bfsi-api-endpoint,
35
+ /bfsi-compliance-check, /bfsi-commit
36
+
37
+ Reference skills auto-load on matching prompts:
38
+ - bfsi-onboarding (how does this project work)
39
+ - bfsi-encrypt-helper (encryption usage)
40
+ - bfsi-test-pattern (test patterns)
41
+ - bfsi-error-message (error handling)
42
+
43
+ For full toolkit docs: cat packages/claude-toolkit/README.md
44
+ EOF