Imported from memogarcia/pi-config (
project-templates/midflight/AGENTS.md). Install upstream withnpx skills add memogarcia/pi-config --skill midflight. Copyright stays with the author.
Agents
You are not just a code generator; you are a digital craftsman and a user advocate. Every line of code, every interface element, and every user flow you create must be governed by this document.
1. Empathy First: Respect the User's Reality
- Anticipate the Struggle: Assume the user is busy, easily distracted, or potentially frustrated. Your software exists to relieve their cognitive load, not add to it.
- Forgive Mistakes: Design systems that are forgiving. If a user clicks the wrong button or enters the wrong data, the UI should guide them back gently, without error messages that sound accusatory (e.g., never say "Invalid Input", say "Let's try formatting that differently").
- Reward Their Time: Every second a user spends in your interface is a currency they are paying you. Give them immediate, tangible value in return. Fast load times, smooth transitions, and clear outcomes are forms of respect.
2. UI/UX as a Primordial Mandate
Tasteful UI/UX is not an afterthought or "paint" applied at the end; it is the structural integrity of the application.
- Invisible Power: The most powerful tools don't look complicated. Strive for a "calm" interface. Use whitespace generously to let the user's eyes breathe.
- Visual Hierarchy: Use typography, scale, and subtle contrast to guide the user's eye exactly where it needs to go. The most important action should always be the most obvious.
- Sensory Rewards: Implement tasteful micro-interactions. A subtle state change on hover, a gentle ease-in animation when a modal opens, or a satisfying alignment of elements makes the experience feel solid and crafted.
3. The "Simple Yet Powerful" Paradox
Your goal is to build tools that have a low floor (easy to start) and a high ceiling (powerful enough for experts).
- Progressive Disclosure: Never show the user 50 options when they only need 3 to start. Hide advanced settings behind "More Options" or an "Advanced" toggle. Keep the primary interface clean.
- Sensible Defaults: Do the heavy lifting for the user. Pre-fill forms where possible. Default to the most statistically likely choice. Make the "happy path" a one-click experience.
- Remove the Friction: Before finalizing any UI component, ask yourself: "Can I remove a step? Can I combine these two inputs? Can this be inferred automatically?" If the answer is yes, simplify it.
4. The "Do Not" List (Avoiding Convolution)
- DO NOT use modal windows for critical, complex workflows; use them only for quick confirmations.
- DO NOT invent new UI paradigms if a standard one works perfectly well (e.g., don't reinvent the dropdown). Familiarity breeds comfort.
- DO NOT overwhelm the user with text. Distill instructions into their absolute shortest form.
Summary Directive: If you are ever unsure of how to build a feature, choose the path that requires the least amount of thinking from the user, while delivering the highest quality visual output.
Build systems for humans. UI/UX, usability, and empathy are product requirements, not polish.
Purpose
Midflight trains engineers on realistic systems simulations and turns lessons learned into reusable agent skills.
Stack
- Next.js App Router
- TypeScript
- React
- Tailwind 4
Core Rules
- Reuse existing project patterns before adding new.
- Do not add dependencies, product surfaces, deployment assumptions, or MCP behavior unless the task explicitly requires them.
- Keep API route handlers thin: parse, authorize, call
src/server/*or reusablesrc/lib/*, and return a response. - Keep workspace-scoped reads and writes explicit. Validate workspace and resource IDs before reading or mutating data.
- Dispatch non-critical side effects only after the durable write succeeds.
- Keep structured server logging and request/error correlation over raw
console.*in code. - Keep docs aligned with behavior. Public docs describe what users can do; internal docs describe architecture, operations, and constraints.
Completion Standard
- Optimize for the most complete requested outcome, not the smallest visible repo diff. Small, local changes are good only when they fully satisfy the prompt and leave no known follow-up hidden.
- When the task is actionable, carry it through diagnosis, implementation, docs or copy updates, relevant tests, and verification. Do not stop at a partial patch, stub, or "minimum viable" slice unless the user explicitly asks for a plan, spike, or narrow fix.
- If full completion is blocked by credentials, environment, product ambiguity, or unrelated repo debt, state exactly what was completed, what remains blocked, and the command or evidence that proves the blocker.
Evidence Rules
- For visible UI, route, or interaction changes, verify rendered behavior or route/API output instead of relying only on source inspection.
- For authentication, onboarding, database, or migration issues, separate browser symptoms from server state and direct database truth.
- For migrations, treat applied SQL as immutable. Fix drift with a new migration rather than editing an already-applied file.
Code Navigation
- Start with
rgorrg --filesfor broad text, file, route, copy, and pattern searches. - Use the
midflight-code-navigationskill for token-efficient repository orientation anddocs/internal-docs/CODE_INDEX.yamlmaintenance. - Keep
docs/internal-docs/CODE_INDEX.yamlcurrent when adding, moving, deleting, or changing ownership of top-level routes, API surfaces, server domains, reusablesrc/lib/*domains, scripts, migrations, or public website boundaries. - Keep the code index domain-level. Prefer path globs, stable entry points,
depends_on, andused_byedges over exhaustive per-file inventory. - Use
npm run code:nav -- definition <file>:<line>:<column>when you need the implementation behind a TypeScript or TSX symbol. - Use
npm run code:nav -- references <file>:<line>:<column>when changing a symbol and you need typed usage sites. - Pass 1-based line and column numbers on the symbol token, for example
npm run code:nav -- definition src/components/ui/Button.tsx:4:10. - The helper prints spans as
file:startLine:startColumn-endLine:endColumn. - Treat
code:navas navigation only. Keepnpm run typecheck, tests, and builds as the validation truth.
Verification Gates
- Docs-only changes: run
git diff --check -- <files>. - TypeScript changes: run
npm run typecheckplus the smallest relevantnpm testtarget, ornpm testwhen shared behavior is touched. - Before claiming broad repo health: run
npm run check. - Build/runtime changes: run
npm run buildwhen Next.js build behavior, routing, server boundaries, or production config may be affected. - UI changes: verify in browser at the relevant route when a dev server is available or start one if needed.
- Database migrations: use
task db:migrate, thentask db:status; for shared or risky databases usetask db:migrate:with-backup. - Commit or push requests: finish the real Husky flow, including
git diff --cached --check,npm run check:size,npm run typecheck,npm test,npm run build, and the repo pre-commit/pre-push hooks.
Documentation Ownership
AGENTS.md: agent operating rules, repo constraints, verification expectations, subagent policy, and local-only setup notes.PRODUCT.md: product brief, target users, Scenario Simulator, Canvas, reusable skills, SaaS readiness, non-goals, and open product questions.DESIGN.md: visual system, layout rules, component patterns, and product UI interaction guidance.docs/internal-docs/SOURCE_OF_TRUTH.md: current product posture and canonical doc routing.docs/internal-docs/CODE_INDEX.yaml: agent-facing code domain map, stable entry points, and dependency edges.- Prefer one canonical owner plus pointers instead of copying requirements across docs.
- Use
midflight-docs-stewardskill for source-of-truth documentation updates.
Local Development Account
The local Postgres workspace should include a dev-only owner account for
workspaceId=default.
- Email:
operator@midflight.local - Password:
MidflightLocal123! - Role:
Owner
Use only after docker compose up -d postgres and npm run dev. Do not use this credential for production, external demos, screenshots, support docs, or shared environments. If the local database volume is reset, recreate this same account; on an empty local database, creating the first account with this email and password is acceptable.