Skip to main content

When to Use This Skill

✅ Use when:

  • Creating new GitHub repository for CODITECT submodule
  • Configuring git remote tracking for existing repository
  • Setting up repository settings (description, topics, visibility)
  • Adding repository to coditect-ai organization
  • Configuring branch protection and collaboration settings

❌ Don't use when:

  • Repository already exists on GitHub (use verification instead)
  • Only need local git operations (use git commands directly)
  • Working with non-GitHub version control (GitLab, Bitbucket)
  • Need to modify existing repository settings (use GitHub web UI)

Core Capabilities

1. Repository Creation via GitHub CLI

Automates GitHub repository creation using gh CLI:

  • Creates repository in coditect-ai organization
  • Sets description, visibility (public/private)
  • Configures topics/tags for discoverability
  • Initializes with README if requested
  • Sets default branch (main)

2. Remote Configuration

Configures git remote tracking for submodule:

  • Adds GitHub remote as origin
  • Sets up tracking for main branch
  • Configures push/pull defaults
  • Verifies remote connectivity
  • Handles SSH vs HTTPS authentication

3. Repository Settings Management

Configures repository settings for CODITECT standards:

  • Enable/disable features (Issues, Wiki, Projects, Discussions)
  • Set repository visibility
  • Configure default branch
  • Add topics for organization
  • Set repository description

4. Collaboration Setup

Configures team access and collaboration:

  • Add repository to organization
  • Configure team permissions
  • Set up branch protection rules
  • Configure required reviews
  • Enable status checks

Usage Pattern

Step 1: Verify GitHub CLI Installation

Ensure GitHub CLI is installed and authenticated:

# Check gh CLI installed

## How to Use This Skill

1. Review the patterns and examples below
2. Apply the relevant patterns to your implementation
3. Follow the best practices outlined in this skill

gh --version

# Check authentication
gh auth status

# If not authenticated
gh auth login

Step 2: Create Repository on GitHub

Use GitHub CLI to create repository in organization:

# Create public repository
gh repo create coditect-ai/coditect-cloud-newservice \
--public \
--description "CODITECT cloud service for XYZ" \
--homepage "https://coditect.ai"

# Create private repository
gh repo create coditect-ai/coditect-labs-experiment \
--private \
--description "Research experiment for XYZ"

Step 3: Configure Local Git Remote

Add GitHub repository as remote in local submodule:

cd submodules/cloud/coditect-cloud-newservice

# Add remote
git remote add origin https://github.com/coditect-ai/coditect-cloud-newservice.git

# Verify remote
git remote -v

# Set upstream tracking
git push -u origin main

Step 4: Configure Repository Settings

Set repository metadata and features:

# Add topics
gh repo edit coditect-ai/coditect-cloud-newservice \
--add-topic coditect \
--add-topic cloud \
--add-topic microservices

# Update description
gh repo edit coditect-ai/coditect-cloud-newservice \
--description "Updated description"

# Enable/disable features
gh repo edit coditect-ai/coditect-cloud-newservice \
--enable-issues \
--disable-wiki

Step 5: Setup Branch Protection

Configure branch protection for main branch:

# Basic protection
gh api repos/coditect-ai/coditect-cloud-newservice/branches/main/protection \
-X PUT \
--field required_status_checks='{"strict":true,"contexts":["ci/tests"]}' \
--field enforce_admins=true \
--field required_pull_request_reviews='{"required_approving_review_count":1}'

Examples

See examples/ directory for:

  • create-repo.sh - Create repository with standard settings
  • batch-create-repos.sh - Create multiple repositories
  • configure-settings.sh - Apply standard repository settings

Templates

See templates/ directory for:

  • .github-settings.yml - Standard repository settings
  • .github-topics.txt - Standard topics by category
  • branch-protection.json - Branch protection configuration

Integration Points

Works with:

  • submodule-setup skill - Complete submodule initialization
  • submodule-validation skill - Verify GitHub configuration
  • GitHub CLI (gh) - Primary automation tool

Prerequisites:

  • GitHub CLI installed (brew install gh or equivalent)
  • Authenticated to GitHub (gh auth login)
  • Member of coditect-ai organization with repo creation permissions

Success Criteria

GitHub integration complete when:

  • Repository created on GitHub in coditect-ai organization
  • Local git remote configured to GitHub repository
  • Initial commit pushed to GitHub
  • Repository settings configured (description, topics, visibility)
  • Branch protection enabled on main branch
  • Repository visible in organization dashboard

Common Issues

GitHub CLI not installed:

# macOS
brew install gh

# Linux
sudo apt install gh # or equivalent for your distro

# Windows
winget install GitHub.cli

Authentication failed:

# Re-authenticate
gh auth logout
gh auth login

# Check status
gh auth status

Organization permission denied:

  • Ensure you're member of coditect-ai organization
  • Check with organization owner to grant repository creation permissions
  • Verify organization membership: gh api user/memberships/orgs

Repository already exists:

# Check if repository exists
gh repo view coditect-ai/repo-name

# If exists, use existing repo
git remote add origin https://github.com/coditect-ai/repo-name.git

Security Considerations

Repository Visibility:

  • Public: Open source, documentation, examples
  • Private: Proprietary code, internal tools, research

Access Control:

  • Use organization teams for access management
  • Apply least-privilege principle
  • Require 2FA for organization members
  • Enable branch protection on main branches

Secrets Management:

  • Never commit secrets to repository
  • Use GitHub Secrets for CI/CD
  • Rotate tokens regularly
  • Audit access logs

Advanced Usage

Batch Repository Creation

Create multiple repositories from configuration file:

# Read from repos.txt
while IFS=',' read -r name description topics; do
gh repo create "coditect-ai/$name" \
--public \
--description "$description"

# Add topics
for topic in $(echo "$topics" | tr '|' ' '); do
gh repo edit "coditect-ai/$name" --add-topic "$topic"
done
done < repos.txt

Repository Templates

Create new repositories from template:

# Use existing repo as template
gh repo create coditect-ai/new-service \
--template coditect-ai/service-template \
--public

Automated Settings Sync

Keep repository settings synchronized:

# Export settings from template repo
gh api repos/coditect-ai/template/topics > template-topics.json

# Apply to new repos
gh api repos/coditect-ai/new-repo/topics \
-X PUT \
--input template-topics.json
  • submodule-setup - Initialize submodule directory structure
  • submodule-validation - Verify GitHub integration
  • submodule-configuration - Manage repository configuration

Success Output

When successful, this skill MUST output:

✅ SKILL COMPLETE: github-integration

Completed:
- [x] GitHub repository created: coditect-ai/repo-name
- [x] Git remote configured and verified
- [x] Initial push successful to main branch
- [x] Repository settings applied (description, topics, visibility)
- [x] Branch protection enabled on main branch
- [x] Repository accessible at https://github.com/coditect-ai/repo-name

Outputs:
- Repository URL: https://github.com/coditect-ai/repo-name
- Local remote configured: origin → git@github.com:coditect-ai/repo-name.git
- Settings: 3 topics, public visibility, issues enabled
- Branch protection: required reviews (1), status checks enabled

Completion Checklist

Before marking this skill as complete, verify:

  • gh repo view coditect-ai/repo-name succeeds
  • git remote -v shows correct GitHub URL
  • git push origin main completes successfully
  • Repository visible on https://github.com/coditect-ai
  • Repository description matches project purpose
  • Topics/tags applied for discoverability
  • Branch protection prevents direct pushes to main
  • CI/CD workflows triggered on initial push (if configured)

Failure Indicators

This skill has FAILED if:

  • gh repo create returns permission denied or organization not found
  • gh auth status shows not authenticated to GitHub
  • git push fails with authentication or permission errors
  • ❌ Repository created but not visible in organization
  • ❌ Branch protection not applied or bypassable by admins
  • ❌ Repository settings (topics, description) not saved
  • ❌ Local git remote points to incorrect URL

When NOT to Use

Do NOT use github-integration when:

  • Repository already exists on GitHub (use verification/sync instead)
  • Working with non-GitHub VCS platforms (GitLab, Bitbucket, Azure DevOps)
  • Only need local git operations without remote (use git commands directly)
  • Automated repository creation would violate organization policies
  • Repository requires manual approval process before creation
  • Using GitHub Enterprise with different authentication flow

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Creating repo before local initializationConflicts, empty repo issuesInitialize local git first, then create remote
Not setting branch protectionAccidental force pushes, lost workAlways enable protection on main/production branches
Public repo with sensitive dataSecurity breach, compliance violationUse private visibility, scan for secrets first
Hardcoded GitHub tokensToken exposure, security riskUse gh auth login or environment variables
Skipping topics/descriptionPoor discoverability, unclear purposeSet metadata during creation, not as afterthought
No organization membership checkCreation fails late in processVerify gh api user/memberships/orgs first
Using HTTPS without credential helperRepeated password promptsUse SSH keys or configure credential helper

Principles

This skill embodies:

  • #5 Eliminate Ambiguity - Clear separation of local vs remote repository setup
  • #6 Clear, Understandable, Explainable - GitHub CLI provides transparent operation logging
  • #8 No Assumptions - Verify authentication and permissions before attempting creation
  • #9 Quality Over Speed - Proper branch protection prevents future incidents
  • #12 Separation of Concerns - Repository creation isolated from code development

Full Principles: CODITECT-STANDARD-AUTOMATION.md

  • submodule-orchestrator - Coordinates all submodule operations

GitHub CLI Reference

Common Commands:

# Repository operations
gh repo create <owner>/<repo> # Create repository
gh repo view <owner>/<repo> # View repository
gh repo edit <owner>/<repo> # Edit settings
gh repo delete <owner>/<repo> # Delete repository

# Remote operations
gh repo clone <owner>/<repo> # Clone repository
gh repo fork <owner>/<repo> # Fork repository

