Development guide for the CCMM project with TypeScript best practices, testing requirements, and work documentation standards
A comprehensive development guide for the CCMM (Nasubikun/ccmm) project that enforces coding standards, testing requirements, and work documentation practices.
This skill provides you with project-specific guidelines for working on the CCMM codebase. It ensures:
When implementing features or making changes:
1. **Avoid classes** - Use function-based implementations whenever possible
2. **Use Result type** - Import and use `src/lib/result.ts` for all operations that can fail
- Return `Ok(value)` for successful operations
- Return `Err(error)` for failures
- This provides type-safe error handling without exceptions
Example:
```typescript
import { Ok, Err, type Result } from '@/lib/result'
function processData(input: string): Result<Data, Error> {
if (!input) {
return Err(new Error('Input required'))
}
return Ok(transformedData)
}
```
After implementing any feature:
1. **Write unit tests** using vitest in the same directory or a `__tests__` subdirectory
2. Tests should verify:
- Happy path functionality
- Error cases and edge cases
- Result type handling (Ok/Err branches)
3. Test file naming: `<filename>.test.ts` or `<filename>.spec.ts`
Example test structure:
```typescript
import { describe, it, expect } from 'vitest'
import { processData } from './module'
describe('processData', () => {
it('returns Ok with valid input', () => {
const result = processData('valid')
expect(result.isOk()).toBe(true)
})
it('returns Err with invalid input', () => {
const result = processData('')
expect(result.isErr()).toBe(true)
})
})
```
Before completing any task:
1. **Run the comprehensive check command**:
```bash
npm run check
```
2. This command runs:
- Code formatting checks
- Linting
- TypeScript type checking
- All unit tests
3. **Fix any issues** before marking the task complete
4. Do not proceed if `npm run check` fails
At the end of each task:
1. **Create a work file** in the `./works` directory
2. **Naming convention**: `<index>-<description>.md`
- `<index>`: Zero-padded number indicating order (e.g., 0, 1, 2, 10)
- `<description>`: Brief kebab-case description of the work
3. **Content should include**:
- What was implemented or changed
- Why the changes were made
- Any important decisions or trade-offs
- References to related files or issues
Examples:
When starting a new task:
1. **Review existing work files** in `./works` to understand:
- Implementation history
- Architectural decisions
- Patterns used in the codebase
2. Check files in chronological order (by index number)
3. Look for related work that might inform your current task
For every task:
1. ✅ Review past work files if relevant
2. ✅ Implement using function-based approach with Result types
3. ✅ Write unit tests with vitest
4. ✅ Run `npm run check` and fix any issues
5. ✅ Document your work in `./works/<index>-<description>.md`
6. ✅ Mark task complete only after all checks pass
**Task**: Add a new data validation function
1. Read related work files to understand validation patterns
2. Implement `validateUserInput()` as a pure function returning `Result<Valid, ValidationError>`
3. Write tests in `validateUserInput.test.ts` covering valid/invalid cases
4. Run `npm run check` - ensure all checks pass
5. Create `./works/5-user-input-validation.md` documenting the implementation
6. Complete the task
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/ccmm-project-guide/raw