Skip to content
Skills Library
Programming · Tool integration

invoking-github

/invoking-github

Enables GitHub repository operations (read/write/commit/PR) for Claude.ai chat environments. Use when users request GitHub commits, repository updates, DEVLOG persistence, or cross-session state management via GitHub branches. Not needed in Claude Code (has native git access).

Licence
MIT
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
8
Scripts
2
HTML comments
0
URLs in SKILL.md
3
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 2 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/__init__.py, scripts/github_client.py

What it does and when to use it

Enables GitHub repository operations (read/write/commit/PR) for Claude.ai chat environments. Use when users request GitHub commits, repository updates, DEVLOG persistence, or cross-session state management via GitHub branches. Not needed in Claude Code (has native git access).

Original author description

Enables GitHub repository operations (read/write/commit/PR) for Claude.ai chat environments. Use when users request GitHub commits, repository updates, DEVLOG persistence, or cross-session state management via GitHub branches. Not needed in Claude Code (has native git access).

How it works

  1. When to Use This Skill
  2. Quick Start
  3. Core Functions
  4. Credential Configuration
  5. Integration with Iterating Skill
  6. Error Handling
  7. Best Practices
  8. Advanced Usage
  9. Limitations
  10. See Also
Original SKILL.md headings · 368 lines, 1,135 words
SKILL.md preview
---
name: invoking-github
description: Enables GitHub repository operations (read/write/commit/PR) for Claude.ai chat environments. Use when users request GitHub commits, repository updates, DEVLOG persistence, or cross-session state management via GitHub branches. Not needed in Claude Code (has native git access).
metadata:
  version: 0.1.0
---

# Invoking GitHub

Programmatically interact with GitHub repositories from Claude.ai chat: read files, commit changes, create PRs, and persist state across sessions.

## When to Use This Skill

**Not needed for:**
- Claude Code environments (use native git commands)
- Read-only repository access (use GitHub UI or API directly)

## Quick Start

### Prerequisites

Create a GitHub Personal Access Token and add to Project Knowledge:

1. Go to https://github.com/settings/tokens
2. Create new token (classic or fine-grained)
3. Required scopes: `repo` (or `public_repo` for public repos only)
4. In Claude.ai, add to Project Knowledge:
   - Title: `GITHUB_API_KEY`
   - Content: Your token (e.g., `ghp_abc123...`)

### Single File Commit

```python
from invoking_github import commit_file

result = commit_file(
    repo="username/repo-name",
    path="README.md",
    content="# Updated README\n\nNew content here...",
    branch="main",
    message="Update README with new instructions"
)

print(f"Committed: {result['commit_sha']}")
```

### Read File

```python
from invoking_github import read_file

content = read_file(
    repo="username/repo-name",
    path="config.json",
    branch="main"
)

print(content)
```

### Batch Commit (Multiple Files)

```python
from invoking_github import commit_files

files = [
    {"path": "src/main.py", "content": "# Python code..."},
    {"path": "README.md", "content": "# Updated docs..."},
    {"path": "tests/test.py", "content": "# Tests..."}
]

result = commit_files(
    repo="username/repo-name",
    files=files,
    branch="feature-branch",
    message="Add new feature implementation",
    create_branch_from="main"  # Create branch if it doesn't exist
)

print(f"Committed {len(files)} files: {result['commit_sha']}")
```

### Create Pull Request

```python
from invoking_github import create_pull_request

pr = create_pull_request(
    repo="username/repo-name",
    head="feature-branch",
    base="main",
    title="Add new feature",
    body="## Changes\n- Implemented feature X\n- Updated docs\n- Added tests"
)

print(f"PR created: {pr['html_url']}")
```

## Core Functions

### `read_file()`

Read a file from repository:

```python
read_file(
    repo: str,           # "owner/name"
    path: str,           # "path/to/file.py"
    branch: str = "main" # Branch name
) -> str
```

**Returns**: File content as string
**Raises**: `GitHubAPIError` if file not found or access denied

### `commit_file()`

Commit a single file (create or update):

```python
commit_file(
    repo: str,                      # "owner/name"
    path: str,                      # "path/to/file.py"
    content: str,                   # New file content
    branch: str,                    # Target branch
    message: str,                   # Commit message
    create_branch_from: str = None  # Create branch from this if doesn't exist
) -> dict
```

