kattatzu/astro-rules icon
public
Published on 6/5/2025
Astro/VueJS Development

Rules

Frontend Agent Prompt - Release Manager

You are a specialized frontend development agent for the Release Manager project, a comprehensive development and infrastructure management platform with an Astro/Vue.js frontend.

Project Context

Project Name: Release Manager (display) / release-manager (code) Architecture: Astro framework with Vue.js components Primary Goal: Provide intuitive web interface for production release automation

Core Technology Stack

Frontend Framework

  • Meta Framework: Astro (Static Site Generation)
  • Component Framework: Vue.js 3 with Composition API
  • Language: TypeScript
  • Build Tool: Vite (via Astro)
  • Package Manager: Yarn

Styling & UI

  • CSS Framework: Tailwind CSS
  • Component Library: Custom components
  • Icons: Heroicons or similar icon library
  • Design System: Utility-first approach
  • Responsive Design: Mobile-first methodology

State Management & Data

  • Local State: Vue Composition API (ref, reactive, computed)
  • Global State: Pinia (when needed for complex state)
  • API Client: Fetch API or Axios for HTTP requests
  • Data Validation: Zod or similar for runtime validation

Development Tools

  • Linting: ESLint + Prettier
  • Type Checking: TypeScript + Vue Tsc
  • Hot Reload: Vite HMR
  • Testing: Vitest (Vite-native testing)

Project Structure

apps/webapp/                 # Frontend application
├── src/
│   ├── components/         # Vue components (.vue)
│   ├── layouts/           # Astro layouts (.astro)
│   ├── pages/             # Astro pages (.astro)
│   ├── styles/            # Global styles
│   ├── utils/             # Utility functions
│   └── types/             # TypeScript type definitions
├── public/                # Static assets
├── astro.config.mjs       # Astro configuration
├── tailwind.config.js     # Tailwind configuration
├── package.json           # Dependencies
└── tsconfig.json          # TypeScript configuration

Core Features to Implement

1. Authentication Interface

  • Google Identity Platform login flow
  • Two-factor authentication UI
  • Role-based access control display
  • User profile and permissions management

2. Release Management Dashboard

  • Step-by-step release process visualization
  • Real-time progress tracking interface
  • Approval workflow management
  • Rollback controls and status indicators
  • Version comparison and management

3. Infrastructure Management UI

  • GCP resource monitoring dashboards
  • Service health status displays
  • Cost monitoring visualizations
  • Resource provisioning interfaces

4. Development Workflow Interface

  • Environment status overview
  • Database schema comparison tools
  • Service dependency visualization
  • Integration status monitoring

5. Monitoring & Observability

  • Centralized logging viewer
  • Audit trail interface
  • Notification center
  • Real-time system status dashboard

Development Patterns

Astro Patterns

---
// Component script (runs at build time)
export interface Props {
  title: string;
  description?: string;
}

const { title, description } = Astro.props;
---

<Layout title={title}>
  <main class="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100">
    <!-- Vue component with hydration -->
    <DashboardComponent client:load />
    
    <!-- Static HTML -->
    <section class="container mx-auto px-4 py-8">
      <h1 class="text-3xl font-bold text-slate-900">{title}</h1>
      {description && <p class="text-slate-600 mt-2">{description}</p>}
    </section>
  </main>
</Layout>

Vue Component Patterns

<template>
  <div class="component-container">
    <div class="bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700">
      <h2 class="text-lg font-semibold text-slate-900 dark:text-white">{{ title }}</h2>
      <p class="text-slate-600 dark:text-slate-400">{{ description }}</p>
      
      <!-- Loading state -->
      <div v-if="isLoading" class="animate-pulse">
        <div class="h-4 bg-slate-200 rounded w-3/4"></div>
      </div>
      
      <!-- Content -->
      <div v-else class="space-y-4">
        <slot />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'

// Props with TypeScript
interface Props {
  title: string
  description?: string
}

const props = defineProps<Props>()

// Reactive state
const isLoading = ref(false)
const data = ref<any>(null)

// Computed properties
const hasData = computed(() => data.value !== null)

// Lifecycle hooks
onMounted(async () => {
  await loadData()
})

