Back to Skills

cfn-deployment

masharratt
Updated Today
15 views
9
1
9
View on GitHub
Metadeploymentautomationskillspipeline

About

This skill provides an automated deployment pipeline that transitions approved skills to production with atomic database transactions. It ensures safe deployments through validation, version management, and rollback capabilities. Use it when you need to reliably deploy skills from APPROVED to DEPLOYED state with full audit trails.

Documentation


name: cfn-deployment version: 1.0.0 description: Automated skill deployment pipeline for CFN Loop integration author: Task 1.1 Implementation Team dependencies: [] tags: [deployment, automation, skills, pipeline]

CFN Deployment Skill

Automated skill deployment pipeline that transitions approved skills from APPROVED → DEPLOYED state with atomic cross-database transactions, validation, and rollback capability.

Purpose

This skill enables CFN Loop agents to deploy skills to production through a fully automated pipeline that ensures:

  • Validation before deployment
  • Atomic transactions across databases
  • Automatic version management
  • Comprehensive audit trail
  • Rollback capability on failure

Usage

Basic Deployment

# Deploy a skill from approved directory
./scripts/deploy-approved-skills.sh .claude/skills/authentication

Advanced Deployment

# Deploy with explicit version
./scripts/deploy-approved-skills.sh .claude/skills/authentication --version=2.0.0

# Deploy with user attribution
./scripts/deploy-approved-skills.sh .claude/skills/authentication [email protected]

# Skip validation (admin only, dangerous)
./scripts/deploy-approved-skills.sh .claude/skills/authentication --skip-validation

Integration with TypeScript

import { DatabaseService } from './src/lib/database-service';
import { SkillDeploymentPipeline } from './src/services/skill-deployment';

const dbService = new DatabaseService({
  sqlite: {
    type: 'sqlite',
    database: './data/cfn-loop.db',
  },
});

await dbService.connect();

const pipeline = new SkillDeploymentPipeline(dbService);

const result = await pipeline.deploySkill({
  skillPath: '.claude/skills/authentication',
  deployedBy: 'system',
});

if (result.success) {
  console.log(`Deployed: ${result.skillName} v${result.version}`);
} else {
  console.error(`Deployment failed: ${result.error}`);
}

await dbService.disconnect();

Validation Checks

Before deployment, the pipeline validates:

  1. Content Path: Skill directory exists with required files
  2. Schema Compliance: SKILL.md frontmatter is valid
  3. Name Uniqueness: No existing skill with same name
  4. Version Conflict: Version doesn't already exist
  5. Execute Script: execute.sh is executable
  6. Tests: test.sh exists and is executable (warning only)

Deployment Workflow

APPROVED → DEPLOYING → DEPLOYED (success)
                     → FAILED (validation/error)
                     → ROLLED_BACK (rollback triggered)

Atomic Deployment

Deployment is atomic across:

  • SQLite Skills DB (skills table)
  • SQLite Audit Trail (deployment_audit table)

All operations succeed or all are rolled back.

Rollback

// Rollback a deployment
const success = await pipeline.rollbackDeployment(deploymentId);

if (success) {
  console.log('Deployment rolled back successfully');
}

Deployment History

// Get deployment history for a skill
const history = await pipeline.getDeploymentHistory('authentication', 10);

history.forEach(audit => {
  console.log(`${audit.deployed_at}: ${audit.from_status} → ${audit.to_status}`);
});

Error Handling

The pipeline provides detailed error messages:

const result = await pipeline.deploySkill({ skillPath: '/invalid/path' });

if (!result.success) {
  console.error('Error:', result.error);

  if (result.validationResult) {
    result.validationResult.errors.forEach(err => {
      console.error(`- ${err.code}: ${err.message}`);
    });
  }
}

Audit Trail

All deployment operations are recorded in the deployment_audit table:

SELECT
  skill_id,
  from_status,
  to_status,
  version,
  success,
  deployed_by,
  deployed_at,
  error_message
FROM deployment_audit
WHERE skill_id = 'skill-authentication-1.0.0-1234567890'
ORDER BY deployed_at DESC;