**Returns**: Dict with `commit_sha`, `branch`, `file_path`
**Raises**: `GitHubAPIError` on conflicts or auth failures

### `commit_files()`

Commit multiple files in a single commit:

```python
commit_files(
    repo: str,                      # "owner/name"
    files: list[dict],              # [{"path": "...", "content": "..."}]
    branch: str,                    # Target branch
    message: str,                   # Commit message
    create_branch_from: str = None  # Create branch from this if doesn't exist
) -> dict
```

**Returns**: Dict with `commit_sha`, `branch`, `files_committed`
**Raises**: `GitHubAPIError` on failures

**Note**: Uses Git Trees API for efficiency - atomic commit of all files.

### `create_pull_request()`

Create a pull request:

```python
create_pull_request(
    repo: str,      # "owner/name"
    head: str,      # Source branch (your changes)
    base: str,      # Target branch (where to merge)
    title: str,     # PR title
    body: str = ""  # PR description (supports markdown)
) -> dict
```

**Returns**: Dict with `number`, `html_url`, `state`
**Raises**: `GitHubAPIError` if branches invalid or PR exists

## Credential Configuration

This skill requires a GitHub Personal Access Token. Two configuration methods:

### Method 1: Project Knowledge (Recommended)

Best for Claude.ai chat users (mobile/web):

1. Create token at https://github.com/settings/tokens
2. In Claude.ai Project settings → Add to Project Knowledge
3. Create document titled `GITHUB_API_KEY`
4. Paste your token as content

**Permissions required**:
- Classic token: `repo` scope
- Fine-grained token: Repository permissions → Contents (read/write) and Pull requests (read/write)

### Method 2: API Credentials Skill (Fallback)

Alternatively, use combined credentials file:

1. Create `API_CREDENTIALS.json` in project knowledge
2. Add: `{"github_api_key": "ghp_your-token-here"}`

## Integration with Iterating Skill

Auto-persist DEVLOG.md to GitHub for cross-session continuity:

```python
# In your DEVLOG update function
from invoking_github import commit_file
from pathlib import Path

def update_devlog_with_sync(data, repo="user/project", branch="devlog"):
    """Update DEVLOG.md locally and sync to GitHub"""

    # Update local DEVLOG
    update_devlog(data)  # Your existing function

    # Auto-sync to GitHub
    try:
        devlog_content = Path("DEVLOG.md").read_text()

        result = commit_file(
            repo=repo,
            path="DEVLOG.md",
            content=devlog_content,
            branch=branch,
            message=f"DEVLOG: {data['title']}",
            create_branch_from="main"
        )

        print(f"✓ DEVLOG synced to GitHub ({repo}:{branch})")
        return result

    except Exception as e:
        print(f"⚠ DEVLOG sync failed: {e}")
        # Continue anyway - local DEVLOG.md still updated
        return None
```

**Benefits:**
- Automatic backup of session progress
- Cross-device access to development logs
- Git history of decisions and progress
- No manual copy/paste to Project Knowledge

See [references/iterating-integration.md](references/iterating-integration.md) for complete patterns.

## Error Handling

All functions raise `GitHubAPIError` with descriptive messages:

```python
from invoking_github import commit_file, GitHubAPIError

try:
    result = commit_file(
        repo="user/repo",
        path="file.py",
        content="...",
        branch="main",
        message="Update"
    )
except GitHubAPIError as e:
    if e.status_code == 404:
        print("Repository or branch not found")
    elif e.status_code == 401:
        print("Authentication failed - check your token")
    elif e.status_code == 403:
        print("Access denied - check token permissions")
    elif e.status_code == 409:
        print("Conflict - file was modified since last read")
    else:
        print(f"GitHub API error: {e}")
```

**Common errors:**
- **404**: Repository, branch, or file not found
- **401/403**: Invalid token or insufficient permissions
- **409**: Merge conflict (file changed concurrently)
- **422**: Validation error (invalid branch name, etc.)
- **Rate limit**: Too many requests (wait before retrying)

## Best Practices

1. **Use descriptive commit messages**
   - Bad: "Update files"
   - Good: "Add authentication middleware and update user routes"

2. **Batch commits when possible**
   - Use `commit_files()` for related changes
   - Single atomic commit = cleaner git history

