ai-context

Generates AI IDE context files (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md) from codebase analysis. Creates project-specific instructions for AI coding assistants so they understand conventions, architecture, and workflows. Use when setting up AI tool context for a repository.

16 stars

Best use case

ai-context is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generates AI IDE context files (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md) from codebase analysis. Creates project-specific instructions for AI coding assistants so they understand conventions, architecture, and workflows. Use when setting up AI tool context for a repository.

Teams using ai-context should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ai-context/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/tools/ai-context/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ai-context/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ai-context Compares

Feature / Agentai-contextStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generates AI IDE context files (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md) from codebase analysis. Creates project-specific instructions for AI coding assistants so they understand conventions, architecture, and workflows. Use when setting up AI tool context for a repository.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# AI Context File Generator

## Philosophy

AI coding assistants work better when they understand a project's conventions, architecture, and constraints. Context files tell AI tools **how** to work with the codebase — coding standards, test patterns, import conventions, key file paths, and deployment workflows.

This skill generates context files for multiple AI tools from a single codebase analysis. The same scan produces output for Claude Code, Codex CLI, Cursor, GitHub Copilot, and Gemini CLI.

## Supported Context Files

| File | AI Tool | Purpose | Adoption |
|------|---------|---------|----------|
| `AGENTS.md` | Codex CLI, Cursor, Gemini CLI, Claude Code | Cross-tool agent context — identity, capabilities, conventions | 40,000+ repos |
| `CLAUDE.md` | Claude Code | Project-specific instructions loaded on every session | Native to Claude Code |
| `.cursorrules` | Cursor | Editor-specific rules for code generation | Native to Cursor |
| `.github/copilot-instructions.md` | GitHub Copilot | Repository-level instructions for Copilot suggestions | Native to Copilot |
| `.windsurfrules` | Windsurf | Project-specific rules for Windsurf's Cascade AI | Native to Windsurf |
| `.clinerules` | Cline (VS Code extension) | Project context for autonomous Cline tasks | Native to Cline |
| `GEMINI.md` | Gemini CLI | Project context loaded at the start of every Gemini CLI session | Native to Gemini CLI |

## Codebase Analysis Workflow

### Step 1: Detect Project Profile

```bash
# Language and runtime
ls package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle 2>/dev/null

# Framework detection
cat package.json 2>/dev/null | grep -E '"(react|next|express|fastify|hono|astro|svelte)"'
cat pyproject.toml 2>/dev/null | grep -E '(fastapi|django|flask|starlette)'

# Test runner
ls jest.config* vitest.config* pytest.ini pyproject.toml .mocharc* 2>/dev/null
grep -l "test" package.json 2>/dev/null

# Linter/formatter
ls .eslintrc* eslint.config* .prettierrc* biome.json ruff.toml .flake8 2>/dev/null

# TypeScript configuration
ls tsconfig*.json 2>/dev/null

# Monorepo detection
ls pnpm-workspace.yaml lerna.json nx.json turbo.json 2>/dev/null

# CI/CD
ls .github/workflows/*.yml 2>/dev/null
```

### Step 2: Extract Conventions

From the codebase analysis, extract:

1. **Language version** — Node.js version from `.nvmrc`/`engines`, Python from `requires-python`, Go from `go.mod`
2. **Import conventions** — ESM vs CommonJS, absolute vs relative imports, path aliases (`@/`)
3. **Naming patterns** — camelCase/snake_case for variables, PascalCase for types, file naming
4. **Directory structure** — where source, tests, config, and docs live
5. **Test patterns** — test file location (`__tests__/`, `*.test.ts`, `tests/`), test runner, assertion style
6. **Build/deploy** — build command, deploy target (Cloudflare, Vercel, AWS, etc.)
7. **Error handling** — custom error classes, Result types, try-catch patterns
8. **Security rules** — .gitignore patterns, secret management, input validation

### Step 3: Generate Context Files

#### AGENTS.md Structure

```markdown
# AGENTS.md

## Identity

[Project name] is a [brief description]. Built with [language/framework].

## Project Structure

```
[Key directories and their purpose]
```

## Coding Conventions

- [Language]: [version]
- Style: [naming conventions, import order]
- Types: [strict mode, no any, explicit returns — if TypeScript]
- Tests: [runner, location, naming pattern]
- Commits: [conventional commits, branch naming]

## Key Commands

```bash
[install command]
[test command]
[build command]
[lint command]
[deploy command]
```

## Architecture

[2-3 sentences on architecture: patterns used, key abstractions, data flow]

## Important Files

- [key config file] — [purpose]
- [main entry point] — [purpose]
- [key module] — [purpose]

## Rules

- [Critical rule 1 — e.g., never commit secrets]
- [Critical rule 2 — e.g., all public functions need tests]
- [Critical rule 3 — e.g., use direnv exec for deploy commands]
```

