Torna alle skill
awesome-zed-rules
di MedElfadhelELHACHEMI
Cursor—Non ancora valutato
La tua valutazione
Sintesi
rule files for the Zed IDE, can be used for Cursor
Descrizione
# Coding Rules Collection This directory contains individual rule files for defensive CSS practices and TypeScript/JavaScript best practices. These rules help you build future-proof, maintainable user interfaces and applications. ## 📋 Complete Rule List (26 Rules) ### **🎨 Defensive CSS Rules (1-15)** #### **High Priority (Implement First)** 1. **[Flexbox Wrapping](01-flexbox-wrapping.md)** - Always add `flex-wrap: wrap` to prevent horizontal overflow 2. **[Image Distortion](02-image-distortion.md)** - Use `object-fit: cover` to maintain aspect ratios 3. **[Long Content](03-long-content.md)** - Implement text truncation for unpredictable content 4. **[Flexbox Min Content Size](08-flexbox-min-content-size.md)** - Set `min-width: 0` on flex items with large content 5. **[Grid Min Content Size](09-grid-min-content-size.md)** - Prevent grid items from expanding beyond containers #### **Medium Priority** 6. **[Component Spacing](04-component-spacing.md)** - Add defensive spacing even when not immediately needed 7. **[CSS Variable Fallback](07-css-variable-fallback.md)** - Always provide fallback values for CSS variables 8. **[Background Repeat](06-background-repeat.md)** - Set `background-repeat: no-repeat` for large images 9. **[Accidental Hover on Mobile](12-accidental-hover-mobile.md)** - Use hover media queries for touch devices 10. **[Using Space-Between](10-using-space-between.md)** - Prefer `gap` over `justify-content: space-between` #### **Low Priority (Nice to Have)** 11. **[Auto-fit vs Auto-fill](05-auto-fit-vs-auto-fill.md)** - Use `auto-fill` to prevent items becoming too wide 12. **[Default Flexbox Stretching](11-default-flexbox-stretching.md)** - Override stretching with `align-self` or `align-items` 13. **[Scrollbars on Demand](13-scrollbars-on-demand.md)** - Use `overflow: auto` instead of `overflow: scroll` 14. **[Scrollbar Gutter](14-scrollbar-gutter.md)** - Use `scrollbar-gutter: stable` to prevent layout shifts 15. **[Input Zoom on iOS Safari](15-input-zoom-ios-safari.md)** - Set font-size to 16px+ to prevent unwanted zoom ### **⚛️ TypeScript & JavaScript Rules (16-26)** #### **Code Structure & Architecture** 16. **[CSS Grid for Positioning](16-css-grid-positioning.md)** - Use CSS Grid instead of absolute positioning for overlays 17. **[Early Returns](17-early-returns.md)** - Reduce nesting with early returns for better readability #### **TypeScript Type System** 18. **[TypeScript Types](18-typescript-types.md)** - Use discriminated unions and prevent impossible states 19. **[Enums and Constants](19-enums-constants.md)** - Use `as const` objects instead of enums 23. **[Generics and Any](23-generics-any.md)** - Strategic use of `any` in generic functions only #### **Code Organization** 20. **[Imports and Exports](20-imports-exports.md)** - Prefer named exports and proper import syntax 21. **[Naming Conventions](21-naming-conventions.md)** - Consistent naming patterns across the codebase 24. **[Function Declarations](24-function-declarations.md)** - Always declare return types for module functions #### **Error Handling & Documentation** 22. **[Error Handling](22-error-handling.md)** - Use Result types instead of throwing errors 25. **[JSDoc Comments](25-jsdoc-comments.md)** - Document non-obvious functions with JSDoc 26. **[TypeScript Configuration](26-typescript-config.md)** - Handle different TypeScript config scenarios --- ## 🎯 Rule Categories ### **🎨 CSS & Layout** - **Flexbox Management** - Rules 1, 8, 11, 12 - **Grid Systems** - Rules 9, 16 - **Image Handling** - Rules 2, 6 - **Spacing & Positioning** - Rules 4, 10 - **Responsive Design** - Rules 12, 15 ### **📝 Content & Typography** - **Text Management** - Rule 3 - **User Input** - Rule 15 - **Variable Content** - Rules 4, 7 ### **🔧 Interactive Elements** - **Scrolling Behavior** - Rules 13, 14 - **Touch Interactions** - Rule 12 - **Progressive Enhancement** - Rules 5, 7, 14 ### **🏗️ Code Architecture** - **Function Structure** - Rule 17 - **Error Patterns** - Rule 22 - **Module Organization** - Rule 20 ### **📐 Type Safety** - **Type Definitions** - Rules 18, 19 - **Generic Programming** - Rule 23 - **Runtime Safety** - Rules 22, 26 ### **📚 Code Quality** - **Documentation** - Rule 25 - **Naming Standards** - Rule 21 - **Configuration Management** - Rule 26 --- ## 🚀 Quick Start Guide ### **For New Projects** 1. **Start with High Priority CSS rules** (1-5) - Prevent common layout issues 2. **Implement TypeScript foundation** (18, 19, 21) - Establish type safety patterns 3. **Add error handling** (17, 22) - Build robust error management 4. **Set up code organization** (20, 24, 25) - Create maintainable structure ### **For Existing Projects** 1. **Audit current issues** - Find which rules address existing problems 2. **Implement incrementally** - Add rules one at a time 3. **Focus on high-impact areas** - Start with rules that fix current pain points 4. **Update team conventions** - Ensure everyone follows new patterns --- ## 🧪 Testing Strategy ### **CSS Rules Testing** 1. **Content Stress Testing** - Use longer text than expected 2. **Image Variation Testing** - Test with different aspect ratios 3. **Device Testing** - Test on various screen sizes and devices 4. **User-Generated Content Simulation** - Use realistic variable content ### **TypeScript Rules Testing** 1. **Type Safety Verification** - Ensure types prevent runtime errors 2. **Configuration Testing** - Test with different TypeScript settings 3. **Edge Case Handling** - Verify error scenarios work correctly 4. **Refactoring Safety** - Ensure changes are caught by type system --- ## 📊 Implementation Priority Matrix | Priority | CSS Rules | TypeScript Rules | Impact | Effort | |----------|-----------|------------------|---------|---------| | **Critical** | 1, 2, 3, 8, 9 | 17, 18, 22 | High | Medium | | **High** | 4, 6, 7, 10, 12 | 19, 20, 21 | High | Low | | **Medium** | 5, 11, 13 | 16, 23, 24 | Medium | Low | | **Low** | 14, 15 | 25, 26 | Low | Low | --- ## 🌟 Benefits by Category ### **User Experience Improvements** - **Responsive Layouts** - Rules 1, 4, 8, 9, 12, 16 - **Visual Consistency** - Rules 2, 3, 11, 14, 15 - **Performance** - Rules 5, 6, 13 ### **Developer Experience Improvements** - **Type Safety** - Rules 18, 19, 22, 23, 26 - **Code Readability** - Rules 17, 21, 24, 25 - **Maintainability** - Rules 20, 21, 25 ### **Team Productivity Improvements** - **Consistent Patterns** - Rules 19, 20, 21, 24 - **Error Prevention** - Rules 17, 18, 22, 26 - **Documentation** - Rules 25 --- ## 📚 Educational Resources ### **CSS Fundamentals** - **Flexbox & Grid** - Understanding modern layout systems - **Responsive Design** - Mobile-first development principles - **CSS Architecture** - Scalable styling patterns ### **TypeScript Mastery** - **Type System** - Advanced type patterns and utility types - **Error Handling** - Functional error handling patterns - **Code Organization** - Module systems and project structure ### **Best Practices** - **Code Review** - What to look for when reviewing code - **Testing** - How to test defensive code patterns - **Performance** - Optimization techniques for each rule --- ## 🔗 References ### **Defensive CSS** - **Original Website:** [https://defensivecss.dev/](https://defensivecss.dev/) - **Author:** Ahmad Shadeed - [@shadeed9](https://twitter.com/shadeed9) - **Additional Reading:** [CSS Debugging Book](https://debuggingcss.com/) ### **TypeScript Resources** - **Official Documentation:** [https://www.typescriptlang.org/](https://www.typescriptlang.org/) - **Type Challenges:** [https://github.com/type-challenges/type-challenges](https://github.com/type-challenges/type-challenges) - **Best Practices:** [https://typescript-eslint.io/](https://typescript-eslint.io/) ### **Code Quality Tools** - **ESLint:** Linting and code quality - **Prettier:** Code formatting - **Husky:** Git hooks for quality checks --- ## 🤝 Contributing When adding new rules: 1. **Follow the established format** - Use the same structure as existing rules 2. **Include practical examples** - Show both good and bad patterns 3. **Explain the "why"** - Context matters as much as the rule itself 4. **Test thoroughly** - Verify examples work in real scenarios 5. **Update this README** - Keep the overview current --- ## 📈 Quick Reference Checklist ### **Before Every Pull Request** - [ ] Check flexbox wrapping (Rule 1) - [ ] Verify image object-fit (Rule 2) - [ ] Handle long content gracefully (Rule 3) - [ ] Use early returns (Rule 17) - [ ] Apply proper TypeScript types (Rule 18) - [ ] Use named exports (Rule 20) - [ ] Follow naming conventions (Rule 21) ### **Before Production Deploy** - [ ] Test with variable content lengths - [ ] Verify responsive behavior - [ ] Check error handling paths - [ ] Validate type safety - [ ] Review performance implications --- *Each rule file contains detailed explanations, code examples, use cases, and implementation guidance. This collection represents battle-tested patterns for building robust, maintainable web applications.*
Installazione
Installa la skill da https://github.com/MedElfadhelELHACHEMI/awesome-zed-rulesQuesta skill non è pubblicata sul registro ClawHub. Incolla il prompt nel tuo agente di coding — Claude Code, Cursor, Codex — e installerà la skill direttamente dal repository sorgente.
Apri il repository