@smartsoft001/claude-plugins 2.113.0 → 2.115.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.
@@ -1,6 +1,6 @@
1
1
  # Hooks
2
2
 
3
- Claude Code hooks for skill activation, safety validation, formatting, and audit logging.
3
+ Claude Code hooks for safety validation, sensitive file protection, formatting, and audit logging.
4
4
 
5
5
  ---
6
6
 
@@ -16,54 +16,56 @@ Hooks are scripts that run at specific points in Claude's workflow:
16
16
 
17
17
  ---
18
18
 
19
+ ## Configuration
20
+
21
+ All hooks are configured in `hooks.json` in this directory. Claude Code reads this file automatically when the plugin is installed.
22
+
23
+ ---
24
+
19
25
  ## Current Hooks
20
26
 
21
27
  | Hook | Event | Purpose |
22
28
  |------|-------|---------|
23
- | `skill-suggester.py` | UserPromptSubmit | Suggests relevant skills based on prompt |
24
29
  | `safety_validator.py` | PreToolUse | Blocks destructive commands |
25
- | `skill-validator.py` | PreToolUse | Validates skill file structure |
26
- | `auto-format.sh` | PostToolUse | Auto-formats Python/JS/TS files |
30
+ | `sensitive_file_blocker.py` | PreToolUse | Blocks access to sensitive files |
31
+ | `skill_validator.py` | PreToolUse | Validates skill file structure |
32
+ | `auto_format.sh` | PostToolUse | Auto-formats after file changes |
27
33
  | `audit_logger.py` | All events | Logs all actions for audit trail |
28
34
 
29
35
  ---
30
36
 
31
37
  ## Hook Details
32
38
 
33
- ### skill-suggester.py (UserPromptSubmit)
39
+ ### safety_validator.py (PreToolUse)
34
40
 
35
- **Purpose:** Automatically suggests relevant skills based on user prompts and file context.
41
+ **Purpose:** Blocks destructive bash commands and sensitive file modifications.
36
42
 
37
- **How it works:**
38
- 1. Reads `.claude/skills/skill-rules.json`
39
- 2. Matches prompt against keywords and intent patterns
40
- 3. Matches file paths against path patterns
41
- 4. Groups matches by priority (critical, high, medium, low)
42
- 5. Outputs all matching skills in a visual block
43
+ **Matcher:** `Bash|Write|Edit`
43
44
 
44
- **Output example:**
45
- ```
46
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
- SKILL ACTIVATION CHECK
48
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
-
50
- >> RECOMMENDED SKILLS:
51
- -> /python-dev (keyword: python)
45
+ **Blocks:**
46
+ - `rm -rf /`, `rm -rf ~`, `rm -rf *`
47
+ - `dd` disk operations, `mkfs` formatting
48
+ - Fork bombs
49
+ - Bash access to `.env`, `id_rsa`, `credentials` files
52
50
 
53
- ACTION: Use slash command to activate skill
54
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
- ```
51
+ **Exit codes:**
52
+ - `0` - Allow
53
+ - `2` - Block with message
56
54
 
57
55
  ---
58
56
 
59
- ### safety_validator.py (PreToolUse)
57
+ ### sensitive_file_blocker.py (PreToolUse)
60
58
 
61
- **Purpose:** Blocks destructive bash commands and sensitive file modifications.
59
+ **Purpose:** Blocks Read/Edit/Write access to sensitive files.
62
60
 
63
- **Blocks:**
64
- - `rm -rf /`, `rm -rf ~`, `rm -rf *`
65
- - Modifications to `.env`, `id_rsa`, `credentials` files
66
- - Other dangerous patterns
61
+ **Matcher:** `Read|Edit|Write`
62
+
63
+ **Blocked patterns:**
64
+ - `.env` files (`.env`, `.env.local`, `.env.production`)
65
+ - `secrets` in path
66
+ - `credentials` in path
67
+
68
+ **Exception:** Files ending with `.example` are allowed.
67
69
 
68
70
  **Exit codes:**
69
71
  - `0` - Allow
@@ -71,10 +73,12 @@ ACTION: Use slash command to activate skill
71
73
 
72
74
  ---
73
75
 
74
- ### skill-validator.py (PreToolUse)
76
+ ### skill_validator.py (PreToolUse)
75
77
 
76
78
  **Purpose:** Validates skill files follow correct structure.
77
79
 
80
+ **Matcher:** `Write|Edit`
81
+
78
82
  **Checks:**
79
83
  - YAML frontmatter (name, description)
80
84
  - Required sections (Purpose, When to Use)
@@ -85,15 +89,15 @@ ACTION: Use slash command to activate skill
85
89
 
86
90
  ---
87
91
 
88
- ### auto-format.sh (PostToolUse)
92
+ ### auto_format.sh (PostToolUse)
89
93
 
90
94
  **Purpose:** Auto-formats files after Write/Edit operations.
91
95
 
92
- **Formatters:**
93
- - Python: `ruff format`
94
- - JS/TS: `prettier` (if available)
96
+ **Matcher:** `Write|Edit`
95
97
 
96
- **Runs on:** Files matching `*.py`, `*.js`, `*.ts`, `*.tsx`
98
+ **Runs:** `source ~/.nvm/nvm.sh && nvm use 24 && npm run format`
99
+
100
+ **Requires:** Node.js 24 via nvm
97
101
 
98
102
  ---
99
103
 
@@ -111,20 +115,14 @@ ACTION: Use slash command to activate skill
111
115
 
112
116
  ---
113
117
 
114
- ## Configuration
115
-
116
- All hooks are configured in `.claude/settings.json`. See [CONFIG.md](./CONFIG.md) for customization options.
117
-
118
- ---
119
-
120
118
  ## Adding New Hooks
121
119
 
122
- 1. Create script in `.claude/hooks/`
120
+ 1. Create script in this `hooks/` directory
123
121
  2. Make executable: `chmod +x script.py`
124
- 3. Add to `.claude/settings.json` under appropriate event
122
+ 3. Add to `hooks.json` under appropriate event
125
123
  4. Include `_description` for documentation
126
124
 
127
- Example:
125
+ Example entry in `hooks.json`:
128
126
  ```json
129
127
  {
130
128
  "_description": "My custom hook: does something useful",
@@ -132,8 +130,10 @@ Example:
132
130
  "hooks": [
133
131
  {
134
132
  "type": "command",
135
- "command": ".claude/hooks/my-hook.py"
133
+ "command": "./my-hook.py"
136
134
  }
137
135
  ]
138
136
  }
139
137
  ```
