Advanced Claude Code Skills You Should Learn

Advanced Claude Code Skills You Should Learn

Beyond Basic Prompting

Claude Code Skills : Custom commands and capabilities that extend Claude Code beyond basic prompting, including slash commands, MCP integrations, and workflow automation.

You’ve learned to prompt Claude Code. Now learn to command it.

Skill 1: Custom Slash Commands

Create reusable commands for common operations.

Creating Commands

In your project’s .claude/commands/ directory:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<!-- .claude/commands/security-review.md -->
# /security-review

Review the current changes for security vulnerabilities.

Check for:
- IDOR vulnerabilities in data access
- Authentication bypass opportunities
- Input validation gaps
- SQL/NoSQL injection
- XSS in rendered content
- Hardcoded secrets
- Missing rate limiting on auth endpoints

Provide findings in this format:
- Severity: Critical/High/Medium/Low
- Location: file:line
- Issue: Description
- Fix: Recommended remediation

Now you can run /security-review anytime.

More Useful Commands

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<!-- .claude/commands/add-tests.md -->
# /add-tests

Add comprehensive tests for the specified file or function.

Requirements:
- Use existing test patterns in the project
- Cover happy paths, error cases, edge cases
- Include type assertions where applicable
- Mock external dependencies
- Use descriptive test names
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<!-- .claude/commands/document.md -->
# /document

Generate documentation for the specified code.

Include:
- Brief description
- Parameters with types
- Return value
- Usage examples
- Error cases

Format as TSDoc/JSDoc comments.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<!-- .claude/commands/refactor.md -->
# /refactor

Refactor the specified code following project patterns.

Guidelines:
- Break down large functions
- Extract repeated logic
- Improve naming
- Add types where missing
- Remove dead code
- Maintain existing behavior

Skill 2: MCP Servers

Model Context Protocol (MCP) lets Claude Code connect to external systems.

Using Built-in MCP Servers

Claude Code ships with MCP servers for common tools:

1
2
3
4
5
6
7
8
# Enable GitHub integration
claude mcp add github

# Enable database access (read-only)
claude mcp add postgres --connection-string $DATABASE_URL

# Enable web search
claude mcp add brave-search --api-key $BRAVE_API_KEY

Now Claude can:

  • Read GitHub issues and PRs
  • Query your database to understand data
  • Search the web for documentation

Custom MCP Servers

Build your own for project-specific needs:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// mcp-servers/jira-server.ts
import { MCPServer } from '@anthropic-ai/mcp';

const server = new MCPServer({
  name: 'jira',
  version: '1.0.0'
});

server.addTool({
  name: 'get_ticket',
  description: 'Fetch a Jira ticket by ID',
  parameters: {
    ticket_id: { type: 'string', description: 'Jira ticket ID' }
  },
  handler: async ({ ticket_id }) => {
    const ticket = await jira.getTicket(ticket_id);
    return {
      summary: ticket.summary,
      description: ticket.description,
      status: ticket.status,
      acceptanceCriteria: ticket.customFields.acceptanceCriteria
    };
  }
});

server.start();

Enable it:

1
claude mcp add ./mcp-servers/jira-server.ts

Now Claude can fetch Jira tickets directly:

1
Get the acceptance criteria from PROJ-1234 and implement it.

Skill 3: Agent Orchestration

Claude Code can run as part of larger automation.

CLI Automation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# auto-fix-pr.sh

# Get PR diff
DIFF=$(gh pr diff $1)

# Have Claude review and fix
claude --no-interactive "
Review this PR diff for issues and fix them:

$DIFF

Focus on:
- Security vulnerabilities
- Type errors
- Missing error handling

Apply fixes directly to the files.
"

# Commit fixes
git add -A
git commit -m "Auto-fix PR issues"
git push

CI Integration

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# .github/workflows/claude-review.yml
name: Claude Code Review

on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Claude Code
        run: npm install -g @anthropic-ai/claude-code

      - name: Run Security Review
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: |
          claude --no-interactive "
          Review the changes in this PR for security issues.
          Output findings as GitHub PR comments.
          " > review.md

      - name: Post Review
        uses: actions/github-script@v6
        with:
          script: |
            const fs = require('fs');
            const review = fs.readFileSync('review.md', 'utf8');
            github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.issue.number,
              body: review
            });

Chaining Operations

1
2
3
4
5
6
7
8
9
# Complex workflow: migrate database and update code
claude --no-interactive "
Step 1: Read the current Prisma schema
Step 2: Create a migration for adding user preferences
Step 3: Update the User type to include preferences
Step 4: Add a getPreferences method to UserService
Step 5: Create tests for the new method
Step 6: Run the tests and fix any failures
"

Skill 4: Project Templates

Create templates for common project types.

Template Structure

1
2
3
4
5
6
7
.claude/templates/
  api-route/
    route.ts.template
    route.test.ts.template
  component/
    component.tsx.template
    component.test.tsx.template

Using Templates

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<!-- .claude/commands/new-api.md -->
# /new-api <name>

Create a new API route using the api-route template.

1. Read .claude/templates/api-route/
2. Replace {{name}} with the provided name
3. Create app/api/{{name}}/route.ts
4. Create app/api/{{name}}/route.test.ts
5. Add the route to the API documentation

Skill 5: Context Management

Master how Claude Code manages context for better results.

Explicit Context Loading

1
2
3
4
5
6
Read and understand these files before we start:
- lib/auth.ts
- types/user.ts
- app/api/users/route.ts

I'll be adding user impersonation for admin users.

Context Checkpoints

For long sessions:

1
Save current context as "before-refactor".

Later:

1
2
Compare current state to "before-refactor" checkpoint.
What changed?

Focused Context

For large codebases:

1
2
3
4
5
6
Focus only on the payment module:
- lib/payments/
- app/api/payments/
- types/payment.ts

Ignore other parts of the codebase for this session.

Skill 6: Output Formatting

Control how Claude presents information.

Structured Output

1
2
3
4
List all API routes in this format:

| Route | Method | Auth Required | Description |
|-------|--------|---------------|-------------|

Code-Only Output

1
2
Generate the implementation. Output only the code,
no explanations. Use code blocks with filenames.

Diff Output

1
Show changes as git diff format so I can review before applying.

Skill 7: Error Recovery

When things go wrong:

Undo Operations

1
2
The last change broke the auth flow. Undo all changes
from the last operation and restore previous state.

Partial Application

1
2
Apply only the changes to lib/auth.ts from the last suggestion.
Skip the other file changes.

Debug Mode

1
2
The test is failing. Walk through the logic step by step
and explain what's happening at each stage.

FAQ

How do I learn which MCP servers are available?

Run claude mcp list for built-in servers. Community servers are on GitHub. You can build custom servers for any API you need.

Can I use Claude Code without the terminal?

Not directly. Claude Code is CLI-first. For IDE integration, use Cursor which uses Claude’s models but with a different interface.

How do I share custom commands with my team?

Commit the .claude/commands/ directory to your repo. Team members get your commands automatically when they clone the project.

What's the context limit for Claude Code?

Claude Code uses Claude 3.5 Sonnet with ~200K token context. For very large codebases, use focused context to stay within limits.

Conclusion

Key Takeaways

  • Custom slash commands create reusable operations
  • MCP servers connect Claude to external systems (GitHub, databases, APIs)
  • CLI automation enables CI/CD integration
  • Templates standardize code generation
  • Context management improves output for large projects
  • Structured output controls response formatting
  • Master error recovery for complex operations

AI Coding Security Insights.
Ship Vibe-Coded Apps Safely.

Effortlessly test and evaluate web application security using Vibe Eval agents.