### Install and Run Documentation Site Locally
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/contributing.md
Commands to install dependencies, generate rules, and start the local documentation website. Ensure you are in the website directory.
```bash
npm --prefix website ci
```
```bash
npm --prefix website run generate:rules
```
```bash
npm --prefix website start
```
--------------------------------
### CLAUDE.md Structure Template: Setup Commands
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/claude-code-OPINIONS.md
Provides example bash commands for setting up a project, including installing dependencies and copying environment files. This is part of a standard CLAUDE.md structure.
```bash
npm install
cp .env.example .env.local
```
--------------------------------
### Full Agnix Setup Example
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/doc/agnix.txt
Comprehensive setup configuration for the agnix Neovim plugin, including options for command path, filetypes, root markers, autostart, attach callback, LSP settings, and logging.
```lua
require('agnix').setup({
cmd = nil, -- auto-detect agnix-lsp binary
filetypes = { 'markdown', 'json' },
root_markers = { '.git', '.agnix.toml', 'CLAUDE.md', 'AGENTS.md' },
autostart = true,
on_attach = function(client, bufnr)
-- Custom key mappings, etc.
end,
settings = {
severity = 'Warning', -- 'Error', 'Warning', 'Info'
rules = {
skills = true,
hooks = true,
disabled_rules = { 'AS-001' },
},
versions = {
claude_code = '1.0.0',
},
},
log_level = 'warn',
telescope = { enable = true },
})
```
--------------------------------
### Install and Use pypdf Library
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/agent-skills-OPINIONS.md
Demonstrates how to install the pypdf library using pip and then use it to read a PDF file. This is a good example of providing clear setup instructions.
```python
from pypdf import PdfReader
reader = PdfReader("file.pdf")
```
--------------------------------
### Valid Instructions with Positive Guidance
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/pe-006.md
This example demonstrates prompts that include both negative constraints and positive, constructive guidance. This approach is more effective for guiding AI models.
```markdown
# Rules
Don't use global variables. Instead, pass values as function parameters.
Avoid console.log in production. Use the structured logger instead.
```
--------------------------------
### Install Plugin with Project Scope
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/claude-code-HARD-RULES.md
Example CLI command to install a plugin with the 'project' scope, which uses the .claude/settings.json file for team plugins shared via git.
```bash
claude plugin install formatter@marketplace --scope project
```
--------------------------------
### Install agnix.nvim with vim-plug
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/README.md
Install the agnix Neovim plugin using vim-plug. After adding the Plug line, call the setup function in your init.lua.
```vim
Plug 'agent-sh/agnix'
```
```lua
require('agnix').setup()
```
--------------------------------
### Minimal Agnix Setup
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/doc/agnix.txt
Minimal setup call for the agnix Neovim plugin.
```lua
require('agnix').setup()
```
--------------------------------
### Setup and Run agnix Real-World Validation
Source: https://github.com/agent-sh/agnix/blob/main/docs/REAL-WORLD-TESTING.md
Quick start commands for setting up the Python environment, building the agnix project, and running the validation script against all or a subset of repositories.
```bash
# Setup
python3 -m venv .venv
source .venv/bin/activate
pip install pyyaml
# Build
cargo build --release
# Run against all repos (auto-cleans clones to save disk)
python scripts/real-world-validate.py --parallel 8 --timeout 60
# Run a subset
python scripts/real-world-validate.py --limit 50 --parallel 8
python scripts/real-world-validate.py --category claude-code --parallel 4
python scripts/real-world-validate.py --filter streamlit --parallel 1
```
--------------------------------
### Example AGENTS.md Project Guidelines
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CODEX-REFERENCE.md
An example of an AGENTS.md file outlining project guidelines for code style, testing, and Git conventions.
```markdown
# Project Guidelines
## Code Style
- Use TypeScript strict mode
- Prefer async/await over callbacks
- All functions must have JSDoc comments
## Testing
- Run `npm test` before committing
- Maintain >80% code coverage
## Git Conventions
- Use conventional commits (feat:, fix:, docs:)
- Never force push to main
```
--------------------------------
### Example Structure: Anti-Patterns
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/prompt-engineering-OPINIONS.md
Include 'what-not-to-do' examples to highlight common mistakes and their correct alternatives. This aids in preventing errors.
```yaml
❌ BAD: Creating new file without checking if it exists
✅ GOOD: Use Glob to check for existing file, then Edit if found
```
--------------------------------
### Verify Homebrew Installation
Source: https://github.com/agent-sh/agnix/blob/main/docs/RELEASING.md
Install the agnix CLI using Homebrew and verify the installed version.
```bash
brew install agnix
agnix --version
```
--------------------------------
### Install Dependencies
Source: https://github.com/agent-sh/agnix/blob/main/tests/fixtures/gemini_md/GEMINI.md
Installs all project dependencies using npm.
```bash
npm install
```
--------------------------------
### Install agnix-lsp Manually via npm
Source: https://github.com/agent-sh/agnix/blob/main/editors/zed/README.md
Install the agnix language server globally using npm if automatic download fails. This is the easiest manual installation method.
```bash
# npm (easiest)
npm install -g agnix
```
--------------------------------
### Install agnix via Homebrew
Source: https://github.com/agent-sh/agnix/blob/main/README.md
Install agnix on macOS or Linux using Homebrew by tapping the agnix repository and then installing the package.
```bash
# Homebrew (macOS/Linux)
brew tap agent-sh/agnix && brew install agnix
```
--------------------------------
### Valid Import Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/ref-003.md
This example demonstrates a references file with unique imports, adhering to the REF-003 rule.
```markdown
# Project
@docs/coding-standards.md
@docs/testing-guide.md
```
--------------------------------
### Valid YAML Frontmatter Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cur-003.md
This example demonstrates correctly formatted YAML frontmatter. It is used as a reference for valid configurations.
```markdown
---
description: TypeScript rules
globs: "**/*.ts"
---
# Rules
Use strict mode.
```
--------------------------------
### Minimal Few-Shot Prompting Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/prompt-engineering-OPINIONS.md
Use a minimal number of examples (1-3) for straightforward tasks in few-shot prompting. This example illustrates a simple task with a sequence of actions.
```yaml
User: "Fix the bug in auth.py"
Thought: Need to read the file first to understand the bug
Action: Read auth.py → Identify issue → Edit to fix → Verify
```
--------------------------------
### Install Agnix LSP Binary
Source: https://github.com/agent-sh/agnix/blob/main/editors/vscode/README.md
Install the agnix-lsp binary from crates.io or via Homebrew. The binary is automatically downloaded on first use.
```bash
# From crates.io
cargo install agnix-lsp
# Or via Homebrew
brew tap agent-sh/agnix && brew install agnix
```
--------------------------------
### Valid Mode Slug Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/roo-004.md
This example shows a file path with a valid mode slug, demonstrating the correct structure.
```markdown
.roo/rules-architect/general.md
```
--------------------------------
### agnix.setup()
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/doc/agnix.txt
Initializes the Agnix plugin. This function takes an optional `opts` table for configuration, referring to |agnix-setup| for available options.
```APIDOC
## agnix.setup()
### Description
Initializes the plugin. See |agnix-setup| for options.
### Method
Lua Function Call
### Parameters
#### Options Table (`opts`)
- `opts` (table) - Optional - Configuration options for the plugin. Refer to |agnix-setup| for details.
```
--------------------------------
### Example .env File Structure
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/multi-platform-OPINIONS.md
Demonstrates the recommended pattern for an .env.example file, including required and optional variables for different AI models and features.
```bash
# .env.example (commit this)
# Copy to .env and fill in actual values
# Required: Anthropic API key for Claude models
ANTHROPIC_API_KEY=sk-ant-...
# Required: OpenAI API key for GPT models
OPENAI_API_KEY=sk-...
# Optional: Specific model selections
PRIMARY_MODEL=claude-3-5-sonnet-20241022
FALLBACK_MODEL=gpt-4o-mini
# Optional: Feature flags
ENABLE_VOICE=false
ENABLE_MCP_SERVERS=true
```
--------------------------------
### Node.js API: Get Version
Source: https://github.com/agent-sh/agnix/blob/main/npm/README.md
Retrieve the installed version of agnix using the Node.js API.
```javascript
console.log(agnix.version());
```
--------------------------------
### Skill File Structure Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/claude-code-HARD-RULES.md
Shows the directory structure for a skill, including the required SKILL.md entrypoint and optional reference, examples, and scripts directories.
```text
skills/
└── my-skill/
├── SKILL.md # REQUIRED: entrypoint
├── reference.md # Optional: detailed docs
├── examples/ # Optional: examples
└── scripts/ # Optional: executable scripts
```
--------------------------------
### Manual Installation of agnix.nvim
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/README.md
Manually install the agnix Neovim plugin by copying its directory contents to the specified Neovim site-pack path.
```bash
Copy the `editors/neovim/` directory contents to:
~/.local/share/nvim/site/pack/plugins/start/agnix/
```
--------------------------------
### Neovim Editor Setup for Agnix
Source: https://github.com/agent-sh/agnix/blob/main/README.md
Configuration snippet for Neovim to integrate Agnix. Ensure you have the `agnix` plugin installed and configured.
```lua
{ "agent-sh/agnix", config = function() require("agnix").setup() end }
```
--------------------------------
### Multi-Window Workflow Setup (Claude 4.5)
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/PROMPT-ENGINEERING-REFERENCE.md
Steps for managing tasks that span multiple context windows, including setting up frameworks, using structured formats for tests, and creating setup scripts.
```text
1. Use first window to set up framework (tests, scripts)
2. Write tests in structured format (e.g., `tests.json`)
3. Create setup scripts (`init.sh`) for graceful restarts
4. Use git for state tracking across sessions
5. Consider fresh contexts over compaction
```
--------------------------------
### Install agnix LSP Server
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/README.md
Install the agnix LSP server using npm, Cargo, or by downloading a release. This is a prerequisite for the Neovim plugin.
```bash
# npm (easiest)
npm install -g agnix
# Cargo
cargo install agnix-lsp
# Or download from releases
# https://github.com/agent-sh/agnix/releases
```
--------------------------------
### Invalid Skill Name: Leading/Trailing Hyphens
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/agent-skills-HARD-RULES.md
Skill names cannot start or end with a hyphen. These examples demonstrate invalid name formats that will fail validation.
```yaml
name: -pdf-tool # WILL FAIL VALIDATION
```
```yaml
name: pdf-tool- # WILL FAIL VALIDATION
```
--------------------------------
### Agent Config Examples: Few-Shot Prompting Best Practices
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/prompt-engineering-HARD-RULES.md
Illustrates good and bad practices for structuring few-shot examples in agent configurations, emphasizing order and balance.
```yaml
✅ GOOD: Place most important examples first (but test variations)
✅ GOOD: Balance example types (not all edge cases, include common cases)
✅ GOOD: Be aware order matters—test different orderings
❌ BAD: Assuming more examples always helps
❌ BAD: Placing all negative examples together at the end
```
--------------------------------
### Valid Asset Path Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cdx-pl-012.md
This JSON snippet shows a valid asset path for the 'logo' field. Relative paths starting with './' are considered valid.
```json
{
"name": "my-plugin",
"interface": {"logo": "./assets/logo.png"}
}
```
--------------------------------
### Example MCP Server Implementation
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/multi-platform-OPINIONS.md
This TypeScript example demonstrates how to set up an MCP server for database access, defining tools for actions and resources for data. It uses the Model Context Protocol SDK.
```typescript
// mcp-servers/database/
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
const server = new Server({
name: "database-mcp-server",
version: "1.0.0"
}, {
capabilities: {
tools: {},
resources: {},
}
});
// Define tools (actions)
server.setRequestHandler("tools/list", async () => ({
tools: [
{
name: "query_database",
description: "Execute SQL query",
inputSchema: {
type: "object",
properties: {
query: { type: "string" },
params: { type: "array" }
}
}
}
]
}));
// Define resources (data)
server.setRequestHandler("resources/list", async () => ({
resources: [
{
uri: "db://schema/tables",
name: "Database Schema",
mimeType: "application/json"
}
]
}));
```
--------------------------------
### Cursor Project-Specific Rules
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/multi-platform-OPINIONS.md
Example of custom rules for Cursor to guide the AI on project-specific anti-patterns and constraints. This helps the AI learn unique project requirements.
```markdown
## This Project's Gotchas
- Never use `Date.now()` directly - use our `getCurrentTimestamp()` utility
- Database queries must use prepared statements (prevent SQL injection)
- All API responses must match our standard error format (see ErrorResponse type)
```
--------------------------------
### Integration Test Script for Claude
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/claude-code-OPINIONS.md
An example shell script demonstrating how to use Claude for integration testing, including project setup, command execution, and file verification.
```bash
set -e
echo "Setting up test environment..."
mkdir -p /tmp/test-project
cd /tmp/test-project
git init
echo "Loading plugins..."
claude --plugin-dir ../plugins \
--session-id integration-test \
--command "/create-component Button" \
--exit-after-command
echo "Verifying files created..."
[ -f "src/components/Button.tsx" ] || exit 1
[ -f "src/components/Button.test.tsx" ] || exit 1
echo "Running tests..."
npm test Button
echo "Verifying lint..."
npm run lint src/components/Button.tsx
echo "✅ Integration test passed"
```
--------------------------------
### Resource Picker UI Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-OPINIONS.md
Demonstrates a user interface for resource selection, featuring a hierarchical view with checkboxes for selection and options for bulk actions.
```text
📁 Resources
├─ 📁 Project Files
│ ├─ ☑ README.md (18 KB)
│ ├─ ☐ CONTRIBUTING.md (5 KB)
│ └─ ☑ src/main.py (42 KB)
├─ 📁 Documentation
│ └─ ☐ API.md (103 KB)
└─ 🔗 External
└─ ☑ https://api.example.com/schema
[Select All] [Clear] [Add Selected]
```
--------------------------------
### Example .agnix.toml Configuration
Source: https://github.com/agent-sh/agnix/blob/main/editors/zed/README.md
Configure agnix linting rules and severity for your project. This example sets the target and disables a specific rule.
```toml
target = "claude-code"
severity = "warning"
[rules]
disabled_rules = ["AS-001"]
```
--------------------------------
### Effective System Prompt Example for Constraints
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/PROMPT-ENGINEERING-REFERENCE.md
Illustrates how to provide context for negative constraints, explaining the 'why' behind the rule for better model adherence.
```text
Your response will be read aloud by a text-to-speech engine, so never use
ellipses since the text-to-speech engine will not know how to pronounce them.
```
--------------------------------
### End-to-End Integration Test for MCP Client
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-OPINIONS.md
An asynchronous Python example demonstrating an end-to-end integration test for an MCP client. It starts a server as a subprocess and interacts with it using ClientSession.
```python
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def test_end_to_end():
# Start server as subprocess
server_params = StdioServerParameters(
command="python",
args=["server.py"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize
await session.initialize()
# List tools
tools = await session.list_tools()
assert len(tools) > 0
# Call tool
result = await session.call_tool(
"get_weather",
{"location": "New York"}
)
assert result is not None
```
--------------------------------
### Full Configuration Reference
Source: https://github.com/agent-sh/agnix/blob/main/docs/CONFIGURATION.md
A comprehensive TOML configuration example covering severity, target, tools, file exclusions, rule toggles, and version specifications.
```toml
severity = "Warning" # Warning, Error, Info
target = "Generic" # Deprecated: Generic, ClaudeCode, Cursor, Codex
# Multi-tool support (overrides target)
tools = ["claude-code", "cursor", "github-copilot"] # Valid: claude-code, cursor, codex, copilot, github-copilot, generic
exclude = [
"node_modules/**",
".git/**",
"target/**",
]
[rules]
# Category toggles - all default to true
skills = true # AS-*, CC-SK-* rules
hooks = true # CC-HK-* rules
agents = true # CC-AG-* rules
copilot = true # COP-* rules
cursor = true # CUR-* rules
memory = true # CC-MEM-* rules
plugins = true # CC-PL-* rules
mcp = true # MCP-* rules
prompt_engineering = true # PE-* rules
xml = true # XML-* rules
imports = true # REF-* rules
cross_platform = true # XP-* rules
agents_md = true # AGM-* rules
# Disable specific rules by ID
disabled_rules = ["CC-MEM-006", "PE-003"]
# Version-aware validation (optional)
[tool_versions]
# claude_code = "1.0.0"
# cursor = "0.45.0"
[spec_revisions]
# mcp_protocol = "2025-11-25"
# File inclusion/exclusion for non-standard agent files
[files]
# Validate as CLAUDE.md-like memory/instruction files
# include_as_memory = ["docs/ai-rules/*.md", "custom/INSTRUCTIONS.md"]
# Validate as generic markdown (XML, imports, cross-platform rules)
# include_as_generic = ["internal/*.md"]
# Exclude from validation entirely (even built-in file types)
# exclude = ["vendor/**", "generated/**"]
# Per-file rule suppression (see "Per-file rule overrides" below).
# Each [[overrides]] block disables `disabled_rules` for files matching
# any pattern in `paths`. Multiple blocks stack (set union); ordering
# does not matter.
# [[overrides]]
# paths = ["CLAUDE.md", "AGENTS.md"]
# disabled_rules = ["CC-MEM-005"]
```
--------------------------------
### Prompting Decision Framework: Zero-Shot vs Few-Shot
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/PROMPT-ENGINEERING-REFERENCE.md
A flowchart illustrating the decision process for choosing between zero-shot and few-shot prompting, starting with zero-shot and progressively adding examples if needed.
```text
Start with Zero-Shot
|
v
Does it work? --Yes--> Done
|
No
v
Add 2-3 Few-Shot Examples
|
v
Does it work? --Yes--> Done
|
No
v
Add more examples OR consider fine-tuning
```
--------------------------------
### Invalid YAML Frontmatter: Missing Delimiters
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/agent-skills-HARD-RULES.md
YAML frontmatter in markdown files must be correctly delimited by '---' on both the start and end. This example shows missing closing delimiters.
```markdown
name: my-skill
description: Does something
---
# Instructions
```
```markdown
---
name: my-skill
description: Does something
# Instructions (missing closing ---)
```
--------------------------------
### Valid copilot-setup-steps Job Configuration
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cop-018.md
This example demonstrates a valid job configuration that adheres to the COP-018 rule. Correctly naming the job 'copilot-setup-steps' resolves the issue.
```yaml
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- run: echo setup
```
--------------------------------
### Valid Agent Skills File Name
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/as-005.md
This example demonstrates a correctly formatted agent skills file name that does not start or end with a hyphen, satisfying rule AS-005. This configuration is compliant.
```markdown
---
name: build-project
description: Use when building the project
---
Run the build script.
```
--------------------------------
### Effective System Prompt Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/PROMPT-ENGINEERING-REFERENCE.md
Contrast less effective, vague instructions with more effective, explicit instructions for creating an analytics dashboard.
```text
Create an analytics dashboard. Include as many relevant features and
interactions as possible. Go beyond the basics to create a fully-featured
implementation.
```
--------------------------------
### Invalid Agent Skills File Name
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/as-005.md
This example shows an agent skills file name that starts and ends with a hyphen, which violates rule AS-005. This configuration would be flagged by the linter.
```markdown
---
name: -build-project-
description: Use when building the project
---
Run the build script.
```
--------------------------------
### Basic Codex SDK Usage
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CODEX-REFERENCE.md
A fundamental example of using the Codex TypeScript SDK to start a thread, run a task, and access the final response. It demonstrates the core workflow for interacting with Codex via code.
```typescript
import { Codex } from "@openai/codex-sdk";
const codex = new Codex();
const thread = codex.startThread({
workingDirectory: process.cwd()
});
const turn = await thread.run("Find and fix bugs");
console.log(turn.finalResponse);
```
--------------------------------
### Slash Command Prompt Discovery Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-OPINIONS.md
Shows an example of a slash command interface for discovering and invoking prompts, with a search input and a list of available commands.
```text
/ [Type to search prompts]
📝 /draft_email - Create a professional email
🔍 /analyze_data - Perform data analysis
✈️ /plan_vacation - Plan a trip itinerary
🐛 /debug_code - Debug code issues
```
--------------------------------
### Invalid agents.md file exceeding size limit
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cdx-ag-004.md
This TOML snippet represents an invalid agents.md file that triggers the CDX-AG-004 rule due to exceeding the size limit. This example is for demonstration purposes and requires no specific setup.
```toml
agents.md
```
--------------------------------
### agnix.start()
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/doc/agnix.txt
Starts the LSP client for the current Neovim buffer. This function is used to initiate the language server process.
```APIDOC
## agnix.start()
### Description
Start the LSP client for the current buffer.
### Method
Lua Function Call
```
--------------------------------
### Basic Agnix GitHub Action Setup
Source: https://github.com/agent-sh/agnix/blob/main/docs/CONFIGURATION.md
A minimal configuration for the Agnix GitHub Action. This sets up the action to run with default parameters.
```yaml
- uses: agent-sh/agnix@v0
```
--------------------------------
### Invalid Claude Skills Configuration (Too Many Injections)
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cc-sk-009.md
This example shows an invalid Claude Skills configuration that triggers CC-SK-009 due to an excessive number of injections. Ensure the number of injections is appropriate for the skill's setup.
```markdown
---
name: template-skill
description: Use when applying a code template
---
Use !`config.json` and !`env.json` and !`secrets.json` and !`overrides.json` for setup.
```
--------------------------------
### Verify npm Installation
Source: https://github.com/agent-sh/agnix/blob/main/docs/RELEASING.md
Install the agnix CLI using npm and verify the installed version.
```bash
npm install -g @agnix/cli
agnix --version
```
--------------------------------
### Build agnix-lsp from Source
Source: https://github.com/agent-sh/agnix/blob/main/crates/agnix-lsp/README.md
Build the agnix-lsp binary in release mode from the workspace root.
```bash
cargo build --release -p agnix-lsp
```
--------------------------------
### Agent Config Examples: Instruction Length vs. Effectiveness
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/prompt-engineering-HARD-RULES.md
Shows how to balance instruction length and detail, emphasizing task-relevant information over extraneous details.
```yaml
❌ BAD: Long backstory about why the agent exists
❌ BAD: Philosophical explanations about AI behavior
✅ GOOD: Direct, task-relevant instructions
✅ GOOD: Context that affects decision-making
✅ GOOD: Specific examples of desired behavior
```
--------------------------------
### Valid Configuration Using Environment Variables
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/xp-003.md
This example demonstrates a valid configuration that avoids hard-coded platform paths by using environment variables or relative paths. It promotes cross-platform compatibility.
```markdown
# Configuration
Use environment variables for all platform-specific settings.
See ./src/config.ts for defaults.
```
--------------------------------
### Verify Cargo Installation
Source: https://github.com/agent-sh/agnix/blob/main/docs/RELEASING.md
Install the agnix CLI using Cargo and verify the installed version.
```bash
cargo install agnix
agnix --version
```
--------------------------------
### Install Agnix LSP Binary with npm or Cargo
Source: https://github.com/agent-sh/agnix/blob/main/docs/EDITOR-SETUP.md
Use npm to install the Agnix LSP globally or Cargo to install the `agnix-lsp` binary. This is useful for manual installation or when automatic downloads fail.
```bash
# npm
npm install -g agnix
```
```bash
# Cargo
cargo install agnix-lsp
```
--------------------------------
### Example .agnix.toml Configuration
Source: https://github.com/agent-sh/agnix/blob/main/editors/vscode/README.md
Use a .agnix.toml file in your workspace root for team-shared configuration. This example sets the target tool and disables specific rules.
```toml
target = "ClaudeCode"
[rules]
disabled_rules = ["PE-003"]
```
--------------------------------
### Verify agnix installation
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/installation.md
Check if agnix is installed correctly and display its version. This command is useful after any installation method.
```bash
agnix --version
```
--------------------------------
### Valid Profile Configuration
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cdx-app-003.md
This example demonstrates a valid profile configuration. The 'profile' setting is correctly set to a string value.
```toml
profile = "default"
```
--------------------------------
### Tool Invocation UI Flow Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-OPINIONS.md
Illustrates a recommended user interface flow for tool invocation, showing pre-execution, during execution, and post-execution states.
```text
🔧 About to call: send_email
To: team@example.com
Subject: "Weekly update"
Body: [Preview...]
[Approve] [Modify] [Cancel]
⏳ Sending email...
✅ Email sent successfully at 10:30 AM
```
--------------------------------
### Optional Skill Directory Structure
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/agent-skills-OPINIONS.md
This example outlines a recommended directory structure for organizing skill-related files, including executable code, additional documentation, and static resources.
```tree
skill-name/
├── SKILL.md
├── scripts/ # Executable code
├── references/ # Additional documentation
└── assets/ # Static resources
```
--------------------------------
### Install agnix via npm
Source: https://github.com/agent-sh/agnix/blob/main/README.md
Install the agnix package globally using npm for cross-platform compatibility. This is the recommended installation method.
```bash
# npm (recommended, all platforms)
npm install -g agnix
```
--------------------------------
### Using Symbolic Links for Configuration Management
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/multi-platform-OPINIONS.md
Demonstrates how to use symbolic links to manage scattered configurations, specifically for the Cursor tool. This helps centralize settings within a project.
```bash
ln -s .platform/cursor/.cursor/rules .cursor/rules
```
--------------------------------
### Check Agnix Installation
Source: https://github.com/agent-sh/agnix/blob/main/skills/agnix/SKILL.md
Verify if the agnix CLI tool is installed by checking its version. If not found, instructions are provided to install it using cargo.
```bash
agnix --version
```
```bash
cargo install agnix-cli
```
--------------------------------
### Commit Message Generation Example
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/agent-skills-OPINIONS.md
Provide input/output examples for skills that generate structured text like commit messages. This example demonstrates the desired format.
```markdown
## Commit message format
Generate commit messages following these examples:
**Example 1:**
Input: Added user authentication with JWT tokens
Output:
```
feat(auth): implement JWT-based authentication
Add login endpoint and token validation middleware
```
Follow this style: type(scope): brief description, then detailed explanation.
```
--------------------------------
### Agent Config Examples: Instruction Separation and Structure
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/prompt-engineering-HARD-RULES.md
Illustrates effective prompt structuring using separators to distinguish instructions, context, and input data.
```yaml
✅ GOOD: Use clear sections
---
# Instructions
Edit existing files. Only create new files when explicitly requested.
# Context
You are working in a git repository at /path/to/repo
# Output Format
Respond with file paths and explanations.
---
❌ BAD: Mixed instructions and context in a single paragraph
```
--------------------------------
### Valid Prompt Example: Specific Instructions
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/pe-005.md
This example demonstrates a prompt with specific and actionable instructions. It includes details like formatting requirements (2-space indentation) and error code inclusion, making it more effective.
```markdown
# Rules
Format all output as JSON with 2-space indentation.
Always include error codes in responses.
```
--------------------------------
### Install VS Code Extension from Source
Source: https://github.com/agent-sh/agnix/blob/main/docs/EDITOR-SETUP.md
Steps to install the VS Code extension for agnix from its source code. This involves installing dependencies, compiling, and packaging the extension.
```bash
cd editors/vscode
npm install
npm run compile
npm run package
code --install-extension agnix-*.vsix
```
--------------------------------
### Example tools/list Response
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-HARD-RULES.md
A sample response from the 'tools/list' method, containing an array of tool definitions. Each tool object must include at least its name, description, and inputSchema.
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "get_weather",
"description": "Get weather data",
"inputSchema": { "type": "object", "properties": { "location": { "type": "string" } }, "required": ["location"] }
}
]
}
}
```
--------------------------------
### Correct Pattern: Initialize First
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-HARD-RULES.md
Shows the correct client behavior of sending an `initialize` request before other methods like `tools/list`.
```json
// ✅ CORRECT: Initialize first
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": { "protocolVersion": "2025-11-25", ... }
}
// Wait for response, send initialized notification, then send tools/list
```
--------------------------------
### Install Dependencies with pnpm
Source: https://github.com/agent-sh/agnix/blob/main/tests/fixtures/cross_platform/conflicting-commands/AGENTS.md
Installs project dependencies using pnpm.
```bash
pnpm install
```
--------------------------------
### Valid Prompt File with Content
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cop-013.md
This example demonstrates a valid prompt file that adheres to the COP-013 rule. It includes a description and a non-empty body, providing necessary context for GitHub Copilot.
```markdown
---
description: Refactor selected code
---
Refactor the selected code while preserving behavior.
```
--------------------------------
### Install Agnix CLI
Source: https://github.com/agent-sh/agnix/blob/main/crates/agnix-cli/README.md
Install the agnix CLI using cargo.
```bash
cargo install agnix-cli
```
--------------------------------
### MCP Server CLI Wizard
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CLAUDE-CODE-REFERENCE.md
Initiate the MCP server setup process using the `claude mcp add` command.
```bash
claude mcp add
```
--------------------------------
### Neovim Lazy.nvim Installation
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/editor-integration.md
Install the agnix.nvim plugin using the lazy.nvim package manager.
```lua
{ "agent-sh/agnix.nvim" }
```
--------------------------------
### TypeScript MCP Server Installation
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CLAUDE-CODE-REFERENCE.md
Install the MCP TypeScript SDK using npm.
```bash
npm install @modelcontextprotocol/sdk
```
--------------------------------
### Example tools/call Request
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-HARD-RULES.md
Demonstrates a request to the 'tools/call' method, specifying the tool name and its arguments. The server must validate the provided arguments against the tool's inputSchema.
```json
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": {
"location": "New York"
}
}
}
```
--------------------------------
### Python MCP Server Installation
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CLAUDE-CODE-REFERENCE.md
Install the MCP Python SDK using pip.
```bash
pip install mcp
```
--------------------------------
### Example Version Mismatch Error
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-HARD-RULES.md
An example of an initialization error where the protocol version is mismatched.
```json
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "Unsupported protocol version",
"data": {
"supported": ["2024-11-05"],
"requested": "1.0.0"
}
}
}
```
--------------------------------
### Agnix Configuration File Example
Source: https://github.com/agent-sh/agnix/blob/main/SPEC.md
Shows the structure of the .agnix.toml configuration file, including settings for severity, target, locale, and rule customization. This file allows for persistent configuration of Agnix behavior.
```toml
severity = "Warning"
target = "Generic" # Options: Generic, ClaudeCode, Cursor, Codex
locale = "en" # Options: en, es, zh-CN
tools = ["claude-code", "cursor"] # Preferred over target
[rules]
```
--------------------------------
### Valid Frontmatter Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/cop-002.md
This example demonstrates the correct format for scoped instructions with valid frontmatter, ensuring that GitHub Copilot correctly applies the specified instructions to the target files. The `applyTo` field specifies the file pattern.
```markdown
---
applyTo: "**/*.ts"
---
# TypeScript Instructions
Use strict mode and explicit types.
```
--------------------------------
### Install Agnix with vim-plug
Source: https://github.com/agent-sh/agnix/blob/main/editors/neovim/doc/agnix.txt
Configuration for installing the agnix plugin using the vim-plug package manager.
```vim
Plug 'agent-sh/agnix'
" In your init.lua or after/plugin:
lua require('agnix').setup()
```
--------------------------------
### Example prompts/get Request
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/mcp-HARD-RULES.md
A JSON-RPC request to retrieve a specific prompt by its name and provide necessary arguments for its execution.
```json
{
"jsonrpc": "2.0",
"id": 2,
"method": "prompts/get",
"params": {
"name": "code_review",
"arguments": {
"code": "def hello():\n print('world')"
}
}
}
```
--------------------------------
### Install agnix-lsp with Cargo
Source: https://github.com/agent-sh/agnix/blob/main/crates/agnix-lsp/README.md
Install the agnix-lsp binary using Cargo, the Rust package manager.
```bash
cargo install agnix-lsp
```
--------------------------------
### Install Claude Agent SDK (TypeScript)
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CLAUDE-CODE-REFERENCE.md
Install the Claude Agent SDK for TypeScript using npm.
```bash
npm install @anthropic-ai/claude-agent-sdk
```
--------------------------------
### Validate .env.example Completeness
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/standards/multi-platform-OPINIONS.md
Ensures that all required environment variables are present in the .env.example file. This is crucial for setting up new environments correctly.
```bash
required_keys=("ANTHROPIC_API_KEY" "OPENAI_API_KEY")
for key in "${required_keys[@]}"; do
grep -q "$key" .env.example || exit 1
done
```
--------------------------------
### Valid Configuration Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/xp-001.md
This configuration is valid as it adheres to generic project guidelines without platform-specific features.
```markdown
# Project Guidelines
Follow the coding style guide.
## Commands
- npm run build
- npm run test
```
--------------------------------
### Install Claude Agent SDK (Python)
Source: https://github.com/agent-sh/agnix/blob/main/knowledge-base/agent-docs/CLAUDE-CODE-REFERENCE.md
Install the Claude Agent SDK for Python using pip.
```bash
pip install claude-agent-sdk
```
--------------------------------
### Build Project
Source: https://github.com/agent-sh/agnix/blob/main/tests/fixtures/gemini_md/GEMINI.md
Builds the project for production deployment.
```bash
npm run build
```
--------------------------------
### Valid agents.md Example (With Project Context)
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/agm-004.md
This example shows a correctly formatted agents.md file that includes a project context section, satisfying the AGM-004 rule. It clearly defines the project and its purpose.
```markdown
# Project
This is a web application for task management built with React and Node.js.
## Build Commands
Run npm install and npm build.
```
--------------------------------
### Invalid JSON Example
Source: https://github.com/agent-sh/agnix/blob/main/website/docs/rules/generated/gm-009.md
This snippet shows an example of invalid JSON that would trigger the GM-009 rule.
```json
{ invalid json }
```
--------------------------------
### Agnix CLI Reference Examples
Source: https://github.com/agent-sh/agnix/blob/main/plugin/skills/agnix/SKILL.md
Provides examples of common agnix CLI commands and their functionalities, including validation, auto-fixing, strict mode, targeting specific AI tools, watch mode, and output formatting.
```bash
agnix .
```
```bash
agnix --fix .
```
```bash
agnix --strict .
```
```bash
agnix --target claude-code .
```
```bash
agnix --target cursor .
```
```bash
agnix --watch .
```
```bash
agnix --format json .
```
```bash
agnix --format sarif .
```