CCJK Hub
모범 사례2025년 1월 22일Updated 2025년 1월 29일

CCJK 프롬프트 엔지니어링 모범 사례

CCJK 와 현대 AI 코딩 워크플로우를 위한 효과적인 프롬프트 작성법 배우기

CCJK Team
ccjkprompt-engineeringbest-practicesai

Prompt Engineering Best Practices for CCJK

Effective prompts are key to getting the best results from CCJK. This guide covers practical techniques for producing higher-quality code and more reliable workflow outcomes.

Core Principles

1. Be Specific

❌ Bad:

Write a function to process data

✅ Good:

Write a TypeScript function that:
- Takes an array of user objects with {id, name, email}
- Filters users with valid email addresses
- Returns sorted by name alphabetically
- Handles empty arrays gracefully

2. Provide Context

❌ Bad:

Fix this bug

✅ Good:

Fix this bug in our React component:
- Expected: Button should be disabled when form is invalid
- Actual: Button stays enabled even with empty required fields
- Framework: React 18 with TypeScript
- State management: Zustand

3. Specify Output Format

❌ Bad:

Create an API endpoint

✅ Good:

Create a REST API endpoint:
- Framework: Express.js with TypeScript
- Route: POST /api/users
- Input: JSON body with {name, email, role}
- Output: Created user object with id
- Include: Input validation, error handling, JSDoc comments

Prompt Templates

Code Generation

Generate [language] code for [task]:

Requirements:
- [requirement 1]
- [requirement 2]
- [requirement 3]

Constraints:
- [constraint 1]
- [constraint 2]

Style:
- [coding style preference]
- [naming convention]

Code Review

Review this [language] code for:
- Security vulnerabilities
- Performance issues
- Code style violations
- Potential bugs

Context:
- [project context]
- [specific concerns]

Code:
[paste code here]

Refactoring

Refactor this code to:
- [goal 1: e.g., improve readability]
- [goal 2: e.g., reduce complexity]
- [goal 3: e.g., add type safety]

Keep:
- [what to preserve]
- [existing behavior]

Code:
[paste code here]

Advanced Techniques

Chain of Thought

For complex tasks, ask CCJK to think step by step:

I need to implement a caching system. Please:

1. First, analyze the requirements
2. Then, propose 2-3 design options
3. Recommend the best approach with reasoning
4. Finally, implement the solution

Requirements:
- Cache API responses
- TTL-based expiration
- LRU eviction when full
- Thread-safe operations

Few-Shot Examples

Provide examples of desired output:

Generate unit tests following this pattern:

Example:
```typescript
describe('UserService', () => {
  it('should create user with valid data', async () => {
    const input = { name: 'Test', email: 'test@example.com' };
    const result = await userService.create(input);
    expect(result.id).toBeDefined();
    expect(result.name).toBe(input.name);
  });
});

Now generate tests for OrderService with methods:

  • create(order)
  • cancel(orderId)
  • getByUser(userId)

### Iterative Refinement

Build on previous responses:

// First prompt Create a basic Express router for user CRUD operations

// Follow-up Now add input validation using Zod schemas

// Follow-up Add rate limiting middleware to prevent abuse

// Follow-up Add comprehensive error handling with custom error classes


## CCJK-Specific Tips

### Using Skills

Leverage structured workflow prompts for common tasks:

Review src/services/auth.ts with a security-first lens and list blocking risks first. Design tests for src/utils/validation.ts and explain edge cases before implementation. Draft API documentation for src/api/routes.ts with usage examples and failure modes.


### Context Files

Use CCJK.md for project-wide context:

```markdown
# Project Context

## Tech Stack
- Next.js 14 with App Router
- TypeScript strict mode
- Prisma ORM with PostgreSQL
- Tailwind CSS

## Conventions
- Use functional components
- Prefer server components
- Use Zod for validation
- Follow Airbnb style guide

## Patterns
- Repository pattern for data access
- Service layer for business logic
- DTOs for API contracts

MCP Integration

Use MCP servers for enhanced capabilities:

// With filesystem MCP
Read all TypeScript files in src/services and identify unused exports

// With GitHub MCP
Create a PR with the refactored authentication module

// With database MCP
Generate TypeScript types from the current database schema

Common Mistakes

1. Vague Requirements

❌ "Make it better" ✅ "Improve performance by reducing database queries from N+1 to batch loading"

2. Missing Context

❌ "Why doesn't this work?" ✅ "This function returns undefined instead of the expected user object. Here's the input data and expected output..."

3. Overloading Single Prompts

❌ "Build a complete e-commerce system" ✅ Break into smaller tasks: "First, design the product catalog data model"

Conclusion

Effective prompt engineering is a skill that improves with practice. Start with these templates, iterate based on results, and develop your own patterns for common tasks.