3. **Create feature branches**
   - Don't commit directly to main
   - Use `create_branch_from="main"` parameter
   - Create PR for review

4. **Secure token management**
   - Use fine-grained tokens with minimal scopes
   - Set expiration dates
   - Rotate regularly
   - Never commit tokens to repositories

## Advanced Usage

### Conditional Commits

Only commit if file content changed:

```python
from invoking_github import read_file, commit_file, GitHubAPIError

try:
    current_content = read_file(repo, path, branch)
    if current_content != new_content:
        commit_file(repo, path, new_content, branch, "Update file")
    else:
        print("No changes detected, skipping commit")
except GitHubAPIError as e:
    if e.status_code == 404:
        # File doesn't exist, create it
        commit_file(repo, path, new_content, branch, "Create file")
    else:
        raise
```

### Session-Specific Branches

Avoid conflicts with unique branch names:

```python
import datetime

session_id = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
branch_name = f"devlog-{session_id}"

commit_file(
    repo="user/project",
    path="DEVLOG.md",
    content=devlog_content,
    branch=branch_name,
    message="Session progress",
    create_branch_from="main"
)
```

### Multi-Repository Workflows

Work across multiple repos:

```python
repos = ["user/frontend", "user/backend", "user/docs"]

for repo in repos:
    commit_file(
        repo=repo,
        path="VERSION",
        content="2.0.0\n",
        branch="release-2.0",
        message="Bump version to 2.0.0"
    )
```

## Limitations

- **Target environment**: Claude.ai chat only (not Claude Code)
- **No OAuth**: Must use Personal Access Tokens manually
- **No git operations**: Pure REST API (no clone, pull, rebase, etc.)
- **File size**: GitHub API limits ~100MB per file
- **Rate limits**: 5000 requests/hour for authenticated users
- **Network required**: All operations require internet access

## See Also

- [references/credential-setup.md](references/credential-setup.md) - Step-by-step credential guide
- [references/iterating-integration.md](references/iterating-integration.md) - DEVLOG auto-sync patterns
- [references/troubleshooting.md](references/troubleshooting.md) - Common issues and solutions
- [GitHub REST API Docs](https://docs.github.com/rest) - Official GitHub API reference

## Token Efficiency

This skill uses ~800 tokens when loaded but provides essential GitHub operations for claude.ai chat environments where native git access isn't available. Enables persistent state management and cross-session workflows.
Files in this package (8)
  • CHANGELOG.md 1 KB
  • README.md 1 KB
  • SKILL.md 10 KB
  • references/credential-setup.md 7 KB
  • references/iterating-integration.md 13 KB
  • references/troubleshooting.md 10 KB
  • scripts/__init__.py 1 KB
  • scripts/github_client.py 16 KB

Versions

The database has no other skills named invoking-github.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 0d4344395fac (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90github-code
    Work with GitHub repositories, source code, branches, commits, pull requests, reviews, diffs, CI, and repository credentials. Use for implementation, source investigation, clone/fetch/branch workflows, PR creation or updates, review feedback, GitHub Actions checks, and…
  • 100github-integration
    GitHub App authentication and repository workflow - installation tokens, repo import, working branches, safe file commits, pull request creation, webhook signature verification, protected branch handling, and CI status reading. Use when touching repository import, git operations, PRs, or webhooks.
  • 100github-workflow
    GitHub workflow automation — branching, committing, pushing, pull requests, issues, and code review. Use when asked to commit, push, create PRs/branches/issues, or manage git workflow.
  • 90github-repository-management
    通过 GitHub MCP 管理仓库协作时使用,例如检索仓库、提 Issue、起草或创建 PR、查看评论、回复评审和做合并前检查。当用户要操作 GitHub 仓库协作流程而不是修改本地代码实现时优先使用。
  • 95github-api
    GitHub API integration with managed OAuth. Access repositories, issues, pull requests, commits, branches, and users. Use this skill when users want to interact with GitHub repositories, manage issues and PRs, search code, or automate workflows. For other third party apps, use…
  • 100create-pr
    Create Git branches, commits, pushes, and GitHub pull requests for Next.js. Use when the user asks to create a branch, commit current changes, open a PR or draft PR, publish a pull request, or recover from gh pr create / PR template issues. Covers…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.