Agent skill

Aif Best Practices

by unxed in unxed/f4

Code quality guidelines and best practices for writing clean, maintainable code.

BSD-3-ClauseAuto-check passedDevelopment

Install Aif Best Practices

skills CLI
$ npx skills add unxed/f4 --skill aif-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install unxed/f4 aif-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/unxed/f4.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/aif-best-practices .claude/skills/aif-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
aif-best-practices
GitHub stars
243
Token cost
~2.3k tokens
SKILL.md length
596 words
Files
1
Skills in repo
36
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Code quality guidelines and best practices for writing clean, maintainable code.

  • Asking how should I name this
  • SKILL.md covers Quick Reference, Naming Conventions, Code Structure and Error Handling, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Best practice for

What it does

Aif Best Practices is an agent skill from unxed/f4. 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".

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Code quality, Code review and Refactoring. The repository describes itself as: dual pane like a charm. The licence is BSD-3-Clause.

When your agent uses it

  • Asking how should I name this
  • Best practice for

Example prompts

  • “how should I name this”
  • “best practice for”
  • “clean code”
  • “/aif-best-practices”

Requirements

  • Pre-approved tools (allowed-tools): Read, Glob, Grep

What it can do on your machine

Read from SKILL.md and the folder at commit 772edc7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and php).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Aif Best Practices loads about 2.3k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 596 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~74
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from unxed/f4 at commit 772edc7, republished under its BSD-3-Clause licence (© unxed). 596 words, ~2,271 tokens.

Download SKILL.mdSave it as .claude/skills/aif-best-practices/SKILL.md (or your agent's skills folder).
name
aif-best-practices
description
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".
allowed-tools
Read, Glob, Grep
argument-hint
[naming|structure|errors|testing|review]
disable-model-invocation
false

Best Practices Guide

Universal code quality guidelines applicable to any language or framework.

Context: If .ai-factory/ARCHITECTURE.md exists, follow its folder structure, dependency rules, and module boundaries alongside these guidelines.

Read .ai-factory/skill-context/aif-best-practices/SKILL.md — MANDATORY if the file exists.

This file contains project-specific rules accumulated by /aif-evolve from patches, codebase conventions, and tech-stack analysis. These rules are tailored to the current project.

How to apply skill-context rules:

  • Treat them as project-level overrides for this skill's general instructions
  • When a skill-context rule conflicts with a general rule written in this SKILL.md, the skill-context rule wins (more specific context takes priority — same principle as nested CLAUDE.md files)
  • When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
  • Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults — they exist because the project's experience proved the default insufficient
  • CRITICAL: skill-context rules apply to ALL outputs of this skill — including the recommendations, examples, and checklists you present. If a skill-context rule says "best practices MUST prioritize X" or "examples MUST follow convention Y" — you MUST comply. Presenting guidance that contradicts skill-context rules is a bug.

Enforcement: After generating any output artifact, verify it against all skill-context rules. If any rule is violated — fix the output before presenting it to the user.

Quick Reference

  • /aif-best-practices — Full overview
  • /aif-best-practices naming — Naming conventions
  • /aif-best-practices structure — Code organization
  • /aif-best-practices errors — Error handling
  • /aif-best-practices testing — Testing practices
  • /aif-best-practices review — Code review checklist

Naming Conventions

Variables & Functions
✅ Good                          ❌ Bad
─────────────────────────────────────────────
getUserById(id)                  getUser(i)
isValidEmail                     checkEmail
maxRetryCount                    max
calculateTotalPrice              calc
handleSubmit                     submit

Rules:

  • Use descriptive names that reveal intent
  • Avoid abbreviations (except universally known: id, url, api)
  • Boolean variables: is, has, can, should prefix
  • Functions: verb + noun (fetchUser, validateInput)
  • Constants: SCREAMING_SNAKE_CASE
  • Classes/Types: PascalCase
  • Variables/functions: camelCase (JS/TS/PHP) or snake_case (Python/Rust)
Files & Directories
✅ Good                          ❌ Bad
─────────────────────────────────────────────
user-service.ts                  userService.ts (inconsistent)
UserRepository.ts                user_repository.ts (mixed)
/components/Button/              /Components/button/
/services/auth/                  /Services/Auth/

Rules:

  • One convention per project (kebab-case or PascalCase for files)
  • Directories: lowercase with hyphens
  • Test files: *.test.ts or *.spec.ts (consistent)
  • Index files: only for re-exports, not logic

Code Structure

Function Design
typescript
// ✅ 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;
}
php
// ✅ 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:

  • Single Responsibility: one function = one job
  • Max 20-30 lines per function
  • Max 3-4 parameters (use object for more)
  • No side effects in pure functions
  • Early returns for guard clauses
