with one click
anitrend-agentic-workflow
// Use when working autonomously in the AniTrend website repository and needing project-specific conventions, CI requirements, tool choices, or implementation patterns before making changes.
// Use when working autonomously in the AniTrend website repository and needing project-specific conventions, CI requirements, tool choices, or implementation patterns before making changes.
Use when implementing or reviewing deeplinks, Open in App CTAs, dashboard shortcuts, and web-to-app handoff decisions across the AniTrend website.
Use when implementing or reviewing Next.js App Router metadata, Open Graph, Twitter cards, and social preview consistency across AniTrend routes.
Use when extending AniTrend UI primitives with shadcn, cva, asChild, or Tailwind tokens instead of duplicating components or scattering raw classes.
Use when adding or editing Next.js App Router pages, React components, or Tailwind styles in the AniTrend website and you need guidance on server vs client boundaries, metadata, state placement, shadcn/ui reuse, or token-based responsive styling.
| name | anitrend-agentic-workflow |
| description | Use when working autonomously in the AniTrend website repository and needing project-specific conventions, CI requirements, tool choices, or implementation patterns before making changes. |
This skill turns the repository's agent guidance into concrete execution steps. Use it to stay aligned with AniTrend conventions while working with minimal supervision.
Use this skill when:
src/ai/flows/Prefer local inspection first, then GitHub CLI:
| Task | Tool | Why |
|---|---|---|
| Verify branch naming format | git branch -a + local .github/branch-lint.sh | Already in checkout |
| Check recent commits | git log --oneline -20 | Fast, local, confirms pattern |
| Validate package.json scripts | cat package.json + read_file | No need for remote call |
| Inspect workflow files | read_file on .github/workflows/*.yml | Authoritative, local reference |
| Check for CI failures | GitHub UI or gh run list | Real-time status, no local equivalent |
Prefer GitHub CLI for:
Use open_browser_page + screenshot_page when:
http://localhost:9002)Example workflow:
# Terminal 1: Start dev server
yarn dev # Port 9002
# Then use browser tools:
# open_browser_page("http://localhost:9002/discover")
# screenshot_page(pageId) # Capture current state
# click_element(pageId, "Add to Watchlist button")
# screenshot_page(pageId) # Verify interaction
Follow this sequence for implementing any feature:
git fetch origin
git checkout -b feat/your-feature-name
# Branch name: feat/<kebab-case-description>
# Examples: feat/add-anime-filters, feat/enhance-recommendation-ui
Validation: The .github/branch-lint.sh pre-commit hook enforces format automatically.
any, no unsafe casts).env.local, never hardcodeKey files to reference:
src/lib/types.ts — Shared interfaces (Anime, RepoInfo, etc.)src/lib/utils.ts — cn() utility for conditional Tailwind classestsconfig.json — TypeScript strict settings.env.example — Required environment variables# Run full validation suite
yarn lint # ESLint (must pass cleanly)
yarn typecheck # TypeScript (strict mode)
yarn build # Next.js build to .next/
yarn test:e2e # Playwright tests (requires yarn dev running)
Stop here if any step fails — fix issues before push.
git add .
git commit -m "feat: add anime filter to discover page"
# Format: <type>(<optional-scope>): <message>
# Types: feat, fix, chore, docs, refactor, test, build, ci, revert
git push origin feat/your-feature-name
# Open PR on GitHub, use PULL_REQUEST_TEMPLATE.md format
PR requirements:
GitHub Actions runs:
If CI fails:
# Fix the issue locally, commit, push
git add .
git commit -m "fix: resolve linting error in anime-card component"
git push origin feat/your-feature-name
# CI re-runs automatically
Once CI passes and human review approves, merge via GitHub UI.
AI flows live in src/ai/flows/ and use the server-side pattern.
// src/ai/flows/my-recommendation-flow.ts
'use server';
import { ai } from '@/ai/genkit';
import { z } from 'zod';
const InputSchema = z.object({
animeGenres: z.array(z.string()),
userPreferences: z.string(),
});
const OutputSchema = z.object({
recommendedAnimeIds: z.array(z.string()),
reasoning: z.string(),
});
type Input = z.infer<typeof InputSchema>;
type Output = z.infer<typeof OutputSchema>;
const prompt = ai.definePrompt({
name: 'myRecommendationPrompt',
input: { schema: InputSchema },
output: { schema: OutputSchema },
prompt: `Recommend anime that matches the user's preferences.`,
});
const recommendationFlow = ai.defineFlow(
{
name: 'myRecommendationFlow',
inputSchema: InputSchema,
outputSchema: OutputSchema,
},
async (input) => {
const { output } = await prompt(input);
if (!output) {
throw new Error('Failed to generate recommendation');
}
return output;
}
);
// Export wrapper for client
export async function getRecommendation(input: Input): Promise<Output | null> {
try {
return await recommendationFlow(input);
} catch (error) {
console.error('Flow failed:', error);
return null; // Graceful fallback
}
}
// src/ai/dev.ts (add import for side-effect)
import '@/ai/flows/my-recommendation-flow'; // Side-effect import
This makes the flow discoverable in Genkit dev server.
# Terminal 1: Start Genkit dev server
yarn genkit:dev
# Opens UI at http://localhost:4000
# Terminal 2: Use browser to test flow
# open_browser_page("http://localhost:4000")
# Invoke flow, verify input/output, check for errors
// src/app/recommend/recommend-client.tsx (or new component)
'use client'
import { getRecommendation } from '@/ai/flows/my-recommendation-flow'
export function RecommendationUI() {
const [result, setResult] = useState<Output | null>(null)
const handleRecommend = async () => {
const output = await getRecommendation(input)
setResult(output) // Will be null if flow fails (graceful)
}
return (
// UI component
)
}
Follow standard feature workflow (lint → typecheck → build → test → commit → push).
Reference implementation pattern from src/lib/:
// src/lib/anime-service.ts pattern
const BASE_URL = 'https://api.jikan.moe/v4/';
export async function getTopAnime(page = 1): Promise<Anime[]> {
try {
const res = await fetch(`${BASE_URL}top/anime?page=${page}&limit=25`);
if (!res.ok) throw new Error(`API error: ${res.status}`);
const data = await res.json();
// Transform to internal Anime type
return data.data.map((anime) => ({
id: anime.mal_id.toString(),
title: anime.title_english || anime.title,
posterUrl: anime.images?.jpg?.image_url,
rating: anime.score,
// ... map all fields
}));
} catch (error) {
console.error('Jikan API failed:', error);
return []; // Graceful fallback
}
}
Key pattern:
types.ts schemaAlready covered in "Adding an AI Flow" workflow above.
// src/lib/github-service.ts pattern
const BASE_URL = 'https://api.github.com';
export async function getOrgRepos(org: string) {
try {
const res = await fetch(`${BASE_URL}/orgs/${org}/repos`, {
headers: {
Accept: 'application/vnd.github.v3+json',
// Optional: add Authorization header if available
},
});
if (res.status === 403) {
console.warn(`GitHub API rate limit exceeded`);
return []; // Fallback
}
if (!res.ok) throw new Error(`API error: ${res.status}`);
const data = await res.json();
// Transform and return
} catch (error) {
console.error('GitHub API failed:', error);
return [];
}
}
Releases are automated by tags — your job is to prepare and trigger.
{
"version": "1.2.3" // Follows semver (major.minor.patch)
}
Create or update release notes, and update CHANGELOG.md only if the repository is maintaining one, noting:
git checkout -b release/v1.2.3
git add package.json
git commit -m "chore: prepare release v1.2.3"
git push origin release/v1.2.3
Once merged, trigger the next step.
git tag v1.2.3
git push origin v1.2.3
Automation kicks in:
deploy.yml validates releaseghcr.io/anitrend/website:v1.2.3Check GitHub Release page for status, monitor container registry for image push.
When GitHub Actions CI fails:
# Simulate CI exactly
yarn install --immutable # Use frozen lockfile
yarn lint # Exact command from ci.yml
yarn typecheck # Exact command from ci.yml
yarn build # Exact command from ci.yml
Common failures:
yarn lint --fix to auto-fixgit add .
git commit -m "fix: resolve build error in animation component"
git push origin feat/your-feature
CI re-runs automatically.
yarn lint && yarn typecheck && yarn build && yarn test:e2eany, no unsafe casts without justification<type>/<kebab-case>type(scope): messagecontext.instructions.md if making architectural changes (per update-context.instructions.md).env.local locally, GitHub Secrets for CI/CD.env.example as reference)any type in TypeScript.env.local — git-ignored)# Google Genkit AI
GOOGLE_GENKIT_API_KEY=<your-api-key>
# Firebase (optional, for analytics)
NEXT_PUBLIC_FIREBASE_PROJECT_ID=<project-id>
NEXT_PUBLIC_FIREBASE_API_KEY=<key>
# ... other Firebase config
# Reference: See .env.example for all available vars
Set up in GitHub repository settings → Secrets and variables → Actions:
GOOGLE_GENKIT_API_KEY — Genkit API keyDOCKER_REGISTRY_TOKEN — For GHCR push# Development
yarn dev # Next.js dev server (port 9002)
yarn genkit:dev # Genkit AI dev server (port 4000)
yarn genkit:watch # Watch mode for AI flows
# Validation
yarn lint # ESLint check
yarn typecheck # TypeScript check
yarn build # Production build
yarn test:e2e # Playwright e2e tests
# Git
git checkout -b feat/name # Create feature branch
git commit -m "feat: ..." # Conventional commit
git push origin feat/name # Push to remote
git tag v1.2.3 # Create release tag
git push origin v1.2.3 # Push tag (triggers deploy)
| Purpose | Path |
|---|---|
| Agentic workflows guide | .github/instructions/AGENTS.md |
| Architecture reference | .github/instructions/context.instructions.md |
| Git validation script | .github/branch-lint.sh |
| CI/CD workflows | .github/workflows/ |
| AI flows | src/ai/flows/ |
| API clients | src/lib/ |
| Type definitions | src/lib/types.ts |
| Shared utilities | src/lib/utils.ts |
| Issue | Solution |
|---|---|
| Port 9002 already in use | lsof -i :9002 then kill -9 PID |
| Yarn lock conflicts | yarn install --immutable (respect frozen lock) |
| TypeScript strict errors | Check tsconfig.json, use explicit types instead of any |
| ESLint failures | yarn lint --fix to auto-fix |
| Build cache stale | rm -rf .next && yarn build |
| Genkit API errors | Verify GOOGLE_GENKIT_API_KEY in .env.local |
This skill is the executable guide for AGENTS.md. Whenever you reference AGENTS.md for:
...this skill provides the step-by-step workflow to implement it.
.github/instructions/AGENTS.md (authoritative reference).github/instructions/context.instructions.mdSkill Version: 1.0
Last Updated: April 2026
Alignment: AGENTS.md + context.instructions.md
For questions about this skill or AniTrend project conventions, consult the referenced guides or open an issue in the repository.