git-protocol

Git protocol implementation patterns using gitoxide for Guts repository operations

242 stars

Best use case

git-protocol is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Git protocol implementation patterns using gitoxide for Guts repository operations

Git protocol implementation patterns using gitoxide for Guts repository operations

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "git-protocol" skill to help with this workflow task. Context: Git protocol implementation patterns using gitoxide for Guts repository operations

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/git-protocol/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/abdelstark/git-protocol/SKILL.md"

Manual Installation

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

How git-protocol Compares

Feature / Agentgit-protocolStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Git protocol implementation patterns using gitoxide for Guts repository operations

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.

SKILL.md Source

# Git Protocol Skill for Guts

You are implementing Git-compatible repository operations using gitoxide (gix).

## Gitoxide Overview

Gitoxide is a pure-Rust Git implementation. Key crates:

- `gix`: High-level Git operations
- `gix-object`: Git object types
- `gix-hash`: Object ID handling
- `gix-pack`: Pack file operations
- `gix-transport`: Git protocol transport

## Repository Operations

### Opening/Creating Repositories

```rust
use gix::Repository;
use std::path::Path;

pub async fn open_or_create(path: &Path) -> Result<Repository> {
    match gix::open(path) {
        Ok(repo) => Ok(repo),
        Err(_) => {
            // Create new bare repository
            gix::init_bare(path)?
        }
    }
}
```

### Working with Objects

```rust
use gix::ObjectId;
use gix::object::Kind;

pub struct ObjectStore {
    repo: Repository,
}

impl ObjectStore {
    pub fn get_object(&self, id: &ObjectId) -> Result<Object> {
        let object = self.repo.find_object(id)?;

        match object.kind {
            Kind::Blob => self.decode_blob(object),
            Kind::Tree => self.decode_tree(object),
            Kind::Commit => self.decode_commit(object),
            Kind::Tag => self.decode_tag(object),
        }
    }

    pub fn write_blob(&self, data: &[u8]) -> Result<ObjectId> {
        let id = self.repo.write_blob(data)?;
        Ok(id)
    }
}
```

### Commits

```rust
use gix::actor::Signature;

pub struct CommitBuilder<'a> {
    repo: &'a Repository,
    tree: ObjectId,
    parents: Vec<ObjectId>,
    message: String,
    author: Signature,
}

impl<'a> CommitBuilder<'a> {
    pub fn new(repo: &'a Repository) -> Self {
        let now = gix::date::Time::now_local_or_utc();
        let default_sig = Signature {
            name: "Guts User".into(),
            email: "user@guts.local".into(),
            time: now,
        };

        Self {
            repo,
            tree: ObjectId::null(),
            parents: vec![],
            message: String::new(),
            author: default_sig,
        }
    }

    pub fn tree(mut self, tree: ObjectId) -> Self {
        self.tree = tree;
        self
    }

    pub fn parent(mut self, parent: ObjectId) -> Self {
        self.parents.push(parent);
        self
    }

    pub fn message(mut self, msg: impl Into<String>) -> Self {
        self.message = msg.into();
        self
    }

    pub fn commit(self) -> Result<ObjectId> {
        let commit = gix::objs::CommitRef {
            tree: self.tree,
            parents: self.parents.into(),
            author: self.author.clone(),
            committer: self.author,
            encoding: None,
            message: self.message.into(),
            extra_headers: vec![],
        };

        let id = self.repo.write_object(&commit)?;
        Ok(id)
    }
}
```

## Git Protocol Implementation

### Smart HTTP Protocol

```rust
use axum::{Router, routing::post, extract::Path};

pub fn git_http_router() -> Router {
    Router::new()
        .route("/:owner/:repo/git-upload-pack", post(upload_pack))
        .route("/:owner/:repo/git-receive-pack", post(receive_pack))
        .route("/:owner/:repo/info/refs", get(info_refs))
}

async fn upload_pack(
    Path((owner, repo)): Path<(String, String)>,
    body: Bytes,
) -> Result<impl IntoResponse> {
    let repo = get_repository(&owner, &repo).await?;

    // Parse want/have lines
    let request = parse_upload_pack_request(&body)?;

    // Generate packfile with requested objects
    let packfile = generate_packfile(&repo, &request).await?;

    Ok((
        [(header::CONTENT_TYPE, "application/x-git-upload-pack-result")],
        packfile,
    ))
}

async fn receive_pack(
    Path((owner, repo)): Path<(String, String)>,
    body: Bytes,
) -> Result<impl IntoResponse> {
    let repo = get_repository(&owner, &repo).await?;

    // Parse commands and packfile
    let (commands, packfile) = parse_receive_pack(&body)?;

    // Verify permissions
    verify_push_permissions(&owner, &repo).await?;

    // Apply packfile
    apply_packfile(&repo, &packfile).await?;

    // Update refs
    for cmd in commands {
        update_ref(&repo, &cmd).await?;
    }

    Ok((
        [(header::CONTENT_TYPE, "application/x-git-receive-pack-result")],
        "ok\n",
    ))
}
```

