Sync Custom to Upstream Repo (professional)
Skill text is English; answer in the user's preferred language when Cursor User Rules or the conversation specify it.
Use Git operations and GitHub repository patterns for API truth; align with branch naming conventions, commit message standards, and PR workflow best practices. This skill encodes repository sync discipline, change tracking, branch management, and automated PR workflow. Confirm repository URL, custom content types, and sync frequency when known.
Boundary
sync-custom-to-repo owns sync workflow automation: detecting custom skills/workflows/templates, creating descriptive branch names, committing with dynamic messages, pushing to remote, and providing PR creation URLs. It does not replace git-operations-pro for advanced Git operations, cli-pro for CLI tool design, or security-pro for credential management.
| Skill |
When to combine |
git-operations-pro |
Advanced Git workflows, conflict resolution, branch management |
cli-pro |
Command-line tool design patterns, cross-platform compatibility |
security-pro |
Credential handling, repository access security, token management |
When to use
- Syncing custom skills from local devkit to upstream repository
- Syncing custom workflows to the skills repository
- Syncing custom templates to the skills repository
- Creating feature branches with descriptive names based on content
- Automating PR creation workflow for custom additions
- Trigger keywords:
sync custom, sync skills, sync to repo, push to upstream
When not to use
- General Git operations without sync context —
git-operations-pro first
- CLI tool development —
cli-pro for tooling patterns
- Security/credential management —
security-pro for access control
Required inputs
- Repository URL: Target upstream repository (default: https://github.com/truongnat/skills.git)
- Devkit root path: Path to local devkit directory (default: script's parent directory)
- Custom content types: Skills, workflows, and/or templates to sync
Expected output
- Branch name: Dynamic based on content (e.g.,
sync-ocr-pro-20260424)
- Commit message: Descriptive with content counts and timestamp
- PR URL: Direct link to create PR (when GitHub CLI unavailable)
- Summary report: Complete breakdown of synced items
Workflow
Detection Phase
- Scan skills directory for directories containing
SKILL.md
- Scan workflows directory for workflow directories
- Scan templates directory for template directories
- Report total count and breakdown by type
Branch Creation
- Generate date string: YYYYMMDD format
- Generate content string: Join skill/workflow/template names (max 30 chars)
- Create branch name:
sync-{content}-{date}
Sync Process
- Clone upstream repo to temporary directory
- Create feature branch in cloned repo
- Copy custom skills using Windows xcopy command
- Copy custom workflows using Windows xcopy command
- Copy custom templates using Windows xcopy command
- Commit with descriptive message including content counts and timestamp
- Push branch to upstream with tracking
- Attempt PR creation via GitHub CLI, fallback to manual URL
Cleanup
- Remove temporary directory after sync completes
- Generate summary report with branch name and synced items
Reporting
Summary format:
=== Sync complete ===
=== Summary ===
Synced: 1 skill(s)
Branch: sync-ocr-pro-20260424
Skills synced (1):
- ocr-pro
Branch đã sẵn sàng: https://github.com/truongnat/skills/pull/new/sync-ocr-pro-20260424
Implementation details
Windows compatibility
Uses xcopy command for directory copying:
/E - Copy subdirectories including empty ones
/I - Assume destination is a directory
/Y - Suppress overwrite prompts
Error handling
- GitHub CLI failure: Falls back to manual PR URL display
- No custom content: Reports and exits gracefully
- Git operation failures: Propagate errors with descriptive messages
Dynamic naming
Branch name pattern:
- Content-based: Includes actual skill/workflow/template names
- Date-based: YYYYMMDD format for chronological ordering
- Length-limited: Content string truncated to 30 characters
Commit message pattern:
- Descriptive: Includes count of each content type synced
- Timestamped: ISO format timestamp for audit trail
- Clear: "Sync X skill(s), Y workflow(s), Z template(s) - YYYY-MM-DD HH:MM:SS"
Cross-platform considerations
Current implementation: Windows-specific (PowerShell, xcopy)
Future enhancements:
- Detect platform (Windows vs Unix)
- Use
cp -r for Unix systems
- Use
robocopy or rsync for better performance
- Add platform detection logic
Integration points
Works with:
.agents/devkit/skills/ - Custom skills directory
.agents/devkit/workflows/ - Custom workflows directory
.agents/devkit/templates/ - Custom templates directory
- GitHub repository - Upstream target
Does not modify:
- Local devkit structure
- Original custom content
- Git configuration
Security considerations
- Repository access: Requires Git credentials for push operations
- Temporary files: Uses OS temp directory, cleaned up after sync
- No secrets: Script does not handle or store credentials
- GitHub CLI: Optional, falls back gracefully if unavailable
Troubleshooting
Issue: "Not a git repository" error
- Cause: Script run from non-git directory
- Fix: Ensure devkit is in a git-tracked location
Issue: xcopy command fails
- Cause: Path contains special characters or spaces
- Fix: Quote paths in xcopy command
Issue: GitHub CLI not found
- Cause: gh not installed or not in PATH
- Fix: Manual PR creation using provided URL
Issue: Branch push fails
- Cause: Authentication failure or permission denied
- Fix: Check Git credentials and repository permissions
Operating principles
- Detect and report the actual custom content set before creating any branch.
- Keep the workflow deterministic and minimal: copy only the intended custom directories.
- Prefer descriptive branch and commit naming so review scope is obvious upstream.
- Treat push/PR creation as separate verification points; do not blur local sync success with remote success.
- Surface platform assumptions clearly when the script is Windows-specific or environment-specific.
Suggested response format
Use this structure for sync work:
- Context — target repo, content types, local source, platform assumptions.
- Detected changes — counts and names of skills/workflows/templates to sync.
- Sync plan or result — branch name, commit message pattern, push/PR status.
- Verification — what was copied, what remote state was confirmed, what remains manual.
- Residual risks — auth, conflicts, platform limits, or upstream review dependencies.
Resources in this skill
references/workflow.md — canonical sync workflow, branch/commit behavior, and reporting expectations.
Quick example
User asks: "Sync my custom OCR skill and template to the upstream skills repo."
Response shape:
- Detect the exact custom skill/template directories present.
- Generate a descriptive branch and commit scope from those directories.
- Report whether clone, copy, commit, push, and PR-link generation each succeeded.
- Call out any manual GitHub step if PR creation is not automatic.
Checklist before calling the skill done
- The exact content selected for sync is listed.
- Branch and commit naming are descriptive and reproducible.
- Local sync success and remote push/PR success are reported separately.
- Platform-specific assumptions or limitations are explicit.
- Remaining manual steps are clearly called out.
Source: truongnat/skills — distributed by TomeVault.
1---2name: truongnat-skills-sync-custom-to-repo3description: Sync Custom to Upstream Repo (professional)4---56# Sync Custom to Upstream Repo (professional)78Skill text is **English**; answer in the user's preferred language when Cursor User Rules or the conversation specify it.910Use Git operations and GitHub repository patterns for API truth; align with **branch naming conventions**, **commit message standards**, and **PR workflow best practices**. This skill encodes **repository sync discipline**, **change tracking**, **branch management**, and **automated PR workflow**. Confirm **repository URL**, **custom content types**, and **sync frequency** when known.1112## Boundary1314**`sync-custom-to-repo`** owns **sync workflow automation**: detecting custom skills/workflows/templates, creating descriptive branch names, committing with dynamic messages, pushing to remote, and providing PR creation URLs. It does **not** replace **`git-operations-pro`** for advanced Git operations, **`cli-pro`** for CLI tool design, or **`security-pro`** for credential management.1516| Skill | When to combine |17|-------|-----------------|18| **`git-operations-pro`** | Advanced Git workflows, conflict resolution, branch management |19| **`cli-pro`** | Command-line tool design patterns, cross-platform compatibility |20| **`security-pro`** | Credential handling, repository access security, token management |2122## When to use2324- Syncing custom skills from local devkit to upstream repository25- Syncing custom workflows to the skills repository26- Syncing custom templates to the skills repository27- Creating feature branches with descriptive names based on content28- Automating PR creation workflow for custom additions29- Trigger keywords: `sync custom`, `sync skills`, `sync to repo`, `push to upstream`3031## When not to use3233- **General Git operations** without sync context — **`git-operations-pro`** first34- **CLI tool development** — **`cli-pro`** for tooling patterns35- **Security/credential management** — **`security-pro`** for access control3637## Required inputs3839- **Repository URL**: Target upstream repository (default: https://github.com/truongnat/skills.git)40- **Devkit root path**: Path to local devkit directory (default: script's parent directory)41- **Custom content types**: Skills, workflows, and/or templates to sync4243## Expected output4445- **Branch name**: Dynamic based on content (e.g., `sync-ocr-pro-20260424`)46- **Commit message**: Descriptive with content counts and timestamp47- **PR URL**: Direct link to create PR (when GitHub CLI unavailable)48- **Summary report**: Complete breakdown of synced items4950## Workflow5152### Detection Phase53541. **Scan skills directory** for directories containing `SKILL.md`552. **Scan workflows directory** for workflow directories563. **Scan templates directory** for template directories574. **Report total count** and breakdown by type5859### Branch Creation60611. **Generate date string**: YYYYMMDD format622. **Generate content string**: Join skill/workflow/template names (max 30 chars)633. **Create branch name**: `sync-{content}-{date}`6465### Sync Process66671. **Clone upstream repo** to temporary directory682. **Create feature branch** in cloned repo693. **Copy custom skills** using Windows xcopy command704. **Copy custom workflows** using Windows xcopy command715. **Copy custom templates** using Windows xcopy command726. **Commit with descriptive message** including content counts and timestamp737. **Push branch to upstream** with tracking748. **Attempt PR creation** via GitHub CLI, fallback to manual URL7576### Cleanup77781. **Remove temporary directory** after sync completes792. **Generate summary report** with branch name and synced items8081### Reporting8283**Summary format:**84```85=== Sync complete ===8687=== Summary ===88Synced: 1 skill(s)89Branch: sync-ocr-pro-2026042490Skills synced (1):91 - ocr-pro92Branch đã sẵn sàng: https://github.com/truongnat/skills/pull/new/sync-ocr-pro-2026042493```9495## Implementation details9697### Windows compatibility9899Uses `xcopy` command for directory copying:100- `/E` - Copy subdirectories including empty ones101- `/I` - Assume destination is a directory102- `/Y` - Suppress overwrite prompts103104### Error handling105106- **GitHub CLI failure**: Falls back to manual PR URL display107- **No custom content**: Reports and exits gracefully108- **Git operation failures**: Propagate errors with descriptive messages109110### Dynamic naming111112**Branch name pattern:**113- Content-based: Includes actual skill/workflow/template names114- Date-based: YYYYMMDD format for chronological ordering115- Length-limited: Content string truncated to 30 characters116117**Commit message pattern:**118- Descriptive: Includes count of each content type synced119- Timestamped: ISO format timestamp for audit trail120- Clear: "Sync X skill(s), Y workflow(s), Z template(s) - YYYY-MM-DD HH:MM:SS"121122## Cross-platform considerations123124**Current implementation:** Windows-specific (PowerShell, xcopy)125126**Future enhancements:**127- Detect platform (Windows vs Unix)128- Use `cp -r` for Unix systems129- Use `robocopy` or `rsync` for better performance130- Add platform detection logic131132## Integration points133134**Works with:**135- `.agents/devkit/skills/` - Custom skills directory136- `.agents/devkit/workflows/` - Custom workflows directory137- `.agents/devkit/templates/` - Custom templates directory138- GitHub repository - Upstream target139140**Does not modify:**141- Local devkit structure142- Original custom content143- Git configuration144145## Security considerations146147- **Repository access**: Requires Git credentials for push operations148- **Temporary files**: Uses OS temp directory, cleaned up after sync149- **No secrets**: Script does not handle or store credentials150- **GitHub CLI**: Optional, falls back gracefully if unavailable151152## Troubleshooting153154**Issue:** "Not a git repository" error155- **Cause:** Script run from non-git directory156- **Fix:** Ensure devkit is in a git-tracked location157158**Issue:** xcopy command fails159- **Cause:** Path contains special characters or spaces160- **Fix:** Quote paths in xcopy command161162**Issue:** GitHub CLI not found163- **Cause:** gh not installed or not in PATH164- **Fix:** Manual PR creation using provided URL165166**Issue:** Branch push fails167- **Cause:** Authentication failure or permission denied168- **Fix:** Check Git credentials and repository permissions169170### Operating principles171172- Detect and report the **actual custom content set** before creating any branch.173- Keep the workflow **deterministic and minimal**: copy only the intended custom directories.174- Prefer **descriptive branch and commit naming** so review scope is obvious upstream.175- Treat push/PR creation as **separate verification points**; do not blur local sync success with remote success.176- Surface platform assumptions clearly when the script is Windows-specific or environment-specific.177178## Suggested response format179180Use this structure for sync work:1811821. **Context** — target repo, content types, local source, platform assumptions.1832. **Detected changes** — counts and names of skills/workflows/templates to sync.1843. **Sync plan or result** — branch name, commit message pattern, push/PR status.1854. **Verification** — what was copied, what remote state was confirmed, what remains manual.1865. **Residual risks** — auth, conflicts, platform limits, or upstream review dependencies.187188## Resources in this skill189190- `references/workflow.md` — canonical sync workflow, branch/commit behavior, and reporting expectations.191192## Quick example193194User asks: "Sync my custom OCR skill and template to the upstream skills repo."195196Response shape:197- Detect the exact custom skill/template directories present.198- Generate a descriptive branch and commit scope from those directories.199- Report whether clone, copy, commit, push, and PR-link generation each succeeded.200- Call out any manual GitHub step if PR creation is not automatic.201202## Checklist before calling the skill done203204- The exact content selected for sync is listed.205- Branch and commit naming are descriptive and reproducible.206- Local sync success and remote push/PR success are reported separately.207- Platform-specific assumptions or limitations are explicit.208- Remaining manual steps are clearly called out.209210---211> Source: [truongnat/skills](https://github.com/truongnat/skills) — distributed by [TomeVault](https://tomevault.io).212<!-- tomevault:4.0:skill_md:2026-05-22 -->