Skip to content

Commit 1b643cd

Browse files
πŸ“– docs: restructure examples folder into copy-paste templates (#2)
* Initial plan * πŸ“– docs: restructure examples folder and merge documentation Co-authored-by: warengonzaga <[email protected]> * πŸ“– docs: add bot and github action examples to readme Co-authored-by: warengonzaga <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: warengonzaga <[email protected]>
1 parent d458db5 commit 1b643cd

File tree

4 files changed

+414
-344
lines changed

4 files changed

+414
-344
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 320 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,330 @@ See: https://github.com/wgtechlabs/clean-commit
189189

190190
---
191191

192+
## Real-World Examples
193+
194+
This section shows real-world commit examples organized by project type to help you apply Clean Commit to your projects.
195+
196+
### Web Application
197+
198+
**Context:** A full-stack web app with React frontend and Node.js backend
199+
200+
#### Feature Development
201+
```
202+
πŸ“¦ new: user profile page with avatar upload
203+
πŸ“¦ new(auth): social login with google and github
204+
πŸ“¦ new(dashboard): real-time analytics widgets
205+
πŸ”§ update(ui): improve mobile responsive layout
206+
πŸ”§ update: optimize image loading with lazy loading
207+
πŸ—‘οΈ remove(ui): deprecated jquery legacy code
208+
```
209+
210+
#### Bug Fixes & Improvements
211+
```
212+
πŸ”§ update: fix cart total calculation rounding error
213+
πŸ”§ update(form): improve validation error messages
214+
πŸ”§ update(api): handle network timeout gracefully
215+
πŸ”’ security: sanitize html input to prevent xss
216+
πŸ”’ security(session): implement csrf token validation
217+
```
218+
219+
#### Testing & Documentation
220+
```
221+
πŸ§ͺ test(e2e): add cypress tests for checkout flow
222+
πŸ§ͺ test: increase coverage for payment module
223+
πŸ“– docs: update component usage examples
224+
πŸ“– docs(api): document authentication flow
225+
```
226+
227+
#### Maintenance
228+
```
229+
β˜• chore(deps): bump react from 17.0.2 to 18.2.0
230+
β˜• chore: update webpack to version 5
231+
βš™οΈ setup(ci): add automated deployment pipeline
232+
βš™οΈ setup: configure storybook for components
233+
```
234+
235+
#### Release
236+
```
237+
πŸš€ release: version 2.0.0
238+
πŸš€ release: hotfix version 2.0.1 for login bug
239+
```
240+
241+
### API / Backend
242+
243+
**Context:** RESTful API service with database and authentication
244+
245+
#### API Development
246+
```
247+
πŸ“¦ new(api): user registration endpoint with validation
248+
πŸ“¦ new: rate limiting middleware for api protection
249+
πŸ“¦ new(db): migration for orders table
250+
πŸ“¦ new(auth): jwt token refresh mechanism
251+
πŸ”§ update(api): improve error response format
252+
πŸ”§ update: optimize database query with indexing
253+
πŸ”§ update(middleware): refactor logging to use winston
254+
```
255+
256+
#### Security & Performance
257+
```
258+
πŸ”’ security(api): add input validation to prevent injection
259+
πŸ”’ security: hash passwords with bcrypt instead of md5
260+
πŸ”’ security(auth): fix authorization bypass in admin routes
261+
πŸ”§ update: implement connection pooling for database
262+
πŸ”§ update(cache): add redis caching for frequent queries
263+
```
264+
265+
#### Database & Infrastructure
266+
```
267+
πŸ“¦ new(db): add full-text search indexes
268+
πŸ”§ update(db): optimize user query performance
269+
πŸ—‘οΈ remove(db): drop unused legacy tables
270+
βš™οΈ setup(docker): containerize application with compose
271+
βš™οΈ setup: configure automated database backups
272+
```
273+
274+
#### Testing & Documentation
275+
```
276+
πŸ§ͺ test(api): integration tests for auth endpoints
277+
πŸ§ͺ test: add load testing with artillery
278+
πŸ“– docs(api): generate swagger documentation
279+
πŸ“– docs: add architecture decision records
280+
```
281+
282+
#### Maintenance & Release
283+
```
284+
β˜• chore(deps): update express to latest security patch
285+
β˜• chore: clean up deprecated api endpoints
286+
πŸš€ release: version 3.1.0 with new features
287+
```
288+
289+
### Library / SDK
290+
291+
**Context:** JavaScript/TypeScript library for developers
292+
293+
#### Library Features
294+
```
295+
πŸ“¦ new: add async/await support to all methods
296+
πŸ“¦ new(api): client method for batch operations
297+
πŸ“¦ new: typescript type definitions
298+
πŸ”§ update: improve error handling with custom errors
299+
πŸ”§ update: refactor core module for better performance
300+
πŸ—‘οΈ remove: deprecated callback-based api
301+
```
302+
303+
#### API Changes
304+
```
305+
πŸ”§ update(api): simplify configuration options
306+
πŸ”§ update: change default timeout to 30 seconds
307+
πŸ“– docs(breaking): document v3 migration guide
308+
πŸš€ release: version 3.0.0 with breaking changes
309+
```
310+
311+
#### Developer Experience
312+
```
313+
πŸ“¦ new: add debug mode for troubleshooting
314+
πŸ”§ update: improve error messages with actionable hints
315+
πŸ“– docs: add interactive examples to readme
316+
πŸ“– docs(api): document all public methods with jsdoc
317+
πŸ“– docs: create getting started tutorial
318+
```
319+
320+
#### Testing & Quality
321+
```
322+
πŸ§ͺ test: add unit tests for all core modules
323+
πŸ§ͺ test: achieve 95% code coverage
324+
βš™οΈ setup: configure automatic type checking
325+
βš™οΈ setup(ci): add automated npm publishing
326+
β˜• chore: update dependencies to latest stable
327+
```
328+
329+
#### Distribution
330+
```
331+
πŸ“¦ new: add esm module support
332+
πŸ“¦ new: add umd bundle for browsers
333+
βš™οΈ setup(build): optimize bundle size with rollup
334+
πŸš€ release: publish version 2.5.0 to npm
335+
```
336+
337+
### CLI Tool
338+
339+
**Context:** Command-line tool built with Node.js
340+
341+
#### Commands & Features
342+
```
343+
πŸ“¦ new: add init command for project setup
344+
πŸ“¦ new(cmd): deploy command with progress bar
345+
πŸ“¦ new: interactive configuration wizard
346+
πŸ”§ update(cli): improve help text formatting
347+
πŸ”§ update: add colorized output for better readability
348+
πŸ—‘οΈ remove: deprecated --legacy flag
349+
```
350+
351+
#### User Experience
352+
```
353+
πŸ“¦ new: add autocomplete support for bash and zsh
354+
πŸ“¦ new(ui): spinner animation for long operations
355+
πŸ”§ update: improve error messages with suggestions
356+
πŸ”§ update(config): support yaml and json config files
357+
πŸ“– docs: add command examples to help text
358+
```
359+
360+
#### Installation & Distribution
361+
```
362+
βš™οΈ setup: add installation script for multiple platforms
363+
βš™οΈ setup(ci): automate binary builds for releases
364+
πŸ“¦ new: support installation via homebrew
365+
πŸ“¦ new: add windows installer
366+
πŸš€ release: version 1.0.0 stable release
367+
```
368+
369+
#### Testing & Debugging
370+
```
371+
πŸ§ͺ test: add integration tests for all commands
372+
πŸ§ͺ test(cmd): test deploy command with mocked api
373+
πŸ“¦ new(debug): add verbose flag for troubleshooting
374+
β˜• chore(deps): update commander to latest version
375+
```
376+
377+
#### Documentation
378+
```
379+
πŸ“– docs: create comprehensive usage guide
380+
πŸ“– docs(examples): add real-world workflow examples
381+
πŸ“– docs: add troubleshooting section
382+
πŸ“– docs(install): platform-specific installation guides
383+
```
384+
385+
### Bot (Discord/Telegram)
386+
387+
**Context:** Chat bot with commands and event handlers
388+
389+
#### Bot Commands
390+
```
391+
πŸ“¦ new(cmd): welcome command for new members
392+
πŸ“¦ new: moderation commands for admins
393+
πŸ“¦ new(cmd): poll creation with reaction voting
394+
πŸ”§ update: improve help command with categories
395+
πŸ”§ update(cmd): enhance music player with queue system
396+
πŸ—‘οΈ remove: deprecated legacy command syntax
397+
```
398+
399+
#### Features & Integrations
400+
```
401+
πŸ“¦ new: integration with spotify api
402+
πŸ“¦ new(feature): automated role assignment
403+
πŸ“¦ new: custom embed messages with rich formatting
404+
πŸ”§ update: improve message parsing and validation
405+
πŸ”§ update(db): migrate to postgresql for better scaling
406+
```
407+
408+
#### Event Handlers
409+
```
410+
πŸ“¦ new(event): handle member join events
411+
πŸ“¦ new: reaction role system
412+
πŸ”§ update(event): improve message deletion logging
413+
πŸ”§ update: add rate limiting for command usage
414+
πŸ”’ security: validate user permissions before commands
415+
```
416+
417+
#### Configuration & Deployment
418+
```
419+
βš™οΈ setup: add environment variable configuration
420+
βš™οΈ setup(deploy): containerize bot with docker
421+
πŸ“¦ new(config): per-server configuration system
422+
β˜• chore: update discord.js to latest version
423+
```
424+
425+
#### Testing & Documentation
426+
```
427+
πŸ§ͺ test: add unit tests for command handlers
428+
πŸ§ͺ test: mock discord api for integration tests
429+
πŸ“– docs: create bot setup guide for server admins
430+
πŸ“– docs(commands): document all available commands
431+
πŸš€ release: deploy version 2.0.0 to production
432+
```
433+
434+
### GitHub Action
435+
436+
**Context:** Custom GitHub Action for CI/CD workflows
437+
438+
#### Action Development
439+
```
440+
πŸ“¦ new: initial action for code quality checks
441+
πŸ“¦ new(input): add customizable threshold options
442+
πŸ“¦ new: support for multiple programming languages
443+
πŸ”§ update: improve performance of file scanning
444+
πŸ”§ update(output): add detailed report generation
445+
πŸ—‘οΈ remove: legacy node 12 support
446+
```
447+
448+
#### Integration & Compatibility
449+
```
450+
πŸ“¦ new: add support for pull request comments
451+
πŸ“¦ new(integration): slack notification output
452+
πŸ”§ update: support both github token and app auth
453+
πŸ”§ update: improve error handling with actionable messages
454+
βš™οΈ setup(ci): add automated testing workflow
455+
```
456+
457+
#### Documentation & Examples
458+
```
459+
πŸ“– docs: create comprehensive action usage guide
460+
πŸ“– docs(examples): add workflow examples for common scenarios
461+
πŸ“– docs: add troubleshooting section
462+
πŸ“– docs(inputs): document all input parameters
463+
πŸ“– docs(outputs): document all output values
464+
```
465+
466+
#### Distribution & Versioning
467+
```
468+
βš™οΈ setup: configure automated release process
469+
βš™οΈ setup(build): optimize action bundle size
470+
πŸš€ release: version 1.0.0 stable release
471+
πŸš€ release: tag v2 for breaking changes
472+
β˜• chore(deps): update action dependencies
473+
```
474+
475+
#### Testing & Quality
476+
```
477+
πŸ§ͺ test: add end-to-end tests with real workflows
478+
πŸ§ͺ test(unit): test action logic with various inputs
479+
πŸ”’ security: validate and sanitize user inputs
480+
β˜• chore: update action to use node 20
481+
```
482+
483+
---
484+
485+
## AI Integration
486+
487+
Copy these templates to integrate Clean Commit with AI coding assistants.
488+
489+
### GitHub Copilot
490+
491+
Copy [`examples/copilot.instructions.md`](examples/copilot.instructions.md) to your project:
492+
493+
```bash
494+
mkdir -p .github/instructions
495+
curl -o .github/instructions/copilot.instructions.md https://raw.githubusercontent.com/wgtechlabs/clean-commit/main/examples/copilot.instructions.md
496+
```
497+
498+
### AI Agents (Codex, Claude, Cursor, Windsurf, etc.)
499+
500+
Copy [`examples/AGENTS.md`](examples/AGENTS.md) to your project root:
501+
502+
```bash
503+
curl -o AGENTS.md https://raw.githubusercontent.com/wgtechlabs/clean-commit/main/examples/AGENTS.md
504+
```
505+
506+
### Real-World Implementation
507+
508+
- [wgtechlabs/nuvex](https://github.com/wgtechlabs/nuvex/blob/main/.github/instructions/clean_commit.instructions.md)
509+
510+
---
511+
192512
## Learn More
193513

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

198517
---
199518

β€Žexamples/AGENTS.mdβ€Ž

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Clean Commit Convention
2+
3+
When generating commit messages for this repository, follow the **Clean Commit** convention.
4+
5+
Reference: https://github.com/wgtechlabs/clean-commit
6+
7+
## Format
8+
9+
```text
10+
<emoji> <type>: <description>
11+
<emoji> <type>(<scope>): <description>
12+
```
13+
14+
## The 9 Types
15+
16+
| Emoji | Type | What it covers |
17+
|:-----:|------|----------------|
18+
| πŸ“¦ | `new` | Adding new features, files, or capabilities |
19+
| πŸ”§ | `update` | Changing existing code, refactoring, improvements |
20+
| πŸ—‘οΈ | `remove` | Removing code, files, features, or dependencies |
21+
| πŸ”’ | `security` | Security fixes, patches, vulnerability resolutions |
22+
| βš™οΈ | `setup` | Project configs, CI/CD, tooling, build systems |
23+
| β˜• | `chore` | Maintenance tasks, dependency updates, housekeeping |
24+
| πŸ§ͺ | `test` | Adding, updating, or fixing tests |
25+
| πŸ“– | `docs` | Documentation changes and updates |
26+
| πŸš€ | `release` | Version releases and release preparation |
27+
28+
## Rules
29+
30+
- Use lowercase for type
31+
- Use present tense ("add" not "added")
32+
- No period at the end
33+
- Keep description under 72 characters
34+
35+
## Examples
36+
37+
- `πŸ“¦ new: user authentication system`
38+
- `πŸ”§ update(api): improve error handling`
39+
- `πŸ—‘οΈ remove(deps): unused lodash dependency`
40+
- `πŸ”’ security: patch XSS vulnerability`
41+
- `βš™οΈ setup: add eslint configuration`
42+
- `β˜• chore: update npm dependencies`
43+
- `πŸ§ͺ test: add unit tests for auth service`
44+
- `πŸ“– docs: update installation instructions`
45+
- `πŸš€ release: version 1.0.0`

0 commit comments

Comments
Β (0)