Files
english/.opencode/skills/ai-artist/references/domain-code.md
2026-04-12 01:06:31 +07:00

1.2 KiB

Code Generation Patterns

Function Implementation

Write a [language] function:
- Input: [params with types]
- Output: [return type]
- Behavior: [logic]

Requirements:
- Edge cases: [list]
- Error handling: [approach]
- Performance: O([complexity])

Code Review

Review for:
1. Bugs/logic errors
2. Security vulnerabilities
3. Performance issues
4. Style violations
5. Missing edge cases

Format: Issue, line number, severity, fix.

Refactoring

Refactor to:
- [Improvement goal]
- Maintain backward compatibility
- Keep public API
- Add comments for complex logic
Show before/after.

Debugging

<error>[Error message/behavior]</error>
<code>[Relevant code]</code>
<context>[When it occurs]</context>

Analyze:
1. Root cause
2. Why it happens
3. Fix with explanation
4. Prevention strategy

Test Generation

Generate tests for [function/class]:
- Framework: [jest/pytest/etc]
- Coverage: happy path, edge cases, errors
- Include: setup, assertion, cleanup
- Mock: [external dependencies]

Documentation

Document this [function/class/API]:
- Format: [JSDoc/docstring/OpenAPI]
- Include: description, params, returns, examples
- Note: edge cases, errors, deprecations