#### CLAUDE.md Structure

Claude Code loads this file at the start of every session. Keep it concise — under 200 lines.

```markdown
# [Project Name]

## Quick Reference

- **Language**: [X] with [framework]
- **Test**: `[test command]`
- **Build**: `[build command]`
- **Deploy**: `[deploy command]`

## Coding Standards

[3-5 bullet points on the most important conventions]

## Architecture

[Key patterns, file organisation, data flow — 3-5 bullet points]

## Key Paths

| Path | Purpose |
|------|---------|
| `src/` | Source code |
| `tests/` | Test files |
| ... | ... |

## Rules

[Critical do/don't rules that prevent common mistakes]
```

#### .cursorrules Structure

Cursor rules are plain text, loaded when editing files in the project.

```
You are working on [project name], a [description].

Language: [X] with [framework]
Style: [conventions]

Key rules:
- [Rule 1]
- [Rule 2]
- [Rule 3]

When writing code:
- [Pattern 1]
- [Pattern 2]

When writing tests:
- [Test pattern 1]
- [Test pattern 2]

File structure:
- src/ — source code
- tests/ — test files
```

#### .github/copilot-instructions.md Structure

```markdown
# Copilot Instructions

## Project Context

This is a [description] built with [language/framework].

## Coding Standards

- [Convention 1]
- [Convention 2]
- [Convention 3]

## Patterns to Follow

- [Pattern 1]
- [Pattern 2]

## Patterns to Avoid

- [Anti-pattern 1]
- [Anti-pattern 2]
```

#### .windsurfrules Structure

Windsurf's Cascade AI reads `.windsurfrules` from the project root. Format is plain text — similar to `.cursorrules`. Windsurf supports both global (`~/.codeium/windsurf/memories/global_rules.md`) and project-level rules.

```
# [Project Name] — Windsurf Rules

## Project Context

[Project name] is a [description]. Built with [language/framework].

## Coding Standards

- [Convention 1]
- [Convention 2]
- [Convention 3]

## Key Files

- [main entry] — [purpose]
- [config file] — [purpose]

## Commands

[test command]
[build command]
[deploy command]

## Rules

- [Critical rule 1]
- [Critical rule 2]
```

#### .clinerules Structure

Cline reads `.clinerules` from the project root. It supports a richer format than `.cursorrules` including task checklists.

```markdown
# [Project Name]

## Project Overview

[1-2 sentence description of what the project is and does]

## Tech Stack

- **Language**: [X]
- **Framework**: [Y]
- **Test runner**: [Z]
- **Linter**: [W]

## Coding Standards

- [Rule 1]
- [Rule 2]
- [Rule 3]

## Important Paths

- `[path]` — [purpose]

## Before Committing

- [ ] Tests pass (`[test command]`)
- [ ] Linting passes (`[lint command]`)
- [ ] No secrets or credentials in changed files
```

#### GEMINI.md Structure

Gemini CLI reads `GEMINI.md` from the project root (or `.gemini/GEMINI.md`). Keep it concise — Gemini CLI's context window handling differs from Claude Code.

```markdown
# [Project Name]

[One sentence: what is this project and who is it for]

## Tech Stack

[Language], [Framework], [Key dependencies]

## Commands

[test command]
[build command]
[deploy command]

## Conventions

- [Convention 1]
- [Convention 2]
- [Convention 3]

## Key Paths

- `[path]`: [purpose]
```

## Staleness Audit

When running in `audit` mode, check existing context files for drift:

1. **Version mismatch** — Does the context file reference the correct language/framework version?
2. **Missing commands** — Are test/build/deploy commands still accurate? Run them to verify.
3. **Stale paths** — Do referenced file paths still exist?
4. **New conventions** — Has the project adopted new patterns (e.g., added ESLint, switched to Vitest) that aren't reflected?

Report format:
```
AI Context Audit:
  ✓ AGENTS.md — up to date (last modified: 2 days ago)
  ⚠ CLAUDE.md — references jest but vitest.config.ts detected
  ✗ .cursorrules — references src/index.ts but file moved to src/main.ts
  · .github/copilot-instructions.md — not present
  · .windsurfrules — not present (recommend generating)
  · .clinerules — not present (recommend generating)
  · GEMINI.md — not present (recommend generating)
```

