Implement Pre-Commit Hooks Integration

Render OpenSpec artifact files from td state before each git commit.

1|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/em-jones/staccato-toolkit --skill implement-pre-commit-hooks-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Implement Pre-Commit Hooks Integration
Source: https://github.com/em-jones/staccato-toolkit/tree/main/.opencode/skills/pre-commit-hooks-implementation
Command: npx skills add https://github.com/em-jones/staccato-toolkit --skill implement-pre-commit-hooks-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill automates the rendering of OpenSpec artifact files (spec.md and tasks.md) from your td state before every Git commit, ensuring documents are always synchronized with the source of truth without manual intervention.

Core Features & Use Cases

  • Automatic Document Rendering: Ensures spec.md and tasks.md are up-to-date with td state before each commit.
  • Commit Validation: Fails commits if rendering errors occur, prompting agents to fix issues.
  • Staged File Management: Automatically stages newly rendered files, allowing for review before final commit.
  • Use Case: As a developer, you make changes to your proposal.md. When you try to commit, the hook automatically renders the updated spec.md and tasks.md, stages them, and allows you to review before finalizing the commit.

Quick Start

Commit your changes to openspec/changes/my-feature/proposal.md and the hook will automatically render and stage the updated spec.md and tasks.md.

Frequently Asked Questions about Implement Pre-Commit Hooks Integration

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

FAQPage Schema
How do I automatically render documentation files before a git commit?

To automatically render documentation files before a git commit, you can integrate pre-commit hooks that execute rendering commands for changed files, stage the outputs, and abort the commit if rendering fails. This ensures document synchronization.

What are pre-commit hooks and how do they enforce code documentation synchronization?

Pre-commit hooks are scripts triggered before a git commit is finalized. They enforce documentation synchronization by automatically executing render commands for changed files, staging updated outputs, and aborting the commit if any rendering errors occur.

How do I set up a git hook to stage rendered spec and task files automatically?

You set up a git hook to stage rendered files by configuring a pre-commit script that detects changes in your proposal files, executes a render command to generate spec and task documents, and automatically stages the newly rendered outputs for review.

Why does my git commit abort when automated document rendering fails?

Your git commit aborts when automated document rendering fails because the pre-commit hook is designed to enforce document integrity. It stops the commit process to prompt you to fix the underlying rendering errors before trying again.

Can pre-commit hooks handle edge cases like the first commit in a repository?

Yes, pre-commit hooks can handle edge cases like the first commit in a repository. The hook logic is designed to manage single-change detection and ensure idempotency, preventing failures during initial repository setup or subsequent commits.

Do I need any specific dependencies to automate OpenSpec artifact rendering in my workflow?

No specific external dependencies are required to automate OpenSpec artifact rendering. The integration relies on standard git hooks and scripts to execute the rendering commands, automatically managing staged files and commit validation natively.