sam-fakhreddine

wfc-init

Performs FIRST-TIME initialization of the WFC (Workflow Control) framework for projects without an existing .wfc/ directory. This skill identifies programming languages by file extension and generates a .wfc/config.json with fixed tool mappings (black/ruff for Python, prettier/eslint for JS/TS, gofmt/golangci-lint for Go, rustfmt/clippy for Rust, google-java-format/checkstyle for Java, rubocop for Ruby, dotnet-format for C#), plus Makefile targets for running quality checks. TRIGGER INTENT: Use ONLY for greenfield WFC setup when no .wfc/ directory exists. Key phrases: "/wfc-init", "initialize WFC", "set up WFC for this project". DO NOT USE if .wfc/ already exists (use wfc-configure), or if the user wants standalone formatter/linter setup without WFC framework integration.

sam-fakhreddine 5 Updated 3mo ago
GitHub

Install

npx skillscat add sam-fakhreddine/wfc/wfc-init

Install via the SkillsCat registry.

SKILL.md

WFC-INIT - Project Initialization

One-command setup for WFC quality tools in any project.

What It Does

  1. Identifies languages by scanning for file extensions (.py, .js, .ts, .go, .rs, .java, .rb, .cs)
  2. Assigns standard tools per language (see Language Support table below)
  3. Generates .wfc/config.json at project root
  4. Creates Makefile targets for quality-check, format, and lint (appends if Makefile exists)
  5. Optionally creates .pre-commit-config.yaml (requires --pre-commit flag)

Prerequisites

  • Current directory or specified path must exist
  • Must NOT contain .wfc/ directory (if exists, use wfc-configure)
  • Must NOT contain wfc.config.json at root (legacy config; delete before init)

Usage

/wfc-init                          # Initialize in current directory
/wfc-init /path/to/project         # Initialize in specified directory
/wfc-init --pre-commit             # Include pre-commit hook configuration
/wfc-init --detect-only            # Show detected languages, no file changes
/wfc-init --language python        # Initialize only for specified language

Flag Definitions

Flag Behavior
--pre-commit Creates .pre-commit-config.yaml with hooks for detected languages
--detect-only Prints detected languages to stdout, exits without writing files
--language <name> Initializes only for the specified language; skips all others
--dry-run Shows all files that would be created/modified; does not write

Note: This skill does NOT run interactive prompts. All decisions use documented defaults.

Language Support

Language File Patterns Formatter Linter Test Framework
Python **/*.py black ruff pytest
JavaScript **/*.js, **/*.mjs prettier eslint jest
TypeScript **/*.ts, **/*.tsx prettier eslint + TS rules jest
Go **/*.go gofmt golangci-lint go test
Rust **/*.rs rustfmt clippy cargo test
Java **/*.java google-java-format checkstyle junit
Ruby **/*.rb rubocop (format mode) rubocop rspec
C# **/*.cs dotnet format dotnet analyze dotnet test

Detection exclusions: The scanner skips these directories: node_modules/, venv/, .venv/, __pycache__/, target/, build/, dist/, .git/, vendor/

Output Files

.wfc/config.json (created at project root)

{
  "version": 1,
  "languages": [
    {
      "name": "python",
      "formatter": "black",
      "linter": "ruff",
      "test_framework": "pytest",
      "include_patterns": ["**/*.py"],
      "exclude_patterns": ["venv/**", ".venv/**", "build/**"]
    }
  ],
  "quality_gate": {
    "enabled": true,
    "fail_on_error": true
  }
}

Note: The agent must populate include_patterns and exclude_patterns based on detected project structure.

Makefile (appended if exists, created if not)

Generated targets use find commands to locate source files dynamically:

# WFC Quality Targets (generated by wfc-init)
.PHONY: quality-check format lint

quality-check: format lint
 @echo "All quality checks passed"

format:
 @echo "Formatting code..."
 @if command -v black >/dev/null 2>&1; then \
  find . -name "*.py" -not -path "./venv/*" -not -path "./.venv/*" -exec black {} +; \
 fi
 @if command -v prettier >/dev/null 2>&1; then \
  find . \( -name "*.js" -o -name "*.ts" \) -not -path "./node_modules/*" -exec prettier --write {} +; \
 fi
 @echo "Code formatted"

lint:
 @echo "Linting..."
 @if command -v ruff >/dev/null 2>&1; then ruff check .; fi
 @if command -v eslint >/dev/null 2>&1; then eslint . --ext .js,.ts; fi
 @echo "Linting complete"

.pre-commit-config.yaml (only with --pre-commit flag)

# WFC Pre-commit Hooks (generated by wfc-init)
repos:
  - repo: https://github.com/psf/black
    rev: 24.1.1
    hooks:
      - id: black
        language_version: python3

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.2.0
    hooks:
      - id: ruff
        args: ['--fix']

  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier
        types_or: [javascript, jsx, ts, tsx]

Note: The agent should check for the latest stable versions of these hooks at generation time, not use the versions shown above as fixed values.

Detection Algorithm

The language detection logic:

  1. Scan directory recursively (max depth: 10)
  2. Skip directories in exclusion list
  3. Count files matching each language's file patterns
  4. A language is "detected" if it has >=1 matching file
  5. With --language flag, skip detection and use specified language only

Error Conditions

Condition Behavior
.wfc/ directory exists Abort with error: "WFC already initialized. Use wfc-configure to modify."
No languages detected Abort with error: "No supported languages found. Supported: Python, JS/TS, Go, Rust, Java, Ruby, C#"
Specified --language not supported Abort with error: "Unsupported language '{name}'. Supported: python, javascript, typescript, go, rust, java, ruby, csharp"
Target directory does not exist Abort with error: "Directory '{path}' does not exist"
Makefile cannot be appended Create Makefile.new and warn user to merge manually

Not For

This skill must NOT be used for:

  • Projects with existing .wfc/ directory — use wfc-configure instead
  • Stand-alone formatter/linter installation — use language-specific setup (npm install prettier, pip install black)
  • Running format or lint operations — use wfc-check or run tools directly
  • CI/CD pipeline configuration — use wfc-ci skill
  • System-level WFC toolchain installation — use system package managers
  • Modifying existing Makefiles for non-WFC purposes — edit Makefile directly
  • Projects with partial/corrupted WFC installations — delete .wfc/ manually, then run wfc-init
  • Updating or migrating existing WFC configurations — use wfc-configure or wfc-migrate

Example Output

/wfc-init --pre-commit

Scanning for supported languages...

Detected languages:
  Python (42 .py files)
  JavaScript (18 .js files)

Generating WFC configuration...

Files created:
  .wfc/config.json
  Makefile (appended 3 targets)
  .pre-commit-config.yaml

Next steps:
  1. Install tools: pip install black ruff && npm install -g prettier
  2. Run: make quality-check
  3. Commit generated files to version control

See Also

  • wfc-configure — Modify existing WFC configuration
  • wfc-check — Run quality checks using configured tools
  • wfc-implement — Implementation workflow that uses configured tools