How to add mechanical enforcement to any AI coding agent

How to add mechanical enforcement to any AI coding agent

calendar_today ago • schedule2 min read
— Originally published at dev.to

The problem

AI coding agents generate code at impressive speeds. But they also commit untested code, hallucinate APIs, and forget your instructions the moment context fills up. If you've ever reviewed an AI-generated PR and thought "this looks right but I don't trust it," you've experienced the gap this framework fills.

github.com/juandelossantos/another-agent-skills

Prompts (CLAUDE.md, .cursorrules) work until they don't. The agent remembers until context degrades. Then it forgets. Mechanical enforcement via git hooks doesn't have that problem, hooks run regardless of what the agent remembers.

What you'll build

By the end of this tutorial, you'll have:

  • 14 pre-commit gates running on every commit
  • A TDD gate that blocks code without tests
  • 57 composable skills your agent loads on demand
  • A 6-phase development lifecycle (Define → Plan → Build → Verify → Review → Ship)

Step 1: Install (10 seconds)

git clone https://github.com/juandelossantos/another-agent-skills.git
cd another-agent-skills
bash install.sh

That's it. The installer copies the framework to ~/.config/opencode/ and sets up the skill loader.

Step 2: Initialize in any project

cd your-project
init-agents

This creates:

  • STACK_CONFIG.md — auto-detected test/lint/build commands
  • Git hooks in .git/hooks/ (pre-commit v11, commit-msg v4)
  • .gitignore and .env.example if missing

Step 3: How the gates work

The pre-commit hook runs 14 checks before every commit:

# Example: a commit is blocked
$ git commit -m "add feature"
⛔ BRANCH CHECK: on main — create a feature branch
⛔ STAGED CHECK: nothing staged — use git add
⛔ REMOTE SYNC: 3 unpulled commits — run git pull

Each gate must pass before the commit proceeds. The agent cannot use --no-verify unless you explicitly allow it (and that override is tracked).

# Example: a commit passes all gates
$ git commit -m "feat: add user auth"
✅ BRANCH CHECK: on feat/user-auth
✅ STAGED CHECK: 4 files staged
✅ REMOTE SYNC: up to date
✅ HTML INTEGRITY: all markers present
✅ SKILL GATE: skills were consulted
✅ ANTI-SLOP: no generic patterns detected
✅ TDD GATE: test files match code files
✅ TEST RUNNER: 29/29 tests passing
✅ All 14 gates passed → commit allowed

Step 4: The 6-phase lifecycle

Every project follows the same disciplined flow:

DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP

Each phase has corresponding skills:

  • DEFINE: spec-driven-development, architecture-analysis, interview-me
  • PLAN: planning-and-task-breakdown
  • BUILD: incremental-implementation, test-driven-development, doubt-driven-development
  • VERIFY: test-driven-development, debugging-and-error-recovery
  • REVIEW: code-review-and-quality, security-and-hardening, performance-optimization
  • SHIP: git-workflow-and-versioning, ci-cd-and-automation, shipping-and-launch

The agent loads skills on demand. 57 total, each with a declared Output Contract (artifact, format, location, quality criteria).

Step 5: Customizing for your stack

The framework auto-detects your stack from lockfiles:

$ init-agents
 Detected: Node.js (package.json)
 Created: STACK_CONFIG.md with npm test, npm run lint, npm run build
 Installed: 57 skills ready for agent

Supports Node, Python, Rust, Go, Ruby, Dart, any stack with git.

Why this matters

Most "AI agent frameworks" are prompt collections. They teach the agent. They don't enforce.

This is a harness. Mechanical infrastructure around the model. The difference between "please follow the rules" and "you literally cannot commit without passing 14 gates."

57 skills. 14 gates. 6 harness components. 0 lint errors. MIT. Free.

If you're building with AI agents and want production-grade guardrails:

github.com/juandelossantos/another-agent-skills, clone, run bash install.sh, and star the repo ⭐

10 seconds to your first gate.

2 Comments

2 votes
1
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Your AI Agent Skills Have a Version Control Problem

snapsynapseverified - Apr 22

Your AI Doesn't Just Write Tests. It Runs Them Too.

Kevin Martinez - May 12

I Wrote a Script to Fix Audible's Unreadable PDF Filenames

snapsynapseverified - Apr 20
chevron_left
1Posts
1Comments
Frontend & Full-Stack Developer · AI Agent Engineering · another-agent-skills OSS

Commenters (This Week)

5 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!