cfn-deployment

Automated skill deployment pipeline for CFN Loop integration

14 stars

Best use case

cfn-deployment is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Automated skill deployment pipeline for CFN Loop integration

Teams using cfn-deployment should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/deployment/SKILL.md --create-dirs "https://raw.githubusercontent.com/masharratt/claude-flow-novice/main/.claude/skills/cfn-deployment-lifecycle/lib/deployment/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/deployment/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cfn-deployment Compares

Feature / Agentcfn-deploymentStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Automated skill deployment pipeline for CFN Loop integration

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

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

### Advanced Deployment

```bash
# 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 --deployed-by=admin@example.com

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

## Integration with TypeScript

```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

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

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

## Deployment History

```typescript
// 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:

```typescript
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:

```sql
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):

```typescript
// 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:

```bash
# 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:

```bash
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**:
```bash
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

- [Skill Validator](../../src/services/skill-validator.ts) - Validation logic
- [Skill Versioning](../../src/services/skill-versioning.ts) - Version management
- [Database Service](../../src/lib/database-service/) - Database abstraction
- [Integration Plan](../../docs/DATABASE_QUERY_ABSTRACTION.md) - Overall architecture

## 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

Related Skills

We are still matching the closest adjacent skills for this page. In the meantime, continue through the full directory.