Complete guide for integrating DNA guidelines into your projects.
- Installation
- Quick Start
- Project Commands Reference
- Project Configuration
- Using AI Agents with DNA
- Troubleshooting
- Examples
- Development
Download the latest release for your platform from GitHub Releases:
macOS:
# ARM (M1/M2/M3)
curl -L https://github.com/hypernetix/dnaspec/releases/latest/download/dnaspec_darwin_arm64.tar.gz | tar xz
sudo mv dnaspec /usr/local/bin/
# Intel
curl -L https://github.com/hypernetix/dnaspec/releases/latest/download/dnaspec_darwin_amd64.tar.gz | tar xz
sudo mv dnaspec /usr/local/bin/Linux:
# x86_64
curl -L https://github.com/hypernetix/dnaspec/releases/latest/download/dnaspec_linux_amd64.tar.gz | tar xz
sudo mv dnaspec /usr/local/bin/
# ARM64
curl -L https://github.com/hypernetix/dnaspec/releases/latest/download/dnaspec_linux_arm64.tar.gz | tar xz
sudo mv dnaspec /usr/local/bin/Windows:
# Download from: https://github.com/hypernetix/dnaspec/releases/latest
# Extract and add to PATHIf you have Go 1.21+ installed:
go install github.com/hypernetix/dnaspec/cmd/dnaspec@latestdnaspec version- Initialize DNASpec in your project:
dnaspec init- Add DNA guidelines from a repository:
dnaspec add --git-repo https://github.com/company/dna-guidelines- Configure AI agents to use your guidelines:
dnaspec update-agents- Or add from a local directory:
dnaspec add /path/to/local/dna-guidelinesDNASpec supports adding guidelines from multiple sources to a single project:
# Add company-wide guidelines
dnaspec add --git-repo https://github.com/company/dna --name company
# Add team-specific patterns
dnaspec add --git-repo https://github.com/team/patterns --name team
# Add personal experimental guidelines
dnaspec add /Users/me/my-dna --name personal
# Generate agent configuration with all sources
dnaspec update-agentsBenefits of multiple sources:
- Company-wide standards: Shared across all organization projects
- Team-specific patterns: Tailored to your team's tech stack
- Personal guidelines: Your own best practices
- Independent versioning: Update each source on its own schedule
- Namespace isolation: No conflicts between sources (e.g.,
company-reviewvsteam-review)
All guidelines from all sources are available to AI agents simultaneously.
Initialize a new dnaspec.yaml file in your project.
dnaspec initThis command:
- Creates a new
dnaspec.yamlconfiguration file in the current directory - Includes commented examples showing how to add DNA sources
- Prevents overwriting an existing configuration file
Example output:
✓ Success: Created dnaspec.yaml
Next steps:
1. Run dnaspec add to add DNA guidelines from a repository or local directory
2. Run dnaspec update-agents to generate agent configuration files
Add DNA guidelines from a git repository or local directory to your project.
Add from git repository:
# Add from default branch/tag
dnaspec add --git-repo https://github.com/company/dna-guidelines
# Add from specific branch or tag
dnaspec add --git-repo https://github.com/company/dna-guidelines --git-ref v1.2.0
# Add with custom source name
dnaspec add --git-repo https://github.com/company/dna-guidelines --name my-dnaAdd from local directory:
# Add from local path
dnaspec add /path/to/local/dna-guidelines
# Add with custom source name
dnaspec add /path/to/local/dna-guidelines --name my-local-dnaSelection options:
# Interactive selection (default)
dnaspec add --git-repo https://github.com/company/dna-guidelines
# Add all guidelines without prompting
dnaspec add --git-repo https://github.com/company/dna-guidelines --all
# Add specific guidelines
dnaspec add --git-repo https://github.com/company/dna-guidelines --guideline go-style --guideline rest-api
# Preview changes without modifying files
dnaspec add --git-repo https://github.com/company/dna-guidelines --dry-runThis command:
- Clones the git repository (for git sources) or reads the local directory
- Parses the
dnaspec-manifest.yamlfile from the source - Shows an interactive guideline selection (unless
--allor--guidelineflags are used) - Copies selected guideline and prompt files to
dnaspec/<source-name>/directory - Updates
dnaspec.yamlwith source metadata and selected guidelines
Flags:
--git-repo <url>: Git repository URL (https:// or git@)--git-ref <ref>: Git branch or tag to use (defaults to repository's default branch)--name <name>: Custom source name (defaults to derived name from URL/path)--all: Add all guidelines without interactive selection--guideline <name>: Add specific guideline by name (can be repeated)--dry-run: Preview changes without modifying files
Example output:
→ Cloning repository https://github.com/company/dna-guidelines...
✓ Repository cloned successfully
Select guidelines to add:
[x] go-style - Go coding style conventions
[x] rest-api - REST API design principles
[ ] database-design - Database schema design guidelines
→ Copying 2 guidelines and 3 prompts to dnaspec/dna-guidelines/...
✓ Files copied successfully
✓ Updated dnaspec.yaml
Added source: dna-guidelines
Guidelines: go-style, rest-api
Prompts: code-review, documentation, api-review
Next steps:
1. Review the added guidelines in dnaspec/dna-guidelines/
2. Run dnaspec update-agents to generate agent configuration files
Remove a DNA source from your project configuration. This command safely removes the source from dnaspec.yaml, deletes the source directory and all guideline files, and cleans up generated agent files for all supported agents (Antigravity, Claude Code, Cursor, GitHub Copilot, and Windsurf).
Basic usage:
# Remove a source with confirmation prompt
dnaspec remove company-dna
# Remove a source without confirmation
dnaspec remove company-dna --forceThis command:
- Shows what will be deleted (config entry, source directory, generated agent files)
- Prompts for confirmation before deletion (unless
--forceis used) - Removes the source entry from
dnaspec.yaml - Deletes the
dnaspec/<source-name>/directory - Cleans up generated agent files for all supported agents:
- Antigravity:
.agent/workflows/dnaspec-<source-name>-*.md - Claude Code:
.claude/commands/dnaspec/<source-name>-*.md - Cursor:
.cursor/commands/dnaspec-<source-name>-*.md - GitHub Copilot:
.github/prompts/dnaspec-<source-name>-*.prompt.md - Windsurf:
.windsurf/workflows/dnaspec-<source-name>-*.md
- Antigravity:
- Handles missing files gracefully (idempotent operation)
Flags:
--force,-f: Skip confirmation prompt
Example output:
The following will be deleted:
- dnaspec.yaml entry for 'company-dna'
- dnaspec/company-dna/ directory (5 guidelines, 3 prompts)
- .claude/commands/dnaspec/company-dna-*.md (3 files)
- .github/prompts/dnaspec-company-dna-*.prompt.md (2 files)
This cannot be undone. Continue? [y/N]: y
✓ Success: Removed source company-dna
Cleaned up 5 file(s)
Next steps:
Run dnaspec update-agents to regenerate AGENTS.md
Error handling:
- If the source doesn't exist, shows available sources
- If config file is missing, suggests running
dnaspec init - If file deletion fails, provides clear error messages
View the current DNA configuration for your project, showing all configured agents, sources, guidelines, and prompts.
dnaspec listThis command:
- Loads and displays the
dnaspec.yamlconfiguration file - Shows configured AI agents (Antigravity, Claude Code, Cursor, GitHub Copilot, Windsurf)
- Lists all DNA sources with their type-specific metadata
- Displays guidelines and prompts for each source
- Provides a quick overview of your project's DNA setup
Example output:
Configured Agents (Phase 1):
- Claude Code
- GitHub Copilot
Sources:
company-dna (git-repo)
URL: https://github.com/company/dna-guidelines
Ref: v1.2.0
Commit: abc123def456789...
Guidelines:
- go-style: Go coding style conventions
- rest-api: REST API design principles
Prompts:
- code-review: Review Go code for style compliance
- api-review: Review API designs
local-patterns (local-path)
Path: /Users/me/my-dna-patterns
Guidelines:
- error-handling: Error handling patterns
When no configuration exists:
✗ Error: dnaspec.yaml not found
Run 'dnaspec init' to create a new configuration file.
Use cases:
- Verify which DNA sources are currently active
- Check which guidelines are available before running code reviews
- Confirm agent configuration before running
dnaspec update-agents - Debug configuration issues
Update a DNA source from its origin (git repository or local directory) with interactive guideline selection.
Basic usage:
# Update a source with interactive guideline selection
dnaspec update my-company-dna
# Preview changes without interactive selection
dnaspec update my-company-dna --dry-runThis command:
- Fetches the latest manifest from the source (git clone or local directory read)
- Presents an interactive multi-select UI to choose which guidelines to keep, add, or remove
- Pre-selects existing guidelines (already in your config)
- Shows orphaned guidelines (in config but missing from source) with
⚠️ warning icon - Updates metadata for selected guidelines (description, scenarios, prompts)
- Copies selected guideline and prompt files to
dnaspec/<source-name>/directory - Updates
dnaspec.yamlwith new commit hashes (git sources) and metadata
Flags:
--dry-run: Preview changes without interactive selection or modifying files
Interactive selection example:
⏳ Fetching latest from https://github.com/company/dna...
✓ Current commit: abc123de
✓ Latest commit: def456ab (changed)
Select guidelines to keep or add:
Use space to select/deselect, enter to confirm. ⚠️ = missing from source
[✓] go-style - Go coding conventions
[✓] rest-api - REST API design principles
[ ] go-testing - Go testing patterns (new)
[✓] old-guideline - Deprecated pattern ⚠️
Dry-run output:
⏳ Fetching latest from https://github.com/company/dna...
✓ Current commit: abc123de
✓ Latest commit: def456ab (changed)
=== Dry Run - Preview ===
Available guidelines in source:
- go-style: Go coding conventions
- rest-api: REST API design principles
- go-testing: Go testing patterns
Already in config:
✓ go-style
✓ rest-api (updated)
Orphaned (in config but not in source):
⚠️ old-guideline (no longer in manifest)
No changes made (dry run)
When sources are up to date:
⏳ Fetching latest from https://github.com/company/dna...
✓ Current commit: abc123de
✓ Already at latest commit
All guidelines up to date.
Updating multiple sources:
To update multiple sources, use the dnaspec sync command or iterate over sources:
# Non-interactive batch update for CI/CD
dnaspec sync
# Or manually iterate for interactive selection
for source in $(yq '.sources[].name' dnaspec.yaml); do
dnaspec update "$source"
doneGenerate or update AI agent configuration files based on selected DNA guidelines.
# Interactive mode - select which agents to configure
dnaspec update-agents
# Non-interactive mode - use saved selection
dnaspec update-agents --no-askThis command:
- Shows an interactive checklist of available AI agents (Claude Code, GitHub Copilot)
- Saves your agent selection to
dnaspec.yaml - Generates agent-specific integration files based on your DNA guidelines
- Updates managed blocks while preserving custom content outside those blocks
- When no sources are configured: Removes existing DNASPEC blocks from AGENTS.md and CLAUDE.md (if present)
Generated Files:
AGENTS.md (always):
- Contains references to all guidelines with their applicable scenarios
- Format:
@/dnaspec/<source-name>/<file>with scenario bullet points - Uses managed blocks (
<!-- DNASPEC:START/END -->) that can be safely regenerated
CLAUDE.md (if Claude Code selected):
- Same content as AGENTS.md
- Enables Claude Code to discover project-specific instructions
Claude Commands (if Claude Code selected):
.claude/commands/dnaspec/<source-name>-<prompt-name>.md- Slash commands for guideline-based code reviews and tasks
- Includes frontmatter with name, description, category, and tags
Copilot Prompts (if GitHub Copilot selected):
.github/prompts/dnaspec-<source-name>-<prompt-name>.prompt.md- Prompts for guideline-based assistance
- Includes
$ARGUMENTSplaceholder for context
Flags:
--no-ask: Use saved agent configuration without prompting (useful for CI/CD)
Example output:
Select AI agents to configure:
[x] Claude Code
[x] GitHub Copilot
→ Generating agent configuration files...
✓ Created AGENTS.md
✓ Created CLAUDE.md
✓ Created .claude/commands/dnaspec/dna-guidelines-code-review.md
✓ Created .claude/commands/dnaspec/dna-guidelines-documentation.md
✓ Created .github/prompts/dnaspec-dna-guidelines-code-review.prompt.md
✓ Created .github/prompts/dnaspec-dna-guidelines-documentation.prompt.md
Agent configuration updated successfully!
Your AI assistants can now access your DNA guidelines:
• Claude Code: Type / and search for "dnaspec" commands
• GitHub Copilot: Use GitHub Copilot Chat with dnaspec prompts
When no sources are configured:
If you've removed all DNA sources, the command will clean up any existing DNASPEC blocks:
No DNA sources configured.
Checking for DNASPEC blocks to remove...
Removed DNASPEC blocks from:
✓ AGENTS.md
✓ CLAUDE.md
Or if no blocks exist:
No DNA sources configured.
Checking for DNASPEC blocks to remove...
No DNASPEC blocks found to remove.
Run 'dnaspec add' to add guidelines first.
When to run:
- After adding new DNA sources with
dnaspec add - After changing which agents you want to use
- After updating guidelines in your DNA sources (with
--no-askflag) - After removing all DNA sources to clean up agent files
Managed Blocks:
The command uses managed block markers to safely update generated content:
<!-- DNASPEC:START -->
Generated content here
<!-- DNASPEC:END -->Content outside these markers is preserved, so you can add custom instructions alongside generated guidelines.
Validate the project configuration (dnaspec.yaml) without modifying any files.
dnaspec validateThis command checks:
- YAML syntax and schema structure: Ensures the configuration file is valid
- Config version: Verifies version is supported (currently version 1)
- Source fields: Checks all sources have required fields based on type
- File references: Verifies all guideline and prompt files exist in
dnaspec/directory - Agent IDs: Validates agent IDs are recognized (claude-code, github-copilot)
- Duplicate names: Checks for duplicate source names
- Comprehensive error reporting: Collects and displays all errors before exiting
Example output (success):
Validating dnaspec.yaml...
✓ YAML syntax valid
✓ Version 1 schema valid
✓ 2 sources configured
✓ All referenced files exist:
- dnaspec/company-dna/guidelines/go-style.md
- dnaspec/company-dna/guidelines/rest-api.md
- dnaspec/company-dna/prompts/code-review.md
✓ All agent IDs recognized: claude-code, github-copilot
✓ Configuration is valid
Example output (errors):
Validating dnaspec.yaml...
✓ YAML syntax valid
✗ Found 3 validation error(s):
• Source 'company-dna' (git-repo) missing required field: url
• File not found: dnaspec/company-dna/guidelines/missing.md
• Unknown agent ID: 'invalid-agent' (recognized: claude-code, github-copilot)
Validation failed with 3 error(s)
Use cases:
- Verify configuration before running other commands
- Debug configuration issues
- Check in CI/CD pipelines to catch errors early
- Ensure all referenced files exist after cloning a repository
Update all DNA sources and regenerate agent files in a single non-interactive operation.
# Sync all sources and regenerate agent files
dnaspec sync
# Preview changes without writing files
dnaspec sync --dry-runThis command is a convenience wrapper that:
- Updates all sources from their origins sequentially (non-interactive)
- Regenerates all agent files (equivalent to
dnaspec update-agents --no-ask) - Displays consolidated summary of all changes
Non-interactive design:
- Safe for CI/CD pipelines - never prompts for user input
- Uses saved agent configuration from
dnaspec.yaml - Does NOT add new guidelines automatically (keeps only existing guidelines)
- Exits early if any source update fails
Flags:
--dry-run: Preview changes without modifying files
Example output:
Syncing all DNA sources...
Updating 2 sources...
=== Updating company-dna ===
⏳ Refreshing from https://github.com/company/dna...
✓ Updated 1 guideline
✓ No new guidelines available
=== Updating local-patterns ===
⏳ Refreshing from local directory...
✓ No changes (already up to date)
✓ All sources updated
Regenerating agent files...
Using saved agents: [claude-code, github-copilot]
✓ AGENTS.md
✓ CLAUDE.md
✓ Generated 2 Claude command(s)
✓ Generated 2 Copilot prompt(s)
✓ Sync complete
When to use:
- In CI/CD pipelines to keep DNA guidelines up to date
- Before starting work to ensure you have latest guidelines
- After pulling repository changes that might affect DNA sources
- When you want to update everything with a single command
Comparison with individual commands:
| Command | Interactive | Adds New Guidelines | Use Case |
|---|---|---|---|
dnaspec update <source> |
Yes | User selects | Update specific source with control |
dnaspec sync |
No | No | CI/CD, batch updates |
The dnaspec.yaml file in your project directory tracks which DNA sources you've added and which guidelines are active.
version: 1
agents:
- "claude-code"
- "github-copilot"
sources:
- name: "company-dna" # Human-readable source name
type: "git-repo" # or "local-path"
url: "https://github.com/company/dna-guidelines"
ref: "v1.2.0" # Git tag or branch
commit: "abc123def456789..." # Resolved commit hash
guidelines:
- name: "go-style" # spinal-case
file: "guidelines/go-style.md" # Relative to source root
description: "Go code style conventions"
applicable_scenarios: # Used for generating AGENTS.md
- "writing new Go code"
prompts: # List of prompt names (not paths)
- "code-review"
prompts:
- name: "code-review" # spinal-case
file: "prompts/code-review.md"
description: "Review Go code"
- name: "local-patterns"
type: "local-path"
path: "/Users/me/my-dna-patterns"
guidelines:
- name: "error-handling"
file: "guidelines/error-handling.md"
description: "Error handling patterns"
applicable_scenarios:
- "handling errors"
prompts: []Top-level:
version: Must be1agents: List of AI agents to generate configuration for (values:"claude-code","github-copilot")sources: List of DNA sources added to this project
Source (git-repo type):
name: Unique source identifier (derived from URL or custom via--name)type: Must be"git-repo"url: Git repository URLref: Git branch or tag used (optional)commit: Git commit hash for tracking updatesguidelines: List of selected guidelines from this sourceprompts: List of prompts referenced by selected guidelines
Source (local type):
name: Unique source identifier (derived from path or custom via--name)type: Must be"local"path: Absolute path to local directoryguidelines: List of selected guidelines from this sourceprompts: List of prompts referenced by selected guidelines
Guideline:
name: Guideline identifierfile: Relative path to guideline file (from source root)description: Brief descriptionapplicable_scenarios: List of scenarios where guideline appliesprompts: List of prompt names referenced by this guideline
Prompt:
name: Prompt identifierfile: Relative path to prompt file (from source root)description: Brief description
When you don't specify --name, DNASpec automatically derives a source name:
From git URL:
https://github.com/company/dna-guidelines.git→dna-guidelinesgit@github.com:company/my-patterns.git→my-patterns
From local path:
/Users/me/my-dna-patterns→my-dna-patterns/path/to/Company_DNA→company-dna
Names are sanitized to lowercase with hyphens, removing special characters.
After running dnaspec update-agents, your DNA guidelines become available to AI coding assistants through generated files.
Generated files:
CLAUDE.md- Contains managed block with guideline references.claude/commands/dnaspec/<source-name>-<prompt-name>.md- Slash commands for each prompt
Usage:
- Claude Code automatically reads
CLAUDE.mdwhen assisting in your project - Use slash commands to trigger guideline-based reviews:
/dnaspec-<source>-<prompt> - Claude will reference the appropriate guidelines when executing prompts
Example:
Type: /dnaspec-company-dna-code-review
Claude will review your code against the guidelines in:
@/dnaspec/company-dna/guidelines/go-style.md
Generated files:
AGENTS.md- Contains managed block with guideline references.github/prompts/dnaspec-<source-name>-<prompt-name>.prompt.md- Copilot prompts
Usage:
- GitHub Copilot reads prompts from
.github/prompts/automatically - Invoke prompts in Copilot Chat
- Copilot will apply the guidelines specified in the prompts
Problem: You ran dnaspec init but a configuration file already exists.
Solution:
- If you want to keep the existing file, use
dnaspec addto add more sources - If you want to start fresh, rename or delete the existing file first:
mv dnaspec.yaml dnaspec.yaml.bak dnaspec init
Problem: You're trying to add a source with a name that's already in your configuration.
Solution: Use the --name flag to specify a different name:
dnaspec add --git-repo https://github.com/company/dna --name company-dna-v2Problem: Unable to clone the git repository.
Solutions:
- Network issues: Check your internet connection
- Authentication: For private repositories, ensure you have SSH keys set up or use HTTPS with credentials
- Invalid URL: Verify the repository URL is correct
- Timeout: Large repositories may timeout; try using
--git-refto specify a tag/branch
Problem: The source directory doesn't contain a valid DNASpec manifest.
Solution:
- Verify you're pointing to the correct repository/directory
- Check that the repository is actually a DNA guidelines repository
- If you're a maintainer, run
dnaspec manifest initin that directory first
Problem: You specified a guideline with --guideline that doesn't exist in the source.
Solution:
- Remove the
--guidelineflag to see all available guidelines interactively - Check the source's manifest for correct guideline names
- Fix any typos in the guideline name
Problem: Unable to copy files to your project directory.
Solutions:
- Permission denied: Check that you have write permissions in the current directory
- Disk full: Ensure you have sufficient disk space
- Path too long: On Windows, file paths might exceed maximum length
Problem: The repository clone operation took longer than 5 minutes.
Solutions:
- Check your network connection
- Try cloning the repository manually first to diagnose issues
- For very large repositories, consider using a local directory instead:
git clone https://github.com/company/dna /tmp/dna dnaspec add /tmp/dna
Problem: You ran dnaspec update-agents but haven't added any DNA sources yet.
Solution:
- If you want to use DNA guidelines, add at least one DNA source first:
dnaspec add --git-repo https://github.com/company/dna-guidelines
- If you've intentionally removed all sources,
update-agentswill automatically clean up any existing DNASPEC blocks from AGENTS.md and CLAUDE.md
Problem: Unable to create agent configuration directories (.claude/commands/, .github/prompts/).
Solutions:
- Permission denied: Check that you have write permissions in the current directory
- Path conflicts: Ensure no files exist with the same names as the directories
- Disk full: Ensure you have sufficient disk space
Problem: The managed block markers in AGENTS.md or CLAUDE.md are incomplete or malformed.
Solution:
- Manually fix the markers to ensure they appear in pairs:
<!-- DNASPEC:START --> ...content... <!-- DNASPEC:END -->
- Or delete the file and run
dnaspec update-agentsagain to regenerate it
# 1. Initialize project configuration
dnaspec init
# 2. Add DNA guidelines from company repo
dnaspec add --git-repo https://github.com/company/dna-guidelines --git-ref v1.0.0
# (Interactive: select guidelines)
# 3. Configure AI agents
dnaspec update-agents
# (Interactive: select Claude Code, GitHub Copilot)
# 4. Commit to version control
git add dnaspec.yaml dnaspec/ AGENTS.md CLAUDE.md .claude/ .github/
git commit -m "Add DNA guidelines"# Add company-wide guidelines
dnaspec add --git-repo https://github.com/company/dna --name company
# Add team-specific patterns
dnaspec add --git-repo https://github.com/team/patterns --name team
# Add local experimental guidelines
dnaspec add /Users/me/experimental-dna --name experimental
# Update agent files
dnaspec update-agents --no-ask# Option 1: Update specific source (interactive)
dnaspec update company
# (Shows interactive selection UI for guidelines)
# Option 2: Update all sources (non-interactive for CI/CD)
dnaspec sync
# (Updates all sources, regenerates agents)git add dnaspec.yaml dnaspec/ AGENTS.md CLAUDE.md .claude/ .github/ git commit -m "Update DNA guidelines to latest"
## Development
### Running Tests
```bash
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific test package
go test ./internal/core/validate/...
# Clone the repository
git clone https://github.com/hypernetix/dnaspec.git
cd dnaspec
# Build
go build -o dnaspec ./cmd/dnaspec
# Install
go install ./cmd/dnaspec