Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Coverage: 60% of projects already have CI configured
4. Project Type Detection Caching (200 token savings)
Problem: Re-detecting framework and test commands on every run
Solution: Cache project analysis results
Cache Structure:
{"projectType":"nodejs","framework":"nextjs","testCmd":"npm test","lintCmd":"npm run lint","buildCmd":"npm run build","packageManager":"npm","cachedAt":"2026-01-27T10:00:00Z","gitConfigHash":"abc123..."}
Problem: Using Edit tool for multiple find-replace operations
Solution: Pure bash sed commands for placeholder substitution
Implementation:
sed -i "s|TEST_CMD_PLACEHOLDER|$TEST_CMD|g" .github/workflows/ci.yml
sed -i "s|LINT_CMD_PLACEHOLDER|$LINT_CMD|g" .github/workflows/ci.yml
sed -i "s|BUILD_CMD_PLACEHOLDER|$BUILD_CMD|g" .github/workflows/ci.yml
Savings: 100 tokens (no Edit tool invocations)
Benefit: Atomic file generation with single Bash call
Performance Comparison
Scenario
Unoptimized
Optimized
Savings
New CI setup (GitHub Actions)
2,500
800
68%
New CI setup (GitLab CI)
2,800
900
68%
Existing CI detected (early exit)
2,000
300
85%
Subsequent runs (cached)
2,000
600
70%
Multiple platforms comparison
3,500
1,500
57%
Average across all scenarios
2,560
820
68%
Real-World Distribution:
40% - New CI setup (first-time configuration)
35% - Existing CI detected (verification/update)
25% - Subsequent runs with cache (enhancements)
Effective Savings: 68% reduction vs. unoptimized baseline
Implementation Details
Early Exit Check:
# Phase 0: Check for existing CI (50 tokens)if [ -f ".github/workflows/ci.yml" ] || [ -f ".github/workflows/main.yml" ]; thenecho"⚠️ GitHub Actions CI already configured"echo"Existing workflow: .github/workflows/ci.yml"read -p "Overwrite existing configuration? (yes/no): " overwrite
if [ "$overwrite" != "yes" ]; thenecho"CI setup cancelled. Use /deploy-validate to verify existing pipeline."exit 0
fifi
Cache Integration:
# Load or create cache (100 tokens with cache hit)
CACHE_FILE=".claude/cache/ci/platform-config.json"mkdir -p .claude/cache/ci
if [ -f "$CACHE_FILE" ]; then# Validate cache age and file hash
CACHED_AT=$(jq -r '.cachedAt'"$CACHE_FILE")
CACHE_AGE=$(( $(date +%s) - $(date -d "$CACHED_AT" +%s) ))
if [ $CACHE_AGE -lt 604800 ]; then# Cache valid, load values
PROJECT_TYPE=$(jq -r '.projectType'"$CACHE_FILE")
TEST_CMD=$(jq -r '.testCmd'"$CACHE_FILE")
LINT_CMD=$(jq -r '.lintCmd'"$CACHE_FILE")
BUILD_CMD=$(jq -r '.buildCmd'"$CACHE_FILE")
echo"✓ Using cached project configuration"fielse# Detect and cache
detect_project_type
save_cache
fi
{"version":"1.0.0","projectType":"nodejs","framework":"nextjs","testCmd":"npm test","lintCmd":"npm run lint","buildCmd":"npm run build","packageManager":"npm","hasDocker":false,"hasTypeScript":true,"nodeVersion":"20.x","pythonVersion":null,"ciPlatform":"github","gitRemote":"git@github.com:user/repo.git","cachedAt":"2026-01-27T10:00:00Z","packageJsonHash":"abc123...","gitConfigHash":"def456..."}
Invalidation Triggers:
Age > 7 days
package.json modified (hash mismatch)
.git/config modified (platform change)
Manual invalidation via rm -rf .claude/cache/ci/
Shared Cache: Other skills can read this cache:
/test - Reuse test command detection
/deploy-validate - Reuse build command and platform info
/release-automation - Reuse CI platform for release workflows
/e2e-generate - Reuse project type for E2E test setup
Validation Approach
1. Generated Config Validation (No Additional Tokens)
Bash-based YAML/JSON syntax validation before writing
# Generate status badge for READMEecho""echo"=== CI Status Badge ==="echo""echo"Add this badge to your README.md:"echo""case$CI_PLATFORMin
github)
REPO_PATH=$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')
echo"[](https://github.com/$REPO_PATH/actions/workflows/ci.yml)"
;;
gitlab)
PROJECT_PATH=$(git remote get-url origin | sed 's/.*gitlab.com[:/]\(.*\)\.git/\1/')
echo"[](https://gitlab.com/$PROJECT_PATH/-/commits/main)"
;;
circle)
echo"[](https://circleci.com/gh/USERNAME/REPO)"
;;
esac
Summary
echo""echo"=== CI/CD Setup Complete! ==="echo""echo"✓ Platform: $CI_PLATFORM"echo"✓ Project type: $PROJECT_TYPE"echo"✓ Configuration created"echo""echo"📋 Pipeline stages:"echo" 1. Lint: Code quality checks"echo" 2. Test: Automated testing"echo" 3. Build: Compile/bundle application"echo""echo"🚀 Next steps:"echo" 1. Commit CI configuration:"echo" git add .github/ .gitlab-ci.yml .circleci/"echo" git commit -m 'ci: Add CI/CD pipeline'"echo" git push"echo" 2. Verify pipeline runs successfully"echo" 3. Configure deployment with /deploy-validate"echo" 4. Add security scanning with /dependency-audit"echo""echo"💡 Pro tips:"echo" - Run 'npm test' locally before pushing"echo" - Use '/test' skill for intelligent test execution"echo" - Add E2E tests with '/e2e-generate'"echo" - Monitor build times and optimize as needed"
Integration Points
/deploy-validate - Add deployment validation to pipeline
/test - Run tests locally before CI
/dependency-audit - Add security scanning to CI
/e2e-generate - Add E2E tests to CI pipeline
Important Git Safety:
This skill NEVER modifies git credentials
This skill NEVER adds AI attribution to CI configs
All commits use your existing git configuration
Credits: CI/CD patterns based on industry best practices from GitHub Actions, GitLab CI, and CircleCI documentation.