Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 320 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,330 @@ See: https://github.com/wgtechlabs/clean-commit

---

## Real-World Examples

This section shows real-world commit examples organized by project type to help you apply Clean Commit to your projects.

### Web Application

**Context:** A full-stack web app with React frontend and Node.js backend

#### Feature Development
```
πŸ“¦ new: user profile page with avatar upload
πŸ“¦ new(auth): social login with google and github
πŸ“¦ new(dashboard): real-time analytics widgets
πŸ”§ update(ui): improve mobile responsive layout
πŸ”§ update: optimize image loading with lazy loading
πŸ—‘οΈ remove(ui): deprecated jquery legacy code
```

#### Bug Fixes & Improvements
```
πŸ”§ update: fix cart total calculation rounding error
πŸ”§ update(form): improve validation error messages
πŸ”§ update(api): handle network timeout gracefully
πŸ”’ security: sanitize html input to prevent xss
πŸ”’ security(session): implement csrf token validation
```

#### Testing & Documentation
```
πŸ§ͺ test(e2e): add cypress tests for checkout flow
πŸ§ͺ test: increase coverage for payment module
πŸ“– docs: update component usage examples
πŸ“– docs(api): document authentication flow
```

#### Maintenance
```
β˜• chore(deps): bump react from 17.0.2 to 18.2.0
β˜• chore: update webpack to version 5
βš™οΈ setup(ci): add automated deployment pipeline
βš™οΈ setup: configure storybook for components
```

#### Release
```
πŸš€ release: version 2.0.0
πŸš€ release: hotfix version 2.0.1 for login bug
```

### API / Backend

**Context:** RESTful API service with database and authentication

#### API Development
```
πŸ“¦ new(api): user registration endpoint with validation
πŸ“¦ new: rate limiting middleware for api protection
πŸ“¦ new(db): migration for orders table
πŸ“¦ new(auth): jwt token refresh mechanism
πŸ”§ update(api): improve error response format
πŸ”§ update: optimize database query with indexing
πŸ”§ update(middleware): refactor logging to use winston
```

#### Security & Performance
```
πŸ”’ security(api): add input validation to prevent injection
πŸ”’ security: hash passwords with bcrypt instead of md5
πŸ”’ security(auth): fix authorization bypass in admin routes
πŸ”§ update: implement connection pooling for database
πŸ”§ update(cache): add redis caching for frequent queries
```

#### Database & Infrastructure
```
πŸ“¦ new(db): add full-text search indexes
πŸ”§ update(db): optimize user query performance
πŸ—‘οΈ remove(db): drop unused legacy tables
βš™οΈ setup(docker): containerize application with compose
βš™οΈ setup: configure automated database backups
```

#### Testing & Documentation
```
πŸ§ͺ test(api): integration tests for auth endpoints
πŸ§ͺ test: add load testing with artillery
πŸ“– docs(api): generate swagger documentation
πŸ“– docs: add architecture decision records
```

#### Maintenance & Release
```
β˜• chore(deps): update express to latest security patch
β˜• chore: clean up deprecated api endpoints
πŸš€ release: version 3.1.0 with new features
```

### Library / SDK

**Context:** JavaScript/TypeScript library for developers

#### Library Features
```
πŸ“¦ new: add async/await support to all methods
πŸ“¦ new(api): client method for batch operations
πŸ“¦ new: typescript type definitions
πŸ”§ update: improve error handling with custom errors
πŸ”§ update: refactor core module for better performance
πŸ—‘οΈ remove: deprecated callback-based api
```

#### API Changes
```
πŸ”§ update(api): simplify configuration options
πŸ”§ update: change default timeout to 30 seconds
πŸ“– docs(breaking): document v3 migration guide
πŸš€ release: version 3.0.0 with breaking changes
```

#### Developer Experience
```
πŸ“¦ new: add debug mode for troubleshooting
πŸ”§ update: improve error messages with actionable hints
πŸ“– docs: add interactive examples to readme
πŸ“– docs(api): document all public methods with jsdoc
πŸ“– docs: create getting started tutorial
```

