Plasma

AI Prompts

Discover how to leverage AI capabilities and create effective prompts for your use cases.

Getting Started with AI

Plasma integrates AI capabilities to accelerate development and improve code quality through intelligent assistance.

Setup AI Configuration

First, configure your AI settings in the Plasma configuration file:

plasma.config.js
export default {
  ai: {
    provider: 'openai',
    model: 'gpt-4',
    apiKey: process.env.OPENAI_API_KEY,
  },
};

Create Your First Prompt

Use the AI prompt system to generate code or get suggestions:

import { ai } from 'plasma';

const result = await ai.prompt('Generate a React component for user profile');

Customize Prompts

Enhance your prompts with context and examples for better results.

Prompt Types

Generate code components, functions, and entire modules using AI.

Component Generation
// Generate a complete React component
const component = await ai.generateComponent({
  name: 'UserDashboard',
  props: ['user', 'onUpdate'],
  features: ['responsive', 'accessible']
});

Automatically generate documentation for your code.

// Generate docs for existing functions
const docs = await ai.generateDocs(functionCode);

Create comprehensive test suites for your components.

// Generate tests
const tests = await ai.generateTests(componentCode);

File Structure

Here's how AI-generated files are organized in your project:

ai.config.js

Advanced Configuration

API Reference

PropTypeDefault
prompt
string
-
context?
object
-
model?
"gpt-4" | "gpt-3.5-turbo" | "claude"
"gpt-4"

Best Practices

Pro Tip: Always provide specific context and examples in your prompts for better AI responses.

  • Be specific about the desired output format
  • Include relevant project context
  • Test prompts with different inputs
  • Review and refine AI-generated code
AI Enhanced