- Add 9 agent skills (cc-agent-*) - Add 10 command skills (cc-cmd-*) - Add 8 skill files (cc-skill-*) - Add 8 rule skills (cc-rule-*) - Update README.md skill count from 225 to 260 - Add new skills to Full Skill Registry - Add credit to affaan-m in Credits section - Regenerate skills_index.json Source: https://github.com/affaan-m/everything-claude-code Author attribution: affaan-m, version 1.0
78 lines
1.4 KiB
Markdown
78 lines
1.4 KiB
Markdown
---
|
|
name: cc-rule-coding-style
|
|
description: Coding Style
|
|
author: affaan-m
|
|
version: "1.0"
|
|
---
|
|
|
|
# Coding Style
|
|
|
|
## Immutability (CRITICAL)
|
|
|
|
ALWAYS create new objects, NEVER mutate:
|
|
|
|
```javascript
|
|
// WRONG: Mutation
|
|
function updateUser(user, name) {
|
|
user.name = name // MUTATION!
|
|
return user
|
|
}
|
|
|
|
// CORRECT: Immutability
|
|
function updateUser(user, name) {
|
|
return {
|
|
...user,
|
|
name
|
|
}
|
|
}
|
|
```
|
|
|
|
## File Organization
|
|
|
|
MANY SMALL FILES > FEW LARGE FILES:
|
|
- High cohesion, low coupling
|
|
- 200-400 lines typical, 800 max
|
|
- Extract utilities from large components
|
|
- Organize by feature/domain, not by type
|
|
|
|
## Error Handling
|
|
|
|
ALWAYS handle errors comprehensively:
|
|
|
|
```typescript
|
|
try {
|
|
const result = await riskyOperation()
|
|
return result
|
|
} catch (error) {
|
|
console.error('Operation failed:', error)
|
|
throw new Error('Detailed user-friendly message')
|
|
}
|
|
```
|
|
|
|
## Input Validation
|
|
|
|
ALWAYS validate user input:
|
|
|
|
```typescript
|
|
import { z } from 'zod'
|
|
|
|
const schema = z.object({
|
|
email: z.string().email(),
|
|
age: z.number().int().min(0).max(150)
|
|
})
|
|
|
|
const validated = schema.parse(input)
|
|
```
|
|
|
|
## Code Quality Checklist
|
|
|
|
Before marking work complete:
|
|
- [ ] Code is readable and well-named
|
|
- [ ] Functions are small (<50 lines)
|
|
- [ ] Files are focused (<800 lines)
|
|
- [ ] No deep nesting (>4 levels)
|
|
- [ ] Proper error handling
|
|
- [ ] No console.log statements
|
|
- [ ] No hardcoded values
|
|
- [ ] No mutation (immutable patterns used)
|