#### Testing & Quality
```
πŸ§ͺ test: add unit tests for all core modules
πŸ§ͺ test: achieve 95% code coverage
βš™οΈ setup: configure automatic type checking
βš™οΈ setup(ci): add automated npm publishing
β˜• chore: update dependencies to latest stable
```

#### Distribution
```
πŸ“¦ new: add esm module support
πŸ“¦ new: add umd bundle for browsers
βš™οΈ setup(build): optimize bundle size with rollup
πŸš€ release: publish version 2.5.0 to npm
```

### CLI Tool

**Context:** Command-line tool built with Node.js

#### Commands & Features
```
πŸ“¦ new: add init command for project setup
πŸ“¦ new(cmd): deploy command with progress bar
πŸ“¦ new: interactive configuration wizard
πŸ”§ update(cli): improve help text formatting
πŸ”§ update: add colorized output for better readability
πŸ—‘οΈ remove: deprecated --legacy flag
```

#### User Experience
```
πŸ“¦ new: add autocomplete support for bash and zsh
πŸ“¦ new(ui): spinner animation for long operations
πŸ”§ update: improve error messages with suggestions
πŸ”§ update(config): support yaml and json config files
πŸ“– docs: add command examples to help text
```

#### Installation & Distribution
```
βš™οΈ setup: add installation script for multiple platforms
βš™οΈ setup(ci): automate binary builds for releases
πŸ“¦ new: support installation via homebrew
πŸ“¦ new: add windows installer
πŸš€ release: version 1.0.0 stable release
```

#### Testing & Debugging
```
πŸ§ͺ test: add integration tests for all commands
πŸ§ͺ test(cmd): test deploy command with mocked api
πŸ“¦ new(debug): add verbose flag for troubleshooting
β˜• chore(deps): update commander to latest version
```

#### Documentation
```
πŸ“– docs: create comprehensive usage guide
πŸ“– docs(examples): add real-world workflow examples
πŸ“– docs: add troubleshooting section
πŸ“– docs(install): platform-specific installation guides
```

### Bot (Discord/Telegram)

**Context:** Chat bot with commands and event handlers

#### Bot Commands
```
πŸ“¦ new(cmd): welcome command for new members
πŸ“¦ new: moderation commands for admins
πŸ“¦ new(cmd): poll creation with reaction voting
πŸ”§ update: improve help command with categories
πŸ”§ update(cmd): enhance music player with queue system
πŸ—‘οΈ remove: deprecated legacy command syntax
```

#### Features & Integrations
```
πŸ“¦ new: integration with spotify api
πŸ“¦ new(feature): automated role assignment
πŸ“¦ new: custom embed messages with rich formatting
πŸ”§ update: improve message parsing and validation
πŸ”§ update(db): migrate to postgresql for better scaling
```

#### Event Handlers
```
πŸ“¦ new(event): handle member join events
πŸ“¦ new: reaction role system
πŸ”§ update(event): improve message deletion logging
πŸ”§ update: add rate limiting for command usage
πŸ”’ security: validate user permissions before commands
```

#### Configuration & Deployment
```
βš™οΈ setup: add environment variable configuration
βš™οΈ setup(deploy): containerize bot with docker
πŸ“¦ new(config): per-server configuration system
β˜• chore: update discord.js to latest version
```

#### Testing & Documentation
```
πŸ§ͺ test: add unit tests for command handlers
πŸ§ͺ test: mock discord api for integration tests
πŸ“– docs: create bot setup guide for server admins
πŸ“– docs(commands): document all available commands
πŸš€ release: deploy version 2.0.0 to production
```

### GitHub Action

**Context:** Custom GitHub Action for CI/CD workflows

#### Action Development
```
πŸ“¦ new: initial action for code quality checks
πŸ“¦ new(input): add customizable threshold options
πŸ“¦ new: support for multiple programming languages
πŸ”§ update: improve performance of file scanning
πŸ”§ update(output): add detailed report generation
πŸ—‘οΈ remove: legacy node 12 support
```

