vivainio

tasks-py

0
0
# Install this skill:
npx skills add vivainio/agent-skills --skill "tasks-py"

Install specific skill from multi-skill repository

# Description

Create and maintain tasks.py task runner files. Use when user wants to add project automation, create a tasks.py file, add tasks, or mentions "tasks.py".

# SKILL.md


name: tasks-py
description: Create and maintain tasks.py task runner files. Use when user wants to add project automation, create a tasks.py file, add tasks, or mentions "tasks.py".


tasks.py Task Runner

A zero-dependency Python task runner using do_ prefixed functions.

Creating a New tasks.py

Minimal (zero dependencies, self-contained): Copy tasks.py to the project root.

Maximal (argparse integration, task modules, task-by-index): Use scaffer-templates tasks.py

Use minimal for standard tasks (check, format, test). Use maximal for project-specific tasks or if you need argparse arguments.

Adding Tasks

Add new tasks by creating do_<name> functions:

def do_build(args) -> None:
    """Build the project"""
    c("python -m build")

Common Task Patterns

Publishing to PyPI

def do_publish(args) -> None:
    """Publish package to PyPI"""
    shutil.rmtree("dist", ignore_errors=True)
    c("python -m build")
    c("twine upload dist/*")

Running in subdirectory

def do_test(args) -> None:
    """Run tests in test directory"""
    os.chdir("test")
    c("pytest")

Using c_dir for directory-scoped commands

def do_frontend(args) -> None:
    """Build frontend"""
    c_dir("npm run build", "frontend")

Task with arguments

def do_greet(args) -> None:
    """Greet someone: greet <name>"""
    name = args[0] if args else "World"
    print(f"Hello, {name}!")

Usage

python tasks.py              # Show available tasks
python tasks.py check        # Run the check task
python tasks.py test -h      # Show help for test task

Library Functions Reference

Function Purpose
c(cmd) Run command, fail on error
c_ignore(cmd) Run command, ignore errors
c_dir(cmd, dir) Run command in directory
c_spawn(cmd, cwd) Run command in background
copy_files(src, dest) Copy files to destinations

Guidelines

  • Keep tasks.py at project root
  • Only use standard library imports
  • Document tasks with docstrings
  • Use c() for commands that must succeed
  • Use c_ignore() for optional/cleanup commands

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.