## AGENTS.md Spec Version Tracking

The AGENTS.md format is defined by the [agents.md spec](https://github.com/agentsmd/agents.md). PitchDocs tracks the pinned version in `upstream-versions.json`.

### Current Stable: v1.0

The v1.0 spec defines these standard sections:

| Section | Purpose |
|---------|---------|
| Identity | Project name, description, what it does |
| Project Structure | Key directories and their purposes |
| Conventions | Coding standards, naming, commit conventions |
| Commands | Test, build, deploy, lint commands |
| Architecture | System design, data flow, key abstractions |
| Files | Important files and their roles |
| Rules | Hard constraints (security, compatibility) |

### Proposed v1.1 Features (Draft — Do Not Implement)

These features are under discussion and may change before stabilisation:

| Feature | Status | Notes |
|---------|--------|-------|
| Sub-agents section | Draft | Nested agent definitions within AGENTS.md |
| Tool permissions | Proposed | Declaring which tools an agent can use |
| `.agent/` directory | Proposed | Directory-based agent definitions (alternative to single file) |
| `when:` frontmatter | Draft | Trigger conditions for agent activation |

**Guidance:** Do not generate these proposed sections until they reach stable status. Monitor the [agents.md releases](https://github.com/agentsmd/agents.md/releases) for v1.1 announcement. The `check-upstream` GitHub Action will flag when a new version is available.

## Anti-Patterns

- **Don't dump entire codebase** — context files should be concise summaries, not file listings
- **Don't include secrets** — no API keys, tokens, or credentials in context files
- **Don't repeat framework docs** — reference framework conventions, don't reproduce them
- **Don't over-constrain** — provide patterns, not rigid rules that prevent creative problem-solving
- **Don't include session-specific state** — context files should be durable across sessions

Related Skills

context-session-end

16
from diegosouzapw/awesome-omni-skill

AI behavioral guideline for autonomously detecting work session boundaries and proposing updates to current_focus.md. The AI monitors conversation flow for natural breakpoints and acts without explicit invocation.

_context-ack

16
from diegosouzapw/awesome-omni-skill

在每次回复中使用固定前缀并列出本次实际参考的指令/文件,便于校验是否遵循上下文与规则。

Zendesk Customer Context

16
from diegosouzapw/awesome-omni-skill

Ticket history, requester context

agent-context-generator

16
from diegosouzapw/awesome-omni-skill

Generate project-level AGENTS.md guides that capture conventions, workflows, and required follow-up tasks. Use when a repository needs clear agent onboarding covering structure, tooling, testing, task flow, README expectations, and conventional commit summaries.

cdd-gather-context

16
from diegosouzapw/awesome-omni-skill

新規機能・複数ファイル変更前にコンテキスト収集

using-context7-for-docs

16
from diegosouzapw/awesome-omni-skill

Use when researching library documentation with Context7 MCP tools for official patterns and best practices

Tero Voice Project Context

16
from diegosouzapw/awesome-omni-skill

Load full project context, tech stack, status, and guidelines for the AI Receptionist SaaS project

project-context-discovery

16
from diegosouzapw/awesome-omni-skill

Discover project structure, package managers, test frameworks, and automation without hardcoded assumptions

moai-context7-lang-integration

16
from diegosouzapw/awesome-omni-skill

Enterprise-grade Context7 MCP integration patterns for language-specific documentation access with real-time library resolution and intelligent caching

init-context

16
from diegosouzapw/awesome-omni-skill

Analyze the codebase and generate context rules for Cursor. Use when setting up or populating .cursor/rules/ files.

ddd-context-mapping

16
from diegosouzapw/awesome-omni-skill

Map relationships between bounded contexts and define integration contracts using DDD context mapping patterns.

contextui

16
from diegosouzapw/awesome-omni-skill

Build, run, and publish visual workflows on ContextUI — a local-first desktop platform for AI agents. Create React TSX workflows (dashboards, tools, apps, visualizations), manage local Python backend servers, test workflows via scoped UI automation within the ContextUI app window, and optionally publish to the ContextUI Exchange. All tools operate locally on the user's machine under standard OS permissions — no remote execution or privilege escalation. Python backends bind to localhost. See SECURITY.md for the full capability scope and trust model. Requires ContextUI installed locally and MCP server configured.