chore: import upstream snapshot with attribution
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:38:58 +08:00
commit bb5c75ce05
8824 changed files with 1946442 additions and 0 deletions
@@ -0,0 +1,239 @@
# Git Workflow Helper
Manage Git workflows with best practices and common operations.
## Purpose
This command helps you perform common Git operations following best practices for collaborative development.
## Usage
```
/git-workflow
```
## What this command does
1. **Guides through Git operations** with proper workflow
2. **Suggests best practices** for commits and branches
3. **Helps with conflict resolution** and merging
4. **Provides templates** for commit messages
5. **Manages branching strategies** (Git Flow, GitHub Flow)
## Common Workflows
### Feature Development
```bash
# Create and switch to feature branch
git checkout -b feature/user-authentication
# Work on your feature
# ... make changes ...
# Stage and commit changes
git add .
git commit -m "feat: add user authentication system
- Implement login/logout functionality
- Add password validation
- Create user session management
- Add authentication middleware"
# Push feature branch
git push -u origin feature/user-authentication
# Create pull request (via GitHub/GitLab interface)
```
### Hotfix Workflow
```bash
# Create hotfix branch from main
git checkout main
git checkout -b hotfix/security-patch
# Fix the issue
# ... make changes ...
# Commit the fix
git commit -m "fix: resolve security vulnerability in auth module
- Patch XSS vulnerability in login form
- Update input validation
- Add CSRF protection"
# Push and create urgent PR
git push -u origin hotfix/security-patch
```
### Sync with Remote
```bash
# Update main branch
git checkout main
git pull origin main
# Update feature branch with latest main
git checkout feature/your-feature
git rebase main
# OR
git merge main
```
## Commit Message Conventions
### Conventional Commits Format
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
### Common Types
- **feat**: New feature
- **fix**: Bug fix
- **docs**: Documentation changes
- **style**: Code style changes (formatting, etc.)
- **refactor**: Code refactoring
- **test**: Adding or updating tests
- **chore**: Maintenance tasks
### Examples
```bash
# Feature
git commit -m "feat(auth): add OAuth2 integration"
# Bug fix
git commit -m "fix(api): handle null response in user endpoint"
# Documentation
git commit -m "docs: update API documentation for v2.0"
# Breaking change
git commit -m "feat!: change API response format
BREAKING CHANGE: API responses now use 'data' wrapper"
```
## Branch Management
### Git Flow Strategy
```bash
# Main branches
main # Production-ready code
develop # Integration branch
# Supporting branches
feature/* # New features
release/* # Release preparation
hotfix/* # Quick fixes to production
```
### GitHub Flow (Simplified)
```bash
# Only main branch + feature branches
main # Production-ready code
feature/* # All new work
```
## Conflict Resolution
### When Conflicts Occur
```bash
# Start merge/rebase
git merge feature-branch
# OR
git rebase main
# If conflicts occur, Git will list conflicted files
# Edit each file to resolve conflicts
# Mark conflicts as resolved
git add conflicted-file.js
# Continue the merge/rebase
git merge --continue
# OR
git rebase --continue
```
### Conflict Markers
```javascript
<<<<<<< HEAD
// Your current branch code
const user = getCurrentUser();
=======
// Incoming branch code
const user = getAuthenticatedUser();
>>>>>>> feature-branch
```
## Useful Git Commands
### Status and Information
```bash
git status # Check working directory status
git log --oneline # View commit history
git branch -a # List all branches
git remote -v # List remote repositories
```
### Undoing Changes
```bash
git checkout -- file.js # Discard changes to file
git reset HEAD file.js # Unstage file
git reset --soft HEAD~1 # Undo last commit (keep changes)
git reset --hard HEAD~1 # Undo last commit (discard changes)
```
### Stashing Work
```bash
git stash # Save current work
git stash pop # Apply and remove latest stash
git stash list # List all stashes
git stash apply stash@{1} # Apply specific stash
```
## Best Practices
1. **Commit Often** - Make small, focused commits
2. **Write Clear Messages** - Use conventional commit format
3. **Test Before Committing** - Ensure code works
4. **Pull Before Push** - Keep history clean
5. **Use Branches** - Don't work directly on main
6. **Review Code** - Use pull requests for collaboration
7. **Keep History Clean** - Rebase feature branches when appropriate
## Git Hooks (Optional)
### Pre-commit Hook
```bash
#!/bin/sh
# .git/hooks/pre-commit
# Run linter
npm run lint
if [ $? -ne 0 ]; then
echo "Linting failed. Please fix errors before committing."
exit 1
fi
# Run tests
npm test
if [ $? -ne 0 ]; then
echo "Tests failed. Please fix tests before committing."
exit 1
fi
```
### Commit Message Hook
```bash
#!/bin/sh
# .git/hooks/commit-msg
# Check commit message format
if ! grep -qE "^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}" "$1"; then
echo "Invalid commit message format. Use conventional commits."
exit 1
fi
```
@@ -0,0 +1,316 @@
# Project Setup Helper
Set up new projects with proper structure and best practices.
## Purpose
This command helps you set up new projects with proper directory structure, configuration files, and development environment.
## Usage
```
/project-setup
```
## What this command does
1. **Creates project structure** with standard directories
2. **Sets up configuration files** (.gitignore, README, etc.)
3. **Initializes version control** and development tools
4. **Configures environment files** and dependencies
5. **Follows language-specific** conventions and best practices
## Project Structure Templates
### Generic Project Structure
```
project-name/
├── README.md # Project documentation
├── .gitignore # Git ignore rules
├── .env.example # Environment variables template
├── LICENSE # Project license
├── CHANGELOG.md # Version history
├── docs/ # Documentation
│ ├── API.md
│ ├── CONTRIBUTING.md
│ └── DEPLOYMENT.md
├── src/ # Source code
│ ├── main/
│ ├── utils/
│ └── config/
├── tests/ # Test files
│ ├── unit/
│ ├── integration/
│ └── fixtures/
├── scripts/ # Build and deployment scripts
│ ├── build.sh
│ ├── deploy.sh
│ └── setup.sh
└── config/ # Configuration files
├── development.yml
├── production.yml
└── testing.yml
```
### Web Application Structure
```
web-app/
├── public/ # Static assets
│ ├── index.html
│ ├── favicon.ico
│ └── assets/
│ ├── css/
│ ├── js/
│ └── images/
├── src/ # Source code
│ ├── components/ # Reusable components
│ ├── pages/ # Page components
│ ├── services/ # API services
│ ├── utils/ # Utility functions
│ ├── styles/ # Stylesheets
│ └── config/ # Configuration
├── tests/ # Test files
└── build/ # Build output
```
### API Project Structure
```
api-project/
├── src/
│ ├── controllers/ # Request handlers
│ ├── models/ # Data models
│ ├── services/ # Business logic
│ ├── middleware/ # Custom middleware
│ ├── routes/ # API routes
│ ├── utils/ # Utility functions
│ └── config/ # Configuration
├── tests/
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── docs/
│ ├── api-spec.yml # OpenAPI specification
│ └── README.md
└── scripts/
├── seed-db.js # Database seeding
└── migrate.js # Database migrations
```
## Essential Configuration Files
### .gitignore Template
```gitignore
# Dependencies
node_modules/
*.log
npm-debug.log*
# Environment files
.env
.env.local
.env.production
# Build outputs
dist/
build/
*.tgz
# IDE files
.vscode/
.idea/
*.swp
*.swo
# OS files
.DS_Store
Thumbs.db
# Temporary files
*.tmp
*.temp
```
### README.md Template
```markdown
# Project Name
Brief description of what this project does.
## Features
- Feature 1
- Feature 2
- Feature 3
## Installation
\`\`\`bash
# Clone the repository
git clone https://github.com/username/project-name.git
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
\`\`\`
## Usage
\`\`\`bash
# Start development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
\`\`\`
## API Documentation
[API documentation](docs/API.md)
## Contributing
Please read [CONTRIBUTING.md](docs/CONTRIBUTING.md) for details.
## License
This project is licensed under the MIT License - see [LICENSE](LICENSE) file.
```
### .env.example Template
```env
# Application
NODE_ENV=development
PORT=3000
HOST=localhost
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=myapp
DB_USER=username
DB_PASSWORD=password
# API Keys
API_KEY=your-api-key-here
SECRET_KEY=your-secret-key-here
# External Services
REDIS_URL=redis://localhost:6379
EMAIL_SERVICE_API_KEY=your-email-key
```
## Development Environment Setup
### Package.json Scripts
```json
{
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"lint": "eslint src/",
"lint:fix": "eslint src/ --fix",
"format": "prettier --write src/",
"build": "webpack --mode production",
"build:dev": "webpack --mode development",
"clean": "rm -rf dist/"
}
}
```
### Git Initialization
```bash
# Initialize Git repository
git init
# Add initial files
git add .
# Create initial commit
git commit -m "feat: initial project setup
- Add project structure
- Configure development environment
- Add documentation templates
- Set up testing framework"
# Add remote origin
git remote add origin https://github.com/username/project-name.git
# Push to remote
git push -u origin main
```
## Language-Specific Setup
### Node.js/JavaScript
```bash
npm init -y
npm install --save-dev nodemon jest eslint prettier
```
### Python
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```
### Docker Setup
```dockerfile
# Dockerfile
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
```
```yaml
# docker-compose.yml
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=development
volumes:
- .:/app
- /app/node_modules
```
## Best Practices
1. **Consistent Structure** - Follow established conventions
2. **Clear Documentation** - Write comprehensive README
3. **Environment Variables** - Keep secrets out of code
4. **Version Control** - Initialize Git from the start
5. **Testing Setup** - Configure testing from day one
6. **Code Quality** - Set up linting and formatting
7. **CI/CD Ready** - Structure for automated deployment
8. **Security** - Include security best practices
## Checklist
- [ ] Create project directory structure
- [ ] Initialize version control (Git)
- [ ] Set up package manager (npm, pip, etc.)
- [ ] Create README.md with project info
- [ ] Add .gitignore file
- [ ] Set up environment variables
- [ ] Configure linting and formatting
- [ ] Set up testing framework
- [ ] Create basic documentation
- [ ] Add license file
- [ ] Set up CI/CD configuration (if needed)
+41
View File
@@ -0,0 +1,41 @@
{
"mcpServers": {
"memory-bank": {
"name": "Memory Bank MCP",
"description": "Centralized memory system for AI agents",
"command": "server-memory",
"args": [],
"env": {}
},
"sequential-thinking": {
"name": "Sequential Thinking MCP",
"description": "Helps LLMs decompose complex tasks into logical steps",
"command": "code-reasoning",
"args": [],
"env": {}
},
"brave-search": {
"name": "Brave Search MCP",
"description": "Privacy-focused web search tool",
"command": "server-brave-search",
"args": [],
"env": {}
},
"google-maps": {
"name": "Google Maps MCP",
"description": "Integrates Google Maps for geolocation and directions",
"command": "server-google-maps",
"args": [],
"env": {
"GOOGLE_MAPS_API_KEY": "..."
}
},
"deep-graph": {
"name": "Deep Graph MCP (Code Graph)",
"description": "Transforms source code into semantic graphs via DeepGraph",
"command": "mcp-code-graph",
"args": [],
"env": {}
}
}
}
+109
View File
@@ -0,0 +1,109 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Universal Development Guidelines
### Code Quality Standards
- Write clean, readable, and maintainable code
- Follow consistent naming conventions across the project
- Use meaningful variable and function names
- Keep functions focused and single-purpose
- Add comments for complex logic and business rules
### Git Workflow
- Use descriptive commit messages following conventional commits format
- Create feature branches for new development
- Keep commits atomic and focused on single changes
- Use pull requests for code review before merging
- Maintain a clean commit history
### Documentation
- Keep README.md files up to date
- Document public APIs and interfaces
- Include usage examples for complex features
- Maintain inline code documentation
- Update documentation when making changes
### Testing Approach
- Write tests for new features and bug fixes
- Maintain good test coverage
- Use descriptive test names that explain the expected behavior
- Organize tests logically by feature or module
- Run tests before committing changes
### Security Best Practices
- Never commit sensitive information (API keys, passwords, tokens)
- Use environment variables for configuration
- Validate input data and sanitize outputs
- Follow principle of least privilege
- Keep dependencies updated
## Project Structure Guidelines
### File Organization
- Group related files in logical directories
- Use consistent file and folder naming conventions
- Separate source code from configuration files
- Keep build artifacts out of version control
- Organize assets and resources appropriately
### Configuration Management
- Use configuration files for environment-specific settings
- Centralize configuration in dedicated files
- Use environment variables for sensitive or environment-specific data
- Document configuration options and their purposes
- Provide example configuration files
## Development Workflow
### Before Starting Work
1. Pull latest changes from main branch
2. Create a new feature branch
3. Review existing code and architecture
4. Plan the implementation approach
### During Development
1. Make incremental commits with clear messages
2. Run tests frequently to catch issues early
3. Follow established coding standards
4. Update documentation as needed
### Before Submitting
1. Run full test suite
2. Check code quality and formatting
3. Update documentation if necessary
4. Create clear pull request description
## Common Patterns
### Error Handling
- Use appropriate error handling mechanisms for the language
- Provide meaningful error messages
- Log errors appropriately for debugging
- Handle edge cases gracefully
- Don't expose sensitive information in error messages
### Performance Considerations
- Profile code for performance bottlenecks
- Optimize database queries and API calls
- Use caching where appropriate
- Consider memory usage and resource management
- Monitor and measure performance metrics
### Code Reusability
- Extract common functionality into reusable modules
- Use dependency injection for better testability
- Create utility functions for repeated operations
- Design interfaces for extensibility
- Follow DRY (Don't Repeat Yourself) principle
## Review Checklist
Before marking any task as complete:
- [ ] Code follows established conventions
- [ ] Tests are written and passing
- [ ] Documentation is updated
- [ ] Security considerations are addressed
- [ ] Performance impact is considered
- [ ] Code is reviewed for maintainability
+96
View File
@@ -0,0 +1,96 @@
# Common Claude Code Templates
This folder contains language-agnostic templates and configurations that can be used across different programming languages and project types.
## What's Included
### Core Files
- `CLAUDE.md` - Base configuration for Claude Code with universal best practices
- `.claude/commands/` - Custom commands for common development tasks
### Common Custom Commands
- `git-workflow.md` - Git operations and workflow automation
- `code-review.md` - Code review and quality assurance tasks
- `project-setup.md` - Project initialization and configuration
- `documentation.md` - Documentation generation and maintenance
## How to Use
### For New Projects
Copy the entire `common/` folder contents to your project root:
```bash
cp -r claude-code-templates/common/* your-project/
```
### For Existing Projects
Merge the relevant files with your existing Claude Code configuration:
```bash
# Copy custom commands
cp -r claude-code-templates/common/.claude/commands/* your-project/.claude/commands/
# Review and merge CLAUDE.md content
cat claude-code-templates/common/CLAUDE.md >> your-project/CLAUDE.md
```
## Customization
### CLAUDE.md
The base CLAUDE.md file includes:
- Universal development best practices
- Common project patterns and conventions
- Git workflow guidelines
- Code quality standards
Customize it by:
- Adding project-specific information
- Modifying coding standards to match your team's preferences
- Including technology-specific guidelines
### Custom Commands
The included commands are designed to be generic and widely applicable. You can:
- Modify existing commands to match your workflow
- Add new commands for project-specific tasks
- Remove commands that don't apply to your project
## Language-Specific Integration
This common template is designed to work alongside language-specific templates:
1. Start with the common template
2. Add language-specific configurations from the appropriate folder
3. Customize both to match your project needs
## Examples
### Multi-language Projects
For projects using multiple programming languages:
```bash
# Copy common base
cp -r claude-code-templates/common/* your-project/
# Add language-specific configurations
cp -r claude-code-templates/javascript-typescript/.claude/commands/* your-project/.claude/commands/
cp -r claude-code-templates/python/.claude/commands/* your-project/.claude/commands/
```
### Team Standardization
Organizations can use this as a base template and customize it for their specific needs:
1. Fork this repository
2. Modify the common templates to match your standards
3. Distribute to development teams
4. Keep synchronized with updates
## Best Practices
- **Start Simple**: Begin with the common template and add complexity as needed
- **Document Changes**: Keep track of customizations in your project's documentation
- **Regular Updates**: Periodically review and update your Claude Code configuration
- **Team Alignment**: Ensure all team members understand the custom commands and workflows
## Contributing
If you create useful generic commands or improvements to the common template, consider contributing them back to this repository to help other developers.