{"id":"salesforce-developer","name":"salesforce-developer","summary":"Apexコードの作成・デバッグ、Lightning Web Componentsの構築、SOQLクエリの最適化、トリガー、バッチジョブ、プラットフォームイベント、Salesforceプラットフォームでの統合の実装。","body":"# Salesforce Developer\n\n## Core Workflow\n\n1. **Analyze requirements** - Understand business needs, data model, governor limits, scalability\n2. **Design solution** - Choose declarative vs programmatic, plan bulkification, design integrations\n3. **Implement** - Write Apex classes, LWC components, SOQL queries with best practices\n4. **Validate governor limits** - Verify SOQL/DML counts, heap size, and CPU time stay within platform limits before proceeding\n5. **Test thoroughly** - Write test classes with 90%+ coverage, test bulk scenarios (200-record batches)\n6. **Deploy** - Use Salesforce DX, scratch orgs, CI/CD for metadata deployment\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Apex Development | `references/apex-development.md` | Classes, triggers, async patterns, batch processing |\n| Lightning Web Components | `references/lightning-web-components.md` | LWC framework, component design, events, wire service |\n| SOQL/SOSL | `references/soql-sosl.md` | Query optimization, relationships, governor limits |\n| Integration Patterns | `references/integration-patterns.md` | REST/SOAP APIs, platform events, external services |\n| Deployment & DevOps | `references/deployment-devops.md` | Salesforce DX, CI/CD, scratch orgs, metadata API |\n\n## Constraints\n\n### MUST DO\n- Bulkify Apex code — collect IDs/records before loops, query/DML outside loops\n- Write test classes with minimum 90% code coverage, including bulk scenarios\n- Use selective SOQL queries with indexed fields; leverage relationship queries\n- Use appropriate async processing (batch, queueable, future) for long-running work\n- Implement proper error handling and logging; use `Database.update(scope, false)` for partial success\n- Use Salesforce DX for source-driven development and metadata deployment\n\n### MUST NOT DO\n- Execute SOQL/DML inside loops (governor limit violation — see bulkified trigger pattern below)\n- Hard-code IDs or credentials in code\n- Create recursive triggers without safeguards\n- Skip field-level security and sharing rules checks\n- Use deprecated Salesforce APIs or components\n\n## Code Patterns\n\n### Bulkified Trigger (Correct Pattern)\n\n```apex\n// CORRECT: collect IDs, query once outside the loop\ntrigger AccountTrigger on Account (before insert, before update) {\n    AccountTriggerHandler.handleBeforeInsert(Trigger.new);\n}\n\npublic class AccountTriggerHandler {\n    public static void handleBeforeInsert(List<Account> newAccounts) {\n        Set<Id> parentIds = new Set<Id>();\n        for (Account acc : newAccounts) {\n            if (acc.ParentId != null) parentIds.add(acc.ParentId);\n        }\n        Map<Id, Account> parentMap = new Map<Id, Account>(\n            [SELECT Id, Name FROM Account WHERE Id IN :parentIds]\n        );\n        for (Account acc : newAccounts) {\n            if (acc.ParentId != null && parentMap.containsKey(acc.ParentId)) {\n                acc.Description = 'Child of: ' + parentMap.get(acc.ParentId).Name;\n            }\n        }\n    }\n}\n```\n\n```apex\n// INCORRECT: SOQL inside loop — governor limit violation\ntrigger AccountTrigger on Account (before insert) {\n    for (Account acc : Trigger.new) {\n        Account parent = [SELECT Id, Name FROM Account WHERE Id = :acc.ParentId]; // BAD\n        acc.Description = 'Child of: ' + parent.Name;\n    }\n}\n```\n\n### Batch Apex\n\n```apex\npublic class ContactBatchUpdate implements Database.Batchable<SObject> {\n    public Database.QueryLocator start(Database.BatchableContext bc) {\n        return Database.getQueryLocator([SELECT Id, Email FROM Contact WHERE Email = null]);\n    }\n    public void execute(Database.BatchableContext bc, List<Contact> scope) {\n        for (Contact c : scope) {\n            c.Email = 'unknown@example.com';\n        }\n        Database.update(scope, false); // partial success allowed\n    }\n    public void finish(Database.BatchableContext bc) {\n        // Send notification or chain next batch\n    }\n}\n// Execute: Database.executeBatch(new ContactBatchUpdate(), 200);\n```\n\n### Test Class\n\n```apex\n@IsTest\nprivate class AccountTriggerHandlerTest {\n    @TestSetup\n    static void makeData() {\n        Account parent = new Account(Name = 'Parent Co');\n        insert parent;\n        Account child = new Account(Name = 'Child Co', ParentId = parent.Id);\n        insert child;\n    }\n\n    @IsTest\n    static void testBulkInsert() {\n        Account parent = [SELECT Id FROM Account WHERE Name = 'Parent Co' LIMIT 1];\n        List<Account> children = new List<Account>();\n        for (Integer i = 0; i < 200; i++) {\n            children.add(new Account(Name = 'Child ' + i, ParentId = parent.Id));\n        }\n        Test.startTest();\n        insert children;\n        Test.stopTest();\n\n        List<Account> updated = [SELECT Description FROM Account WHERE ParentId = :parent.Id];\n        System.assert(!updated.isEmpty(), 'Children should have descriptions set');\n        System.assert(updated[0].Description.startsWith('Child of:'), 'Description format mismatch');\n    }\n}\n```\n\n### SOQL Best Practices\n\n```apex\n// Selective query — use indexed fields in WHERE clause\nList<Opportunity> opps = [\n    SELECT Id, Name, Amount, StageName\n    FROM Opportunity\n    WHERE AccountId IN :accountIds      // indexed field\n      AND CloseDate >= :Date.today()    // indexed field\n    ORDER BY CloseDate ASC\n    LIMIT 200\n];\n\n// Relationship query to avoid extra round-trips\nList<Account> accounts = [\n    SELECT Id, Name,\n           (SELECT Id, LastName, Email FROM Contacts WHERE Email != null)\n    FROM Account\n    WHERE Id IN :accountIds\n];\n```\n\n### Lightning Web Component (Counter Example)\n\n```html\n<!-- counterComponent.html -->\n<template>\n    <lightning-card title=\"Counter\">\n        <div class=\"slds-p-around_medium\">\n            <p>Count: {count}</p>\n            <lightning-button label=\"Increment\" onclick={handleIncrement}></lightning-button>\n        </div>\n    </lightning-card>\n</template>\n```\n\n```javascript\n// counterComponent.js\nimport { LightningElement, track } from 'lwc';\nexport default class CounterComponent extends LightningElement {\n    @track count = 0;\n    handleIncrement() {\n        this.count += 1;\n    }\n}\n```\n\n```xml\n<!-- counterComponent.js-meta.xml -->\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LightningComponentBundle xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n    <apiVersion>59.0</apiVersion>\n    <isExposed>true</isExposed>\n    <targets>\n        <target>lightning__AppPage</target>\n        <target>lightning__RecordPage</target>\n    </targets>\n</LightningComponentBundle>\n```\n\n[Documentation](https://jeffallan.github.io/claude-skills/skills/platform/salesforce-developer/)","author":"@Jeffallan","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/Jeffallan/claude-skills/tree/main/skills/salesforce-developer","license":"MIT","category":"writing","lang":"en","tokens":1518,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/apex-development.md","size":23559,"sha256":"b948446a06ef78f28314987e921cb24b55c320f0603f236910343ef2494f4efe"},{"path":"references/deployment-devops.md","size":21321,"sha256":"eb26d4ca83b353999bc904805eeeed8080376ed926223a291faba8ea70032a86"},{"path":"references/integration-patterns.md","size":27872,"sha256":"7c4a711b23a7a3eb2c7305ef7d9d13293d19106dd85d583547ed4f511ef67e49"},{"path":"references/lightning-web-components.md","size":24090,"sha256":"180edf8dd336657c05cecf6df156a4dca1382439f1f340c8d597a2e81d1a6f37"},{"path":"references/soql-sosl.md","size":17018,"sha256":"3f357e9a104cd4927ad7cf28d49bdd381fbdbacf15fde6772f671784bf0a85a2"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["developer.salesforce.com","jeffallan.github.io","login.salesforce.com","sandbox-api.external-system.com","soap.sforce.com","test.salesforce.com"]}}