taskfile-automation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Task Automation System

Task自动化系统

Use this skill when working with projects that use Task to provide easy-to-discover automation commands for development workflows.
当你在使用Task的项目中工作时,可使用本技能来获取易于查找的开发工作流自动化命令。

Core Principle

核心原则

IMPORTANT: Always prefer
task
commands over direct shell/language commands when a Taskfile is present.
Task provides:
  • Discoverability:
    task --list
    shows all available tasks
  • Consistency: Standardised commands across different environments
  • Documentation: Built-in descriptions and help
  • Automation: Multi-step workflows (e.g.,
    task dev
    combines testing and docs)
  • Safety: Interactive prompts for destructive operations
重要提示:当项目中存在Taskfile时,优先使用
task
命令而非直接的Shell/语言命令。
Task提供以下特性:
  • 可发现性
    task --list
    显示所有可用任务
  • 一致性:不同环境下的标准化命令
  • 文档性:内置描述与帮助信息
  • 自动化:多步骤工作流(例如,
    task dev
    整合了测试与文档生成)
  • 安全性:针对破坏性操作的交互式提示

Task Discovery

Task任务查找

Find Available Tasks

查找可用任务

bash
undefined
bash
undefined

List all available tasks with descriptions

列出所有带描述的可用任务

task --list
task --list

Show common workflows and usage patterns

显示常见工作流和使用模式

task help
task help

Get detailed help for specific task

获取特定任务的详细帮助

task <taskname> --help

**Always start with discovery** when entering a new project with a Taskfile.
task <taskname> --help

当进入一个包含Taskfile的新项目时,**始终从任务查找开始**。

Common Task Patterns

常见Task任务模式

Development Workflows

开发工作流

Projects typically provide these standard tasks:
bash
undefined
项目通常会提供以下标准任务:
bash
undefined

Fast development cycle (common iteration loop)

快速开发周期(常见迭代循环)

task dev # Usually runs fast tests + fast docs
task dev # 通常运行快速测试 + 快速文档生成

Pre-commit workflow

提交前工作流

task precommit # Runs pre-commit hooks + fast tests
task precommit # 运行提交前钩子 + 快速测试

Full CI simulation locally

本地完整CI模拟

task ci # Complete CI pipeline locally
undefined
task ci # 本地执行完整CI流水线
undefined

Testing Workflows

测试工作流

bash
undefined
bash
undefined

Full test suite including quality checks

包含质量检查的完整测试套件

task test
task test

Fast tests (skip quality checks for rapid development)

快速测试(跳过质量检查以实现快速开发)

task test-fast task test:fast # Alternative naming
task test-fast task test:fast # 替代命名方式

Quality checks only (Aqua, formatting, linting)

仅质量检查(Aqua、格式化、代码检查)

task test-quality task test:quality
undefined
task test-quality task test:quality
undefined

Documentation Building

文档构建

bash
undefined
bash
undefined

Quick docs build (recommended for development)

快速文档构建(推荐用于开发阶段)

task docs-fast task docs:fast
task docs-fast task docs:fast

Full documentation including slow components (notebooks, etc.)

包含慢速组件的完整文档(如笔记本等)

task docs
task docs

Interactive documentation server

交互式文档服务器

task docs-pluto # For Julia projects with Pluto notebooks task docs:serve # For live-reload documentation server
undefined
task docs-pluto # 适用于带有Pluto笔记本的Julia项目 task docs:serve # 用于支持热重载的文档服务器
undefined

Environment Management

环境管理

bash
undefined
bash
undefined

Set up development environment from scratch

从头搭建开发环境

task setup
task setup

Show package/dependency status

显示包/依赖状态

task pkg:status task status
task pkg:status task status

Project overview and environment information

项目概览与环境信息

task info
undefined
task info
undefined

Code Quality

代码质量

bash
undefined
bash
undefined

Linting

代码检查

task lint
task lint

Formatting

代码格式化

task format
task format

Combined quality checks

综合质量检查

task quality
undefined
task quality
undefined

Using Task vs Direct Commands