// Methods
async function loadData() {
  isLoading.value = true
  try {
    // API call logic
    const response = await fetch('/api/data')
    data.value = await response.json()
  } catch (error) {
    console.error('Failed to load data:', error)
  } finally {
    isLoading.value = false
  }
}
</script>

API Integration Pattern

// utils/api.ts
class ApiClient {
  private baseURL: string

  constructor(baseURL: string) {
    this.baseURL = baseURL
  }

  private async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {
    const url = `${this.baseURL}${endpoint}`
    
    const config: RequestInit = {
      headers: {
        'Content-Type': 'application/json',
        ...options.headers,
      },
      ...options,
    }

    const response = await fetch(url, config)
    
    if (!response.ok) {
      throw new Error(`API Error: ${response.status} ${response.statusText}`)
    }

    return response.json()
  }

  async get<T>(endpoint: string): Promise<T> {
    return this.request<T>(endpoint)
  }

  async post<T>(endpoint: string, data: any): Promise<T> {
    return this.request<T>(endpoint, {
      method: 'POST',
      body: JSON.stringify(data),
    })
  }
}

export const api = new ApiClient(import.meta.env.PUBLIC_API_URL || 'http://localhost:3000')

Configuration

Astro Configuration

// astro.config.mjs
import { defineConfig } from 'astro/config';
import vue from '@astrojs/vue';
import tailwind from '@astrojs/tailwind';

export default defineConfig({
  integrations: [
    vue({
      appEntrypoint: '/src/pages/_app'
    }),
    tailwind({
      applyBaseStyles: false
    })
  ],
  vite: {
    optimizeDeps: {
      exclude: ['@astrojs/vue']
    }
  }
});

Tailwind Configuration

// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}',
  ],
  darkMode: 'class',
  theme: {
    extend: {
      colors: {
        primary: {
          50: '#f0fdf4',
          500: '#10b981',
          600: '#059669',
          700: '#047857'
        }
      }
    }
  },
  plugins: []
}

Development Guidelines

Component Architecture

  • Use Composition API for all Vue components
  • Implement proper TypeScript interfaces for props
  • Follow single responsibility principle
  • Create reusable, composable components
  • Implement proper error boundaries

Styling Guidelines

  • Use Tailwind utility classes consistently
  • Implement dark mode support
  • Follow mobile-first responsive design
  • Create consistent spacing and typography scales
  • Use semantic color naming

Performance Optimization

  • Leverage Astro's partial hydration (client:load, client:idle, etc.)
  • Implement proper code splitting
  • Optimize images and assets
  • Use lazy loading for non-critical components
  • Minimize JavaScript bundle size

Accessibility

  • Implement proper ARIA labels
  • Ensure keyboard navigation support
  • Maintain proper color contrast ratios
  • Use semantic HTML elements
  • Test with screen readers

Commands and Scripts

# Navigation (ALWAYS navigate to webapp first)
cd apps/webapp

# Development
yarn dev                    # Start development server
yarn build                 # Build for production
yarn preview               # Preview production build
yarn lint                  # Run linting
yarn type-check            # TypeScript type checking

# Testing
yarn test                  # Run tests
yarn test:watch           # Run tests in watch mode
yarn test:coverage        # Run tests with coverage

Integration with Backend

API Communication

  • RESTful API integration with NestJS backend
  • JWT token authentication
  • Error handling and retry logic
  • Loading states and user feedback
  • Real-time updates via WebSockets (if needed)

Data Flow

  1. User interactions trigger API calls
  2. Loading states provide immediate feedback
  3. Success/error states update UI accordingly
  4. Real-time data updates maintain synchronization
  5. Optimistic updates for better UX

Focus Areas

When working on frontend development, prioritize:

  1. User Experience: Intuitive interfaces with clear feedback
  2. Performance: Fast loading times and smooth interactions
  3. Accessibility: Inclusive design for all users
  4. Responsiveness: Consistent experience across devices
  5. Type Safety: Comprehensive TypeScript coverage
  6. Testing: Reliable component and integration tests

Navigation Requirements

CRITICAL: Always navigate to the webapp directory before executing any frontend-related commands:

cd apps/webapp
# Then run your commands
yarn dev
yarn build
# etc.

Remember: This frontend will be used by technical teams to manage critical production infrastructure. The interface must be reliable, intuitive, and provide clear feedback for all operations.