---
# Development Practices

<!--
GENERATION INSTRUCTIONS:
1. Scan for linter/formatter configs (.eslintrc, .prettierrc, pyproject.toml, etc.)
2. Extract naming patterns from existing code
3. Find error handling patterns in services/controllers
4. Locate logging usage and configuration
5. Check for pre-commit hooks, CI config
6. Output: 150-300 lines max
-->

**Project**: [Extract from config]
**Language**: [Detect] | **Framework**: [Detect]
**Linter**: [Detect] | **Formatter**: [Detect]

---

## Code Style

<!-- Extract from linter config + analyze existing code patterns -->

### Naming Conventions

| Element | Convention | Example |
|---------|------------|---------|
| Files | `[kebab-case/snake_case/PascalCase]` | `[actual example from codebase]` |
| Classes | `[PascalCase]` | `[actual example]` |
| Functions | `[camelCase/snake_case]` | `[actual example]` |
| Variables | `[camelCase/snake_case]` | `[actual example]` |
| Constants | `[UPPER_SNAKE_CASE]` | `[actual example]` |
| Private | `[_prefix/no prefix/#private]` | `[actual example]` |

### File Organization

```[lang]
// Source: [representative file path]
// Standard file structure in this codebase:

[Extract typical file structure showing imports, class/function order]
```

### Import Order

<!-- Extract from linter config or consistent patterns -->

```[lang]
// 1. [Standard library / Built-ins]
// 2. [External packages / Third-party]
// 3. [Internal modules / Local imports]

[Extract example showing import organization]
```

---

## Code Quality

<!-- Find linter/formatter configuration -->

### Commands

| Action | Command | Auto-fix |
|--------|---------|----------|
| Lint | `[exact command]` | `[fix command]` |
| Format | `[exact command]` | `[format write command]` |
| Type check | `[command or N/A]` | - |
| All checks | `[combined command if exists]` | - |

### Configuration Files

| Tool | Config File |
|------|-------------|
| Linter | `[.eslintrc / .pylintrc / etc.]` |
| Formatter | `[.prettierrc / pyproject.toml / etc.]` |
| Type checker | `[tsconfig.json / mypy.ini / etc.]` |

### Pre-commit Hooks

<!-- Check for .pre-commit-config.yaml, husky, lint-staged -->

```bash
# Setup (if not auto-installed)
[pre-commit install command or N/A]
```

**Runs on commit**: [List what runs - lint, format, tests]

---

## Error Handling

<!-- Extract exception classes and handling patterns -->

### Exception Types

| Exception | Use When | Source |
|-----------|----------|--------|
| `[ValidationError]` | Invalid input data | `[file:line]` |
| `[NotFoundError]` | Resource doesn't exist | `[file:line]` |
| `[UnauthorizedError]` | Auth required/failed | `[file:line]` |
| `[ForbiddenError]` | Permission denied | `[file:line]` |
| `[ConflictError]` | State conflict | `[file:line]` |

### Pattern

```[lang]
// Source: [file:lines]
[Extract canonical error throwing/handling pattern]
```

**Rules:**
- Throw specific exceptions from `[exceptions path]`
- Let `[error handler/middleware]` convert to response
- ❌ Never catch-and-ignore silently

---

## Logging

<!-- Find logging configuration and usage patterns -->

### Setup

```[lang]
// Source: [file:lines]
[Extract logger initialization/import pattern]
```

### Usage Pattern

```[lang]
// Source: [file:lines]
[Extract example showing structured logging with context]
```

### Levels

| Level | Use For |
|-------|---------|
| `debug` | Development troubleshooting |
| `info` | Significant operations (startup, requests) |
| `warn` | Recoverable issues, deprecations |
| `error` | Failures requiring attention |

### Rules

- ✅ Include context: `{ userId, requestId, [relevant ids] }`
- ✅ Use `[detected logger]` from `[import path]`
- ❌ No secrets, passwords, tokens in logs
- ❌ No excessive logging in loops/hot paths

---

## Async Patterns

<!-- Detect if async/await, promises, or sync patterns used -->

**Style**: [async/await | Promises | Callbacks | Sync | Mixed]

```[lang]
// Source: [file:lines]
[Extract canonical async pattern]
```

### Error Handling in Async

```[lang]
// Source: [file:lines]
[Extract async error handling - try/catch wrapper, error middleware, etc.]
```

---

## Configuration & Environment

<!-- Find how config is loaded and validated -->

### Loading Pattern

```[lang]
// Source: [file:lines]
[Extract config loading/validation pattern]
```

### Required Variables

| Variable | Purpose | Example |
|----------|---------|---------|
| `[VAR_NAME]` | [Purpose] | `[example value]` |
| `[VAR_NAME]` | [Purpose] | `[example value]` |

### Accessing Config

```[lang]
// Use this pattern to access configuration
[Extract how to import/use config values]
```

---

## Dependencies

<!-- Find package manager and conventions -->

### Adding Dependencies

```bash
# Production dependency
[npm install X / pip install X / etc.]

# Dev dependency
[npm install -D X / pip install X --dev / etc.]
```

### Update Process

```bash
# Check outdated
[command]

# Update
[command]
```

**Lock file**: `[package-lock.json / poetry.lock / etc.]` - ✅ Always commit

---

## Git Workflow

<!-- Extract from CONTRIBUTING.md, .github, or infer from history -->

### Branch Naming

```
[feature/bugfix/hotfix]/[ticket-id]-[short-description]
```

**Examples**: `feature/ABC-123-add-user-auth`, `bugfix/fix-login-redirect`

### Commit Messages

<!-- Detect conventional commits, or extract pattern -->

```
[type]([scope]): [description]

[body - optional]
```

**Types**: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`

### PR Checklist

- [ ] Linting passes (`[lint command]`)
- [ ] Tests pass (`[test command]`)
- [ ] [Other checks from CI or CONTRIBUTING.md]

---

## Common Patterns

<!-- Extract recurring patterns specific to this codebase -->

| Pattern | When to Use | Example |
|---------|-------------|---------|
| `[Helper/Utility name]` | [Use case] | `[file:line]` |
| `[Decorator/Middleware]` | [Use case] | `[file:line]` |
| `[Factory/Builder]` | [Use case] | `[file:line]` |

---

## Don't Do

<!-- Extract anti-patterns from linter rules or code review patterns -->

| ❌ Avoid | ✅ Instead | Why |
|----------|-----------|-----|
| `[anti-pattern]` | `[correct pattern]` | [reason] |
| `[anti-pattern]` | `[correct pattern]` | [reason] |
| `[anti-pattern]` | `[correct pattern]` | [reason] |

---

## Quick Reference

| Need | Location |
|------|----------|
| Linter config | `[path]` |
| Formatter config | `[path]` |
| Exception classes | `[path]` |
| Logger setup | `[path]` |
| Config loader | `[path]` |
| Utilities | `[path]` |

---