/guardrails:init-local-md [--force]from guardrails
Creates or reinitializes .claude/local.md with environment-specific configuration. Detects project type, environment, and available tools, then writes an appropriate template. Supports --force to overwrite without backup prompt.
Ships in guardrails. Installing the plugin adds it to Claude Code.
Create or reinitialize the .claude/local.md file with environment-specific configuration. This command detects the current environment and creates an appropriate local.md file.
if [ -f ".claude/local.md" ]; then
echo "⚠️ .claude/local.md already exists!"
echo "Create backup as .claude/local.md.backup? (y/n)"
# If yes: cp .claude/local.md .claude/local.md.backup
fi
mkdir -p .claude
# Check if .claude/local.md is gitignored
if ! grep -q "^\.claude/local\.md$" .gitignore 2>/dev/null; then
echo "Adding .claude/local.md to .gitignore..."
echo ".claude/local.md" >> .gitignore
fi
Analyze the project to determine the tech stack and environment:
# Check for common project files
- package.json → Node.js/JavaScript
- requirements.txt/Pipfile → Python
- Gemfile → Ruby
- go.mod → Go
- Cargo.toml → Rust
- pom.xml/build.gradle → Java
- composer.json → PHP
# Check environment indicators
- /.dockerenv → Docker container
- /proc/1/cgroup containing "docker" → Docker
- AWS_EXECUTION_ENV → AWS Lambda
- KUBERNETES_SERVICE_HOST → Kubernetes
- VERCEL → Vercel deployment
- NETLIFY → Netlify deployment
- IS_LOCAL not set → Likely production
# Check installed tools
- docker --version
- node --version
- python --version
- Database clients (psql, mysql, mongosh)
- Redis cli
- Git configuration
Based on detection, create appropriate content:
# Local Development Environment
## System Information
- OS: [detected OS - macOS/Linux/Windows]
- Shell: [detected shell - bash/zsh/fish]
- Working Directory: [current directory]
## Detected Project Type
- Primary Language: [detected from files]
- Framework: [if detected]
- Package Manager: [npm/yarn/pip/etc]
## Environment Setup
```bash
# [Project-specific setup based on detected type]
# Example for Node.js:
nvm use 18
npm install
# Example for Python:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# [Inferred from package.json scripts or Makefile]
# Start development server
npm run dev
# Run tests
npm test
# Build project
npm run build
export NODE_OPTIONS='--max-old-space-size=4096'export DEBUG='app:*'# Create .env.local with:
DATABASE_URL=postgresql://localhost:5432/[project]_dev
REDIS_URL=redis://localhost:6379
API_KEY=local-development-key
lsof -ti:[PORT] | xargs kill -9rm -rf node_modules package-lock.json && npm installgit checkout -b feature/[ticket]-[description]
### For Production/Deployment Environment:
```markdown
# Production Environment
## Environment Information
- Type: [Production/Staging/CI]
- Platform: [AWS/GCP/Azure/VPS/Docker]
- Region: [if applicable]
## System Configuration
- OS: [detected OS]
- CPU: [core count]
- Memory: [available RAM]
- Disk: [available space]
## Service Configuration
- Application Server: [process manager/container orchestrator]
- Web Server: [nginx/apache if detected]
- Database: [connection string format, no credentials]
- Cache: [Redis/Memcached endpoint format]
## Deployment Configuration
```bash
# Deployment commands detected
[if Dockerfile exists]: docker build & run commands
[if PM2]: pm2 start ecosystem.config.js
[if systemd]: systemctl commands
# Check application status
[appropriate command for the platform]
# View recent logs
[tail command for log location]
# Check resource usage
htop or top
df -h
free -m
## Template Selection Logic
Choose template based on environment indicators:
```python
if is_ci_environment():
# Minimal CI-focused template
elif is_container():
# Container-specific template
elif is_cloud_platform():
# Cloud platform template (AWS/GCP/Azure)
elif has_dev_dependencies():
# Local development template
else:
# Generic production template
if [ -f ".claude/local.md" ]; then
echo "✅ Successfully created .claude/local.md"
echo "📝 Please review and customize the generated content"
fi
git check-ignore .claude/local.md
if [ $? -eq 0 ]; then
echo "✅ Confirmed: .claude/local.md is gitignored"
else
echo "⚠️ WARNING: .claude/local.md is NOT gitignored!"
fi
Next steps:
1. Review the generated .claude/local.md
2. Add any missing environment-specific details
3. Update with your personal debugging preferences
4. Add local service URLs and ports
5. Include any machine-specific optimizations
Create a generic template with placeholders:
# Local Environment Configuration
## ⚠️ Auto-detection failed - Please customize this file
## System Information
- OS: [YOUR_OS]
- Project Type: [YOUR_PROJECT_TYPE]
- Environment: [development/production]
## Setup Instructions
```bash
# Add your setup commands here
## Usage Examples
### Basic usage:
```bash
# Run the init command
/init-local-md
# If local.md exists, it will prompt to backup
/init-local-md
# > Create backup? (y/n): y
# > Created .claude/local.md.backup
# Add --force flag handling
/init-local-md --force
Remember: This file should contain environment-specific information that helps Claude understand your local setup but should NEVER contain sensitive credentials or secrets that shouldn't be on your local machine.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
10 commands in this plugin
/cleanup-docsAudit and clean up a repo's Claude documentation — measure the always-on tier first (CLAUDE.md + nested + .claude/rules/ + the auto-memory index), then merge redundancy, cut derivable and model-obsolete content, demote misplaced tiers, fix cross-refs. Verifies every fact survives before cutting; asks before destructive operations; reports byte deltas./critical-reviewExit-gate review of this session's changes by a reviewer that never sees the task brief — Codex, Claude or your own command via scripts/review-backend.sh. Findings → plan mode with proposed fixes (one approve/deny), or --review-only for findings in chat. --adversarial forces the deeper prompt-mode pass. Refuses to fake a review when no reviewer is available./crosscheckCross-check recent, not-yet-verified work — in ANY project. Reconstruct what you shipped or optimized lately and haven't confirmed, find where each change's evidence lives (logs / DB / generated output / endpoint / UI / CI — discover, don't assume), and report honestly: does it run clean, did new problems appear, did the intended fixes actually work. Two rules — verify before asserting, and "ran" ≠ "worked". Read-only. Optional focus hint as argument./implementExecute an already-agreed plan one step at a time — implement the smallest shippable increment, verify it before moving on, ask open questions instead of guessing, and HALT on anything unforeseen. Pass a plan file as the argument, or omit it to use the plan already in the conversation./planFront-load a task with a short, cited design spec and get approval BEFORE writing code. Produces a persistent plan artifact that survives compaction and defines the verification contract /verify later checks. Pass the task description as the argument; add --codex to have an independent reviewer (Codex by default, the same one /critical-review uses) adversarially review the spec before you build./refactor-claude-mdRefactor a project's Claude documentation to the distributed pattern — lean CLAUDE.md core + on-demand tiers (.claude/docs/ feature details, .claude/rules/ path-scoped conventions, nested per-subsystem CLAUDE.md, .claude/local.md environment), with an auto-generated doc index and no @-imports. Detects misplaced content and reorganizes; backs up before changes.npx claudepluginhub tillmeier/claude-code-guardrails --plugin guardrailsOther plugins' commands for the same job