# Settings
gh repo edit --add-topic <topic> # Add topic
gh repo edit --description <desc> # Update description
gh repo edit --visibility <vis> # Change visibility

API Access:

# Raw API calls
gh api repos/<owner>/<repo> # Get repository info
gh api repos/<owner>/<repo>/topics # Get topics
gh api -X PUT ... # Update settings

Multi-Context Window Support

This skill supports long-running GitHub repository creation and configuration tasks across multiple context windows using Claude 4.5's enhanced state management capabilities.

State Tracking

Checkpoint State (JSON):

{
"github_integration_id": "gh_20251129_150000",
"phase": "repositories_created",
"repositories_created": [
{"name": "coditect-cloud-service-1", "url": "https://github.com/coditect-ai/coditect-cloud-service-1"},
{"name": "coditect-cloud-service-2", "url": "https://github.com/coditect-ai/coditect-cloud-service-2"}
],
"repositories_pending": [
"coditect-dev-tool-1",
"coditect-dev-tool-2"
],
"remote_configured": 2,
"remote_pending": 2,
"settings_applied": 0,
"branch_protection_enabled": 0,
"token_usage": 7200,
"created_at": "2025-11-29T15:00:00Z"
}

Progress Notes (Markdown):

# GitHub Integration Progress - 2025-11-29

## Completed
- Created coditect-cloud-service-1 (public) ✅
- Created coditect-cloud-service-2 (public) ✅
- Configured git remote for both repositories
- Initial push successful for both

## In Progress
- Repository settings pending (topics, descriptions)
- Branch protection not yet configured

## Next Actions
- Create coditect-dev-tool-1, coditect-dev-tool-2
- Configure repository settings (all 4)
- Enable branch protection (all 4)

Session Recovery

When starting a fresh context window after GitHub integration work:

  1. Load Checkpoint State: Read .coditect/checkpoints/github-integration-latest.json
  2. Review Progress Notes: Check github-integration-progress.md for status
  3. Verify Repositories Created: Use gh repo list to confirm
  4. Resume Pending Operations: Continue with uncreated repos or unconfigured settings
  5. Validate Integration: Check that all repositories accessible and configured

Recovery Commands:

# 1. Check latest checkpoint
cat .coditect/checkpoints/github-integration-latest.json | jq '.repositories_pending'

# 2. Review progress
tail -20 github-integration-progress.md

# 3. Verify created repositories
gh repo list coditect-ai --limit 100 | grep coditect-cloud

# 4. Check local git remotes
for sub in $(cat .coditect/checkpoints/github-integration-latest.json | jq -r '.repositories_created[].name'); do
cd submodules/*/$sub 2>/dev/null && git remote -v && cd ../../..
done

State Management Best Practices

Checkpoint Files (JSON Schema):

  • Store in .coditect/checkpoints/github-integration-{timestamp}.json
  • Track created vs pending repositories separately
  • Record configuration status (settings, topics, branch protection)
  • Include repository URLs for easy access

Progress Tracking (Markdown Narrative):

  • Maintain github-integration-progress.md with creation results
  • Document repository settings applied
  • Note any errors or issues with GitHub API
  • List next configuration steps

Git Integration:

  • Create repository on GitHub first
  • Configure local remote second
  • Push initial commit third
  • Apply settings and protection last (can be done in batch)

Progress Checkpoints

Natural Breaking Points:

  1. After each repository created
  2. After all repositories created
  3. After git remotes configured
  4. After repository settings applied
  5. After branch protection enabled

Checkpoint Creation Pattern:

# Automatic checkpoint creation after each repository or batch of 5
if repo_created or len(repositories_created) % 5 == 0:
create_checkpoint({
"phase": current_phase,
"repositories_created": created_list,
"repositories_pending": pending_list,
"settings_applied": settings_count,
"tokens": current_token_usage
})

Example: Multi-Context Batch Repository Creation

Context Window 1: Create First 10 Repositories

{
"checkpoint_id": "ckpt_gh_batch_part1",
"phase": "repositories_created",
"repositories_created": 10,
"repositories_pending": 31,
"remote_configured": 10,
"settings_applied": 0,
"next_action": "Create remaining 31 repositories",
"token_usage": 8000
}

Context Window 2: Remaining Repositories + Settings

# Resume from checkpoint
cat .coditect/checkpoints/ckpt_gh_batch_part1.json

# Continue creating remaining repositories
# (Context restored in 2 minutes vs 12 minutes from scratch)

{
"checkpoint_id": "ckpt_gh_batch_complete",
"phase": "all_configured",
"total_repositories": 41,
"all_settings_applied": true,
"branch_protection_enabled": 41,
"token_usage": 14000
}

Token Savings: 8000 (first context) + 14000 (second context) = 22000 total vs. 38000 without checkpoint = 42% reduction

Reference: See docs/CLAUDE-4.5-BEST-PRACTICES.md for complete multi-context window workflow guidance.