Context driven development

From oimiragieo/agent-studio · View interactive version

Context driven development is an AI agent skill from the GitHub repository oimiragieo/agent-studio. Context-Driven Development methodology - treating project context as managed artifacts alongside code for consistent AI interactions and team alignment.

How to use this skill

Skill file

Context-Driven Development

Guide for implementing and maintaining context as a managed artifact alongside code, enabling consistent AI interactions and team alignment through structured project documentation.

When to Use This Skill

Core Philosophy

Context-Driven Development treats project context as a first-class artifact managed alongside code. Instead of relying on ad-hoc prompts or scattered documentation, establish a persistent, structured foundation that informs all AI interactions.

Key principles:

  1. Context precedes code: Define what you're building and how before implementation
  2. Living documentation: Context artifacts evolve with the project
  3. Single source of truth: One canonical location for each type of information
  4. AI alignment: Consistent context produces consistent AI behavior

The Workflow

Follow the Context → Spec & Plan → Implement workflow:

  1. Context Phase: Establish or verify project context artifacts exist and are current
  2. Specification Phase: Define requirements and acceptance criteria for work units
  3. Planning Phase: Break specifications into phased, actionable tasks
  4. Implementation Phase: Execute tasks following established workflow patterns

Artifact Relationships

product.md - Defines WHAT and WHY

Purpose: Captures product vision, goals, target users, and business context.

Contents:

Update when:

product-guidelines.md - Defines HOW to Communicate

Purpose: Establishes brand voice, messaging standards, and communication patterns.

Contents:

Update when:

tech-stack.md - Defines WITH WHAT

Purpose: Documents technology choices, dependencies, and architectural decisions.

Contents:

Update when:

workflow.md - Defines HOW to Work

Purpose: Establishes development practices, quality gates, and team workflows.

Contents:

Update when:

tracks.md - Tracks WHAT'S HAPPENING

Purpose: Registry of all work units with status and metadata.

Contents:

Update when:

Context Maintenance Principles

Keep Artifacts Synchronized

Ensure changes in one artifact reflect in related documents:

Update tech-stack.md When Adding Dependencies

Before adding any new dependency:

  1. Check if existing dependencies solve the need
  2. Document the rationale for new dependencies
  3. Add version constraints
  4. Note any configuration requirements

Update product.md When Features Complete

After completing a feature track:

  1. Move feature from "planned" to "implemented" in product.md
  2. Update any affected success metrics
  3. Document any scope changes from original plan

Verify Context Before Implementation

Before starting any track:

  1. Read all context artifacts
  2. Flag any outdated information
  3. Propose updates before proceeding
  4. Confirm context accuracy with stakeholders

Greenfield vs Brownfield Handling

Greenfield Projects (New)

For new projects:

  1. Create all artifacts interactively
  2. Answer questions about product vision, tech preferences, and workflow
  3. Generate initial style guides for chosen languages
  4. Create empty tracks registry

Characteristics:

Brownfield Projects (Existing)

For existing codebases:

  1. Analyze existing code, configs, and documentation
  2. Pre-populate artifacts based on discovered patterns
  3. Review and refine generated context
  4. Reconcile existing patterns with desired patterns

Characteristics:

Benefits

Team Alignment

AI Consistency

Institutional Memory

Quality Assurance

Directory Structure

.claude/context/
├── product.md            # Product vision and goals
├── product-guidelines.md # Communication standards
├── tech-stack.md         # Technology preferences
├── workflow.md           # Development practices
├── tracks.md             # Work unit registry
└── tracks/
    └── <track-id>/
        ├── spec.md
        ├── plan.md
        ├── metadata.json
        └── index.md

Context Lifecycle

  1. Creation: Initial setup
  2. Validation: Verify before each track
  3. Evolution: Update as project grows
  4. Synchronization: Keep artifacts aligned
  5. Archival: Document historical decisions

Context Validation Checklist

Before starting implementation on any track, validate context:

Product Context

Technical Context

Workflow Context

Track Context

Common Anti-Patterns

Avoid these context management mistakes:

Stale Context

Problem: Context documents become outdated and misleading.

Solution: Update context as part of each track's completion process.

Context Sprawl

Problem: Information scattered across multiple locations.

Solution: Use the defined artifact structure; resist creating new document types.

Implicit Context

Problem: Relying on knowledge not captured in artifacts.

Solution: If you reference something repeatedly, add it to the appropriate artifact.

Context Hoarding

Problem: One person maintains context without team input.

Solution: Review context artifacts in pull requests; make updates collaborative.

Over-Specification

Problem: Context becomes so detailed it's impossible to maintain.

Solution: Keep artifacts focused on decisions that affect AI behavior and team alignment.

Integration with Development Tools

IDE Integration

Configure your IDE to display context files prominently:

Git Hooks

Consider pre-commit hooks that:

CI/CD Integration

Include context validation in pipelines:

Session Continuity

Support multi-session development through context persistence:

Starting a New Session

  1. Read product.md to orient yourself
  2. Check tracks.md for active work
  3. Review relevant track's plan.md for current task
  4. Verify context artifacts are current

Ending a Session

  1. Update plan.md with current progress
  2. Note any blockers or decisions made
  3. Commit in-progress work with clear status
  4. Update tracks.md if status changed

Handling Interruptions

If interrupted mid-task:

  1. Mark task as [~] with note about stopping point
  2. Commit work-in-progress to feature branch
  3. Document any uncommitted decisions in plan.md

Best Practices

  1. Read context first: Always read relevant artifacts before starting work
  2. Small updates: Make incremental context changes, not massive rewrites
  3. Link decisions: Reference context when making implementation choices
  4. Version context: Commit context changes alongside code changes
  5. Review context: Include context artifact reviews in code reviews
  6. Validate regularly: Run context validation checklist before major work
  7. Communicate changes: Notify team when context artifacts change significantly
  8. Preserve history: Use git to track context evolution over time
  9. Question staleness: If context feels wrong, investigate and update
  10. Keep it actionable: Every context item should inform a decision or behavior

Iron Laws

  1. ALWAYS read all relevant context artifacts (product.md, tech-stack.md, workflow.md) before starting any implementation track — never begin coding against stale or unverified context.
  2. NEVER create a new artifact type or document location when an existing category in the defined directory structure already fits — resist context sprawl.
  3. ALWAYS update context artifacts atomically with code changes in the same commit — context updates in separate PRs create drift and stale references.
  4. NEVER let any context file exceed 20KB without rotating or archiving — unbounded growth makes context unusable and slows AI interactions.
  5. ALWAYS flag stale or contradictory context before implementation — an outdated tech-stack.md or wrong product.md is technical debt that compounds with every AI interaction.

Memory Protocol (MANDATORY)

Before starting:

cat .claude/context/memory/learnings.md

After completing:

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.