.claude/skills/best-practices/SKILL.md
Code quality guidelines and best practices for writing clean, maintainable code. Covers naming, structure, error handling, testing, and code review standards. Use when writing code, reviewing, refactoring, or asking "how should I name this", "best practice for", "clean code".
npx skillsauth add YaroslavKomarov/ShedulerBot ai-factory.best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Universal code quality guidelines applicable to any language or framework.
/ai-factory.best-practices — Full overview/ai-factory.best-practices naming — Naming conventions/ai-factory.best-practices structure — Code organization/ai-factory.best-practices errors — Error handling/ai-factory.best-practices testing — Testing practices/ai-factory.best-practices review — Code review checklist✅ Good ❌ Bad
─────────────────────────────────────────────
getUserById(id) getUser(i)
isValidEmail checkEmail
maxRetryCount max
calculateTotalPrice calc
handleSubmit submit
Rules:
id, url, api)is, has, can, should prefixfetchUser, validateInput)✅ Good ❌ Bad
─────────────────────────────────────────────
user-service.ts userService.ts (inconsistent)
UserRepository.ts user_repository.ts (mixed)
/components/Button/ /Components/button/
/services/auth/ /Services/Auth/
Rules:
*.test.ts or *.spec.ts (consistent)// ✅ Good: Single responsibility, clear inputs/outputs
function calculateDiscount(price: number, discountPercent: number): number {
if (discountPercent < 0 || discountPercent > 100) {
throw new Error('Discount must be between 0 and 100');
}
return price * (1 - discountPercent / 100);
}
// ❌ Bad: Multiple responsibilities, side effects
function processOrder(order) {
validateOrder(order); // validation
order.discount = getDiscount(); // mutation
saveToDatabase(order); // persistence
sendEmail(order.user); // notification
return order;
}
// ✅ Good: PHP with type declarations
function calculateDiscount(float $price, float $discountPercent): float
{
if ($discountPercent < 0 || $discountPercent > 100) {
throw new InvalidArgumentException('Discount must be between 0 and 100');
}
return $price * (1 - $discountPercent / 100);
}
Rules:
feature/
├── index.ts # Public exports only
├── types.ts # Types and interfaces
├── constants.ts # Constants
├── utils.ts # Pure utility functions
├── hooks.ts # React hooks (if applicable)
├── service.ts # Business logic
└── repository.ts # Data access
Rules:
_ or in internal/// ✅ Good: Specific errors, meaningful messages
class UserNotFoundError extends Error {
constructor(userId: string) {
super(`User not found: ${userId}`);
this.name = 'UserNotFoundError';
}
}
async function getUser(id: string): Promise<User> {
const user = await db.users.find(id);
if (!user) {
throw new UserNotFoundError(id);
}
return user;
}
// ❌ Bad: Generic errors, swallowed exceptions
async function getUser(id) {
try {
return await db.users.find(id);
} catch (e) {
console.log(e); // Swallowed!
return null; // Hides the problem
}
}
Rules:
✅ Good: "Failed to create user: email '[email protected]' already exists"
❌ Bad: "Error occurred"
❌ Bad: "Something went wrong"
describe('calculateDiscount', () => {
it('should apply percentage discount to price', () => {
// Arrange
const price = 100;
const discount = 20;
// Act
const result = calculateDiscount(price, discount);
// Assert
expect(result).toBe(80);
});
it('should throw for invalid discount percentage', () => {
expect(() => calculateDiscount(100, -10)).toThrow();
expect(() => calculateDiscount(100, 150)).toThrow();
});
});
Rules:
1. Critical business logic ████████████ Must have
2. Edge cases and boundaries ████████░░░░ Important
3. Integration points ██████░░░░░░ Important
4. Happy paths ████░░░░░░░░ Basic
5. UI components ██░░░░░░░░░░ Optional
/ai-factory.security-checklist)✅ Good feedback:
"This could throw if `user` is null. Consider adding a null check
or using optional chaining: `user?.profile?.name`"
❌ Bad feedback:
"This is wrong"
"I don't like this"
"Why did you do it this way?"
| Area | Rule | |------|------| | Naming | Descriptive, consistent, reveals intent | | Functions | Small, single purpose, no side effects | | Errors | Specific types, never swallow, log context | | Tests | AAA pattern, test behavior, descriptive names | | Reviews | Be specific, suggest solutions, be kind |
development
Verify completed implementation against the plan. Checks that all tasks were fully implemented, nothing was forgotten, code compiles, tests pass, and quality standards are met. Use after "/ai-factory.implement" completes, or when user says "verify", "check work", "did we miss anything".
data-ai
Create a step-by-step implementation plan for a feature or task. Breaks down work into actionable tasks tracked via the task system. Use when user says "plan", "create tasks", "break down", or "make a plan for".
tools
# Supabase TypeScript Patterns Patterns for using Supabase with TypeScript in this project. Uses **service role key** (server-side only). Tables are prefixed `sch_`. ## Client Setup ```typescript // src/db/client.ts import { createClient } from "@supabase/supabase-js"; import type { Database } from "./types"; // generated types export const supabase = createClient<Database>( process.env.SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!, // server-side only, bypasses RLS { auth:
development
Generate professional Agent Skills for Claude Code and other AI agents. Creates complete skill packages with SKILL.md, references, scripts, and templates. Use when creating new skills, generating custom slash commands, or building reusable AI capabilities. Validates against Agent Skills specification.