restructure agents config and add permissions to settings
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0437729f20
commit
d9c452ff3c
3 changed files with 254 additions and 44 deletions
|
|
@ -1,4 +1,79 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
||||
"permissions": {
|
||||
"deny": [
|
||||
"Read(.env*)",
|
||||
"Read(.dev.vars*)",
|
||||
"Read(**/*.pem)",
|
||||
"Read(.wrangler/**)",
|
||||
"Edit(.env*)",
|
||||
"Edit(.dev.vars*)",
|
||||
"Edit(**/*.pem)",
|
||||
"Edit(.wrangler/**)",
|
||||
"Write(.env*)",
|
||||
"Write(.dev.vars*)",
|
||||
"Write(**/*.pem)",
|
||||
"Write(.wrangler/**)"
|
||||
],
|
||||
"ask": [
|
||||
"Bash(pnpm deploy *)",
|
||||
"Bash(pnpm upload *)",
|
||||
"Bash(pnpm nuke *)",
|
||||
"Bash(pnpm clean *)",
|
||||
"Bash(pnpm dlx *)",
|
||||
"Bash(pnpm exec *)",
|
||||
"Bash(pnpm add *)",
|
||||
"Bash(pnpm remove *)",
|
||||
"Bash(pnpm up *)",
|
||||
"Bash(pnpm update *)",
|
||||
"Bash(flutter pub add *)",
|
||||
"Bash(flutter pub remove *)",
|
||||
"Bash(flutter pub upgrade *)",
|
||||
"Bash(flutter clean *)"
|
||||
],
|
||||
"allow": [
|
||||
"WebFetch",
|
||||
"Task",
|
||||
|
||||
"mcp__next-devtools__*",
|
||||
|
||||
"Bash(git status *)",
|
||||
"Bash(git log *)",
|
||||
"Bash(git diff *)",
|
||||
"Bash(git show *)",
|
||||
"Bash(git add *)",
|
||||
"Bash(git commit *)",
|
||||
"Bash(git branch *)",
|
||||
"Bash(git checkout *)",
|
||||
"Bash(git switch *)",
|
||||
"Bash(git fetch *)",
|
||||
"Bash(git pull *)",
|
||||
"Bash(git stash *)",
|
||||
"Bash(git remote *)",
|
||||
"Bash(git tag *)",
|
||||
"Bash(git blame *)",
|
||||
"Bash(git rev-parse *)",
|
||||
"Bash(git cherry-pick *)",
|
||||
"Bash(git worktree *)",
|
||||
|
||||
"Bash(gh pr *)",
|
||||
"Bash(gh issue view *)",
|
||||
"Bash(gh issue list *)",
|
||||
"Bash(gh repo view *)",
|
||||
"Bash(gh run *)",
|
||||
|
||||
"Bash(pnpm *)",
|
||||
|
||||
"Bash(flutter *)",
|
||||
"Bash(dart *)",
|
||||
|
||||
"Bash(ls *)",
|
||||
"Bash(pwd)",
|
||||
"Bash(which *)",
|
||||
"Bash(wc *)",
|
||||
"Bash(mkdir *)"
|
||||
]
|
||||
},
|
||||
"enabledMcpjsonServers": ["next-devtools"],
|
||||
"enabledPlugins": {
|
||||
"frontend-design@claude-plugins-official": true,
|
||||
|
|
@ -10,22 +85,8 @@
|
|||
"claude-code-setup@claude-plugins-official": true,
|
||||
"skill-creator@claude-plugins-official": true
|
||||
},
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "dart format \"$CLAUDE_FILE_PATH\" 2>/dev/null || true"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"sandbox": {
|
||||
"enabled": true,
|
||||
"autoAllowBashIfSandboxed": true,
|
||||
"enableWeakerNetworkIsolation": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
94
AGENTS.md
94
AGENTS.md
|
|
@ -1,12 +1,85 @@
|
|||
# AGENTS.md
|
||||
|
||||
> **Monorepo note:** `web/` is a separate Next.js landing page with its own `AGENTS.md`. This file covers the Flutter app only.
|
||||
---
|
||||
|
||||
## Workflow
|
||||
# Author Preferences
|
||||
|
||||
- In plan mode, interview thoroughly — ask about UI/UX, tradeoffs, and edge cases before coding
|
||||
- When new code supersedes existing functionality, find and remove everything it makes redundant
|
||||
- Favor parallel tool calls and subagents when tasks are independent
|
||||
## Behavior
|
||||
|
||||
- When asked to add items to a list (models, emotes, constants, etc.), be thorough on the first pass. Read the source data completely and add ALL relevant items, not just the first few.
|
||||
- In plan mode, interview thoroughly — ask about technical implementation, UI/UX, tradeoffs, and edge cases before coding. Don't begin implementation until all important details are resolved. For refactors: summary → trade-offs → next steps.
|
||||
- When implementing new code, search the codebase for existing usages and follow established patterns.
|
||||
- When new code supersedes existing functionality, find and remove everything it makes redundant.
|
||||
- When asked to "verify", always use web search to check current documentation and sources before responding. Do not rely solely on training data.
|
||||
- Favor parallel tool calls and subagents when tasks are independent.
|
||||
|
||||
## Code Opinions
|
||||
|
||||
- Package imports (`import 'package:frosty/...'`), not relative imports
|
||||
- `UPPER_SNAKE_CASE` for constants
|
||||
- Derive state where possible — avoid duplicating what can be computed (MobX `@computed`)
|
||||
- Trailing commas always
|
||||
- Single quotes
|
||||
- Inline until a pattern repeats 3+ times, then extract
|
||||
- Extract related/grouped logic (state, reactions, actions) into dedicated stores when it improves readability — keep widgets focused on rendering
|
||||
|
||||
## Quality Priorities
|
||||
|
||||
In order: **correctness → user experience → simplicity → security**.
|
||||
|
||||
Not priorities: WCAG compliance (easy wins only), public accessibility, SEO, progressive enhancement.
|
||||
|
||||
## Tool Preferences
|
||||
|
||||
- Prefer LSP over Grep for semantic navigation:
|
||||
- `findReferences` before changing a function/widget signature (no false positives)
|
||||
- `hover` to resolve inferred/computed types (generics, MobX computed properties)
|
||||
- `goToDefinition` to navigate through re-exports and barrel files
|
||||
- `incomingCalls`/`outgoingCalls` to trace call chains across screens, stores, widgets
|
||||
- When debugging third-party packages, **read the package source in the pub cache first** — don't speculate about behavior. Check for validation, protocol restrictions, and attribute filtering before writing code.
|
||||
|
||||
## UI Patterns
|
||||
|
||||
- When UI visibility depends on an async operation (modals, banners, gates), default to hidden and only show after loading completes — never let a default value flash the UI while a request is in flight.
|
||||
- Adapt external designs (Figma specs, reference implementations) to codebase conventions before implementing. External descriptions may contain AI-generated rough drafts — always cross-reference against actual codebase patterns.
|
||||
|
||||
## Infrastructure Checklist
|
||||
|
||||
When creating new infrastructure (screens, API clients, stores), use exploration findings as a **checklist** — systematically verify each convention is followed before writing code.
|
||||
|
||||
## Code Review
|
||||
|
||||
- Label severity: `critical` / `major` / `minor`
|
||||
- Prefer minimal, tightly scoped diffs — don't switch layout strategies (e.g., Column to Stack) unless explicitly asked, as it often breaks dependent sizing
|
||||
- Flag unnecessary complexity with a simpler alternative
|
||||
|
||||
## Testing
|
||||
|
||||
- Suggest tests when changes touch logic, but don't write tests unless asked.
|
||||
- Run targeted tests for relevant files, not the full suite.
|
||||
- After finishing implementation that touches logic or adds new code paths, present a concrete list of test cases that should be added or updated. List each as a one-line description (happy path, sad path, edge cases). Surface this clearly, don't bury it.
|
||||
|
||||
## Commit Convention
|
||||
|
||||
Lowercase, no prefixes (e.g., `fix landscape bottom padding in chat bottom bar`). Keep commits tightly scoped.
|
||||
|
||||
## Branching
|
||||
|
||||
New branches: prefix with `tommy/` (e.g., `tommy/add-auth-flow`).
|
||||
|
||||
## Aliases
|
||||
|
||||
- **"vet"** means: review code for correctness/quality, verify claims against external sources (web search), and flag anything suspicious.
|
||||
|
||||
## Never
|
||||
|
||||
- Never edit `.g.dart` files directly — always regenerate with `dart run build_runner build`
|
||||
|
||||
---
|
||||
|
||||
# Project
|
||||
|
||||
Flutter mobile app for browsing Twitch on iOS and Android. Uses MobX for state management with code generation.
|
||||
|
||||
## Commands
|
||||
|
||||
|
|
@ -29,7 +102,7 @@ dart run build_runner build --delete-conflicting-outputs # Same, but
|
|||
- `lib/widgets/` — Shared widgets
|
||||
- `lib/utils/` — Utility functions
|
||||
|
||||
## Architecture (non-obvious bits)
|
||||
## Architecture
|
||||
|
||||
- Feature stores live in `lib/screens/{feature}/stores/` — don't create new top-level store files (only `lib/stores/` holds global stores)
|
||||
- All API services extend `BaseApiClient` (`lib/apis/base_api_client.dart`) — don't create standalone API classes
|
||||
|
|
@ -39,9 +112,6 @@ dart run build_runner build --delete-conflicting-outputs # Same, but
|
|||
|
||||
- After changing MobX stores or `@JsonSerializable` models, regenerate with `dart run build_runner build`. Never edit `.g.dart` files directly. Commit `.g.dart` files to source control.
|
||||
- The secure storage cleanup in `main.dart` looks unnecessary but handles an Android/iOS edge case where secure storage persists after uninstall. Don't remove it.
|
||||
- Use package imports (`import 'package:frosty/...'`), not relative imports
|
||||
- Always include trailing commas
|
||||
- Use single quotes
|
||||
|
||||
## Testing
|
||||
|
||||
|
|
@ -49,9 +119,3 @@ dart run build_runner build --delete-conflicting-outputs # Same, but
|
|||
- HTTP mocking: `http_mock_adapter` (`DioAdapter`) — use full URLs in `onGet`/`onPost`
|
||||
- General mocking: `mocktail` (no codegen required)
|
||||
- Fixtures live in `test/fixtures/` (e.g., `irc_messages.dart`, `api_responses.dart`)
|
||||
|
||||
## Commits
|
||||
|
||||
Conventional commits: `type(scope): description` — lowercase, no trailing period, tightly scoped (e.g., `fix(chat): correct landscape bottom padding in bottom bar`). Append `!` before the `:` for breaking changes (e.g., `feat(api)!: drop legacy auth flow`).
|
||||
|
||||
Common types: `feat`, `fix`, `chore`, `refactor`, `docs`, `test`, `perf`, `style`. Scope is the affected area (e.g., `chat`, `video`, `api`).
|
||||
|
|
|
|||
115
web/AGENTS.md
115
web/AGENTS.md
|
|
@ -1,5 +1,87 @@
|
|||
# AGENTS.md
|
||||
|
||||
---
|
||||
|
||||
# Author Preferences
|
||||
|
||||
## Behavior
|
||||
|
||||
- When asked to add items to a list (models, emotes, constants, etc.), be thorough on the first pass. Read the source data completely and add ALL relevant items, not just the first few.
|
||||
- In plan mode, interview thoroughly — ask about technical implementation, UI/UX, tradeoffs, and edge cases before coding. Don't begin implementation until all important details are resolved. For refactors: summary → trade-offs → next steps.
|
||||
- When implementing new code, search the codebase for existing usages and follow established patterns.
|
||||
- When new code supersedes existing functionality, find and remove everything it makes redundant.
|
||||
- When asked to "verify", always use web search to check current documentation and sources before responding. Do not rely solely on training data.
|
||||
- Favor parallel tool calls and subagents when tasks are independent.
|
||||
|
||||
## Code Opinions
|
||||
|
||||
- Named exports only — no default exports except where required by Next.js (page, layout, route, etc.)
|
||||
- `satisfies` over `as` for type validation
|
||||
- `UPPER_SNAKE_CASE` for constants
|
||||
- Derive state where possible — avoid duplicating what can be computed
|
||||
- Avoid `useRef` unless DOM access or imperative work
|
||||
- Inline until a pattern repeats 3+ times, then extract
|
||||
- Extract related/grouped logic (state, effects, handlers) into dedicated custom hooks when it improves readability — keep components focused on rendering
|
||||
- For new components/hooks/APIs: include a usage example
|
||||
|
||||
## Quality Priorities
|
||||
|
||||
In order: **correctness → user experience → simplicity → security**.
|
||||
|
||||
Not priorities: WCAG compliance (easy wins only), public accessibility, SEO, progressive enhancement.
|
||||
|
||||
## Tool Preferences
|
||||
|
||||
- Prefer LSP over Grep for semantic navigation:
|
||||
- `findReferences` before changing a function/component signature (no false positives)
|
||||
- `hover` to resolve inferred/computed types (tRPC routers, Drizzle schemas, generics)
|
||||
- `goToDefinition` to navigate through re-exports and barrel files
|
||||
- `incomingCalls`/`outgoingCalls` to trace call chains across routes, hooks, components
|
||||
- When debugging third-party libraries, **read the extension source in `node_modules` first** — don't speculate about behavior. Check for validation, protocol restrictions, and attribute filtering before writing code.
|
||||
|
||||
## UI Patterns
|
||||
|
||||
- When UI visibility depends on an async query (modals, banners, gates), default to hidden and only show after loading completes — never let `defaultValue` flash the UI while the query is in flight.
|
||||
- Adapt external designs (Figma specs, reference implementations) to codebase conventions before implementing. External descriptions may contain AI-generated rough drafts — always cross-reference against actual codebase patterns.
|
||||
|
||||
## Infrastructure Checklist
|
||||
|
||||
When creating new infrastructure (routes, API handlers, providers), use exploration findings as a **checklist** — systematically verify each convention is followed before writing code.
|
||||
|
||||
## Code Review
|
||||
|
||||
- Label severity: `critical` / `major` / `minor`
|
||||
- Prefer minimal, tightly scoped diffs — don't switch layout strategies (e.g., grid to flex) unless explicitly asked, as it often breaks dependent sizing
|
||||
- Flag unnecessary complexity with a simpler alternative
|
||||
|
||||
## Testing
|
||||
|
||||
- Suggest tests when changes touch logic, but don't write tests unless asked.
|
||||
- Run targeted tests for relevant files, not the full suite.
|
||||
- After finishing implementation that touches backend logic or adds new code paths, present a concrete list of test cases that should be added or updated. List each as a one-line description (happy path, sad path, edge cases). Surface this clearly, don't bury it.
|
||||
|
||||
## Commit Convention
|
||||
|
||||
Lowercase, no prefixes (e.g., `remove marquee emote background from hero section`). Keep commits tightly scoped.
|
||||
|
||||
## Branching
|
||||
|
||||
New branches: prefix with `tommy/` (e.g., `tommy/add-auth-flow`).
|
||||
|
||||
## Aliases
|
||||
|
||||
- **"vet"** means: review code for correctness/quality, verify claims against external sources (web search), and flag anything suspicious.
|
||||
|
||||
## Never
|
||||
|
||||
- Never use `npm`, `npx`, or `yarn` — always use `pnpm` / `pnpx`
|
||||
|
||||
---
|
||||
|
||||
# Project
|
||||
|
||||
Next.js 16 landing page for [Frosty](https://frostyapp.io) using the App Router with React 19. Deployed on **Cloudflare Workers** via `@opennextjs/cloudflare`.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
|
|
@ -17,25 +99,25 @@ pnpm clean # Delete .next, .open-next, and node_modules
|
|||
pnpm nuke # Delete .next, .open-next, node_modules, and pnpm-lock.yaml
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
Next.js 16 landing page for [Frosty](https://frostyapp.io) using the App Router with React 19. Deployed on **Cloudflare Workers** via `@opennextjs/cloudflare`.
|
||||
|
||||
### Key Configuration
|
||||
|
||||
- **React Compiler**: Enabled in `next.config.ts` for automatic memoization
|
||||
- **Typed Routes**: Enabled for type-safe navigation (use `Route` type from `next/navigation`)
|
||||
- **Path Alias**: `@/*` maps to `./src/*`
|
||||
- **Strict TypeScript**: `noUncheckedIndexedAccess`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, `noImplicitOverride`, `verbatimModuleSyntax`
|
||||
|
||||
### Source Structure
|
||||
## Source Structure
|
||||
|
||||
- `src/app/` - App Router pages and layouts
|
||||
- `src/components/` - React components (`ui/` subdirectory for shadcn `base-vega` style — add with `pnpm dlx shadcn@latest add <component>`)
|
||||
- `src/lib/` - Utilities (`cn()` for className merging, `constants.ts` for external links)
|
||||
- `src/assets/` - Static images (screenshots)
|
||||
|
||||
### Cloudflare Workers
|
||||
## Key Configuration
|
||||
|
||||
- **React Compiler**: Enabled in `next.config.ts` for automatic memoization
|
||||
- **Typed Routes**: Enabled for type-safe navigation (use `Route` type from `next/navigation`)
|
||||
- **Path Alias**: `@/*` maps to `./src/*`
|
||||
- **Strict TypeScript**: `noUncheckedIndexedAccess`, `noImplicitReturns`, `noFallthroughCasesInSwitch`, `noImplicitOverride`, `verbatimModuleSyntax`
|
||||
|
||||
## Cache Components
|
||||
|
||||
Enabled ([docs](https://nextjs.org/docs/app/getting-started/cache-components)) — everything is dynamic (SSR) by default. Opt into caching with `"use cache"` + `cacheLife()`, wrap async work in `<Suspense>` for PPR. Old `revalidate`/`dynamic`/`fetchCache` exports are replaced. Use `cacheTag()` + `revalidateTag()`/`updateTag()` for on-demand invalidation. Durable runtime cache requires R2 incremental cache (see `open-next.config.ts`) — without it, cache is in-memory only per Worker instance.
|
||||
|
||||
## Cloudflare Workers
|
||||
|
||||
- `wrangler.jsonc` - Cloudflare Workers configuration (bindings, R2, KV, etc.)
|
||||
- `open-next.config.ts` - OpenNext adapter config (ISR requires uncommenting R2 incremental cache)
|
||||
|
|
@ -67,9 +149,12 @@ Notable strict rules enforced:
|
|||
- `react-you-might-not-need-an-effect` - Avoid unnecessary useEffect
|
||||
- Unused variables must be prefixed with `_`
|
||||
|
||||
## Commits
|
||||
## Gotchas
|
||||
|
||||
Lowercase, no prefixes (e.g., `remove marquee emote background from hero section`). Keep commits tightly scoped.
|
||||
- **shadcn uses @base-ui/react**: Not Radix UI — component primitives differ from older shadcn examples. `button.tsx` is a `'use client'` module with no `asChild` prop. Check `src/components/ui/` before building custom UI.
|
||||
- **`useSearchParams()` needs Suspense**: Always wrap components using `useSearchParams()` in a `<Suspense>` boundary — required for production builds.
|
||||
- **Never remove `tw-animate-css`**: Required by shadcn/ui components for animations. Check shadcn dependencies before removing any package.
|
||||
- **No `pnpm` prefix inside package.json scripts**: The package manager is already the script runner. Use bare commands (e.g., `next build`, not `pnpm next build`).
|
||||
|
||||
## Dev Tooling
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue