shared-setup-patterns
Shared configuration patterns for project setup commands. Provides security hooks, Claude framework structure templates, and framework detection patterns used across multiple setup commands.
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Install command
npx @skill-hub/cli install applied-artificial-intelligence-claude-code-toolkit-shared-setup-patterns
Repository
Skill path: plugins/setup/skills/shared-setup-patterns
Shared configuration patterns for project setup commands. Provides security hooks, Claude framework structure templates, and framework detection patterns used across multiple setup commands.
Open repositoryBest for
Primary workflow: Run DevOps.
Technical facets: Full Stack, Security.
Target audience: everyone.
License: Unknown.
Original source
Catalog source: SkillHub Club.
Repository owner: applied-artificial-intelligence.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install shared-setup-patterns into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/applied-artificial-intelligence/claude-code-toolkit before adding shared-setup-patterns to shared team environments
- Use shared-setup-patterns for development workflows
Works across
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw SKILL.md
---
name: shared-setup-patterns
description: Shared configuration patterns for project setup commands. Provides security hooks, Claude framework structure templates, and framework detection patterns used across multiple setup commands.
---
# Shared Setup Patterns
**Purpose**: Common configuration patterns and templates shared across all project setup commands.
**Used by**: `/setup:python`, `/setup:javascript`, `/setup:existing`, `/setup:explore`, `/setup:user`
**Token Impact**: Provides ~1,700 tokens of shared templates loaded once, avoiding duplication across 5+ commands (saves ~3,200 tokens through reuse).
---
## Contents
This skill contains ONLY patterns shared by multiple setup commands:
1. **Security Hooks** - PreToolUse and PostToolUse hooks for all project types
2. **Claude Framework Structure** - .claude/ directory templates and memory files
3. **Framework Detection** - Patterns for auto-detecting project languages and frameworks
Language-specific templates (Python, JavaScript, etc.) are kept inline in their respective commands.
---
## 1. Security Hooks
Located: `templates/security_hooks.json`
Comprehensive security and quality hooks configuration:
- **PreToolUse**: Blocks dangerous commands (rm -rf, sudo, chmod 777)
- **PostToolUse**: Auto-formats code (ruff, prettier, eslint), validates JSON/markdown
Used by: ALL setup commands that create projects
---
## 2. Claude Framework Structure
Located: `templates/claude_framework/`
Templates for .claude/ directory structure:
- `structure.md` - Directory layout and purpose
- `memory_templates/` - project_state.md, dependencies.md, conventions.md, decisions.md
- `work_structure.md` - Work directory organization
Used by: ALL setup commands
---
## 3. Framework Detection Patterns
Located: `templates/framework_detection.md`
Patterns for auto-detecting:
- Languages: Python, JavaScript/TypeScript, Go, Rust
- Frameworks: FastAPI, Django, Flask, Next.js, React, Express
- Tools: pytest, Jest, Mocha, go test, cargo test
Used by: `/setup:existing`, `/setup` (if dispatcher exists)
---
## Usage Pattern
Commands reference this skill in frontmatter:
```yaml
skills: [shared-setup-patterns]
```
Then access specific templates:
- Security hooks: Load from `templates/security_hooks.json`
- Framework structure: Generate from `templates/claude_framework/` templates
- Detection: Use patterns from `templates/framework_detection.md`
---
## Design Principle
**Only truly shared content lives here.** Language-specific templates (Python pyproject.toml, JavaScript package.json) stay inline in their respective commands to avoid skill overhead for single-use templates.
This keeps each command self-contained while sharing common infrastructure patterns.
---
## Referenced Files
> The following files are referenced in this skill and included for context.
### templates/security_hooks.json
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "input=\"$CLAUDE_TOOL_INPUT\"; if echo \"$input\" | grep -q 'rm -rf'; then echo 'π¨ BLOCKED: Dangerous rm -rf command detected!' >&2 && echo 'Use git clean or specific file deletion instead.' >&2 && exit 2; fi; if echo \"$input\" | grep -q 'sudo'; then echo 'π¨ BLOCKED: sudo command not allowed in development!' >&2 && echo 'Review your command and run manually if needed.' >&2 && exit 2; fi; if echo \"$input\" | grep -q 'chmod 777'; then echo 'β οΈ BLOCKED: chmod 777 is a security risk!' >&2 && echo 'Use specific permissions like 755 or 644.' >&2 && exit 2; fi"
}
]
}
],
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "file=\"$CLAUDE_TOOL_INPUT_FILE\"; if [ -n \"$file\" ]; then ext=\"${file##*.}\"; case \"$ext\" in py) echo 'π§ Python file edited: '$file && if command -v ruff >/dev/null 2>&1; then if ruff format \"$file\" 2>/dev/null; then echo 'β
ruff format applied'; else echo 'β οΈ ruff format failed - check Python syntax'; fi && if ruff check \"$file\" --fix 2>/dev/null; then echo 'β
ruff linting passed'; else echo 'β οΈ ruff found issues - review the warnings'; fi; else echo 'π‘ Install ruff for automatic formatting & linting: pip install ruff'; fi ;; js|jsx|ts|tsx) echo 'π§ JavaScript/TypeScript file edited: '$file && if command -v prettier >/dev/null 2>&1; then if prettier --write \"$file\" 2>/dev/null; then echo 'β
prettier formatting applied'; else echo 'β οΈ prettier failed - check syntax'; fi; else echo 'π‘ Install prettier: npm install prettier'; fi && if command -v eslint >/dev/null 2>&1; then if eslint \"$file\" --fix 2>/dev/null; then echo 'β
eslint passed'; else echo 'β οΈ eslint found issues - review the warnings'; fi; else echo 'π‘ Install eslint: npm install eslint'; fi ;; json) echo 'π§ JSON file edited: '$file && if python3 -m json.tool \"$file\" >/dev/null 2>&1; then echo 'β
JSON syntax valid'; else echo 'β Invalid JSON syntax in '$file' - fix required!' >&2 && exit 1; fi ;; md) echo 'π Markdown file edited: '$file && if command -v markdownlint >/dev/null 2>&1; then if markdownlint \"$file\" 2>/dev/null; then echo 'β
Markdown linting passed'; else echo 'β οΈ Markdown formatting issues found'; fi; else echo 'π‘ Install markdownlint for markdown quality: npm install -g markdownlint-cli'; fi ;; esac; fi"
}
]
}
]
}
}
```
### templates/framework_detection.md
```markdown
# Framework Detection Patterns
This document provides detection patterns for identifying project languages, frameworks, and tools.
## Language Detection
### Python
**Detection files**:
- `pyproject.toml`
- `setup.py`
- `requirements.txt`
**Version detection**:
```bash
python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f1,2
```
### JavaScript/TypeScript
**Detection files**:
- `package.json`
- `package-lock.json`
**Frameworks**:
- Next.js: `grep -q '"next"' package.json`
- React: `grep -q '"react"' package.json`
- Express: `grep -q '"express"' package.json`
### Go
**Detection files**:
- `go.mod`
**Test tool**: `go test`
### Rust
**Detection files**:
- `Cargo.toml`
**Test tool**: `cargo test`
## Framework Detection Patterns
### Python Frameworks
**FastAPI**:
```bash
grep -q 'fastapi' pyproject.toml
```
**Django**:
```bash
grep -q 'django' pyproject.toml
```
**Flask**:
```bash
grep -q 'flask' pyproject.toml
```
### JavaScript Frameworks
**Next.js**:
```bash
grep -q '"next"' package.json
```
**React**:
```bash
grep -q '"react"' package.json
```
**Express**:
```bash
grep -q '"express"' package.json
```
## Test Tool Detection
### Python Testing
**pytest**:
```bash
grep -q 'pytest' pyproject.toml
```
### JavaScript Testing
**Jest**:
```bash
grep -q '"jest"' package.json
```
**Mocha**:
```bash
grep -q '"mocha"' package.json
```
## Build System Detection
### Python
**Makefile**:
```bash
[ -f "Makefile" ] && DETECTED_BUILD="Make"
```
### Detection Algorithm
```bash
# Language detection
DETECTED_LANG=""
DETECTED_FRAMEWORK=""
DETECTED_TEST_TOOL=""
DETECTED_BUILD=""
if [ -f "package.json" ]; then
DETECTED_LANG="JavaScript/TypeScript"
# Check frameworks and tools
elif [ -f "pyproject.toml" ] || [ -f "setup.py" ] || [ -f "requirements.txt" ]; then
DETECTED_LANG="Python"
# Check frameworks and tools
elif [ -f "go.mod" ]; then
DETECTED_LANG="Go"
DETECTED_TEST_TOOL="go test"
elif [ -f "Cargo.toml" ]; then
DETECTED_LANG="Rust"
DETECTED_TEST_TOOL="cargo test"
fi
```
## Usage in Commands
Commands should use these patterns to auto-detect project characteristics and provide appropriate setup configurations.
Example:
```bash
# Auto-detect project type
if [ -f "package.json" ]; then
SETUP_TYPE="javascript"
elif [ -f "pyproject.toml" ]; then
SETUP_TYPE="python"
fi
```
```