This skill provides context and examples for the enforced development workflow.

0 stars
0 forks
JavaScript
1 views

SKILL.md

Workflow Best Practices

Overview

This skill provides context and examples for the enforced development workflow. The workflow is physically enforced by the workflow-enforcer MCP server.

The Mandatory Workflow

You MUST follow this exact sequence:

  1. Start Issueworkflow_start_issue
  2. Write Code → Use normal file tools
  3. Run Testsworkflow_run_tests
  4. Commitworkflow_commit (only after tests pass)
  5. Deployworkflow_deploy
  6. Verify Productionworkflow_verify_prod
  7. Close Issueworkflow_close_issue

Why This Workflow Exists

Why Start with an Issue?

  • Ensures all work is tracked
  • Provides context for code reviewers
  • Links commits to requirements
  • Enables better project management

Why Run Tests Before Commit?

  • Prevents broken code from entering the repository
  • Catches regressions early
  • Maintains code quality standards
  • Saves time debugging later

Why Verify in Production?

  • Integration tests don't catch everything
  • Real-world data behaves differently
  • Network, latency, and scaling issues appear in prod
  • Confirms the actual problem is solved

Common Scenarios

Scenario 1: Tests Fail

You: workflow_run_tests
MCP: ❌ Tests failed! [output]

CORRECT RESPONSE:
1. Analyze the test failure
2. Fix the code
3. Run workflow_run_tests again
4. DO NOT try to commit

WRONG RESPONSE:
- "I'll commit anyway and fix it later" ❌
- Trying to use git commit directly ❌

Scenario 2: Forgot to Start Issue

You: *writes code*
You: workflow_run_tests
MCP: ❌ No active issue. Use workflow_start_issue first.

CORRECT RESPONSE:
1. Use workflow_start_issue with the issue number
2. Then proceed with testing

This happens because you skipped step 1.

Scenario 3: Production Tests Fail

You: workflow_verify_prod
MCP: ❌ Production tests failed!

CORRECT RESPONSE:
1. Investigate the prod failure
2. Fix the code locally
3. Run workflow_run_tests
4. workflow_commit with fix
5. workflow_deploy again
6. workflow_verify_prod again

The issue remains open until prod tests pass.

Scenario 4: No Active Issue

You: workflow_commit("Fix bug")
MCP: ❌ Cannot commit. Current state: NO_ACTIVE_ISSUE

CORRECT RESPONSE:
1. Use workflow_start_issue first
2. Then write your code
3. Then run tests
4. Then commit

You cannot commit without an active issue.

Tool Reference

workflow_status

Use this when confused about what to do next.

Shows:

  • Current workflow state
  • Active issue number
  • Available next actions

Example:

workflow_status
→ State: TESTS_PASSED
  Active Issue: #42
  Available: workflow_commit

workflow_start_issue

Always use this FIRST before any coding.

Parameters:

  • issue_number: The GitHub issue number

Example:

workflow_start_issue({ issue_number: 123 })

This verifies the issue exists and is open via GitHub CLI.

workflow_run_tests

Always use this after writing or changing code.

Parameters:

  • test_command (optional): Custom test command (default: npm test)

Examples:

workflow_run_tests()
workflow_run_tests({ test_command: "yarn test" })
workflow_run_tests({ test_command: "./run-tests.sh" })

Don't skip this even if you think your code is perfect.

workflow_commit

Only available after tests pass.

Parameters:

  • message: Commit message (issue reference is auto-added)

Example:

workflow_commit({ message: "Add user authentication feature" })

This will automatically add "Refs #123" to your commit.

workflow_deploy

Only available after commit.

Parameters:

  • environment (optional): Target environment (default: production)

Example:

workflow_deploy()
workflow_deploy({ environment: "staging" })

Looks for deploy scripts in this order:

  1. ./deploy.sh
  2. ./scripts/deploy.sh
  3. npm run deploy

workflow_verify_prod

REQUIRED after deploy.

Parameters:

  • test_command (optional): Custom prod test (default: npm run test:prod)

Examples:

workflow_verify_prod()
workflow_verify_prod({ test_command: "curl https://myapp.com/health" })

workflow_close_issue

Only available after prod tests pass.

No parameters needed.

Example:

workflow_close_issue()

This closes the GitHub issue with a comment about the verified deployment.

Anti-Patterns to Avoid

❌ The Optimist

"The code looks good, I'll just commit it." → NO. Run tests. Always.

❌ The Bypasser

"I'll just use git commit directly." → Won't work. The MCP enforces workflow_commit only.

❌ The Apologizer

"Sorry, I forgot to run tests. I'll commit and fix it later." → The workflow prevents this. Just run the tests now.

❌ The Skipper

"Production tests take too long, let's just close the issue." → Cannot close until prod tests pass. This is intentional.

❌ The Multi-Tasker

"I'll work on issue #123 and #124 at the same time." → One issue at a time. Close the current one first.