Module Organization
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:

  • Group by feature, not by type
  • Clear public API via index.ts
  • Internal modules prefixed with _ or in internal/
  • Avoid circular dependencies

Show full SKILL.md (229 more words)Show less

Error Handling

Do's and Don'ts
typescript
// ✅ 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:

  • Create specific error classes for domain errors
  • Never swallow exceptions without logging
  • Log errors with context (user ID, request ID, etc.)
  • Use error boundaries at system edges
  • Return Result types for expected failures (optional)
Error Messages
✅ Good: "Failed to create user: email 'test@example.com' already exists"
❌ Bad: "Error occurred"
❌ Bad: "Something went wrong"

Testing Practices

Test Structure (AAA Pattern)
typescript
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:

  • One assertion concept per test
  • Descriptive test names: "should [expected behavior] when [condition]"
  • Test behavior, not implementation
  • Use factories/fixtures for test data
  • Avoid testing private methods directly
Test Coverage Priorities
1. Critical business logic      ████████████ Must have
2. Edge cases and boundaries    ████████░░░░ Important
3. Integration points           ██████░░░░░░ Important
4. Happy paths                  ████░░░░░░░░ Basic
5. UI components                ██░░░░░░░░░░ Optional

Code Review Checklist

Before Requesting Review
  • Self-reviewed the diff
  • Tests pass locally
  • No debug code (console.log, debugger)
  • No commented-out code
  • Updated documentation if needed
  • Commit messages are clear
Reviewer Checklist
  • Correctness: Does it do what it claims?
  • Edge cases: What could go wrong?
  • Security: Any vulnerabilities? (see /aif-security-checklist)
  • Performance: Any obvious bottlenecks?
  • Readability: Can I understand it in 5 minutes?
  • Tests: Are critical paths covered?
  • Consistency: Follows project conventions?
Review Comments
✅ 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?"

Quick Rules Summary

AreaRule
NamingDescriptive, consistent, reveals intent
FunctionsSmall, single purpose, no side effects
ErrorsSpecific types, never swallow, log context
TestsAAA pattern, test behavior, descriptive names
ReviewsBe specific, suggest solutions, be kind

Artifact Ownership and Config Policy

  • Primary ownership: none. This skill is advisory and reference-only.
  • Write policy: do not create or modify project artifacts by default.
  • Config policy: config-agnostic by design. Follow repository context, .ai-factory/ARCHITECTURE.md, and skill-context overrides instead of reading config.yaml.

© unxed, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/aif-best-practices of unxed/f4.

Open the folder on GitHubat commit 772edc7

Compare with similar skills

Aif Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Aif Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Aif Best Practices this skillunxed/f4243—~2.3kAutomated safety check: PassBSD-3-Clause
Dignified Python Standardsdocling-project/docling69k—~1.5kAutomated safety check: PassApache-2.0
Clean Code GuardamElnagdy/guard-skills1.3k2 repos~4.3kAutomated safety check: PassMIT
Maintainable Code for iPolloWorkDevin-AXIS/iPolloWork6.8k—~2.7kAutomated safety check: PassCustom licence
Cross-Language Coding Standardszereight/gitlab-mcp2k1 repos~1.4kAutomated safety check: PassMIT
Code Qualitypiomin/claude-ai-spring-boot1.3k—~2.2kAutomated safety check: PassApache-2.0