### Pack File Generation

```rust
use gix::pack;

pub async fn generate_packfile(
    repo: &Repository,
    wants: &[ObjectId],
    haves: &[ObjectId],
) -> Result<Vec<u8>> {
    // Find all objects to include
    let objects = repo.rev_walk(wants)
        .sorting(Sorting::ByCommitTimeNewestFirst)
        .ancestors()
        .filter(|id| !haves.contains(id))
        .collect::<Vec<_>>();

    // Create pack file
    let mut pack_data = Vec::new();
    let mut writer = pack::data::output::bytes::Writer::new(&mut pack_data);

    for oid in objects {
        let object = repo.find_object(oid)?;
        writer.write_entry(object)?;
    }

    writer.finish()?;

    Ok(pack_data)
}
```

## Reference Management

```rust
pub struct RefStore {
    repo: Repository,
}

impl RefStore {
    pub fn list_refs(&self) -> Result<Vec<(String, ObjectId)>> {
        let refs = self.repo.references()?;

        refs.all()?
            .map(|r| {
                let r = r?;
                Ok((r.name().to_string(), r.target().id()))
            })
            .collect()
    }

    pub fn update_ref(&self, name: &str, new_id: ObjectId, old_id: Option<ObjectId>) -> Result<()> {
        let ref_log_message = format!("guts: update {}", name);

        if let Some(old) = old_id {
            // Atomic compare-and-swap
            self.repo
                .reference(name, new_id, PreviousValue::MustExistAndMatch(old.into()))?;
        } else {
            // Create new ref
            self.repo
                .reference(name, new_id, PreviousValue::MustNotExist)?;
        }

        Ok(())
    }

    pub fn get_head(&self) -> Result<ObjectId> {
        let head = self.repo.head_commit()?;
        Ok(head.id)
    }
}
```

## Guts Extensions to Git

```rust
/// Extended commit with Guts-specific metadata
#[derive(Debug, Clone)]
pub struct GutsCommit {
    /// Standard Git commit
    pub git_commit: gix::Commit,

    /// Ed25519 signature of commit hash
    pub signature: Signature,

    /// Signer's public key
    pub signer: PublicKey,

    /// Consensus round when commit was accepted
    pub consensus_round: Option<u64>,
}

impl GutsCommit {
    pub fn verify(&self) -> Result<bool> {
        let commit_hash = self.git_commit.id.as_bytes();
        self.signer.verify(commit_hash, &self.signature)
    }
}
```

Related Skills

protocol-reverse-engineering

242
from aiskillstore/marketplace

Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation. Use when analyzing network traffic, understanding proprietary protocols, or debugging network communication.

defi-protocol-templates

242
from aiskillstore/marketplace

Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.

data-structure-protocol

242
from aiskillstore/marketplace

Give agents persistent structural memory of a codebase — navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.

harness-model-protocol

242
from aiskillstore/marketplace

Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding/decoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.

protocolsio-integration

242
from aiskillstore/marketplace

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

daem0nmcp-protocol

242
from aiskillstore/marketplace

Use when Daem0nMCP tools are available - enforces the sacred covenant (commune at session start, seek counsel before changes, inscribe decisions, seal outcomes)

verification-protocol

242
from aiskillstore/marketplace

Independent verification of task completion - eliminates self-attestation

azure-quotas

242
from aiskillstore/marketplace

Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".

DevOps & Infrastructure

raindrop-io

242
from aiskillstore/marketplace

Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.

Data & Research

zlibrary-to-notebooklm

242
from aiskillstore/marketplace

自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。

discover-skills

242
from aiskillstore/marketplace

当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。

web-performance-seo

242
from aiskillstore/marketplace

Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.