conventions
Analyze codebase and create/update .conventions/ directory with gold standards, anti-patterns, and checks. Use this skill when the user asks to 'set up conventions', 'create coding standards', 'extract patterns from the codebase', 'document how code should be written', 'create gold standards', 'establish code style', or wants to ensure consistent code quality across the project. Also use when starting work on a new codebase that lacks a .conventions/ directory — conventions are the foundation for all agent-teams code quality.
What this skill does
# Conventions — Analyze Codebase & Build Convention Files
You analyze the codebase and create or update the `.conventions/` directory. This directory is the **single source of truth** for project patterns — it encodes taste once, so every agent (and human) follows the same conventions.
## Target Structure
```
.conventions/
gold-standards/ # 20-30 line exemplary code snippets
[pattern-name].tsx/ts # one file per pattern (form, api-endpoint, hook, etc.)
anti-patterns/ # what NOT to do (with code examples)
[avoid-something].md # one file per anti-pattern
checks/ # automated pass/fail rules
naming.md # naming conventions (regex patterns, examples)
imports.md # allowed/forbidden import patterns
```
## How It Works
### Step 1: Check current state
```
Glob(".conventions/**/*")
```
- If `.conventions/` exists → this is an **update** (add missing patterns, refresh stale ones)
- If `.conventions/` does not exist → this is a **bootstrap** (create from scratch)
### Step 2: Dispatch researchers (parallel)
Spawn 3 researchers in parallel to scan the codebase:
```
Task(
subagent_type="Explore",
prompt="Analyze this project's STRUCTURE and STACK.
Return: framework, language, package manager, DB, key libraries,
directory structure, where API routes/pages/components live.
Be specific — file paths and command names. Under 30 lines."
)
Task(
subagent_type="Explore",
prompt="Find the 5-7 BEST example files in this codebase — files that represent
'how things are done here'. Look for:
- A well-structured UI component
- An API endpoint / router
- A custom hook
- A form component
- A test file
- A database query / migration
For each: return the file path, what pattern it shows, and the FULL file content.
Skip patterns that don't exist in this project."
)
Task(
subagent_type="Explore",
prompt="Analyze NAMING CONVENTIONS and IMPORT PATTERNS in this codebase.
Check:
- File naming: kebab-case? camelCase? PascalCase? (check src/ files)
- Function/variable naming: camelCase? snake_case?
- Component naming: PascalCase?
- DB tables/columns: snake_case? camelCase?
- API endpoints: /kebab-case? /camelCase?
- Import patterns: what's imported from where, any barrel exports, any forbidden imports
- Design system: what UI library, any wrapper components
Return specific patterns with regex examples where possible. Under 40 lines."
)
```
### Step 3: Build conventions
From researcher findings, create the files:
**Gold standards** — For each pattern found by the reference researcher:
- Extract the BEST 20-30 lines that demonstrate the pattern
- Strip implementation-specific details, keep the structural skeleton
- Add a 2-line comment at the top: what this file demonstrates and what to pay attention to
- File name = pattern name in kebab-case (e.g., `api-endpoint.ts`, `form-component.tsx`)
**Anti-patterns** — Look for:
- Inconsistencies found by researchers (some files do X, others do Y → the minority is an anti-pattern)
- Common mistakes visible in the codebase (raw HTML where design system should be used, direct DB calls where ORM should be used)
- Each anti-pattern file: short description, BAD example, GOOD example
**Checks** — From naming researcher:
- `naming.md`: file naming, function naming, component naming, DB naming — with regex patterns and examples
- `imports.md`: what should be imported from where, forbidden imports
### Step 4: Write files
If **bootstrap** (no `.conventions/` yet):
- Create the full directory structure
- Write all discovered gold standards, anti-patterns, and checks
If **update** (`.conventions/` already exists):
- Read existing files first
- Add new patterns that weren't covered
- Update patterns that have drifted from what the codebase actually does
- Do NOT delete existing files — only add or update
- Report what was added/changed
### Step 5: Report
```
══════════════════════════════════════════════════
CONVENTIONS {CREATED / UPDATED}
══════════════════════════════════════════════════
Gold standards:
[created/updated] .conventions/gold-standards/api-endpoint.ts
[created/updated] .conventions/gold-standards/form-component.tsx
...
Anti-patterns:
[created] .conventions/anti-patterns/avoid-inline-styles.md
...
Checks:
[created/updated] .conventions/checks/naming.md
[created/updated] .conventions/checks/imports.md
Total: N files created, M files updated
══════════════════════════════════════════════════
```
## Rules
- Gold standards are **20-30 lines max** — short enough to include in agent prompts as few-shot examples
- Every gold standard has a **2-line header comment** explaining what it demonstrates
- Anti-patterns always show **BAD → GOOD** comparison
- Checks use **regex patterns** where possible for automated verification
- Do NOT invent patterns — only document what actually exists in the codebase
- If the codebase is inconsistent (50/50 split), pick the better pattern and note the inconsistency in an anti-pattern file
- Skip categories that don't apply (no DB? skip DB gold standard)
## Reference Files
- **`references/examples.md`** — Example convention files showing the expected format and quality level for gold standards, anti-patterns, and checks. Read this before generating convention files to ensure consistent quality and format.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.