build-approval-workflow

Implement a two-step approval workflow with state machine and RSpec specs.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/erwaen/one-shot-test --skill build-approval-workflow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-approval-workflow
Source: https://github.com/erwaen/one-shot-test/tree/main/.claude/skills/build-approval-workflow
Command: npx skills add https://github.com/erwaen/one-shot-test --skill build-approval-workflow

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Build a cohesive, end-to-end approval workflow inside a Rails time-off tracking system, reducing manual handoffs and errors by providing a complete, tested framework.

Core Features & Use Cases

  • State machine on TimeOffRequest to manage transitions: pending → approved, pending → denied, and pending|approved → cancelled, with guard methods for role-based authorization.
  • ApprovalService handling the core workflow logic, including two-step approval rules, persistence of approvals, and status updates.
  • Mailers and views to notify managers, admins, and employees about submissions, approvals, denials, and cancellations.
  • Background job (NotificationJob) to enqueue notifications asynchronously.
  • Comprehensive specs for services, mailers, and jobs to ensure reliability and maintainability.

Quick Start

Run the build-approval-workflow skill after scaffolding all relevant models to generate the full approval workflow.

Frequently Asked Questions about build-approval-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a time-off approval workflow with a state machine in Rails?

You can build a time-off approval workflow in Rails by implementing a state machine on the TimeOffRequest model to manage transitions like pending to approved or denied, along with an ApprovalService to handle the core two-step logic and persistence.

What is the best way to handle two-step role-based approvals in a Rails application?

The best way to handle two-step role-based approvals in Rails is to use an ApprovalService that enforces authorization rules for managers and admins, ensuring status updates and approval persistence follow strict transition guards.

How do I automate notifications for time-off requests asynchronously in Rails?

To automate time-off request notifications asynchronously in Rails, you can implement a background NotificationJob that enqueues mailers to notify managers, admins, and employees about submissions, approvals, denials, and cancellations.

Do I need to scaffold models before generating an end-to-end Rails approval workflow?

Yes, you need to scaffold all relevant models like TimeOffRequest before generating the end-to-end Rails approval workflow, ensuring the state machine, ApprovalService, mailers, and background jobs integrate correctly.

Can I include RSpec specs and RuboCop compliance when automating a Rails time-off tracking system?

Yes, automating a Rails time-off tracking system can include comprehensive RSpec specs for services, mailers, and jobs, along with enforcing RuboCop compliance to ensure reliability and maintainability across the workflow logic.

Why use a state machine for managing time-off request transitions in Rails?

You use a state machine for managing time-off request transitions in Rails to enforce valid status changes like pending to approved or denied, and to provide guard methods that secure role-based authorization before any state shift occurs.