Back to Skills

context-methodology

verified

Knowledge about the context branch methodology for separating AI configuration from project code using git worktrees. Use when users ask about worktree structure, branch organization, or the separation of concerns pattern.

View on GitHub

Marketplace

iknite-cc-marketplace

iknite/claude-code-marketplace

Plugin

worktree-context

project-management

Repository

iknite/claude-code-marketplace

worktree-context/skills/context-methodology/SKILL.md

Last Verified

January 18, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/iknite/claude-code-marketplace/blob/main/worktree-context/skills/context-methodology/SKILL.md -a claude-code --skill context-methodology

Installation paths:

Claude
.claude/skills/context-methodology/
Powered by add-skill CLI

Instructions

# Context Branch Methodology

This skill provides knowledge about the **context branch methodology** - a pattern for separating AI assistant configuration from project source code using git worktrees.

## The Problem

When using AI coding assistants like Claude Code, projects accumulate:
- `CLAUDE.md` files with instructions
- `.claude/` directories with settings, commands, agents
- Custom hooks and configurations

These files:
1. Clutter project history with AI-specific commits
2. Mix tooling concerns with business logic
3. Create noise in code reviews
4. May contain sensitive prompts or configurations

## The Solution

Use **two independent git histories** in the same repository:

### Branch Structure

| Branch | Purpose | Contains |
|--------|---------|----------|
| `context` | AI configuration | CLAUDE.md, .claude/, settings |
| `main`/`master` | Project code | Source code, tests, docs |
| `feature/*` | Development | Feature work (descends from main/master) |

### Directory Layout

```
bare-repo/
└── root/
    ├── context/           # context branch worktree
    │   ├── CLAUDE.md      # AI instructions
    │   ├── .claude/       # Commands, agents, skills
    │   ├── .gitignore     # Contains: worktree/**/
    │   └── worktree/      # All code worktrees here
    │       ├── feature/
    │       │   └── my-feature/  # Feature branch worktree
    │       └── fix/
    │           └── bug-123/     # Bugfix branch worktree
    └── main/              # main/master branch (direct access, read-only)
```

### Key Insight

The `context` branch's `.gitignore` contains `worktree/**/`, so:
- Nested worktrees are invisible to context commits
- AI config and code remain in separate histories
- Claude Code runs from `context/`, sees both contexts

## Detecting the Default Branch

Repositories may use either `main` or `master` as their default branch. Always detect it:

```bash
# Method 1: From remote HEAD (most reliable if remote exists)
git symbolic-ref refs/remotes/origin/HEA

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
4444 chars