- Created structured documentation with /patterns/, /examples/, and /reference/ directories - Implemented automatic context loading rules in CLAUDE.md based on file extensions, directories, and keywords - Added technology-specific patterns for Docker, Python, Node.js, Vue.js, Bash, networking, databases, and VM management - Included complete working examples for common workflows and troubleshooting references - Designed for minimal context usage with precise loading triggers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1021 B
Markdown
32 lines
1021 B
Markdown
# Bash Scripting Patterns
|
|
|
|
## Script Structure
|
|
- Use proper shebang (`#!/bin/bash`)
|
|
- Set error handling (`set -euo pipefail`)
|
|
- Include help/usage functions
|
|
- Implement proper argument parsing
|
|
|
|
## Best Practices
|
|
- **Input validation** before processing
|
|
- **Logging and error messages** to stderr
|
|
- **Exit codes** for script status
|
|
- **Function-based organization** for reusability
|
|
|
|
## Common Patterns
|
|
- **Service management** with systemd integration
|
|
- **Backup scripts** with rotation and compression
|
|
- **Deployment automation** with rollback capabilities
|
|
- **System monitoring** with alerting
|
|
|
|
## Security Considerations
|
|
- Avoid hardcoded credentials
|
|
- Use proper file permissions
|
|
- Sanitize user inputs
|
|
- Quote variables to prevent word splitting
|
|
|
|
## Related Documentation
|
|
- Examples: `/examples/bash/service-management.md`
|
|
- Examples: `/examples/bash/backup-scripts.md`
|
|
- Examples: `/examples/bash/deployment-automation.md`
|
|
- Reference: `/reference/bash/troubleshooting.md`
|
|
- Reference: `/reference/bash/security.md` |