Similar skills

  • Dignified Python Standards

    docling-project/docling

    Applies opinionated production Python conventions chosen by the project's Python version: modern type syntax, pathlib, explicit checks and interface guidance.

    69k GitHub stars~1.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Clean Code Guard

    amElnagdy/guard-skills

    Reviews generated or changed production code against Clean Code, SOLID, DRY, KISS, YAGNI and LLM-specific failure modes before it ships, in any language.

    1.3k GitHub starsUsed in 2 repos~4.3k tokens
    DevelopmentAuto-check passed
  • A code-change gate for the iPolloWork repository: search and reuse first, keep one source of truth, justify every new file or dependency, and audit the change.

    6.8k GitHub stars~2.7k tokensUpdated today
    DevelopmentAuto-check passed
  • Shared reference for naming, function size, complexity and error handling rules that reviewer agents apply across TypeScript, Python, Go, Rust, Java, C# and Swift.

    2k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Code Quality

    piomin/claude-ai-spring-boot

    Comprehensive code review for Java - clean code principles, API contracts, null safety, exception handling, and performance.

    1.3k GitHub stars~2.2k tokensUpdated 5 mo ago
    DevelopmentAuto-check passed
  • Cyclomatic Complexity

    saurabhkumar8112/cyclomatic-complexity-skill

    Refactor code to reduce cyclomatic complexity so it stays readable, maintainable, and aligned with the long-term vision of the codebase, not just optimized for AI comprehension.

    405 GitHub stars~761 tokensUpdated 1 mo ago
    DevelopmentAuto-check passed

More from unxed/f4

All 36 skills in this repo
  • Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt.

    244 GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check passed
  • Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt.

    244 GitHub starsUsed in 3 repos~2.5k tokens
    Auto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    244 GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed
  • Security audit checklist based on OWASP Top 10 and best practices.

    244 GitHub stars~5.4k tokensUpdated today
    Auto-check: notes
  • Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters, functional options, acronyms, test functions, and…

    244 GitHub starsUsed in 2 repos~3.1k tokens
    Auto-check passed
  • Golang concurrency design — goroutine lifecycle and leak prevention, channels and select, channel ownership and direction, sync.Mutex/RWMutex/sync.Map/sync.Once/atomics, errgroup, singleflight…

    244 GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed

Categories

Questions about Aif Best Practices

What does Aif Best Practices do?

Code quality guidelines and best practices for writing clean, maintainable code. Aif Best Practices is an agent skill from unxed/f4. Code quality guidelines and best practices for writing clean, maintainable code.

When should I use Aif Best Practices?

Aif Best Practices fits situations like: asking how should I name this; best practice for.

How do I install Aif Best Practices in Claude Code?

Run `npx skills add unxed/f4 --skill aif-best-practices -a claude-code`. Or copy the skill folder (.agents/skills/aif-best-practices in unxed/f4) into .claude/skills/aif-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Aif Best Practices in Codex?

Run `npx skills add unxed/f4 --skill aif-best-practices -a codex`. Or copy the skill folder (.agents/skills/aif-best-practices in unxed/f4) into .agents/skills/aif-best-practices in your project. Codex loads it when a task matches its description.

Can I use Aif Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add unxed/f4 --skill aif-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/aif-best-practices, .gemini/skills/aif-best-practices, .github/skills/aif-best-practices and .opencode/skills/aif-best-practices in your project.

What does Aif Best Practices need to run?

SKILL.md names no scripts, command-line tools or credentials: Aif Best Practices is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Glob, Grep.

Does Aif Best Practices access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Aif Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Aif Best Practices use?

Aif Best Practices is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Aif Best Practices use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Aif Best Practices?

Skills that share tags, products or a category with Aif Best Practices: Dignified Python Standards (docling-project/docling, 69k stars), Clean Code Guard (amElnagdy/guard-skills, 1.3k stars), Maintainable Code for iPolloWork (Devin-AXIS/iPolloWork, 6.8k stars) and Cross-Language Coding Standards (zereight/gitlab-mcp, 2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Aif Best Practices?

unxed (a GitHub user) maintains it in unxed/f4, which has 243 GitHub stars. The repository holds 36 skills in this directory. The repository was last updated on October 10, 2026.

Source: unxed/f4 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.