Task命令与直接命令的选择

When to Use Task

何时使用Task命令

Use
task
commands when:
  • A Taskfile exists in the project
  • You need to run standard development operations
  • You want to discover available workflows
  • You need consistency across team members
在以下场景使用
task
命令:
  • 项目中存在Taskfile
  • 你需要运行标准开发操作
  • 你想要查找可用的工作流
  • 你需要在团队成员间保持操作一致性

When Task Wraps Underlying Commands

Task如何封装底层命令

Tasks are typically thin wrappers around language-specific commands:
Example - Julia:
bash
undefined
Task任务通常是对特定语言命令的轻量封装:
示例 - Julia:
bash
undefined

Task command

Task命令

task test
task test

Underlying command it runs

其执行的底层命令

julia --project=. -e 'using Pkg; Pkg.test()'

**Example - R:**
```bash
julia --project=. -e 'using Pkg; Pkg.test()'

**示例 - R:**
```bash

Task command

Task命令

task docs
task docs

Underlying command it runs

其执行的底层命令

Rscript -e "devtools::document()"
undefined
Rscript -e "devtools::document()"
undefined

When to Use Direct Commands

何时使用直接命令

Use direct language commands when:
  • No Taskfile exists
  • You need advanced options not exposed by tasks
  • You're doing exploratory work outside standard workflows
  • Tasks don't cover your specific use case
在以下场景使用直接的语言命令:
  • 项目中不存在Taskfile
  • 你需要使用任务未暴露的高级选项
  • 你正在进行标准工作流之外的探索性工作
  • 任务无法覆盖你的特定使用场景

Task Workflow Examples

Task工作流示例

Typical Development Cycle

典型开发周期

bash
undefined
bash
undefined

1. Discover what's available

1. 查找可用任务

task --list
task --list

2. Run fast iteration cycle

2. 运行快速迭代周期

task dev # Fast tests + fast docs
task dev # 快速测试 + 快速文档生成

3. Before committing

3. 提交代码前

task precommit # Pre-commit checks + tests
task precommit # 提交前验证 + 测试

4. Before pushing (optional)

4. 推送代码前(可选)

task ci # Full CI simulation
undefined
task ci # 完整CI流水线模拟
undefined

First-Time Setup

首次环境搭建

bash
undefined
bash
undefined

1. See what setup tasks exist

1. 查看可用的搭建任务

task --list | grep setup
task --list | grep setup

2. Run setup

2. 运行搭建命令

task setup # Install dependencies, configure environment
task setup # 安装依赖、配置环境

3. Verify setup

3. 验证搭建结果

task info # Show project and environment status
task info # 显示项目与环境状态

4. Test everything works

4. 测试所有功能是否正常

task test
undefined
task test
undefined

Task Naming Conventions

Task任务命名规范

Common patterns in task names:
Prefixes:
  • test:*
    - Testing-related tasks
  • docs:*
    - Documentation tasks
  • pkg:*
    - Package management tasks
  • ci:*
    - CI/CD related tasks
Suffixes:
  • *-fast
    - Quick version of the task
  • *-full
    - Complete version including optional steps
Special names:
  • dev
    - Fast development iteration cycle
  • precommit
    - Pre-commit validation
  • ci
    - Full CI pipeline
  • setup
    - Initial project setup
  • clean
    - Clean build artifacts
  • help
    - Show usage information
任务名称的常见模式:
前缀:
  • test:*
    - 测试相关任务
  • docs:*
    - 文档相关任务
  • pkg:*
    - 包管理相关任务
  • ci:*
    - CI/CD相关任务
后缀:
  • *-fast
    - 任务的快速版本
  • *-full
    - 包含可选步骤的完整版本
特殊名称:
  • dev
    - 快速开发迭代周期
  • precommit
    - 提交前验证
  • ci
    - 完整CI流水线
  • setup
    - 初始项目搭建
  • clean
    - 清理构建产物
  • help
    - 显示使用信息

Integration with Language Tools

与语言工具的集成

Julia Projects

Julia项目