Integration with Other Tools

You still have access to:

  • Normal file editing (str_replace, create_file, etc.)
  • bash_tool for other commands
  • Regular development tools
  • view for reading files

The workflow tools only enforce the commit/deploy/close gates.

State Machine Reference

NO_ACTIVE_ISSUE
    ↓ workflow_start_issue
ISSUE_ACTIVE
    ↓ workflow_run_tests
TESTS_FAILED ←┐ (fix code and retry)
    ↓          │
TESTS_PASSED   │
    ↓ workflow_commit
COMMITTED
    ↓ workflow_deploy
DEPLOYED
    ↓ workflow_verify_prod
PROD_VERIFIED
    ↓ workflow_close_issue
NO_ACTIVE_ISSUE (ready for next issue)

Troubleshooting

"I'm stuck in TESTS_FAILED state"

Fix your code, then run workflow_run_tests again.

"I want to abandon this issue"

Close it manually via GitHub, then the workflow will reset. Or fix the tests.

"Can I work on multiple issues at once?"

No. One issue at a time. Close the current one first.

"The MCP server isn't responding"

  1. Check if it's loaded: run workflow_status
  2. Check Claude Code logs for errors
  3. Verify the MCP server is in your config
  4. Restart Claude Code

"Tests are taking too long"

You can override the test command:

workflow_run_tests({ test_command: "npm test -- --fast" })

But don't skip tests entirely.

Success Pattern

workflow_start_issue({ issue_number: 123 })
→ ✅ Started issue #123

*write code using str_replace, create_file, etc.*

workflow_run_tests()
→ ✅ Tests passed

workflow_commit({ message: "Add feature X" })
→ ✅ Committed

workflow_deploy()
→ ✅ Deployed

workflow_verify_prod()
→ ✅ Prod tests passed

workflow_close_issue()
→ 🎉 Issue #123 closed

This is the happy path. Follow it.

Error Recovery

If tests fail

  1. Read the error output
  2. Fix the code
  3. Run workflow_run_tests again
  4. Don't try to commit

If deployment fails

  1. Check the deployment logs
  2. Fix the deployment script or configuration
  3. Commit any fixes needed
  4. Run workflow_deploy again

If prod tests fail

  1. DO NOT CLOSE THE ISSUE
  2. Investigate the prod failure (could be a real bug)
  3. Fix the code locally
  4. Run through the full workflow again:
    • workflow_run_tests
    • workflow_commit
    • workflow_deploy
    • workflow_verify_prod

When to Check Status

Use workflow_status when:

  • You're unsure what to do next
  • You forgot where you are in the workflow
  • You want to verify the active issue number
  • The MCP gives you an error you don't understand

Remember

The MCP server makes it impossible to:

  • Commit without an active issue
  • Commit without passing tests
  • Deploy without committing
  • Close an issue without verifying in production

These are not suggestions. These are enforced constraints.

Work with the workflow, not against it.

README

Workflow Compliance Enforcer MCP

License: MIT MCP

Enforce client-mandated development workflows with audit trails, state persistence, and compliance reporting.

A Model Context Protocol (MCP) server designed for enterprise, government, and regulated industries where development workflows are non-negotiable and compliance is critical.

Why This Exists

In enterprise consulting and government contracts, clients often mandate strict development workflows:

  • ✅ Tests must pass before commit
  • ✅ Code must be deployed before issue close
  • ✅ Production must be verified
  • ✅ Audit trail must exist for compliance

This MCP server enforces those workflows and provides proof of compliance.

Features

🔒 Compliance-First

  • State Persistence - Workflow survives Claude Code restarts
  • Audit Trails - Automatic compliance reports with timestamps
  • Pre-flight Checks - Validates required scripts before starting
  • Time Tracking - Duration tracking for all steps

🎯 Workflow Management

  • Visual Progress - Real-time workflow visualization
  • Multiple Templates - Different workflows for different tasks
  • Resume Capability - Pick up where you left off after crashes
  • Better Errors - Actionable suggestions for common issues

⚙️ Configurable

  • Per-Project Config - Different workflows for different projects
  • Deployment Methods - Git-push, script-based, or manual
  • Verification Strategies - Smoke test, script, manual, or none
  • Strict/Lenient Modes - Enforce or warn

Quick Start

Installation

  1. Clone and build:
git clone https://github.com/scarter4work/workflow-compliance-enforcer.git
cd workflow-compliance-enforcer
npm install
npm run build
  1. Add to Claude Code MCP config (~/.claude/mcp.json):
{
  "mcpServers": {
    "workflow-enforcer": {
      "command": "node",
      "args": ["/path/to/workflow-compliance-enforcer/build/index.js"]
    }
  }
}
  1. Restart Claude Code

Configuration

Create .workflow-enforcer.json in your project root:

{
  "mode": "strict",
  "template": "full-deployment",
  "test_command": "npm test",
  "deploy_method": "git-push",
  "production_verification": "script",
  "production_test_command": "npm run test:prod"
}

Usage

Basic Workflow

// 1. Start work on an issue
workflow_start_issue({ issue_number: 42 })

// 2. Write your code, then run tests
workflow_run_tests()

// 3. Commit (only works after tests pass)
workflow_commit({ message: "fix: resolve authentication bug" })

// 4. Deploy to production
workflow_deploy()

// 5. Verify production
workflow_verify_prod()

// 6. Close issue and generate audit report
workflow_close_issue()

Resume After Crash

// If Claude Code crashes mid-workflow
workflow_start_issue({ issue_number: 42, resume: true })
// Picks up exactly where you left off!

Check Progress

workflow_status({ detailed: true })

Output:

📊 Workflow Status:

State: TESTS_PASSED
Active Issue: #42 - Fix authentication bug
Commit: None

📋 Workflow Progress (full-deployment):

✅ 1. Start Issue (workflow_start_issue)
✅ 2. Run Tests (workflow_run_tests)
⏳ 3. Commit Changes (workflow_commit) ← YOU ARE HERE
⬜ 4. Deploy to Production (workflow_deploy)
⬜ 5. Verify Production (workflow_verify_prod)
⬜ 6. Close Issue (workflow_close_issue)

Available actions:
  - workflow_commit

Workflow Templates

Full Deployment (default)

For production features requiring full release cycle:

  1. Start Issue → 2. Run Tests → 3. Commit → 4. Deploy → 5. Verify → 6. Close

Tests Only

For internal changes that don't need deployment:

  1. Start Issue → 2. Run Tests → 3. Commit → 4. Close

Docs Only

For documentation changes:

  1. Start Issue → 2. Commit → 3. Close

Audit Reports

Every completed workflow generates an audit report:

📊 Workflow Completion Report - Issue #42
======================================================================

Issue: Fix authentication bug
Started: 2025-11-16T12:00:00.000Z
Completed: 2025-11-16T12:45:30.000Z
Duration: 0h 45m 30s

Steps Completed:
✅ Start Issue           - 2025-11-16T12:00:00.000Z
✅ Run Tests             - 2025-11-16T12:15:00.000Z (12450ms)
✅ Commit Changes        - 2025-11-16T12:20:00.000Z
✅ Deploy to Production  - 2025-11-16T12:35:00.000Z (145000ms)
✅ Verify Production     - 2025-11-16T12:43:00.000Z (8200ms)
✅ Close Issue           - 2025-11-16T12:45:30.000Z

Commits:
- a1b2c3d: fix: resolve authentication bug

Attestation: All required workflow steps completed successfully.
Signed: workflow-enforcer v2.0.0

Saved to .workflow/reports/issue-42-report.md for compliance purposes.

Configuration Options

Option Values Description
mode strict, lenient Strict = enforced; Lenient = warnings
template full-deployment, tests-only, docs-only Workflow to use
test_command string Test command (default: npm test)
deploy_method git-push, script, manual How to deploy
production_verification smoke-test, script, manual, none How to verify

See WORKFLOW_ENFORCER_V2.md for complete documentation.

Use Cases

Enterprise Client

{
  "mode": "strict",
  "template": "full-deployment",
  "deploy_method": "manual",
  "production_verification": "manual"
}

Manual gates for deployment and verification with full audit trail.

CI/CD Automation

{
  "mode": "strict",
  "template": "full-deployment",
  "deploy_method": "git-push",
  "production_verification": "smoke-test",
  "production_url": "https://api.example.com/health"
}

Automated deployment with quick smoke test verification.

Internal Development

{
  "mode": "lenient",
  "template": "tests-only"
}

Skip deployment for internal changes, but still enforce tests.

Available Tools

  • workflow_start_issue - Begin work with pre-flight checks
  • workflow_run_tests - Run test suite with duration tracking
  • workflow_commit - Commit code (only after tests pass)
  • workflow_deploy - Deploy to production
  • workflow_verify_prod - Verify production deployment
  • workflow_close_issue - Close issue and generate audit report
  • workflow_status - Check current workflow state
  • workflow_config - View/update configuration

Requirements

  • Node.js 18+
  • GitHub CLI (gh) for issue management
  • Claude Code with MCP support

Comparison: v1.0 vs v2.0

Feature v1.0 v2.0
State Persistence
Pre-flight Checks
Workflow Visualization
Audit Reports
Configuration ❌ Hardcoded ✅ Per-project
Templates ❌ One size fits all ✅ 3 templates
Error Messages ⚠️ Generic ✅ Actionable
Time Tracking
Resume Capability

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

For major changes, please open an issue first.

License

MIT License - see LICENSE file for details.

Support

Acknowledgments

Built with Model Context Protocol by Anthropic.


Built for compliance. Designed for real-world client workflows.