#### Integration & Compatibility
```
πŸ“¦ new: add support for pull request comments
πŸ“¦ new(integration): slack notification output
πŸ”§ update: support both github token and app auth
πŸ”§ update: improve error handling with actionable messages
βš™οΈ setup(ci): add automated testing workflow
```

#### Documentation & Examples
```
πŸ“– docs: create comprehensive action usage guide
πŸ“– docs(examples): add workflow examples for common scenarios
πŸ“– docs: add troubleshooting section
πŸ“– docs(inputs): document all input parameters
πŸ“– docs(outputs): document all output values
```

#### Distribution & Versioning
```
βš™οΈ setup: configure automated release process
βš™οΈ setup(build): optimize action bundle size
πŸš€ release: version 1.0.0 stable release
πŸš€ release: tag v2 for breaking changes
β˜• chore(deps): update action dependencies
```

#### Testing & Quality
```
πŸ§ͺ test: add end-to-end tests with real workflows
πŸ§ͺ test(unit): test action logic with various inputs
πŸ”’ security: validate and sanitize user inputs
β˜• chore: update action to use node 20
```

---

## AI Integration

Copy these templates to integrate Clean Commit with AI coding assistants.

### GitHub Copilot

Copy [`examples/copilot.instructions.md`](examples/copilot.instructions.md) to your project:

```bash
mkdir -p .github/instructions
curl -o .github/instructions/copilot.instructions.md https://raw.githubusercontent.com/wgtechlabs/clean-commit/main/examples/copilot.instructions.md
```

### AI Agents (Codex, Claude, Cursor, Windsurf, etc.)

Copy [`examples/AGENTS.md`](examples/AGENTS.md) to your project root:

```bash
curl -o AGENTS.md https://raw.githubusercontent.com/wgtechlabs/clean-commit/main/examples/AGENTS.md
```

### Real-World Implementation

- [wgtechlabs/nuvex](https://github.com/wgtechlabs/nuvex/blob/main/.github/instructions/clean_commit.instructions.md)

---

## Learn More

- πŸ“‹ [**SPECIFICATION.md**](SPECIFICATION.md) - Full technical specification with detailed guidelines
- πŸ“„ [**QUICK-REFERENCE.md**](QUICK-REFERENCE.md) - Single-page cheatsheet for quick lookup
- πŸ’‘ [**examples/EXAMPLES.md**](examples/EXAMPLES.md) - Real-world examples by project type

---

Expand Down
45 changes: 45 additions & 0 deletions examples/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Clean Commit Convention

When generating commit messages for this repository, follow the **Clean Commit** convention.

Reference: https://github.com/wgtechlabs/clean-commit

## Format

```text
<emoji> <type>: <description>
<emoji> <type>(<scope>): <description>
```

## The 9 Types

| Emoji | Type | What it covers |
|:-----:|------|----------------|
| πŸ“¦ | `new` | Adding new features, files, or capabilities |
| πŸ”§ | `update` | Changing existing code, refactoring, improvements |
| πŸ—‘οΈ | `remove` | Removing code, files, features, or dependencies |
| πŸ”’ | `security` | Security fixes, patches, vulnerability resolutions |
| βš™οΈ | `setup` | Project configs, CI/CD, tooling, build systems |
| β˜• | `chore` | Maintenance tasks, dependency updates, housekeeping |
| πŸ§ͺ | `test` | Adding, updating, or fixing tests |
| πŸ“– | `docs` | Documentation changes and updates |
| πŸš€ | `release` | Version releases and release preparation |

## Rules

- Use lowercase for type
- Use present tense ("add" not "added")
- No period at the end
- Keep description under 72 characters

## Examples

- `πŸ“¦ new: user authentication system`
- `πŸ”§ update(api): improve error handling`
- `πŸ—‘οΈ remove(deps): unused lodash dependency`
- `πŸ”’ security: patch XSS vulnerability`
- `βš™οΈ setup: add eslint configuration`
- `β˜• chore: update npm dependencies`
- `πŸ§ͺ test: add unit tests for auth service`
- `πŸ“– docs: update installation instructions`
- `πŸš€ release: version 1.0.0`
Loading