138
+
139
+ See [CONFIG.md](./CONFIG.md) for customization options.
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+ # Auto-format hook for Claude Code
3
+ #
4
+ # Runs the project's formatting pipeline (nx format + lint --fix)
5
+ # after Write/Edit operations.
6
+ #
7
+ # Requires Node.js 24 via nvm.
8
+
9
+ set -e
10
+
11
+ source ~/.nvm/nvm.sh && nvm use 24 && npm run format
@@ -0,0 +1,79 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "_description": "Safety gate: blocks destructive bash commands",
6
+ "matcher": "Bash|Write|Edit",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "./safety_validator.py"
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "_description": "Block sensitive files with detailed error message",
16
+ "matcher": "Read|Edit|Write",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "./sensitive_file_blocker.py"
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "_description": "Audit trail: logs all PreToolUse events",
26
+ "matcher": "",
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "./audit_logger.py"
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ "_description": "Skill validator: soft enforcement warnings for skill files",
36
+ "matcher": "Write|Edit",
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "./skill_validator.py"
41
+ }
42
+ ]
43
+ }
44
+ ],
45
+ "PostToolUse": [
46
+ {
47
+ "_description": "Auto-format files after Write/Edit",
48
+ "matcher": "Write|Edit",
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "./auto_format.sh"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "_description": "Audit trail: logs all PostToolUse events",
58
+ "matcher": "",
59
+ "hooks": [
60
+ {
61
+ "type": "command",
62
+ "command": "./audit_logger.py"
63
+ }
64
+ ]
65
+ }
66
+ ],
67
+ "UserPromptSubmit": [
68
+ {
69
+ "_description": "Audit trail: logs all user prompt submissions",
70
+ "hooks": [
71
+ {
72
+ "type": "command",
73
+ "command": "./audit_logger.py"
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ }
79
+ }
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Sensitive File Blocker Hook for Claude Code
4
+ =============================================
5
+
6
+ Blocks Read/Edit/Write access to sensitive files such as .env, secrets,
7
+ and credentials. Files ending with .example are allowed.
8
+
9
+ Exit Codes:
10
+ 0 - File access permitted
11
+ 2 - File access blocked (sensitive file detected)
12
+
13
+ Integration:
14
+ Configured as PreToolUse hook in hooks/hooks.json
15
+ Receives tool call JSON via stdin from Claude Code
16
+ """
17
+
18
+ import json
19
+ import re
20
+ import sys
21
+
22
+
23
+ SENSITIVE_PATTERNS = [
24
+ r"\.env(?:\.|$)",
25
+ r"secrets",
26
+ r"credentials",
27
+ ]
28
+
29
+
30
+ def main() -> None:
31
+ try:
32
+ data = json.load(sys.stdin)
33
+ except json.JSONDecodeError:
34
+ sys.exit(0)
35
+
36
+ tool_input = data.get("tool_input", {})
37
+ file_path = tool_input.get("file_path", "")
38
+
39
+ if not file_path:
40
+ sys.exit(0)
41
+
42
+ # Allow .example files (safe templates without secrets)
43
+ if file_path.endswith(".example"):
44
+ sys.exit(0)
45
+
46
+ for pattern in SENSITIVE_PATTERNS:
47
+ if re.search(pattern, file_path, re.IGNORECASE):
48
+ print(
49
+ f"BLOCKED: Access denied to sensitive file: {file_path}",
50
+ file=sys.stderr,
51
+ )
52
+ sys.exit(2)
53
+
54
+ sys.exit(0)
55
+
56
+
57
+ if __name__ == "__main__":
58
+ main()
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: angular-components-button
3
+ description: Button component API, variants, and usage patterns for @smartsoft001/angular
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Button Component
8
+
9
+ Standalone Angular button component with multiple shapes, variants, sizes, and color palette support.
10
+
11
+ ## API
12
+
13
+ ### Selector
14
+
15
+ `<smart-button>` (wrapper) or directly: `<smart-button-standard>`, `<smart-button-rounded>`, `<smart-button-circular>`
16
+
17
+ ### Inputs
18
+
19
+ | Input | Type | Default | Description |
20
+ | ---------- | ---------------- | -------- | ------------------------------------------- |
21
+ | `options` | `IButtonOptions` | required | Button configuration |
22
+ | `disabled` | `boolean` | `false` | Disabled state |
23
+ | `class` | `string` | `''` | External CSS classes (alias for `cssClass`) |
24
+
25
+ ### IButtonOptions
26
+
27
+ ```typescript
28
+ interface IButtonOptions {
29
+ type?: 'submit' | 'button';
30
+ confirm?: boolean;
31
+ click: () => void;
32
+ loading?: Signal<boolean>;
33
+ variant?: SmartVariant; // 'primary' | 'secondary' | 'soft'
34
+ size?: SmartSize; // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
35
+ color?: SmartColor; // 22 Tailwind colors, default 'indigo'
36
+ rounded?: boolean; // Use rounded shape
37
+ circular?: boolean; // Use circular (icon-only) shape
38
+ }
39
+ ```
40
+
41
+ ## Shapes
42
+
43
+ ### Standard (`<smart-button-standard>`)
44
+
45
+ - Border radius based on size: `smart:rounded-sm` (xs/sm), `smart:rounded-md` (md/lg/xl)
46
+ - Supports confirm mode (cancel/confirm buttons)
47
+
48
+ ### Rounded (`<smart-button-rounded>`)
49
+
50
+ - Always `smart:rounded-full`
51
+ - Supports confirm mode
52
+
53
+ ### Circular (`<smart-button-circular>`)
54
+
55
+ - Always `smart:rounded-full`, padding only (no px/py)
56
+ - Icon-only — pass SVG as `<ng-content>`
57
+ - No confirm mode
58
+
59
+ ## Variants (via `variant` option)
60
+
61
+ - **primary** — colored background (`smart:bg-{color}-600`), white text
62
+ - **secondary** — white background, gray border (`smart:inset-ring`), gray text
63
+ - **soft** — light colored background (`smart:bg-{color}-50`), colored text
64
+
65
+ ## Color Palette
66
+
67
+ Uses `COMPONENT_COLORS` from `models/colors.ts`. All 22 Tailwind colors supported. Default: `indigo`.
68
+
69
+ ## Usage Examples
70
+
71
+ ```html
72
+ <!-- Standard primary -->
73
+ <smart-button [options]="{ click: onClick, variant: 'primary', size: 'md' }">
74
+ Click me
75
+ </smart-button>
76
+
77
+ <!-- Rounded secondary with color -->
78
+ <smart-button
79
+ [options]="{ click: onClick, variant: 'secondary', size: 'lg', rounded: true, color: 'red' }"
80
+ >
81
+ Delete
82
+ </smart-button>
83
+
84
+ <!-- Circular with icon -->
85
+ <smart-button [options]="{ click: onClick, circular: true }">
86
+ <svg>...</svg>
87
+ </smart-button>
88
+
89
+ <!-- With loading -->
90
+ <smart-button [options]="{ click: onClick, loading: loadingSignal }">
91
+ Save
92
+ </smart-button>
93
+
94
+ <!-- With confirm -->
95
+ <smart-button
96
+ [options]="{ click: onDelete, confirm: true, variant: 'primary', color: 'red' }"
97
+ >
98
+ Delete
99
+ </smart-button>
100
+
101
+ <!-- With external class -->
102
+ <smart-button class="smart:mt-4" [options]="opts">Submit</smart-button>
103
+ ```
104
+
105
+ ## Related
106
+
107
+ - Icon component: `packages/shared/angular/src/lib/components/icon/` (spinner SVG)
108
+ - Color map: `packages/shared/angular/src/lib/models/colors.ts` (`COMPONENT_COLORS`)
109
+ - Shared types: `SmartVariant`, `SmartSize`, `SmartColor` in `models/interfaces.ts`
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: audit-log
3
+ description: Query and analyze Claude Code audit logs
4
+ user-invocable: true
5
+ allowed-tools: Bash, Read, Grep, Glob
6
+ ---
7
+
8
+ # Audit Log
9
+
10
+ Query and analyze the Claude Code audit trail stored in `.claude/audit_logs/`.
11
+
12
+ ## Purpose
13
+
14
+ Provide easy access to audit logs that track all Claude Code actions, including tool usage, prompt submissions, and session activity.
15
+
16
+ ## When to Use
17
+
18
+ Use `/smart:audit-log` when you need to:
19
+
20
+ - Review what actions Claude took during a session
21
+ - Debug unexpected behavior by checking the audit trail
22
+ - Verify that safety validators blocked dangerous commands
23
+ - Analyze tool usage patterns
24
+
25
+ ## Arguments
26
+
27
+ ```
28
+ /smart:audit-log [today|yesterday|YYYYMMDD]
29
+ ```
30
+
31
+ - **today** (default) — Show today's audit log
32
+ - **yesterday** — Show yesterday's audit log
33
+ - **YYYYMMDD** — Show log for a specific date (e.g., `20260210`)
34
+
35
+ ## Log Location
36
+
37
+ ```
38
+ .claude/audit_logs/YYYYMMDD_audit.jsonl
39
+ ```
40
+
41
+ Each line is a JSON object with:
42
+
43
+ - `timestamp` — ISO 8601 UTC timestamp
44
+ - `event_type` — Hook event (PreToolUse, PostToolUse, UserPromptSubmit, Stop)
45
+ - `session_id` — Unique session identifier
46
+ - `event_data` — Full event payload
47
+
48
+ ## Instructions
49
+
50
+ 1. Determine the target date from the argument (default: today)
51
+ 2. Construct the log file path: `.claude/audit_logs/YYYYMMDD_audit.jsonl`
52
+ 3. Check if the file exists using Glob
53
+ 4. Read the file and parse JSONL entries
54
+ 5. Present a summary:
55
+ - Total events count
56
+ - Breakdown by event type
57
+ - Any blocked actions (exit code 2)
58
+ - Timeline of key actions
59
+
60
+ ### Filtering Examples
61
+
62
+ To filter by tool name:
63
+
64
+ ```bash
65
+ grep '"tool_name":"Bash"' .claude/audit_logs/YYYYMMDD_audit.jsonl
66
+ ```
67
+
68
+ To filter by event type:
69
+
70
+ ```bash
71
+ grep '"event_type":"PreToolUse"' .claude/audit_logs/YYYYMMDD_audit.jsonl
72
+ ```
73
+
74
+ To show only blocked actions:
75
+
76
+ ```bash
77
+ grep 'BLOCKED' .claude/audit_logs/YYYYMMDD_audit.jsonl
78
+ ```
79
+
80
+ ## Output Format
81
+
82
+ Present results as a readable summary table, not raw JSON. Group events chronologically and highlight any safety blocks or errors.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: format-code
3
+ description: Format and lint the codebase using Nx
4
+ user-invocable: true
5
+ allowed-tools: Bash
6
+ ---
7
+
8
+ # Format Code
9
+
10
+ Run the project's formatting and linting pipeline.
11
+
12
+ ## Purpose
13
+
14
+ Execute the standard formatting command (`npm run format`) which runs Nx format and lint with auto-fix across the monorepo.
15
+
16
+ ## When to Use
17
+
18
+ Use `/smart:format-code` when you need to:
19
+
20
+ - Format code after making changes across multiple files
21
+ - Fix lint issues before committing
22
+ - Ensure consistent code style across the monorepo
23
+
24
+ ## Prerequisites
25
+
26
+ - **Node.js 24** via nvm (the project requires Node 24 for formatting tools)
27
+ - nvm must be installed and configured at `~/.nvm/nvm.sh`
28
+
29
+ ## Instructions
30
+
31
+ Run the following command:
32
+
33
+ ```bash
34
+ source ~/.nvm/nvm.sh && nvm use 24 && npm run format
35
+ ```
36
+
37
+ This executes:
38
+
39
+ 1. `nx format` — Prettier formatting via Nx
40
+ 2. `nx run-many -t lint --fix` — ESLint auto-fix across all projects
41
+
42
+ ## Notes
43
+
44
+ - The command may take a few minutes on large changesets
45
+ - If nvm is not available, try running `npm run format` directly
46
+ - Formatting follows the project's ESLint flat config (`eslint.config.mjs`) and Prettier settings
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: project-conventions
3
+ description: Smartsoft001 monorepo conventions and architecture knowledge
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Project Conventions
8
+
9
+ Background skill providing knowledge about the Smartsoft001 monorepo structure, conventions, and patterns.
10
+
11
+ ## Purpose
12
+
13
+ Ensure Claude follows project conventions when generating or modifying code in this Nx monorepo.
14
+
15
+ ## When to Use
16
+
17
+ This skill is applied automatically when working within the Smartsoft001 codebase.
18
+
19
+ ## Monorepo Structure
20
+
21
+ This is an **Nx monorepo** using **pnpm** workspaces. Projects are organized under:
22
+
23
+ - `packages/` — shared libraries and integrations
24
+ - `apps/` — applications (if any)
25
+
26
+ ### Domain Architecture
27
+
28
+ Three main domains, each following the same layered pattern:
29
+
30
+ | Domain | Purpose |
31
+ | ------- | --------------------------------- |
32
+ | `auth` | Authentication and authorization |
33
+ | `crud` | CRUD operations and UI components |
34
+ | `trans` | Translation/internationalization |
35
+
36
+ Each domain's layers:
37
+
38
+ - `domain/` — core business logic and models
39
+ - `shell/app-services/` — application services
40
+ - `shell/dtos/` — data transfer objects
41
+ - `shell/nestjs/` — NestJS implementations
42
+ - `shell/angular/` — Angular UI components (crud only)
43
+
44
+ ### Shared Libraries (`packages/shared/`)
45
+
46
+ `domain-core`, `models`, `angular`, `nestjs`, `users`, `utils`, `mongo`, and payment/third-party integrations (`paypal`, `payu`, `paynow`, `revolut`, `fb`, `google`).
47
+
48
+ ## Code Conventions
49
+
50
+ ### Component Prefixes
51
+
52
+ - `smart` prefix for CRUD shell Angular components
53
+ - `lib` prefix for shared Angular library components
54
+
55
+ ### Project Tags
56
+
57
+ - `scope:crud`, `scope:auth`, `scope:trans` — domain separation
58
+ - `type:shell`, `type:domain` — architectural layers
59
+
60
+ ### ESLint / Import Ordering
61
+
62
+ - Flat ESLint configuration (`eslint.config.mjs`)
63
+ - Alphabetical import sorting
64
+ - Special handling for `@smartsoft001/**` imports
65
+ - Newlines required between import groups
66
+
67
+ ### State Management (NgRx)
68
+
69
+ - Standard NgRx patterns: effects, actions, reducers, selectors
70
+ - Facade pattern for component interaction
71
+ - Error handling via shared error effects and services
72
+
73
+ ### Styling
74
+
75
+ - **Tailwind CSS** for styling
76
+ - **SCSS** for component-level styles
77
+ - PostCSS processing for optimization
78
+
79
+ ### Git Conventions
80
+
81
+ - Conventional commits (enforced by Commitlint + Husky)
82
+ - Main branch: `main`
83
+ - Auto-versioning via GitHub Actions
84
+
85
+ ### Testing
86
+
87
+ - **Jest** as primary test framework
88
+ - `@nx/jest` for Nx integration
89
+ - `jest-preset-angular` for Angular tests
90
+ - Storybook testing with `@storybook/test-runner`