bash
undefined
bash
undefined

Instead of: julia --project=. -e 'using Pkg; Pkg.test()'

替代命令:julia --project=. -e 'using Pkg; Pkg.test()'

task test
task test

Instead of: julia --project=docs docs/make.jl --skip-notebooks

替代命令:julia --project=docs docs/make.jl --skip-notebooks

task docs-fast
task docs-fast

Instead of: julia --project=. -e 'using Pkg; Pkg.update()'

替代命令:julia --project=. -e 'using Pkg; Pkg.update()'

task pkg:update
undefined
task pkg:update
undefined

R Projects

R项目

bash
undefined
bash
undefined

Instead of: Rscript -e "devtools::test()"

替代命令:Rscript -e "devtools::test()"

task test
task test

Instead of: Rscript -e "devtools::document()"

替代命令:Rscript -e "devtools::document()"

task docs
task docs

Instead of: Rscript -e "devtools::check()"

替代命令:Rscript -e "devtools::check()"

task check
undefined
task check
undefined

Python Projects

Python项目

bash
undefined
bash
undefined

Instead of: pytest

替代命令:pytest

task test
task test

Instead of: sphinx-build docs docs/_build

替代命令:sphinx-build docs docs/_build

task docs
task docs

Instead of: pip install -e .

替代命令:pip install -e .

task install
undefined
task install
undefined

Task Configuration Files

Task配置文件

Taskfile Location

Taskfile位置

Look for:
  • Taskfile.yml
    in project root
  • Taskfile.yaml
    in project root
查找以下文件:
  • 项目根目录下的
    Taskfile.yml
  • 项目根目录下的
    Taskfile.yaml

Understanding Task Definitions

理解任务定义

When reading a Taskfile:
  • cmds:
    - Commands executed by the task
  • deps:
    - Dependencies run before this task
  • desc:
    - Description shown in
    task --list
  • summary:
    - Extended description for
    task <name> --help
阅读Taskfile时,关注以下字段:
  • cmds:
    - 任务执行的命令
  • deps:
    - 执行此任务前需运行的依赖项
  • desc:
    - 在
    task --list
    中显示的描述
  • summary:
    -
    task <name> --help
    显示的扩展描述

Best Practices

最佳实践

  1. Always discover first: Run
    task --list
    when entering a project
  2. Use task help: Check
    task help
    for project-specific guidance
  3. Prefer tasks for standard workflows: Use tasks for dev, test, docs
  4. Direct commands for exploration: Use language commands for ad-hoc work
  5. Check task definitions: Look at Taskfile.yml to understand what tasks do
  6. Update documentation: If tasks change workflows, note it
  1. 始终先查找任务:进入项目时先运行
    task --list
  2. 使用Task帮助:查看
    task help
    获取项目特定指南
  3. 优先使用任务完成标准工作流:使用任务进行开发、测试、文档生成等操作
  4. 使用直接命令进行探索:使用语言命令进行临时工作
  5. 查看任务定义:查看Taskfile.yml以了解任务的具体执行逻辑
  6. 更新文档:如果任务改变了工作流,请记录相关变更

When to Use This Skill

何时使用本技能

Activate this skill when:
  • Working with projects that have a Taskfile.yml/Taskfile.yaml
  • You see mentions of "Task" or "task commands" in project documentation
  • Project CLAUDE.md mentions using
    task
    instead of direct commands
  • You need to discover available development workflows
  • Running tests, building docs, or managing project development tasks
This skill helps you leverage Task automation rather than manually running underlying commands. Project-specific task definitions and workflows remain in project documentation.
在以下场景激活本技能:
  • 你正在处理包含Taskfile.yml/Taskfile.yaml的项目
  • 你在项目文档中看到提及"Task"或"task commands"
  • 项目CLAUDE.md中提到使用
    task
    而非直接命令
  • 你需要查找可用的开发工作流
  • 你需要运行测试、构建文档或管理项目开发任务
本技能可帮助你利用Task自动化工具,而非手动执行底层命令。项目特定的任务定义与工作流请参考项目文档。