Style guide adherence
Use when writing code - follow Google style guides where available, otherwise follow established best practices for the languageFrom its SKILL.md
npx -y skills add troykelly/claude-skills --skill style-guide-adherenceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 11 stars11 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.4 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
Style Guide Adherence
Overview
Follow established style guides. Consistency over personal preference.
Core principle: Code is read more than written. Consistent style aids reading.
Priority order:
- Project-specific style guide (if exists)
- Google style guide (if available for language)
- Language community best practices
Google Style Guides
Available Guides
Key Principles (All Languages)
| Principle | Description |
|---|---|
| Consistency | Match surrounding code style |
| Clarity | Prefer readable over clever |
| Simplicity | Simplest solution that works |
| Documentation | Document the why, not the what |
TypeScript/JavaScript Style
Naming
// Classes: PascalCase
class UserService { }
// Interfaces: PascalCase (no I prefix)
interface User { } // NOT IUser
// Functions/methods: camelCase
function fetchUserData() { }
// Variables/parameters: camelCase
const userName = 'Alice';
// Constants: UPPER_SNAKE_CASE
const MAX_RETRIES = 3;
// Private members: no underscore prefix
class Service {
private cache: Map<string, Data>; // NOT _cache
}
// Files: kebab-case
// user-service.ts, not userService.ts or UserService.ts
Formatting
// Indent: 2 spaces
// Line length: 80 characters (100 max)
// Semicolons: required
// Quotes: single for strings
// Trailing commas: yes in multiline
const config = {
name: 'app',
version: '1.0.0',
features: [
'auth',
'logging',
],
};
Imports
// Order: external, then internal, then relative
// Alphabetize within groups
import { something } from 'external-lib';
import { other } from 'another-external';
import { internal } from '@/lib/internal';
import { local } from './local';
import { nearby } from '../nearby';
Python Style
Naming
# Classes: PascalCase
class UserService:
pass
# Functions/variables: snake_case
def fetch_user_data():
pass
user_name = 'Alice'
# Constants: UPPER_SNAKE_CASE
MAX_RETRIES = 3
# Private: single underscore prefix
class Service:
def __init__(self):
self._cache = {} # internal use
def __private_method(self): # name mangling
pass
# Files: snake_case
# user_service.py
Formatting
# Indent: 4 spaces
# Line length: 80 characters
# Use Black formatter for consistency
# Imports order (use isort):
# 1. Standard library
# 2. Third-party
# 3. Local
import os
import sys
import requests
from flask import Flask
from myapp.utils import helper
Docstrings
def calculate_total(items: list[Item], tax_rate: float) -> float:
"""Calculate the total price including tax.
Args:
items: List of items to sum.
tax_rate: Tax rate as decimal (e.g., 0.08 for 8%).
Returns:
Total price including tax.
Raises:
ValueError: If tax_rate is negative.
"""
if tax_rate < 0:
raise ValueError("Tax rate cannot be negative")
subtotal = sum(item.price for item in items)
return subtotal * (1 + tax_rate)
Go Style
Naming
// Exported: PascalCase
type UserService struct { }
func FetchUser() { }
// Unexported: camelCase
type internalCache struct { }
func fetchFromDB() { }
// Acronyms: consistent case
type HTTPClient struct { } // or httpClient for unexported
var userID string // NOT userId
// Files: snake_case
// user_service.go
Formatting
Use gofmt - no options, no debate.
# Format all files
gofmt -w .
# Or use goimports for imports too
goimports -w .
Enforcing Style
Automated Tools
| Language | Formatter | Linter |
|---|---|---|
| TypeScript | Prettier | ESLint |
| Python | Black | Pylint, Ruff |
| Go | gofmt | golangci-lint |
| Rust | rustfmt | clippy |
Configuration Files
Ensure these exist in the project:
TypeScript/JavaScript:
.eslintrc.jsoreslint.config.js.prettierrc
Python:
pyproject.toml(Black, isort, mypy).pylintrcorruff.toml
Go:
.golangci.yml
Pre-commit Hooks
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: format
name: Format code
entry: pnpm format
language: system
- id: lint
name: Lint code
entry: pnpm lint
language: system
When Project Style Differs
If project has established style that differs from Google:
- Follow project style - Consistency within project wins
- Document the difference - Note in CONTRIBUTING.md
- Don't mix styles - All code should match
<!-- CONTRIBUTING.md -->
## Code Style
This project uses [specific style] which differs from Google style:
- We use tabs instead of spaces
- Line length is 120 characters
- [Other differences]
Checking Style
Before committing:
# Run formatter
pnpm format # or black, gofmt, etc.
# Run linter
pnpm lint # or pylint, golangci-lint, etc.
# Fix auto-fixable issues
pnpm lint:fix
Checklist
Before committing:
- Code formatted with project formatter
- No linting errors
- Naming follows conventions
- Imports organized
- Line length within limits
- Consistent with surrounding code
Common Mistakes
| Mistake | Correction |
|---|---|
| Inconsistent naming | Follow project conventions |
| Long lines | Break at logical points |
| Mixed quote styles | Use project standard |
| Unorganized imports | Use import sorter |
| Manual formatting | Use automated formatter |
Integration
This skill is applied by:
issue-driven-development- Step 7comprehensive-review- Style criterion
This skill ensures:
- Readable code
- Easy reviews
- Reduced cognitive load
- Team consistency
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most design systems skills give in ~1.6k tokens
Counted across 501 of the 520 authors here whose files we hold, read 2026-09-06
- Extract colors, typography, spacing, radii, shadows, breakpointsin 20 of 501, across 10 files
- Create a self-contained dependency-free HTML preview pagein 20 of 501, across 10 files
- Keep touch targets at least 44x44pxin 20 of 501
- Score the UI across ten dimensionsin 18 of 501, across 8 files
- Animate exclusively via transform and opacityin 18 of 501, across 15 files
- Ensure WCAG AA color contrastin 18 of 501, across 13 files
- Generate DESIGN.md with rationale for each decisionin 17 of 501, across 7 files
- Ensure proper contrast and readabilityin 15 of 501, across 10 files
- Scan the codebase for existing style patternsin 15 of 501, across 6 files
- Give every interactive element a visible focus indicatorin 15 of 501, across 13 files
- Propose a design token setin 14 of 501, across 5 files
- Create a custom theme when none fitin 14 of 501, across 9 files
Said here and by no other author read
- Follow the style guide priority order
- Match surrounding code style
- Prefer readable over clever code
- Use the simplest solution that works
- Document why, not what
- Run formatter before committing
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.