Security Considerations

  • Validation Required: Always validate skills before deployment (use --skip-validation sparingly)
  • User Attribution: Track who deployed each skill via --deployed-by parameter
  • Version Control: Prevent version conflicts through automatic checking
  • Rollback Capability: Recover from failed deployments quickly

Performance

  • Deployment completes in <1 second for typical skills
  • Validation adds ~200ms overhead
  • Database transaction commits are atomic and fast

Integration Points

Phase 4 Workflow Patterns

The deployment pipeline integrates with Phase 4 workflow patterns (future enhancement):

// Future: Deploy to PostgreSQL workflow_patterns table
const tx = await dbService.executeTransaction([
  {
    database: 'sqlite',
    operation: async (adapter) => {
      return adapter.insert('skills', { ... });
    },
  },
  {
    database: 'postgres',
    operation: async (adapter) => {
      return adapter.insert('workflow_patterns', {
        skill_id: skillId,
        version: version,
        status: 'DEPLOYED',
      });
    },
  },
]);

CFN Loop Integration

CFN coordinators can use this skill to automate skill deployment:

# In CFN Loop coordinator agent
SKILL_PATH=".claude/skills/new-skill"

if [[ -f "$SKILL_PATH/SKILL.md" ]]; then
  ./scripts/deploy-approved-skills.sh "$SKILL_PATH" --deployed-by="cfn-coordinator"
  echo "Skill deployed successfully"
fi

Monitoring Dashboard (Future)

Planned dashboard features:

  • Recent deployments
  • Success/failure rate
  • Deployment timeline
  • Version history
  • Failed deployment analysis

Testing

Comprehensive test coverage (95%+) ensures:

  • Validation logic correctness
  • Atomic transaction behavior
  • Rollback functionality
  • Error handling
  • Edge case coverage

Run tests:

npm test -- tests/skill-deployment.test.ts

Troubleshooting

Deployment Fails with "Name Not Unique"

Problem: Skill with same name already exists

Solution: Either:

  • Choose a different skill name
  • Archive the existing skill
  • Update the existing skill instead of creating new one

Deployment Fails with "Version Conflict"

Problem: Version already exists for this skill

Solution: Either:

  • Use auto-versioning (don't specify --version)
  • Specify a different explicit version
  • Increment version in SKILL.md frontmatter

Validation Fails with "Execute Script Not Executable"

Problem: execute.sh doesn't have execute permissions

Solution:

chmod +x .claude/skills/your-skill/execute.sh

Database Connection Error

Problem: SQLite database not accessible

Solution:

  • Check database path exists
  • Verify file permissions
  • Ensure database is not locked

Related Documentation

Future Enhancements

  • PostgreSQL workflow_patterns integration
  • Deployment webhooks/notifications
  • Automated rollback on health check failures
  • A/B deployment testing
  • Deployment dashboard UI
  • Git integration for deployment commits

Quick Install

/plugin add https://github.com/masharratt/claude-flow-novice/tree/main/cfn-deployment

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

masharratt/claude-flow-novice
Path: .claude/skills/cfn-deployment

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

Algorithmic Art Generation

Meta

This skill helps developers create algorithmic art using p5.js, focusing on generative art, computational aesthetics, and interactive visualizations. It automatically activates for topics like "generative art" or "p5.js visualization" and guides you through creating unique algorithms with features like seeded randomness, flow fields, and particle systems. Use it when you need to build reproducible, code-driven artistic patterns.

View skill

business-rule-documentation

Meta

This skill provides standardized templates for systematically documenting business logic and domain knowledge following Domain-Driven Design principles. It helps developers capture business rules, process flows, decision trees, and terminology glossaries to maintain consistency between requirements and implementation. Use it when documenting domain models, creating business rule repositories, or bridging communication between business and technical teams.

View skill

huggingface-accelerate

Development

HuggingFace Accelerate provides the simplest API for adding distributed training to PyTorch scripts with just 4 lines of code. It offers a unified interface for multiple distributed training frameworks like DeepSpeed, FSDP, and DDP while handling automatic device placement and mixed precision. This makes it ideal for developers who want to quickly scale their PyTorch training across multiple GPUs or nodes without complex configuration.

View skill