chore: add repo-local planning and workflow skills
This commit is contained in:
390
.agents/skills/ci-cd-and-automation/SKILL.md
Normal file
390
.agents/skills/ci-cd-and-automation/SKILL.md
Normal file
@@ -0,0 +1,390 @@
|
||||
---
|
||||
name: ci-cd-and-automation
|
||||
description: Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.
|
||||
---
|
||||
|
||||
# CI/CD and Automation
|
||||
|
||||
## Overview
|
||||
|
||||
Automate quality gates so that no change reaches production without passing tests, lint, type checking, and build. CI/CD is the enforcement mechanism for every other skill — it catches what humans and agents miss, and it does so consistently on every single change.
|
||||
|
||||
**Shift Left:** Catch problems as early in the pipeline as possible. A bug caught in linting costs minutes; the same bug caught in production costs hours. Move checks upstream — static analysis before tests, tests before staging, staging before production.
|
||||
|
||||
**Faster is Safer:** Smaller batches and more frequent releases reduce risk, not increase it. A deployment with 3 changes is easier to debug than one with 30. Frequent releases build confidence in the release process itself.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Setting up a new project's CI pipeline
|
||||
- Adding or modifying automated checks
|
||||
- Configuring deployment pipelines
|
||||
- When a change should trigger automated verification
|
||||
- Debugging CI failures
|
||||
|
||||
## The Quality Gate Pipeline
|
||||
|
||||
Every change goes through these gates before merge:
|
||||
|
||||
```
|
||||
Pull Request Opened
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ LINT CHECK │ eslint, prettier
|
||||
│ ↓ pass │
|
||||
│ TYPE CHECK │ tsc --noEmit
|
||||
│ ↓ pass │
|
||||
│ UNIT TESTS │ jest/vitest
|
||||
│ ↓ pass │
|
||||
│ BUILD │ npm run build
|
||||
│ ↓ pass │
|
||||
│ INTEGRATION │ API/DB tests
|
||||
│ ↓ pass │
|
||||
│ E2E (optional) │ Playwright/Cypress
|
||||
│ ↓ pass │
|
||||
│ SECURITY AUDIT │ npm audit
|
||||
│ ↓ pass │
|
||||
│ BUNDLE SIZE │ bundlesize check
|
||||
└─────────────────┘
|
||||
│
|
||||
▼
|
||||
Ready for review
|
||||
```
|
||||
|
||||
**No gate can be skipped.** If lint fails, fix lint — don't disable the rule. If a test fails, fix the code — don't skip the test.
|
||||
|
||||
## GitHub Actions Configuration
|
||||
|
||||
### Basic CI Pipeline
|
||||
|
||||
```yaml
|
||||
# .github/workflows/ci.yml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
|
||||
- name: Test
|
||||
run: npm test -- --coverage
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Security audit
|
||||
run: npm audit --audit-level=high
|
||||
```
|
||||
|
||||
### With Database Integration Tests
|
||||
|
||||
```yaml
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_DB: testdb
|
||||
POSTGRES_USER: ci_user
|
||||
POSTGRES_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- name: Run migrations
|
||||
run: npx prisma migrate deploy
|
||||
env:
|
||||
DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
|
||||
- name: Integration tests
|
||||
run: npm run test:integration
|
||||
env:
|
||||
DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
|
||||
```
|
||||
|
||||
> **Note:** Even for CI-only test databases, use GitHub Secrets for credentials rather than hardcoding values. This builds good habits and prevents accidental reuse of test credentials in other contexts.
|
||||
|
||||
### E2E Tests
|
||||
|
||||
```yaml
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- name: Install Playwright
|
||||
run: npx playwright install --with-deps chromium
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Run E2E tests
|
||||
run: npx playwright test
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
```
|
||||
|
||||
## Feeding CI Failures Back to Agents
|
||||
|
||||
The power of CI with AI agents is the feedback loop. When CI fails:
|
||||
|
||||
```
|
||||
CI fails
|
||||
│
|
||||
▼
|
||||
Copy the failure output
|
||||
│
|
||||
▼
|
||||
Feed it to the agent:
|
||||
"The CI pipeline failed with this error:
|
||||
[paste specific error]
|
||||
Fix the issue and verify locally before pushing again."
|
||||
│
|
||||
▼
|
||||
Agent fixes → pushes → CI runs again
|
||||
```
|
||||
|
||||
**Key patterns:**
|
||||
|
||||
```
|
||||
Lint failure → Agent runs `npm run lint --fix` and commits
|
||||
Type error → Agent reads the error location and fixes the type
|
||||
Test failure → Agent follows debugging-and-error-recovery skill
|
||||
Build error → Agent checks config and dependencies
|
||||
```
|
||||
|
||||
## Deployment Strategies
|
||||
|
||||
### Preview Deployments
|
||||
|
||||
Every PR gets a preview deployment for manual testing:
|
||||
|
||||
```yaml
|
||||
# Deploy preview on PR (Vercel/Netlify/etc.)
|
||||
deploy-preview:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Deploy preview
|
||||
run: npx vercel --token=${{ secrets.VERCEL_TOKEN }}
|
||||
```
|
||||
|
||||
### Feature Flags
|
||||
|
||||
Feature flags decouple deployment from release. Deploy incomplete or risky features behind flags so you can:
|
||||
|
||||
- **Ship code without enabling it.** Merge to main early, enable when ready.
|
||||
- **Roll back without redeploying.** Disable the flag instead of reverting code.
|
||||
- **Canary new features.** Enable for 1% of users, then 10%, then 100%.
|
||||
- **Run A/B tests.** Compare behavior with and without the feature.
|
||||
|
||||
```typescript
|
||||
// Simple feature flag pattern
|
||||
if (featureFlags.isEnabled('new-checkout-flow', { userId })) {
|
||||
return renderNewCheckout();
|
||||
}
|
||||
return renderLegacyCheckout();
|
||||
```
|
||||
|
||||
**Flag lifecycle:** Create → Enable for testing → Canary → Full rollout → Remove the flag and dead code. Flags that live forever become technical debt — set a cleanup date when you create them.
|
||||
|
||||
### Staged Rollouts
|
||||
|
||||
```
|
||||
PR merged to main
|
||||
│
|
||||
▼
|
||||
Staging deployment (auto)
|
||||
│ Manual verification
|
||||
▼
|
||||
Production deployment (manual trigger or auto after staging)
|
||||
│
|
||||
▼
|
||||
Monitor for errors (15-minute window)
|
||||
│
|
||||
├── Errors detected → Rollback
|
||||
└── Clean → Done
|
||||
```
|
||||
|
||||
### Rollback Plan
|
||||
|
||||
Every deployment should be reversible:
|
||||
|
||||
```yaml
|
||||
# Manual rollback workflow
|
||||
name: Rollback
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to rollback to'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
rollback:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Rollback deployment
|
||||
run: |
|
||||
# Deploy the specified previous version
|
||||
npx vercel rollback ${{ inputs.version }}
|
||||
```
|
||||
|
||||
## Environment Management
|
||||
|
||||
```
|
||||
.env.example → Committed (template for developers)
|
||||
.env → NOT committed (local development)
|
||||
.env.test → Committed (test environment, no real secrets)
|
||||
CI secrets → Stored in GitHub Secrets / vault
|
||||
Production secrets → Stored in deployment platform / vault
|
||||
```
|
||||
|
||||
CI should never have production secrets. Use separate secrets for CI testing.
|
||||
|
||||
## Automation Beyond CI
|
||||
|
||||
### Dependabot / Renovate
|
||||
|
||||
```yaml
|
||||
# .github/dependabot.yml
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 5
|
||||
```
|
||||
|
||||
### Build Cop Role
|
||||
|
||||
Designate someone responsible for keeping CI green. When the build breaks, the Build Cop's job is to fix or revert — not the person whose change caused the break. This prevents broken builds from accumulating while everyone assumes someone else will fix it.
|
||||
|
||||
### PR Checks
|
||||
|
||||
- **Required reviews:** At least 1 approval before merge
|
||||
- **Required status checks:** CI must pass before merge
|
||||
- **Branch protection:** No force-pushes to main
|
||||
- **Auto-merge:** If all checks pass and approved, merge automatically
|
||||
|
||||
## CI Optimization
|
||||
|
||||
When the pipeline exceeds 10 minutes, apply these strategies in order of impact:
|
||||
|
||||
```
|
||||
Slow CI pipeline?
|
||||
├── Cache dependencies
|
||||
│ └── Use actions/cache or setup-node cache option for node_modules
|
||||
├── Run jobs in parallel
|
||||
│ └── Split lint, typecheck, test, build into separate parallel jobs
|
||||
├── Only run what changed
|
||||
│ └── Use path filters to skip unrelated jobs (e.g., skip e2e for docs-only PRs)
|
||||
├── Use matrix builds
|
||||
│ └── Shard test suites across multiple runners
|
||||
├── Optimize the test suite
|
||||
│ └── Remove slow tests from the critical path, run them on a schedule instead
|
||||
└── Use larger runners
|
||||
└── GitHub-hosted larger runners or self-hosted for CPU-heavy builds
|
||||
```
|
||||
|
||||
**Example: caching and parallelism**
|
||||
```yaml
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: '22', cache: 'npm' }
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: '22', cache: 'npm' }
|
||||
- run: npm ci
|
||||
- run: npx tsc --noEmit
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: '22', cache: 'npm' }
|
||||
- run: npm ci
|
||||
- run: npm test -- --coverage
|
||||
```
|
||||
|
||||
## Common Rationalizations
|
||||
|
||||
| Rationalization | Reality |
|
||||
|---|---|
|
||||
| "CI is too slow" | Optimize the pipeline (see CI Optimization below), don't skip it. A 5-minute pipeline prevents hours of debugging. |
|
||||
| "This change is trivial, skip CI" | Trivial changes break builds. CI is fast for trivial changes anyway. |
|
||||
| "The test is flaky, just re-run" | Flaky tests mask real bugs and waste everyone's time. Fix the flakiness. |
|
||||
| "We'll add CI later" | Projects without CI accumulate broken states. Set it up on day one. |
|
||||
| "Manual testing is enough" | Manual testing doesn't scale and isn't repeatable. Automate what you can. |
|
||||
|
||||
## Red Flags
|
||||
|
||||
- No CI pipeline in the project
|
||||
- CI failures ignored or silenced
|
||||
- Tests disabled in CI to make the pipeline pass
|
||||
- Production deploys without staging verification
|
||||
- No rollback mechanism
|
||||
- Secrets stored in code or CI config files (not secrets manager)
|
||||
- Long CI times with no optimization effort
|
||||
|
||||
## Verification
|
||||
|
||||
After setting up or modifying CI:
|
||||
|
||||
- [ ] All quality gates are present (lint, types, tests, build, audit)
|
||||
- [ ] Pipeline runs on every PR and push to main
|
||||
- [ ] Failures block merge (branch protection configured)
|
||||
- [ ] CI results feed back into the development loop
|
||||
- [ ] Secrets are stored in the secrets manager, not in code
|
||||
- [ ] Deployment has a rollback mechanism
|
||||
- [ ] Pipeline runs in under 10 minutes for the test suite
|
||||
288
.agents/skills/documentation-and-adrs/SKILL.md
Normal file
288
.agents/skills/documentation-and-adrs/SKILL.md
Normal file
@@ -0,0 +1,288 @@
|
||||
---
|
||||
name: documentation-and-adrs
|
||||
description: Records decisions and documentation. Use when making architectural decisions, changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.
|
||||
---
|
||||
|
||||
# Documentation and ADRs
|
||||
|
||||
## Overview
|
||||
|
||||
Document decisions, not just code. The most valuable documentation captures the *why* — the context, constraints, and trade-offs that led to a decision. Code shows *what* was built; documentation explains *why it was built this way* and *what alternatives were considered*. This context is essential for future humans and agents working in the codebase.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Making a significant architectural decision
|
||||
- Choosing between competing approaches
|
||||
- Adding or changing a public API
|
||||
- Shipping a feature that changes user-facing behavior
|
||||
- Onboarding new team members (or agents) to the project
|
||||
- When you find yourself explaining the same thing repeatedly
|
||||
|
||||
**When NOT to use:** Don't document obvious code. Don't add comments that restate what the code already says. Don't write docs for throwaway prototypes.
|
||||
|
||||
## Architecture Decision Records (ADRs)
|
||||
|
||||
ADRs capture the reasoning behind significant technical decisions. They're the highest-value documentation you can write.
|
||||
|
||||
### When to Write an ADR
|
||||
|
||||
- Choosing a framework, library, or major dependency
|
||||
- Designing a data model or database schema
|
||||
- Selecting an authentication strategy
|
||||
- Deciding on an API architecture (REST vs. GraphQL vs. tRPC)
|
||||
- Choosing between build tools, hosting platforms, or infrastructure
|
||||
- Any decision that would be expensive to reverse
|
||||
|
||||
### Match the existing convention first
|
||||
|
||||
Before creating an ADR, inspect the available repository context for an established convention — existing ADRs, project instructions, and ADR-related configuration or tooling (e.g. an `.adr-dir` file). An established convention overrides the defaults below. Match:
|
||||
|
||||
- **Location and format** — e.g. `docs/adr/*.md`, `Documentation/Decisions/*.rst`, a MADR layout, or an `adr-tools` setup. Match the existing directory, file extension, and markup (Markdown vs reStructuredText).
|
||||
- **Numbering and naming** — continue the existing sequence and filename pattern (`ADR-004-Title.rst`, `0004-title.md`, …); don't restart at 001 or introduce a second scheme.
|
||||
- **Section headings** — reuse the project's heading set rather than imposing this template's.
|
||||
|
||||
If the available evidence conflicts, surface the conflict rather than silently introducing another scheme. Only when no convention can be established do you apply the default below.
|
||||
|
||||
### ADR Template
|
||||
|
||||
Store ADRs in `docs/decisions/` with sequential numbering (unless the project already uses another location — see above):
|
||||
|
||||
```markdown
|
||||
# ADR-001: Use PostgreSQL for primary database
|
||||
|
||||
## Status
|
||||
Accepted | Superseded by ADR-XXX | Deprecated
|
||||
|
||||
## Date
|
||||
2025-01-15
|
||||
|
||||
## Context
|
||||
We need a primary database for the task management application. Key requirements:
|
||||
- Relational data model (users, tasks, teams with relationships)
|
||||
- ACID transactions for task state changes
|
||||
- Support for full-text search on task content
|
||||
- Managed hosting available (for small team, limited ops capacity)
|
||||
|
||||
## Decision
|
||||
Use PostgreSQL with Prisma ORM.
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
### MongoDB
|
||||
- Pros: Flexible schema, easy to start with
|
||||
- Cons: Our data is inherently relational; would need to manage relationships manually
|
||||
- Rejected: Relational data in a document store leads to complex joins or data duplication
|
||||
|
||||
### SQLite
|
||||
- Pros: Zero configuration, embedded, fast for reads
|
||||
- Cons: Limited concurrent write support, no managed hosting for production
|
||||
- Rejected: Not suitable for multi-user web application in production
|
||||
|
||||
### MySQL
|
||||
- Pros: Mature, widely supported
|
||||
- Cons: PostgreSQL has better JSON support, full-text search, and ecosystem tooling
|
||||
- Rejected: PostgreSQL is the better fit for our feature requirements
|
||||
|
||||
## Consequences
|
||||
- Prisma provides type-safe database access and migration management
|
||||
- We can use PostgreSQL's full-text search instead of adding Elasticsearch
|
||||
- Team needs PostgreSQL knowledge (standard skill, low risk)
|
||||
- Hosting on managed service (Supabase, Neon, or RDS)
|
||||
```
|
||||
|
||||
### ADR Lifecycle
|
||||
|
||||
```
|
||||
PROPOSED → ACCEPTED → (SUPERSEDED or DEPRECATED)
|
||||
```
|
||||
|
||||
- **Don't delete old ADRs.** They capture historical context.
|
||||
- When a decision changes, write a new ADR that references and supersedes the old one.
|
||||
|
||||
## Inline Documentation
|
||||
|
||||
### When to Comment
|
||||
|
||||
Comment the *why*, not the *what*:
|
||||
|
||||
```typescript
|
||||
// BAD: Restates the code
|
||||
// Increment counter by 1
|
||||
counter += 1;
|
||||
|
||||
// GOOD: Explains non-obvious intent
|
||||
// Rate limit uses a sliding window — reset counter at window boundary,
|
||||
// not on a fixed schedule, to prevent burst attacks at window edges
|
||||
if (now - windowStart > WINDOW_SIZE_MS) {
|
||||
counter = 0;
|
||||
windowStart = now;
|
||||
}
|
||||
```
|
||||
|
||||
### When NOT to Comment
|
||||
|
||||
```typescript
|
||||
// Don't comment self-explanatory code
|
||||
function calculateTotal(items: CartItem[]): number {
|
||||
return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
||||
}
|
||||
|
||||
// Don't leave TODO comments for things you should just do now
|
||||
// TODO: add error handling ← Just add it
|
||||
|
||||
// Don't leave commented-out code
|
||||
// const oldImplementation = () => { ... } ← Delete it, git has history
|
||||
```
|
||||
|
||||
### Document Known Gotchas
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* IMPORTANT: This function must be called before the first render.
|
||||
* If called after hydration, it causes a flash of unstyled content
|
||||
* because the theme context isn't available during SSR.
|
||||
*
|
||||
* See ADR-003 for the full design rationale.
|
||||
*/
|
||||
export function initializeTheme(theme: Theme): void {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
|
||||
For public APIs (REST, GraphQL, library interfaces):
|
||||
|
||||
### Inline with Types (Preferred for TypeScript)
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Creates a new task.
|
||||
*
|
||||
* @param input - Task creation data (title required, description optional)
|
||||
* @returns The created task with server-generated ID and timestamps
|
||||
* @throws {ValidationError} If title is empty or exceeds 200 characters
|
||||
* @throws {AuthenticationError} If the user is not authenticated
|
||||
*
|
||||
* @example
|
||||
* const task = await createTask({ title: 'Buy groceries' });
|
||||
* console.log(task.id); // "task_abc123"
|
||||
*/
|
||||
export async function createTask(input: CreateTaskInput): Promise<Task> {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### OpenAPI / Swagger for REST APIs
|
||||
|
||||
```yaml
|
||||
paths:
|
||||
/api/tasks:
|
||||
post:
|
||||
summary: Create a task
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateTaskInput'
|
||||
responses:
|
||||
'201':
|
||||
description: Task created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Task'
|
||||
'422':
|
||||
description: Validation error
|
||||
```
|
||||
|
||||
## README Structure
|
||||
|
||||
Every project should have a README that covers:
|
||||
|
||||
```markdown
|
||||
# Project Name
|
||||
|
||||
One-paragraph description of what this project does.
|
||||
|
||||
## Quick Start
|
||||
1. Clone the repo
|
||||
2. Install dependencies: `npm install`
|
||||
3. Set up environment: `cp .env.example .env`
|
||||
4. Run the dev server: `npm run dev`
|
||||
|
||||
## Commands
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `npm run dev` | Start development server |
|
||||
| `npm test` | Run tests |
|
||||
| `npm run build` | Production build |
|
||||
| `npm run lint` | Run linter |
|
||||
|
||||
## Architecture
|
||||
Brief overview of the project structure and key design decisions.
|
||||
Link to ADRs for details.
|
||||
|
||||
## Contributing
|
||||
How to contribute, coding standards, PR process.
|
||||
```
|
||||
|
||||
## Changelog Maintenance
|
||||
|
||||
For shipped features:
|
||||
|
||||
```markdown
|
||||
# Changelog
|
||||
|
||||
## [1.2.0] - 2025-01-20
|
||||
### Added
|
||||
- Task sharing: users can share tasks with team members (#123)
|
||||
- Email notifications for task assignments (#124)
|
||||
|
||||
### Fixed
|
||||
- Duplicate tasks appearing when rapidly clicking create button (#125)
|
||||
|
||||
### Changed
|
||||
- Task list now loads 50 items per page (was 20) for better UX (#126)
|
||||
```
|
||||
|
||||
## Documentation for Agents
|
||||
|
||||
Special consideration for AI agent context:
|
||||
|
||||
- **CLAUDE.md / rules files** — Document project conventions so agents follow them
|
||||
- **Spec files** — Keep specs updated so agents build the right thing
|
||||
- **ADRs** — Help agents understand why past decisions were made (prevents re-deciding)
|
||||
- **Inline gotchas** — Prevent agents from falling into known traps
|
||||
|
||||
## Common Rationalizations
|
||||
|
||||
| Rationalization | Reality |
|
||||
|---|---|
|
||||
| "The code is self-documenting" | Code shows what. It doesn't show why, what alternatives were rejected, or what constraints apply. |
|
||||
| "We'll write docs when the API stabilizes" | APIs stabilize faster when you document them. The doc is the first test of the design. |
|
||||
| "Nobody reads docs" | Agents do. Future engineers do. Your 3-months-later self does. |
|
||||
| "ADRs are overhead" | A 10-minute ADR prevents a 2-hour debate about the same decision six months later. |
|
||||
| "Comments get outdated" | Comments on *why* are stable. Comments on *what* get outdated — that's why you only write the former. |
|
||||
|
||||
## Red Flags
|
||||
|
||||
- Architectural decisions with no written rationale
|
||||
- Public APIs with no documentation or types
|
||||
- README that doesn't explain how to run the project
|
||||
- Commented-out code instead of deletion
|
||||
- TODO comments that have been there for weeks
|
||||
- No ADRs in a project with significant architectural choices
|
||||
- Documentation that restates the code instead of explaining intent
|
||||
|
||||
## Verification
|
||||
|
||||
After documenting:
|
||||
|
||||
- [ ] ADRs exist for all significant architectural decisions
|
||||
- [ ] README covers quick start, commands, and architecture overview
|
||||
- [ ] API functions have parameter and return type documentation
|
||||
- [ ] Known gotchas are documented inline where they matter
|
||||
- [ ] No commented-out code remains
|
||||
- [ ] Rules files (CLAUDE.md etc.) are current and accurate
|
||||
355
.agents/skills/git-workflow-and-versioning/SKILL.md
Normal file
355
.agents/skills/git-workflow-and-versioning/SKILL.md
Normal file
@@ -0,0 +1,355 @@
|
||||
---
|
||||
name: git-workflow-and-versioning
|
||||
description: Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.
|
||||
---
|
||||
|
||||
# Git Workflow and Versioning
|
||||
|
||||
## Overview
|
||||
|
||||
Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.
|
||||
|
||||
## When to Use
|
||||
|
||||
Always. Every code change flows through git.
|
||||
|
||||
## Core Principles
|
||||
|
||||
### Trunk-Based Development (Recommended)
|
||||
|
||||
Keep `main` always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.
|
||||
|
||||
```
|
||||
main ──●──●──●──●──●──●──●──●──●── (always deployable)
|
||||
╲ ╱ ╲ ╱
|
||||
●──●─╱ ●──╱ ← short-lived feature branches (1-3 days)
|
||||
```
|
||||
|
||||
This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.
|
||||
|
||||
- **Dev branches are costs.** Every day a branch lives, it accumulates merge risk.
|
||||
- **Release branches are acceptable.** When you need to stabilize a release while main moves forward.
|
||||
- **Feature flags > long branches.** Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.
|
||||
|
||||
### 1. Commit Early, Commit Often
|
||||
|
||||
Each successful increment gets its own commit. Don't accumulate large uncommitted changes.
|
||||
|
||||
```
|
||||
Work pattern:
|
||||
Implement slice → Test → Verify → Commit → Next slice
|
||||
|
||||
Not this:
|
||||
Implement everything → Hope it works → Giant commit
|
||||
```
|
||||
|
||||
Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.
|
||||
|
||||
### 2. Atomic Commits
|
||||
|
||||
Each commit does one logical thing:
|
||||
|
||||
```
|
||||
# Good: Each commit is self-contained
|
||||
git log --oneline
|
||||
a1b2c3d Add task creation endpoint with validation
|
||||
d4e5f6g Add task creation form component
|
||||
h7i8j9k Connect form to API and add loading state
|
||||
m1n2o3p Add task creation tests (unit + integration)
|
||||
|
||||
# Bad: Everything mixed together
|
||||
git log --oneline
|
||||
x1y2z3a Add task feature, fix sidebar, update deps, refactor utils
|
||||
```
|
||||
|
||||
### 3. Descriptive Messages
|
||||
|
||||
Commit messages explain the *why*, not just the *what*:
|
||||
|
||||
```
|
||||
# Good: Explains intent
|
||||
feat: add email validation to registration endpoint
|
||||
|
||||
Prevents invalid email formats from reaching the database.
|
||||
Uses Zod schema validation at the route handler level,
|
||||
consistent with existing validation patterns in auth.ts.
|
||||
|
||||
# Bad: Describes what's obvious from the diff
|
||||
update auth.ts
|
||||
```
|
||||
|
||||
**Format:**
|
||||
```
|
||||
<type>: <short description>
|
||||
|
||||
<optional body explaining why, not what>
|
||||
```
|
||||
|
||||
**Types:**
|
||||
- `feat` — New feature
|
||||
- `fix` — Bug fix
|
||||
- `refactor` — Code change that neither fixes a bug nor adds a feature
|
||||
- `test` — Adding or updating tests
|
||||
- `docs` — Documentation only
|
||||
- `chore` — Tooling, dependencies, config
|
||||
|
||||
### 4. Keep Concerns Separate
|
||||
|
||||
Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:
|
||||
|
||||
```
|
||||
# Good: Separate concerns
|
||||
git commit -m "refactor: extract validation logic to shared utility"
|
||||
git commit -m "feat: add phone number validation to registration"
|
||||
|
||||
# Bad: Mixed concerns
|
||||
git commit -m "refactor validation and add phone number field"
|
||||
```
|
||||
|
||||
**Separate refactoring from feature work.** A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.
|
||||
|
||||
### 5. Size Your Changes
|
||||
|
||||
Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in `code-review-and-quality` for how to break down large changes.
|
||||
|
||||
```
|
||||
~100 lines → Easy to review, easy to revert
|
||||
~300 lines → Acceptable for a single logical change
|
||||
~1000 lines → Split into smaller changes
|
||||
```
|
||||
|
||||
## Branching Strategy
|
||||
|
||||
### Feature Branches
|
||||
|
||||
```
|
||||
main (always deployable)
|
||||
│
|
||||
├── feature/task-creation ← One feature per branch
|
||||
├── feature/user-settings ← Parallel work
|
||||
└── fix/duplicate-tasks ← Bug fixes
|
||||
```
|
||||
|
||||
- Branch from `main` (or the team's default branch)
|
||||
- Keep branches short-lived (merge within 1-3 days) — long-lived branches are hidden costs
|
||||
- Delete branches after merge
|
||||
- Prefer feature flags over long-lived branches for incomplete features
|
||||
|
||||
### Branch Naming
|
||||
|
||||
```
|
||||
feature/<short-description> → feature/task-creation
|
||||
fix/<short-description> → fix/duplicate-tasks
|
||||
chore/<short-description> → chore/update-deps
|
||||
refactor/<short-description> → refactor/auth-module
|
||||
```
|
||||
|
||||
## Working with Worktrees
|
||||
|
||||
For parallel AI agent work, use git worktrees to run multiple branches simultaneously:
|
||||
|
||||
```bash
|
||||
# Create a worktree for a feature branch
|
||||
git worktree add ../project-feature-a feature/task-creation
|
||||
git worktree add ../project-feature-b feature/user-settings
|
||||
|
||||
# Each worktree is a separate directory with its own branch
|
||||
# Agents can work in parallel without interfering
|
||||
ls ../
|
||||
project/ ← main branch
|
||||
project-feature-a/ ← task-creation branch
|
||||
project-feature-b/ ← user-settings branch
|
||||
|
||||
# When done, merge and clean up
|
||||
git worktree remove ../project-feature-a
|
||||
```
|
||||
|
||||
Benefits:
|
||||
- Multiple agents can work on different features simultaneously
|
||||
- No branch switching needed (each directory has its own branch)
|
||||
- If one experiment fails, delete the worktree — nothing is lost
|
||||
- Changes are isolated until explicitly merged
|
||||
|
||||
## The Save Point Pattern
|
||||
|
||||
```
|
||||
Agent starts work
|
||||
│
|
||||
├── Makes a change
|
||||
│ ├── Test passes? → Commit → Continue
|
||||
│ └── Test fails? → Revert to last commit → Investigate
|
||||
│
|
||||
├── Makes another change
|
||||
│ ├── Test passes? → Commit → Continue
|
||||
│ └── Test fails? → Revert to last commit → Investigate
|
||||
│
|
||||
└── Feature complete → All commits form a clean history
|
||||
```
|
||||
|
||||
This pattern means you never lose more than one increment of work. If an agent goes off the rails, `git reset --hard HEAD` takes you back to the last successful state.
|
||||
|
||||
## Change Summaries
|
||||
|
||||
After any modification, provide a structured summary. This makes review easier, documents scope discipline, and surfaces unintended changes:
|
||||
|
||||
```
|
||||
CHANGES MADE:
|
||||
- src/routes/tasks.ts: Added validation middleware to POST endpoint
|
||||
- src/lib/validation.ts: Added TaskCreateSchema using Zod
|
||||
|
||||
THINGS I DIDN'T TOUCH (intentionally):
|
||||
- src/routes/auth.ts: Has similar validation gap but out of scope
|
||||
- src/middleware/error.ts: Error format could be improved (separate task)
|
||||
|
||||
POTENTIAL CONCERNS:
|
||||
- The Zod schema is strict — rejects extra fields. Confirm this is desired.
|
||||
- Added zod as a dependency (72KB gzipped) — already in package.json
|
||||
```
|
||||
|
||||
This pattern catches wrong assumptions early and gives reviewers a clear map of the change. The "DIDN'T TOUCH" section is especially important — it shows you exercised scope discipline and didn't go on an unsolicited renovation.
|
||||
|
||||
## Pre-Commit Hygiene
|
||||
|
||||
Before every commit:
|
||||
|
||||
```bash
|
||||
# 1. Check what you're about to commit
|
||||
git diff --staged
|
||||
|
||||
# 2. Ensure no secrets
|
||||
git diff --staged | grep -i "password\|secret\|api_key\|token"
|
||||
|
||||
# 3. Run tests
|
||||
npm test
|
||||
|
||||
# 4. Run linting
|
||||
npm run lint
|
||||
|
||||
# 5. Run type checking
|
||||
npx tsc --noEmit
|
||||
```
|
||||
|
||||
Automate this with git hooks:
|
||||
|
||||
```json
|
||||
// package.json (using lint-staged + husky)
|
||||
{
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
||||
"*.{json,md}": ["prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Handling Generated Files
|
||||
|
||||
- **Commit generated files** only if the project expects them (e.g., `package-lock.json`, Prisma migrations)
|
||||
- **Don't commit** build output (`dist/`, `.next/`), environment files (`.env`), or IDE config (`.vscode/settings.json` unless shared)
|
||||
- **Have a `.gitignore`** that covers: `node_modules/`, `dist/`, `.env`, `.env.local`, `*.pem`
|
||||
|
||||
## Using Git for Debugging
|
||||
|
||||
```bash
|
||||
# Find which commit introduced a bug
|
||||
git bisect start
|
||||
git bisect bad HEAD
|
||||
git bisect good <known-good-commit>
|
||||
# Git checkouts midpoints; run your test at each to narrow down
|
||||
|
||||
# View what changed recently
|
||||
git log --oneline -20
|
||||
git diff HEAD~5..HEAD -- src/
|
||||
|
||||
# Find who last changed a specific line
|
||||
git blame src/services/task.ts
|
||||
|
||||
# Search commit messages for a keyword
|
||||
git log --grep="validation" --oneline
|
||||
```
|
||||
|
||||
## Release & Versioning
|
||||
|
||||
Commits are how *you* track change; a **version** is how your *consumers* track it. The moment anything else depends on your code — another team, a published package, a deployed client — "latest on main" stops being a sufficient answer to "what am I running, and is it safe to upgrade?" A version number and a changelog are the contract that answers it.
|
||||
|
||||
### Semantic Versioning
|
||||
|
||||
For anything with consumers, version `MAJOR.MINOR.PATCH` and let the number carry meaning:
|
||||
|
||||
```
|
||||
MAJOR breaking change — consumers must change their code to upgrade
|
||||
MINOR new functionality, backward-compatible — safe to upgrade
|
||||
PATCH bug fix, backward-compatible — safe to upgrade
|
||||
```
|
||||
|
||||
The number is a promise, so make the code match it. A "patch" that changes behavior consumers relied on is a major change wearing a disguise (Hyrum's Law — see the `api-and-interface-design` skill). When unsure whether a change is breaking, assume it is; a surprise major is far cheaper than a broken consumer.
|
||||
|
||||
### Tag the release, and let the tag be the source of truth
|
||||
|
||||
A release is an immutable point in history, not a moving branch. Tag it so it can always be reproduced:
|
||||
|
||||
```bash
|
||||
git tag -a v1.4.0 -m "Release 1.4.0"
|
||||
git push origin v1.4.0
|
||||
```
|
||||
|
||||
Derive the version from the tag rather than hand-editing it in scattered files, so the artifact, the tag, and the changelog can never disagree.
|
||||
|
||||
### Keep a changelog written for humans
|
||||
|
||||
A changelog is not `git log`. It's the curated, consumer-facing answer to "what changed and do I care?" — grouped by `Added / Changed / Fixed / Deprecated / Removed / Security`, newest on top, every entry phrased around user impact, not internal mechanics.
|
||||
|
||||
```markdown
|
||||
## [1.4.0] - 2025-06-12
|
||||
### Added
|
||||
- Bulk task import via CSV
|
||||
### Fixed
|
||||
- Timezone drift in recurring task due dates
|
||||
### Deprecated
|
||||
- `GET /v1/tasks/all` — use the paginated `GET /v1/tasks` (removal in 2.0)
|
||||
```
|
||||
|
||||
Write the entry in the same change that makes the change, while the impact is fresh — not reconstructed from commit archaeology at release time. Breaking changes get a migration note and a deprecation window (follow the `deprecation-and-migration` skill); shipping the actual release is the `shipping-and-launch` skill's job — this section is the versioning contract that feeds it.
|
||||
|
||||
## Common Rationalizations
|
||||
|
||||
| Rationalization | Reality |
|
||||
|---|---|
|
||||
| "I'll commit when the feature is done" | One giant commit is impossible to review, debug, or revert. Commit each slice. |
|
||||
| "The message doesn't matter" | Messages are documentation. Future you (and future agents) will need to understand what changed and why. |
|
||||
| "I'll squash it all later" | Squashing destroys the development narrative. Prefer clean incremental commits from the start. |
|
||||
| "Branches add overhead" | Short-lived branches are free and prevent conflicting work from colliding. Long-lived branches are the problem — merge within 1-3 days. |
|
||||
| "I'll split this change later" | Large changes are harder to review, riskier to deploy, and harder to revert. Split before submitting, not after. |
|
||||
| "I don't need a .gitignore" | Until `.env` with production secrets gets committed. Set it up immediately. |
|
||||
| "It's just a small fix, bump the patch" | Check what consumers can observe. A behavior change they relied on is a major, whatever the diff size. |
|
||||
| "The changelog is just the commit log" | Commits are for you; the changelog is for consumers, curated by impact. Generating one from raw commits buries what matters. |
|
||||
| "We'll write the changelog at release time" | By then the impact is reconstructed from memory and half of it is missing. Write the entry with the change. |
|
||||
|
||||
## Red Flags
|
||||
|
||||
- Large uncommitted changes accumulating
|
||||
- Commit messages like "fix", "update", "misc"
|
||||
- Formatting changes mixed with behavior changes
|
||||
- No `.gitignore` in the project
|
||||
- Committing `node_modules/`, `.env`, or build artifacts
|
||||
- Long-lived branches that diverge significantly from main
|
||||
- Force-pushing to shared branches
|
||||
- A breaking change shipped under a minor or patch version bump
|
||||
- A release with no tag, or a version number hand-edited out of sync with the tag
|
||||
- A user-facing release with no changelog entry, or a changelog that's just dumped commit messages
|
||||
|
||||
## Verification
|
||||
|
||||
For every commit:
|
||||
|
||||
- [ ] Commit does one logical thing
|
||||
- [ ] Message explains the why, follows type conventions
|
||||
- [ ] Tests pass before committing
|
||||
- [ ] No secrets in the diff
|
||||
- [ ] No formatting-only changes mixed with behavior changes
|
||||
- [ ] `.gitignore` covers standard exclusions
|
||||
|
||||
For every release (anything with consumers):
|
||||
|
||||
- [ ] The version bump matches the change: breaking → major, additive → minor, fix → patch
|
||||
- [ ] The release is tagged, and the version is derived from the tag, not hand-edited out of sync
|
||||
- [ ] The changelog has a curated, human-readable entry grouped by impact for this version
|
||||
7
.agents/skills/grill-me/SKILL.md
Normal file
7
.agents/skills/grill-me/SKILL.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
name: grill-me
|
||||
description: A relentless interview to sharpen a plan or design.
|
||||
disable-model-invocation: true
|
||||
---
|
||||
|
||||
Call the Skill tool with "grilling".
|
||||
5
.agents/skills/grill-me/agents/openai.yaml
Normal file
5
.agents/skills/grill-me/agents/openai.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
interface:
|
||||
display_name: "Grill Me"
|
||||
short_description: "Sharpen a plan through interview"
|
||||
policy:
|
||||
allow_implicit_invocation: false
|
||||
22
.agents/skills/grilling/SKILL.md
Normal file
22
.agents/skills/grilling/SKILL.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: grilling
|
||||
description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
|
||||
---
|
||||
|
||||
Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
|
||||
|
||||
Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
|
||||
|
||||
Each question should be formatted like so:
|
||||
|
||||
```
|
||||
❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
||||
|
||||
➡️ <your recommended answer>
|
||||
```
|
||||
|
||||
Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
|
||||
|
||||
Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
|
||||
|
||||
The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
|
||||
3
.agents/skills/grilling/agents/openai.yaml
Normal file
3
.agents/skills/grilling/agents/openai.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
interface:
|
||||
display_name: "Grilling"
|
||||
short_description: "Stress-test thinking a round of questions at a time"
|
||||
248
.agents/skills/planning-and-task-breakdown/SKILL.md
Normal file
248
.agents/skills/planning-and-task-breakdown/SKILL.md
Normal file
@@ -0,0 +1,248 @@
|
||||
---
|
||||
name: planning-and-task-breakdown
|
||||
description: Breaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.
|
||||
---
|
||||
|
||||
# Planning and Task Breakdown
|
||||
|
||||
## Overview
|
||||
|
||||
Decompose work into small, verifiable tasks with explicit acceptance criteria. Good task breakdown is the difference between an agent that completes work reliably and one that produces a tangled mess. Every task should be small enough to implement, test, and verify in a single focused session.
|
||||
|
||||
## When to Use
|
||||
|
||||
- You have a spec and need to break it into implementable units
|
||||
- A task feels too large or vague to start
|
||||
- Work needs to be parallelized across multiple agents or sessions
|
||||
- You need to communicate scope to a human
|
||||
- The implementation order isn't obvious
|
||||
|
||||
**When NOT to use:** Single-file changes with obvious scope, or when the spec already contains well-defined tasks.
|
||||
|
||||
## The Planning Process
|
||||
|
||||
### Step 1: Enter Plan Mode
|
||||
|
||||
Before writing any code, operate in read-only mode:
|
||||
|
||||
- Read the spec and relevant codebase sections
|
||||
- Identify existing patterns and conventions
|
||||
- Map dependencies between components
|
||||
- Note risks and unknowns
|
||||
|
||||
**Do NOT write code during planning.** The output is a plan document saved to `tasks/plan.md` and a task list recorded in the task list target (see Output Files; default `tasks/todo.md`), not implementation.
|
||||
|
||||
### Step 2: Identify the Dependency Graph
|
||||
|
||||
Map what depends on what:
|
||||
|
||||
```
|
||||
Database schema
|
||||
│
|
||||
├── API models/types
|
||||
│ │
|
||||
│ ├── API endpoints
|
||||
│ │ │
|
||||
│ │ └── Frontend API client
|
||||
│ │ │
|
||||
│ │ └── UI components
|
||||
│ │
|
||||
│ └── Validation logic
|
||||
│
|
||||
└── Seed data / migrations
|
||||
```
|
||||
|
||||
Implementation order follows the dependency graph bottom-up: build foundations first.
|
||||
|
||||
### Step 3: Slice Vertically
|
||||
|
||||
Instead of building all the database, then all the API, then all the UI — build one complete feature path at a time:
|
||||
|
||||
**Bad (horizontal slicing):**
|
||||
```
|
||||
Task 1: Build entire database schema
|
||||
Task 2: Build all API endpoints
|
||||
Task 3: Build all UI components
|
||||
Task 4: Connect everything
|
||||
```
|
||||
|
||||
**Good (vertical slicing):**
|
||||
```
|
||||
Task 1: User can create an account (schema + API + UI for registration)
|
||||
Task 2: User can log in (auth schema + API + UI for login)
|
||||
Task 3: User can create a task (task schema + API + UI for creation)
|
||||
Task 4: User can view task list (query + API + UI for list view)
|
||||
```
|
||||
|
||||
Each vertical slice delivers working, testable functionality.
|
||||
|
||||
### Step 4: Write Tasks
|
||||
|
||||
Each task follows this structure, whether it lands in the markdown task list or as an item in an external tracker (see Output Files):
|
||||
|
||||
```markdown
|
||||
## Task [N]: [Short descriptive title]
|
||||
|
||||
**Description:** One paragraph explaining what this task accomplishes.
|
||||
|
||||
**Acceptance criteria:**
|
||||
- [ ] [Specific, testable condition]
|
||||
- [ ] [Specific, testable condition]
|
||||
|
||||
**Verification:**
|
||||
- [ ] Tests pass: [the repository's focused-test command]
|
||||
- [ ] Build succeeds: [the repository's build command]
|
||||
- [ ] Manual check: [description of what to verify]
|
||||
|
||||
**Dependencies:** [Task numbers this depends on, or "None"]
|
||||
|
||||
**Files likely touched:**
|
||||
- `src/path/to/file.ts`
|
||||
- `tests/path/to/test.ts`
|
||||
|
||||
**Estimated scope:** [Small: 1-2 files | Medium: 3-5 files | Large: 5+ files]
|
||||
```
|
||||
|
||||
### Step 5: Order and Checkpoint
|
||||
|
||||
Arrange tasks so that:
|
||||
|
||||
1. Dependencies are satisfied (build foundation first)
|
||||
2. Each task leaves the system in a working state
|
||||
3. Verification checkpoints occur after every 2-3 tasks
|
||||
4. High-risk tasks are early (fail fast)
|
||||
|
||||
Add explicit checkpoints to the task list target:
|
||||
|
||||
```markdown
|
||||
## Checkpoint: After Tasks 1-3
|
||||
- [ ] All tests pass
|
||||
- [ ] Application builds without errors
|
||||
- [ ] Core user flow works end-to-end
|
||||
- [ ] Review with human before proceeding
|
||||
```
|
||||
|
||||
## Task Sizing Guidelines
|
||||
|
||||
| Size | Files | Scope | Example |
|
||||
|------|-------|-------|---------|
|
||||
| **XS** | 1 | Single function or config change | Add a validation rule |
|
||||
| **S** | 1-2 | One component or endpoint | Add a new API endpoint |
|
||||
| **M** | 3-5 | One feature slice | User registration flow |
|
||||
| **L** | 5-8 | Multi-component feature | Search with filtering and pagination |
|
||||
| **XL** | 8+ | **Too large — break it down further** | — |
|
||||
|
||||
If a task is L or larger, it should be broken into smaller tasks. An agent performs best on S and M tasks.
|
||||
|
||||
**When to break a task down further:**
|
||||
- It would take more than one focused session (roughly 2+ hours of agent work)
|
||||
- You cannot describe the acceptance criteria in 3 or fewer bullet points
|
||||
- It touches two or more independent subsystems (e.g., auth and billing)
|
||||
- You find yourself writing "and" in the task title (a sign it is two tasks)
|
||||
|
||||
## Output Files
|
||||
|
||||
- **Plan document:** Save the implementation plan to `tasks/plan.md`. This is always a markdown file — design decisions, risks, and open questions don't map cleanly onto individual tracker issues.
|
||||
- **Task list:** Record each task in the **task list target** (defined below).
|
||||
|
||||
Create the `tasks/` directory if it does not exist.
|
||||
|
||||
### Task List Target
|
||||
|
||||
The task list target is where tasks and checkpoints are recorded. It is defined once, here; every other reference in this skill defers to it.
|
||||
|
||||
- **Default: a checklist-style markdown file at `tasks/todo.md`.** This is the convention the `/build` command and other downstream tooling expect. Use it unless the project says otherwise.
|
||||
- **External tracker:** if the project's agent rules (`CLAUDE.md`, `AGENTS.md`, etc.) or the user designate an issue tracker (e.g. GitHub Issues, Jira, Linear, `bd`/beads), create one tracker item per task instead of writing `tasks/todo.md`. Map the Step 4 structure onto the tracker's fields: acceptance criteria and verification steps in the item body, dependencies via the tracker's linking mechanism (`bd dep add`, "blocked by", etc.). Record Step 5 checkpoints as tracker items too, or as a checklist in the plan document if the tracker has no natural equivalent.
|
||||
|
||||
When using an external tracker, note it in `tasks/plan.md` (e.g. "Tasks tracked in Linear project FOO") so downstream steps and future sessions know where to look, and keep the plan document's Task List section as an ordered index of tracker item IDs or links rather than a duplicate checklist.
|
||||
|
||||
## Plan Document Template
|
||||
|
||||
```markdown
|
||||
# Implementation Plan: [Feature/Project Name]
|
||||
|
||||
## Overview
|
||||
[One paragraph summary of what we're building]
|
||||
|
||||
## Architecture Decisions
|
||||
- [Key decision 1 and rationale]
|
||||
- [Key decision 2 and rationale]
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Foundation
|
||||
- [ ] Task 1: ...
|
||||
- [ ] Task 2: ...
|
||||
|
||||
### Checkpoint: Foundation
|
||||
- [ ] Tests pass, builds clean
|
||||
|
||||
### Phase 2: Core Features
|
||||
- [ ] Task 3: ...
|
||||
- [ ] Task 4: ...
|
||||
|
||||
### Checkpoint: Core Features
|
||||
- [ ] End-to-end flow works
|
||||
|
||||
### Phase 3: Polish
|
||||
- [ ] Task 5: ...
|
||||
- [ ] Task 6: ...
|
||||
|
||||
### Checkpoint: Complete
|
||||
- [ ] All acceptance criteria met
|
||||
- [ ] Ready for review
|
||||
|
||||
## Risks and Mitigations
|
||||
| Risk | Impact | Mitigation |
|
||||
|------|--------|------------|
|
||||
| [Risk] | [High/Med/Low] | [Strategy] |
|
||||
|
||||
## Open Questions
|
||||
- [Question needing human input]
|
||||
```
|
||||
|
||||
When tasks live in an external tracker, keep the Task List section above as an ordered index of tracker item IDs or links instead of a duplicate checklist.
|
||||
|
||||
## Parallelization Opportunities
|
||||
|
||||
When multiple agents or sessions are available:
|
||||
|
||||
- **Safe to parallelize:** Independent feature slices, tests for already-implemented features, documentation
|
||||
- **Must be sequential:** Database migrations, shared state changes, dependency chains
|
||||
- **Needs coordination:** Features that share an API contract (define the contract first, then parallelize)
|
||||
|
||||
## Common Rationalizations
|
||||
|
||||
| Rationalization | Reality |
|
||||
|---|---|
|
||||
| "I'll figure it out as I go" | That's how you end up with a tangled mess and rework. 10 minutes of planning saves hours. |
|
||||
| "The tasks are obvious" | Write them down anyway. Explicit tasks surface hidden dependencies and forgotten edge cases. |
|
||||
| "Planning is overhead" | Planning is the task. Implementation without a plan is just typing. |
|
||||
| "I can hold it all in my head" | Context windows are finite. Written plans survive session boundaries and compaction. |
|
||||
|
||||
## Red Flags
|
||||
|
||||
- Starting implementation without a written task list
|
||||
- Writing `tasks/todo.md` when the project has designated an external tracker (or scattering tasks across both)
|
||||
- Tasks that say "implement the feature" without acceptance criteria
|
||||
- No verification steps in the plan
|
||||
- All tasks are XL-sized
|
||||
- No checkpoints between tasks
|
||||
- Dependency order isn't considered
|
||||
|
||||
## Verification
|
||||
|
||||
Before starting implementation, confirm:
|
||||
|
||||
- [ ] Every task has acceptance criteria
|
||||
- [ ] Every task has a verification step
|
||||
- [ ] Task dependencies are identified and ordered correctly
|
||||
- [ ] Tasks are recorded in the task list target (default `tasks/todo.md`)
|
||||
- [ ] No task touches more than ~5 files
|
||||
- [ ] Checkpoints exist between major phases
|
||||
- [ ] The human has reviewed and approved the plan
|
||||
|
||||
## See Also
|
||||
|
||||
Acceptance criteria are per-task and answer "did we build the right thing?". They sit on top of the project-wide Definition of Done, the standing bar every task clears before it counts as done. See `references/definition-of-done.md`.
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Definition of Done
|
||||
|
||||
A standing, project-wide bar that every change must clear before it counts as done. Unlike acceptance criteria, which vary per task and answer "did we build the right thing?", the Definition of Done is the same every time and answers "is this finished to our standard?". Use it as the final gate in `planning-and-task-breakdown`, `incremental-implementation`, and `shipping-and-launch`.
|
||||
|
||||
## Definition of Done vs. Acceptance Criteria
|
||||
|
||||
| | Acceptance Criteria | Definition of Done |
|
||||
|---|---|---|
|
||||
| Scope | Specific to one task or spec | Applies to every increment |
|
||||
| Changes | Different for each item | Fixed and reused |
|
||||
| Answers | "Did we build *this thing*?" | "Is it *ready*?" |
|
||||
| Owner | Defined when planning the task | Defined once for the project |
|
||||
| Example | "User can reset password via email link" | "Tests pass, no regressions, docs updated" |
|
||||
|
||||
The two are complementary. A task is done only when **its** acceptance criteria are met **and** the standing Definition of Done is satisfied. Skipping either leaves work that looks finished but is not.
|
||||
|
||||
## The Standing Checklist
|
||||
|
||||
Apply this to every change before declaring it done.
|
||||
|
||||
### Correctness
|
||||
- [ ] All acceptance criteria for the task are met
|
||||
- [ ] Code runs and behaves as intended, verified at runtime, not just compiled or typechecked
|
||||
- [ ] New behavior is covered by tests that fail without the change and pass with it
|
||||
- [ ] Existing tests still pass; no regressions introduced
|
||||
- [ ] Edge cases and error paths are handled, not just the happy path
|
||||
|
||||
### Quality
|
||||
- [ ] Code reveals intent through naming and structure; no comments needed to explain *what* it does
|
||||
- [ ] No duplicated business logic
|
||||
- [ ] No dead code, debug output, or commented-out blocks left behind
|
||||
- [ ] Changes are scoped to the task; no unrelated refactors snuck in
|
||||
- [ ] Linting and formatting pass
|
||||
|
||||
The depth behind these items lives in `code-review-and-quality` (the five-axis review) and `code-simplification` (reducing complexity without changing behavior).
|
||||
|
||||
### Integration
|
||||
- [ ] Change works with the rest of the system, not just in isolation
|
||||
- [ ] Database migrations, config changes, and feature flags are accounted for
|
||||
- [ ] Backward compatibility considered for any public interface or API change
|
||||
|
||||
### Documentation
|
||||
- [ ] Public interfaces, APIs, and user-facing behavior are documented
|
||||
- [ ] Architectural decisions worth preserving are recorded (see `documentation-and-adrs`)
|
||||
- [ ] Documentation describes the current state in timeless language, not the change history
|
||||
|
||||
### Ship-readiness
|
||||
- [ ] Security implications reviewed for any untrusted input, auth, or data handling (see `security-and-hardening`)
|
||||
- [ ] Observability in place for new critical paths (logs, metrics, traces) (see `observability-and-instrumentation`)
|
||||
- [ ] Rollback path exists for anything risky (see `shipping-and-launch`)
|
||||
- [ ] The human has reviewed and approved before merge or deploy
|
||||
|
||||
## How to Apply
|
||||
|
||||
- **Per task**: confirm the Correctness and Quality sections before checking the task off.
|
||||
- **Per feature**: confirm Integration and Documentation before considering the feature complete.
|
||||
- **Per release**: the full checklist is the floor; `shipping-and-launch` adds the deploy-specific gates on top.
|
||||
|
||||
Tailor the list to the project once, then reuse it unchanged. A Definition of Done that is renegotiated every sprint is not a Definition of Done.
|
||||
|
||||
## Red Flags
|
||||
|
||||
- "It's done, I just haven't run it yet": unverified work is not done.
|
||||
- "Tests pass" used as a synonym for done while docs, regressions, or runtime verification are skipped.
|
||||
- A different bar applied depending on deadline pressure.
|
||||
- Acceptance criteria treated as the whole bar, with no standing quality floor.
|
||||
- "Done" declared before human review on changes that need it.
|
||||
Reference in New Issue
Block a user