Skip to content

Instantly share code, notes, and snippets.

View tacoda's full-sized avatar

Ian Johnson tacoda

View GitHub Profile
@tacoda
tacoda / HarnessStructure.md
Created April 4, 2026 20:07
harness-structure

Agent Harness Structure

Subdirectory CLAUDE.md files provide scoped guidance.

The agent loads only the files relevant to its current working directory.

Directory Layout:

CLAUDE.md ← Root: project overview, architecture, shared rules

├── app/

│ ├── Http/

│ │ ├── Controllers/

@tacoda
tacoda / ActionsHarness.md
Created April 4, 2026 20:06
actions-harness

app/Actions/CLAUDE.md

This is a real harness file from the project.

It tells the agent exactly how to write Action classes.

Actions

Actions encapsulate a single domain operation. They are the primary pattern for complex write operations that go beyond simple CRUD.

When to Use an Action

@tacoda
tacoda / InterimWrapper.tsx
Created April 4, 2026 20:05
interim-wrapper
// ─────────────────────────────────────────────────────
// THE INTERIM WRAPPER PATTERN
// Ship SPA features to production inside legacy Blade shells
// ─────────────────────────────────────────────────────
// 1. SPA Component — the source of truth
// resources/js/spa/pages/Dashboard/Dashboard.tsx
import { useEffect, useState } from 'react';
import { AppShell } from '../../layouts/AppShell';
@tacoda
tacoda / PolicyExample.php
Created April 4, 2026 20:04
policy-example
<?php
// app/Policies/OrderPolicy.php
// Centralized authorization — one place for all order access rules.
namespace App\Policies;
use App\Order;
use App\User;
@tacoda
tacoda / ActionResultDTO.php
Created April 4, 2026 20:03
action-result-dto
<?php
// app/Actions/Orders/CreateOrderAction.php
// Single-purpose Action class with Result DTO
namespace App\Actions\Orders;
use App\Order;
use App\Http\Requests\Orders\CreateOrderRequest;
use App\Services\Notifications\Contracts\NotificationInterface;
@tacoda
tacoda / ServiceContract.php
Created April 4, 2026 20:03
service-contract
<?php
// BEFORE: Trait mixed into controllers
// ──────────────────────────────────────
trait SlackNotificationTrait
{
protected function sendSlackNotification(string $channel, string $message): void
{
// Directly calls HTTP from inside the controller
@tacoda
tacoda / pre-commit
Created April 4, 2026 20:02
pre-commit-hook
#!/bin/sh
# .git/hooks/pre-commit
# Runs a fast subset of quality checks before every commit.
# Full checks run in CI — this catches the most common issues early.
set -e
echo "Running pre-commit checks..."
# PHP code style (Pint)
@tacoda
tacoda / Makefile
Created April 4, 2026 20:01
makefile-lint
# Makefile — Lint and code quality targets
# All commands run inside the Docker app container for consistency.
.PHONY: lint pint pint-fix psalm format format-fix eslint typecheck
## Run all code quality checks (pint + psalm + format + eslint + typecheck)
lint: pint psalm format eslint typecheck
## Check PHP code style (Laravel Pint)
pint:
@tacoda
tacoda / ci.yml
Created April 4, 2026 20:00
ci-workflow
# .github/workflows/ci.yml (simplified excerpt)
# Four-stage pipeline: Build → Quality → Tests → Deploy
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
@tacoda
tacoda / UserFactory.php
Created April 4, 2026 19:58
user-factory
<?php
// tests/Setup/UserFactory.php
// Fluent test user factory — accessed via Facades\Tests\Setup\UserFactory
namespace Tests\Setup;
use App\User;
use Database\Seeders\PermissionsSeeder;
use Database\Seeders\RolesSeeder;